source: other-projects/rsyntax-textarea/devel-packages/jflex-1.4.3/examples/java/java12.cup@ 25584

Last change on this file since 25584 was 25584, checked in by davidb, 12 years ago

Initial cut an a text edit area for GLI that supports color syntax highlighting

File size: 22.7 KB
Line 
1import java_cup.runtime.*;
2
3
4/* August 1999 - modified by Gerwin Klein <[email protected]>
5 to interface with JFlex scanners,
6 allows empty semicolon in class decls.
7
8 changed productions:
9
10 class_member_declaration ::=
11 field_declaration
12 | method_declaration
13 [..]
14 | interface_declaration
15 | SEMICOLON
16 ;
17
18 interface_member_declaration ::=
19 constant_declaration
20 | abstract_method_declaration
21 | class_declaration
22 | interface_declaration
23 | SEMICOLON
24 ;
25
26*/
27
28
29/* Java 1.2 parser for CUP.
30 * Copyright (C) 1998 C. Scott Ananian <[email protected]>
31 * This program is released under the terms of the GPL; see the file
32 * COPYING for more details. There is NO WARRANTY on this code.
33 */
34
35/*
36JDK 1.2 Features added:
37 strictfp modifier.
38 explicit_constructor_invocation ::= ...
39 | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON ;
40 field_access ::= ...
41 | name DOT SUPER DOT IDENTIFIER ;
42 method_invocation ::= ...
43 | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ;
44*/
45
46parser code {:
47 public void report_error(String message, Object info) {
48 StringBuffer m = new StringBuffer("Error ");
49
50 if (info instanceof java_cup.runtime.Symbol)
51 m.append( "("+info.toString()+")" );
52
53 m.append(" : "+message);
54
55 System.out.println(m);
56 }
57
58 public void report_fatal_error(String message, Object info) {
59 report_error(message, info);
60 throw new RuntimeException("Fatal Syntax Error");
61 }
62:};
63
64terminal BOOLEAN; // primitive_type
65terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type
66terminal FLOAT, DOUBLE; // floating_point_type
67terminal LBRACK, RBRACK; // array_type
68terminal DOT; // qualified_name
69terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON;
70terminal PACKAGE; // package_declaration
71terminal IMPORT; // import_declaration
72terminal PUBLIC, PROTECTED, PRIVATE; // modifier
73terminal STATIC; // modifier
74terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE;
75terminal CLASS; // class_declaration
76terminal EXTENDS; // super
77terminal IMPLEMENTS; // interfaces
78terminal VOID; // method_header
79terminal THROWS; // throws
80terminal THIS, SUPER; // explicit_constructor_invocation
81terminal INTERFACE; // interface_declaration
82terminal IF, ELSE; // if_then_statement, if_then_else_statement
83terminal SWITCH; // switch_statement
84terminal CASE, DEFAULT; // switch_label
85terminal DO, WHILE; // while_statement, do_statement
86terminal FOR; // for_statement
87terminal BREAK; // break_statement
88terminal CONTINUE; // continue_statement
89terminal RETURN; // return_statement
90terminal THROW; // throw_statement
91terminal TRY; // try_statement
92terminal CATCH; // catch_clause
93terminal FINALLY; // finally
94terminal NEW; // class_instance_creation_expression
95terminal PLUSPLUS; // postincrement_expression
96terminal MINUSMINUS; // postdecrement_expression
97terminal PLUS, MINUS, COMP, NOT, DIV, MOD;
98terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression
99terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression
100terminal EQEQ, NOTEQ; // equality_expression
101terminal AND; // and_expression
102terminal XOR; // exclusive_or_expression
103terminal OR; // inclusive_or_expression
104terminal ANDAND; // conditional_and_expression
105terminal OROR; // conditional_or_expression
106terminal QUESTION; // conditional_expression
107terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator
108terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator
109terminal ANDEQ, XOREQ, OREQ; // assignment_operator
110
111terminal java.lang.Number INTEGER_LITERAL;
112terminal java.lang.Number FLOATING_POINT_LITERAL;
113terminal java.lang.Boolean BOOLEAN_LITERAL;
114terminal java.lang.Character CHARACTER_LITERAL;
115terminal java.lang.String STRING_LITERAL;
116terminal java.lang.String IDENTIFIER; // name
117terminal NULL_LITERAL;
118
119// strictfp keyword, new in Java 1.2
120terminal STRICTFP;
121
122// Reserved but unused:
123terminal CONST, GOTO;
124
125// 19.2) The Syntactic Grammar
126non terminal goal;
127// 19.3) Lexical Structure
128non terminal literal;
129// 19.4) Types, Values, and Variables
130non terminal type, primitive_type, numeric_type;
131non terminal integral_type, floating_point_type;
132non terminal reference_type;
133non terminal class_or_interface_type;
134non terminal class_type, interface_type;
135non terminal array_type;
136// 19.5) Names
137non terminal name, simple_name, qualified_name;
138// 19.6) Packages
139non terminal compilation_unit;
140non terminal package_declaration_opt, package_declaration;
141non terminal import_declarations_opt, import_declarations;
142non terminal type_declarations_opt, type_declarations;
143non terminal import_declaration;
144non terminal single_type_import_declaration;
145non terminal type_import_on_demand_declaration;
146non terminal type_declaration;
147// 19.7) Productions used only in the LALR(1) grammar
148non terminal modifiers_opt, modifiers, modifier;
149// 19.8.1) Class Declaration
150non terminal class_declaration, super_cl, super_opt;
151non terminal interfaces, interfaces_opt, interface_type_list;
152non terminal class_body;
153non terminal class_body_declarations, class_body_declarations_opt;
154non terminal class_body_declaration, class_member_declaration;
155// 19.8.2) Field Declarations
156non terminal field_declaration, variable_declarators, variable_declarator;
157non terminal variable_declarator_id, variable_initializer;
158// 19.8.3) Method Declarations
159non terminal method_declaration, method_header, method_declarator;
160non terminal formal_parameter_list_opt, formal_parameter_list;
161non terminal formal_parameter;
162non terminal throws_opt, throws;
163non terminal class_type_list, method_body;
164// 19.8.4) Static Initializers
165non terminal static_initializer;
166// 19.8.5) Constructor Declarations
167non terminal constructor_declaration, constructor_declarator;
168non terminal constructor_body;
169non terminal explicit_constructor_invocation;
170// 19.9.1) Interface Declarations
171non terminal interface_declaration;
172non terminal extends_interfaces_opt, extends_interfaces;
173non terminal interface_body;
174non terminal interface_member_declarations_opt, interface_member_declarations;
175non terminal interface_member_declaration, constant_declaration;
176non terminal abstract_method_declaration;
177// 19.10) Arrays
178non terminal array_initializer;
179non terminal variable_initializers;
180// 19.11) Blocks and Statements
181non terminal block;
182non terminal block_statements_opt, block_statements, block_statement;
183non terminal local_variable_declaration_statement, local_variable_declaration;
184non terminal statement, statement_no_short_if;
185non terminal statement_without_trailing_substatement;
186non terminal empty_statement;
187non terminal labeled_statement, labeled_statement_no_short_if;
188non terminal expression_statement, statement_expression;
189non terminal if_then_statement;
190non terminal if_then_else_statement, if_then_else_statement_no_short_if;
191non terminal switch_statement, switch_block;
192non terminal switch_block_statement_groups;
193non terminal switch_block_statement_group;
194non terminal switch_labels, switch_label;
195non terminal while_statement, while_statement_no_short_if;
196non terminal do_statement;
197non terminal for_statement, for_statement_no_short_if;
198non terminal for_init_opt, for_init;
199non terminal for_update_opt, for_update;
200non terminal statement_expression_list;
201non terminal identifier_opt;
202non terminal break_statement, continue_statement;
203non terminal return_statement, throw_statement;
204non terminal synchronized_statement, try_statement;
205non terminal catches_opt, catches, catch_clause;
206non terminal finally;
207// 19.12) Expressions
208non terminal primary, primary_no_new_array;
209non terminal class_instance_creation_expression;
210non terminal argument_list_opt, argument_list;
211non terminal array_creation_expression;
212non terminal dim_exprs, dim_expr, dims_opt, dims;
213non terminal field_access, method_invocation, array_access;
214non terminal postfix_expression;
215non terminal postincrement_expression, postdecrement_expression;
216non terminal unary_expression, unary_expression_not_plus_minus;
217non terminal preincrement_expression, predecrement_expression;
218non terminal cast_expression;
219non terminal multiplicative_expression, additive_expression;
220non terminal shift_expression, relational_expression, equality_expression;
221non terminal and_expression, exclusive_or_expression, inclusive_or_expression;
222non terminal conditional_and_expression, conditional_or_expression;
223non terminal conditional_expression, assignment_expression;
224non terminal assignment;
225non terminal left_hand_side;
226non terminal assignment_operator;
227non terminal expression_opt, expression;
228non terminal constant_expression;
229
230
231start with goal;
232
233// 19.2) The Syntactic Grammar
234goal ::= compilation_unit
235 ;
236
237// 19.3) Lexical Structure.
238literal ::= INTEGER_LITERAL
239 | FLOATING_POINT_LITERAL
240 | BOOLEAN_LITERAL
241 | CHARACTER_LITERAL
242 | STRING_LITERAL
243 | NULL_LITERAL
244 ;
245
246// 19.4) Types, Values, and Variables
247type ::= primitive_type
248 | reference_type
249 ;
250primitive_type ::=
251 numeric_type
252 | BOOLEAN
253 ;
254numeric_type::= integral_type
255 | floating_point_type
256 ;
257integral_type ::=
258 BYTE
259 | SHORT
260 | INT
261 | LONG
262 | CHAR
263 ;
264floating_point_type ::=
265 FLOAT
266 | DOUBLE
267 ;
268
269reference_type ::=
270 class_or_interface_type
271 | array_type
272 ;
273class_or_interface_type ::= name;
274
275class_type ::= class_or_interface_type;
276interface_type ::= class_or_interface_type;
277
278array_type ::= primitive_type dims
279 | name dims
280 ;
281
282// 19.5) Names
283name ::= simple_name
284 | qualified_name
285 ;
286simple_name ::= IDENTIFIER
287 ;
288qualified_name ::=
289 name DOT IDENTIFIER
290 ;
291
292// 19.6) Packages
293compilation_unit ::=
294 package_declaration_opt
295 import_declarations_opt
296 type_declarations_opt
297 ;
298package_declaration_opt ::= package_declaration | ;
299import_declarations_opt ::= import_declarations | ;
300type_declarations_opt ::= type_declarations | ;
301
302import_declarations ::=
303 import_declaration
304 | import_declarations import_declaration
305 ;
306type_declarations ::=
307 type_declaration
308 | type_declarations type_declaration
309 ;
310package_declaration ::=
311 PACKAGE name SEMICOLON
312 ;
313import_declaration ::=
314 single_type_import_declaration
315 | type_import_on_demand_declaration
316 ;
317single_type_import_declaration ::=
318 IMPORT name SEMICOLON
319 ;
320type_import_on_demand_declaration ::=
321 IMPORT name DOT MULT SEMICOLON
322 ;
323type_declaration ::=
324 class_declaration
325 | interface_declaration
326 | SEMICOLON
327 ;
328
329// 19.7) Productions used only in the LALR(1) grammar
330modifiers_opt::=
331 | modifiers
332 ;
333modifiers ::= modifier
334 | modifiers modifier
335 ;
336modifier ::= PUBLIC | PROTECTED | PRIVATE
337 | STATIC
338 | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE
339 | STRICTFP // note that semantic analysis must check that the
340 // context of the modifier allows strictfp.
341 ;
342
343// 19.8) Classes
344
345// 19.8.1) Class Declaration:
346class_declaration ::=
347 modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body
348 ;
349super_cl ::= EXTENDS class_type
350 ;
351super_opt ::=
352 | super_cl
353 ;
354interfaces ::= IMPLEMENTS interface_type_list
355 ;
356interfaces_opt::=
357 | interfaces
358 ;
359interface_type_list ::=
360 interface_type
361 | interface_type_list COMMA interface_type
362 ;
363class_body ::= LBRACE class_body_declarations_opt RBRACE
364 ;
365class_body_declarations_opt ::=
366 | class_body_declarations ;
367class_body_declarations ::=
368 class_body_declaration
369 | class_body_declarations class_body_declaration
370 ;
371class_body_declaration ::=
372 class_member_declaration
373 | static_initializer
374 | constructor_declaration
375 | block
376 ;
377class_member_declaration ::=
378 field_declaration
379 | method_declaration
380 /* repeat the prod for 'class_declaration' here: */
381 | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body
382 | interface_declaration
383 | SEMICOLON
384 ;
385
386// 19.8.2) Field Declarations
387field_declaration ::=
388 modifiers_opt type variable_declarators SEMICOLON
389 ;
390variable_declarators ::=
391 variable_declarator
392 | variable_declarators COMMA variable_declarator
393 ;
394variable_declarator ::=
395 variable_declarator_id
396 | variable_declarator_id EQ variable_initializer
397 ;
398variable_declarator_id ::=
399 IDENTIFIER
400 | variable_declarator_id LBRACK RBRACK
401 ;
402variable_initializer ::=
403 expression
404 | array_initializer
405 ;
406
407// 19.8.3) Method Declarations
408method_declaration ::=
409 method_header method_body
410 ;
411method_header ::=
412 modifiers_opt type method_declarator throws_opt
413 | modifiers_opt VOID method_declarator throws_opt
414 ;
415method_declarator ::=
416 IDENTIFIER LPAREN formal_parameter_list_opt RPAREN
417 | method_declarator LBRACK RBRACK // deprecated
418 // be careful; the above production also allows 'void foo() []'
419 ;
420formal_parameter_list_opt ::=
421 | formal_parameter_list
422 ;
423formal_parameter_list ::=
424 formal_parameter
425 | formal_parameter_list COMMA formal_parameter
426 ;
427formal_parameter ::=
428 type variable_declarator_id
429 | FINAL type variable_declarator_id
430 ;
431throws_opt ::=
432 | throws
433 ;
434throws ::= THROWS class_type_list
435 ;
436class_type_list ::=
437 class_type
438 | class_type_list COMMA class_type
439 ;
440method_body ::= block
441 | SEMICOLON
442 ;
443
444// 19.8.4) Static Initializers
445static_initializer ::=
446 STATIC block
447 ;
448
449// 19.8.5) Constructor Declarations
450constructor_declaration ::=
451 modifiers_opt constructor_declarator throws_opt
452 constructor_body
453 ;
454constructor_declarator ::=
455 simple_name LPAREN formal_parameter_list_opt RPAREN
456 ;
457constructor_body ::=
458 LBRACE explicit_constructor_invocation
459 block_statements RBRACE
460 | LBRACE explicit_constructor_invocation RBRACE
461 | LBRACE block_statements RBRACE
462 | LBRACE RBRACE
463 ;
464explicit_constructor_invocation ::=
465 THIS LPAREN argument_list_opt RPAREN SEMICOLON
466 | SUPER LPAREN argument_list_opt RPAREN SEMICOLON
467 | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON
468 | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
469 ;
470
471// 19.9) Interfaces
472
473// 19.9.1) Interface Declarations
474interface_declaration ::=
475 modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt
476 interface_body
477 ;
478extends_interfaces_opt ::=
479 | extends_interfaces
480 ;
481extends_interfaces ::=
482 EXTENDS interface_type
483 | extends_interfaces COMMA interface_type
484 ;
485interface_body ::=
486 LBRACE interface_member_declarations_opt RBRACE
487 ;
488interface_member_declarations_opt ::=
489 | interface_member_declarations
490 ;
491interface_member_declarations ::=
492 interface_member_declaration
493 | interface_member_declarations interface_member_declaration
494 ;
495interface_member_declaration ::=
496 constant_declaration
497 | abstract_method_declaration
498 | class_declaration
499 | interface_declaration
500 | SEMICOLON
501 ;
502constant_declaration ::=
503 field_declaration
504 ;
505abstract_method_declaration ::=
506 method_header SEMICOLON
507 ;
508
509// 19.10) Arrays
510array_initializer ::=
511 LBRACE variable_initializers COMMA RBRACE
512 | LBRACE variable_initializers RBRACE
513 | LBRACE COMMA RBRACE
514 | LBRACE RBRACE
515 ;
516variable_initializers ::=
517 variable_initializer
518 | variable_initializers COMMA variable_initializer
519 ;
520
521// 19.11) Blocks and Statements
522block ::= LBRACE block_statements_opt RBRACE
523 ;
524block_statements_opt ::=
525 | block_statements
526 ;
527block_statements ::=
528 block_statement
529 | block_statements block_statement
530 ;
531block_statement ::=
532 local_variable_declaration_statement
533 | statement
534 | class_declaration
535 | interface_declaration
536 ;
537local_variable_declaration_statement ::=
538 local_variable_declaration SEMICOLON
539 ;
540local_variable_declaration ::=
541 type variable_declarators
542 | FINAL type variable_declarators
543 ;
544statement ::= statement_without_trailing_substatement
545 | labeled_statement
546 | if_then_statement
547 | if_then_else_statement
548 | while_statement
549 | for_statement
550 ;
551statement_no_short_if ::=
552 statement_without_trailing_substatement
553 | labeled_statement_no_short_if
554 | if_then_else_statement_no_short_if
555 | while_statement_no_short_if
556 | for_statement_no_short_if
557 ;
558statement_without_trailing_substatement ::=
559 block
560 | empty_statement
561 | expression_statement
562 | switch_statement
563 | do_statement
564 | break_statement
565 | continue_statement
566 | return_statement
567 | synchronized_statement
568 | throw_statement
569 | try_statement
570 ;
571empty_statement ::=
572 SEMICOLON
573 ;
574labeled_statement ::=
575 IDENTIFIER COLON statement
576 ;
577labeled_statement_no_short_if ::=
578 IDENTIFIER COLON statement_no_short_if
579 ;
580expression_statement ::=
581 statement_expression SEMICOLON
582 ;
583statement_expression ::=
584 assignment
585 | preincrement_expression
586 | predecrement_expression
587 | postincrement_expression
588 | postdecrement_expression
589 | method_invocation
590 | class_instance_creation_expression
591 ;
592if_then_statement ::=
593 IF LPAREN expression RPAREN statement
594 ;
595if_then_else_statement ::=
596 IF LPAREN expression RPAREN statement_no_short_if
597 ELSE statement
598 ;
599if_then_else_statement_no_short_if ::=
600 IF LPAREN expression RPAREN statement_no_short_if
601 ELSE statement_no_short_if
602 ;
603switch_statement ::=
604 SWITCH LPAREN expression RPAREN switch_block
605 ;
606switch_block ::=
607 LBRACE switch_block_statement_groups switch_labels RBRACE
608 | LBRACE switch_block_statement_groups RBRACE
609 | LBRACE switch_labels RBRACE
610 | LBRACE RBRACE
611 ;
612switch_block_statement_groups ::=
613 switch_block_statement_group
614 | switch_block_statement_groups switch_block_statement_group
615 ;
616switch_block_statement_group ::=
617 switch_labels block_statements
618 ;
619switch_labels ::=
620 switch_label
621 | switch_labels switch_label
622 ;
623switch_label ::=
624 CASE constant_expression COLON
625 | DEFAULT COLON
626 ;
627
628while_statement ::=
629 WHILE LPAREN expression RPAREN statement
630 ;
631while_statement_no_short_if ::=
632 WHILE LPAREN expression RPAREN statement_no_short_if
633 ;
634do_statement ::=
635 DO statement WHILE LPAREN expression RPAREN SEMICOLON
636 ;
637for_statement ::=
638 FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON
639 for_update_opt RPAREN statement
640 ;
641for_statement_no_short_if ::=
642 FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON
643 for_update_opt RPAREN statement_no_short_if
644 ;
645for_init_opt ::=
646 | for_init
647 ;
648for_init ::= statement_expression_list
649 | local_variable_declaration
650 ;
651for_update_opt ::=
652 | for_update
653 ;
654for_update ::= statement_expression_list
655 ;
656statement_expression_list ::=
657 statement_expression
658 | statement_expression_list COMMA statement_expression
659 ;
660
661identifier_opt ::=
662 | IDENTIFIER
663 ;
664
665break_statement ::=
666 BREAK identifier_opt SEMICOLON
667 ;
668
669continue_statement ::=
670 CONTINUE identifier_opt SEMICOLON
671 ;
672return_statement ::=
673 RETURN expression_opt SEMICOLON
674 ;
675throw_statement ::=
676 THROW expression SEMICOLON
677 ;
678synchronized_statement ::=
679 SYNCHRONIZED LPAREN expression RPAREN block
680 ;
681try_statement ::=
682 TRY block catches
683 | TRY block catches_opt finally
684 ;
685catches_opt ::=
686 | catches
687 ;
688catches ::= catch_clause
689 | catches catch_clause
690 ;
691catch_clause ::=
692 CATCH LPAREN formal_parameter RPAREN block
693 ;
694finally ::= FINALLY block
695 ;
696
697// 19.12) Expressions
698primary ::= primary_no_new_array
699 | array_creation_expression
700 ;
701primary_no_new_array ::=
702 literal
703 | THIS
704 | LPAREN expression RPAREN
705 | class_instance_creation_expression
706 | field_access
707 | method_invocation
708 | array_access
709 | primitive_type DOT CLASS
710 | VOID DOT CLASS
711 | array_type DOT CLASS
712 | name DOT CLASS
713 | name DOT THIS
714 ;
715class_instance_creation_expression ::=
716 NEW class_type LPAREN argument_list_opt RPAREN
717 | NEW class_type LPAREN argument_list_opt RPAREN class_body
718 | primary DOT NEW IDENTIFIER
719 LPAREN argument_list_opt RPAREN
720 | primary DOT NEW IDENTIFIER
721 LPAREN argument_list_opt RPAREN class_body
722 ;
723argument_list_opt ::=
724 | argument_list
725 ;
726argument_list ::=
727 expression
728 | argument_list COMMA expression
729 ;
730array_creation_expression ::=
731 NEW primitive_type dim_exprs dims_opt
732 | NEW class_or_interface_type dim_exprs dims_opt
733 | NEW primitive_type dims array_initializer
734 | NEW class_or_interface_type dims array_initializer
735 ;
736dim_exprs ::= dim_expr
737 | dim_exprs dim_expr
738 ;
739dim_expr ::= LBRACK expression RBRACK
740 ;
741dims_opt ::=
742 | dims
743 ;
744dims ::= LBRACK RBRACK
745 | dims LBRACK RBRACK
746 ;
747field_access ::=
748 primary DOT IDENTIFIER
749 | SUPER DOT IDENTIFIER
750 | name DOT SUPER DOT IDENTIFIER
751 ;
752method_invocation ::=
753 name LPAREN argument_list_opt RPAREN
754 | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN
755 | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
756 | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN
757 ;
758array_access ::=
759 name LBRACK expression RBRACK
760 | primary_no_new_array LBRACK expression RBRACK
761 ;
762postfix_expression ::=
763 primary
764 | name
765 | postincrement_expression
766 | postdecrement_expression
767 ;
768postincrement_expression ::=
769 postfix_expression PLUSPLUS
770 ;
771postdecrement_expression ::=
772 postfix_expression MINUSMINUS
773 ;
774unary_expression ::=
775 preincrement_expression
776 | predecrement_expression
777 | PLUS unary_expression
778 | MINUS unary_expression
779 | unary_expression_not_plus_minus
780 ;
781preincrement_expression ::=
782 PLUSPLUS unary_expression
783 ;
784predecrement_expression ::=
785 MINUSMINUS unary_expression
786 ;
787unary_expression_not_plus_minus ::=
788 postfix_expression
789 | COMP unary_expression
790 | NOT unary_expression
791 | cast_expression
792 ;
793cast_expression ::=
794 LPAREN primitive_type dims_opt RPAREN unary_expression
795 | LPAREN expression RPAREN unary_expression_not_plus_minus
796 | LPAREN name dims RPAREN unary_expression_not_plus_minus
797 ;
798multiplicative_expression ::=
799 unary_expression
800 | multiplicative_expression MULT unary_expression
801 | multiplicative_expression DIV unary_expression
802 | multiplicative_expression MOD unary_expression
803 ;
804additive_expression ::=
805 multiplicative_expression
806 | additive_expression PLUS multiplicative_expression
807 | additive_expression MINUS multiplicative_expression
808 ;
809shift_expression ::=
810 additive_expression
811 | shift_expression LSHIFT additive_expression
812 | shift_expression RSHIFT additive_expression
813 | shift_expression URSHIFT additive_expression
814 ;
815relational_expression ::=
816 shift_expression
817 | relational_expression LT shift_expression
818 | relational_expression GT shift_expression
819 | relational_expression LTEQ shift_expression
820 | relational_expression GTEQ shift_expression
821 | relational_expression INSTANCEOF reference_type
822 ;
823equality_expression ::=
824 relational_expression
825 | equality_expression EQEQ relational_expression
826 | equality_expression NOTEQ relational_expression
827 ;
828and_expression ::=
829 equality_expression
830 | and_expression AND equality_expression
831 ;
832exclusive_or_expression ::=
833 and_expression
834 | exclusive_or_expression XOR and_expression
835 ;
836inclusive_or_expression ::=
837 exclusive_or_expression
838 | inclusive_or_expression OR exclusive_or_expression
839 ;
840conditional_and_expression ::=
841 inclusive_or_expression
842 | conditional_and_expression ANDAND inclusive_or_expression
843 ;
844conditional_or_expression ::=
845 conditional_and_expression
846 | conditional_or_expression OROR conditional_and_expression
847 ;
848conditional_expression ::=
849 conditional_or_expression
850 | conditional_or_expression QUESTION expression
851 COLON conditional_expression
852 ;
853assignment_expression ::=
854 conditional_expression
855 | assignment
856 ;
857assignment ::= left_hand_side assignment_operator assignment_expression
858 ;
859left_hand_side ::=
860 name
861 | field_access
862 | array_access
863 ;
864assignment_operator ::=
865 EQ
866 | MULTEQ
867 | DIVEQ
868 | MODEQ
869 | PLUSEQ
870 | MINUSEQ
871 | LSHIFTEQ
872 | RSHIFTEQ
873 | URSHIFTEQ
874 | ANDEQ
875 | XOREQ
876 | OREQ
877 ;
878expression_opt ::=
879 | expression
880 ;
881expression ::= assignment_expression
882 ;
883constant_expression ::=
884 expression
885 ;
Note: See TracBrowser for help on using the repository browser.