contrib/jwrapper grammar: eat the strictfp keyword
[nit.git] / contrib / jwrapper / grammar / javap.sablecc
1 Grammar javap;
2
3 // ---
4 Lexer
5
6 identifier = ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'-'|'$'|'0'..'9')*;
7 blank = (' '|'\n'|'\t'|'\r')+;
8 separator = ('.'|'/');
9 brackets = '[]';
10 wildcard = '?';
11 compiled_from = 'Compiled from "' (Any-'"')* '"';
12
13 // ---
14 Parser
15 Ignored blank;
16
17 files = file+;
18 file = compiled_from? class_declaration;
19
20 class_declaration = modifier* class_or_interface full_class_name
21         extends_declaration? implements_declaration? throws_declaration?
22         '{' property_declaration* '}';
23
24 class_or_interface = 'class'|'interface';
25
26 modifier
27         = 'public'|'private'|'protected'|'static'|'final'|'native'|'synchronized'|'abstract'|'threadsafe'|'transient'|'volatile'|'strictfp';
28 type = primitive_type brackets*;
29 primitive_type
30         = 'boolean'|'byte'|'char'|'short'|'int'|'float'|'long'|'double'
31         | type_ref;
32
33 type_ref
34         = full_class_name
35         | generic_identifier 'extends' full_class_name
36         | question_mark;
37
38 generic_param = '<' generic_parameter_list '>';
39 generic_parameter_list
40         = {tail:} generic_parameter_list ',' parameter
41         | {head:} parameter;
42 generic_identifier
43         = full_class_name
44         | wildcard;
45
46 full_class_name
47         = {tail:} full_class_name separator class_name
48         | {head:} class_name;
49 class_name = identifier generic_param?;
50
51 parameter
52         = type '...'?
53         | {wildcard:} wildcard 'super' full_class_name ;
54 parameter_list
55         = {tail:} parameter_list ',' parameter
56         | {head:} parameter;
57
58 attribute_id = identifier brackets*;
59 method_id = identifier;
60
61 property_declaration
62         = {method:} modifier* generic_param? type method_id '(' parameter_list? ')' throws_declaration? ';'
63         | {constructor:} modifier* full_class_name '(' parameter_list? ')' throws_declaration? ';'
64         | {attribute:} modifier* type attribute_id throws_declaration? ';'
65         | {static:} modifier* '{' '}' ';'
66         | ';';
67
68 implements_declaration = 'implements' interface_list;
69 extends_declaration = 'extends' interface_list;
70 interface_list
71         = {tail:} interface_list ',' full_class_name
72         | {head:} full_class_name;
73
74 throws_declaration = 'throws' exception_list?;
75 exception_list
76         = {tail:} exception_list ',' type
77         | {head:} type;