blob: 0f78b8d7d81eb7cc59eb469e2b6829d2eee24b00 [file] [log] [blame]
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001--main options
2%options ACTION, AN=JavaAction.java, GP=java,
3%options FILE-PREFIX=java, ESCAPE=$, PREFIX=TokenName, OUTPUT-SIZE=125 ,
4%options NOGOTO-DEFAULT, SINGLE-PRODUCTIONS, LALR=1 , TABLE,
5
6--error recovering options.....
7%options ERROR_MAPS
8
9--grammar understanding options
10%options first follow
11%options TRACE=FULL ,
12%options VERBOSE
13
14%options DEFERRED
15%options NAMES=MAX
16%options SCOPES
17
18--Usefull macros helping reading/writing semantic actions
19$Define
20$putCase
21/. case $rule_number : if (DEBUG) { System.out.println("$rule_text"); } //$NON-NLS-1$
22 ./
23
24$break
25/.
26 break;
27./
28
29
30$readableName
31/.1#$rule_number#./
32$compliance
33/.2#$rule_number#./
34$recovery
35/.2#$rule_number# recovery./
36$recovery_template
37/.3#$rule_number#./
38$no_statements_recovery
39/.4#$rule_number# 1./
40-- here it starts really ------------------------------------------
41$Terminals
42
43 Identifier
44
45 abstract assert boolean break byte case catch char class
46 continue const default do double else enum extends false final finally float
47 for goto if implements import instanceof int
48 interface long native new null package private
49 protected public return short static strictfp super switch
50 synchronized this throw throws transient true try void
51 volatile while
52
53-- {ObjectTeams: keywords
54 as base callin playedBy precedence readonly team tsuper when with within
55
Stephan Herrmannc4817302012-07-13 01:31:42 +020056-- The following symbols are recognized as keywords only in specific contexts:
Stephan Herrmann234bfec2011-04-26 08:26:58 +000057-- After "<-":
58 replace after before
59-- After "->":
60 get set
61
62-- Markus Witte}
63
64 IntegerLiteral
65 LongLiteral
66 FloatingPointLiteral
67 DoubleLiteral
68 CharacterLiteral
69 StringLiteral
70
71 PLUS_PLUS
72 MINUS_MINUS
73 EQUAL_EQUAL
74 LESS_EQUAL
75 GREATER_EQUAL
76 NOT_EQUAL
77 LEFT_SHIFT
78 RIGHT_SHIFT
79 UNSIGNED_RIGHT_SHIFT
80 PLUS_EQUAL
81 MINUS_EQUAL
82 MULTIPLY_EQUAL
83 DIVIDE_EQUAL
84 AND_EQUAL
85 OR_EQUAL
86 XOR_EQUAL
87 REMAINDER_EQUAL
88 LEFT_SHIFT_EQUAL
89 RIGHT_SHIFT_EQUAL
90 UNSIGNED_RIGHT_SHIFT_EQUAL
91 OR_OR
92 AND_AND
93 PLUS
94 MINUS
95 NOT
96 REMAINDER
97 XOR
98 AND
99 MULTIPLY
100 OR
101 TWIDDLE
102 DIVIDE
103 GREATER
104 LESS
105 LPAREN
106 RPAREN
107 LBRACE
108 RBRACE
109 LBRACKET
110 RBRACKET
111 SEMICOLON
112 QUESTION
113 COLON
114 COMMA
115 DOT
116 EQUAL
117 AT
118 ELLIPSIS
Stephan Herrmannc4817302012-07-13 01:31:42 +0200119 ARROW
120 COLON_COLON
121 BeginLambda
122 BeginTypeArguments
123 ElidedSemicolonAndRightBrace
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200124 AT308
125 AT308DOTDOTDOT
Stephan Herrmannc4817302012-07-13 01:31:42 +0200126
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000127-- {ObjectTeams
128 BINDIN
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000129 CALLOUT_OVERRIDE
Stephan Herrmann926e1182012-07-20 20:26:32 +0200130 SYNTHBINDOUT
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000131-- Markus Witte}
132-- BodyMarker
133
134$Alias
135
Stephan Herrmannc4817302012-07-13 01:31:42 +0200136 '::' ::= COLON_COLON
137 '->' ::= ARROW
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000138 '++' ::= PLUS_PLUS
139 '--' ::= MINUS_MINUS
140 '==' ::= EQUAL_EQUAL
141 '<=' ::= LESS_EQUAL
142 '>=' ::= GREATER_EQUAL
143 '!=' ::= NOT_EQUAL
144 '<<' ::= LEFT_SHIFT
145 '>>' ::= RIGHT_SHIFT
146 '>>>' ::= UNSIGNED_RIGHT_SHIFT
147 '+=' ::= PLUS_EQUAL
148 '-=' ::= MINUS_EQUAL
149 '*=' ::= MULTIPLY_EQUAL
150 '/=' ::= DIVIDE_EQUAL
151 '&=' ::= AND_EQUAL
152 '|=' ::= OR_EQUAL
153 '^=' ::= XOR_EQUAL
154 '%=' ::= REMAINDER_EQUAL
155 '<<=' ::= LEFT_SHIFT_EQUAL
156 '>>=' ::= RIGHT_SHIFT_EQUAL
157 '>>>=' ::= UNSIGNED_RIGHT_SHIFT_EQUAL
158 '||' ::= OR_OR
159 '&&' ::= AND_AND
160 '+' ::= PLUS
161 '-' ::= MINUS
162 '!' ::= NOT
163 '%' ::= REMAINDER
164 '^' ::= XOR
165 '&' ::= AND
166 '*' ::= MULTIPLY
167 '|' ::= OR
168 '~' ::= TWIDDLE
169 '/' ::= DIVIDE
170 '>' ::= GREATER
171 '<' ::= LESS
172 '(' ::= LPAREN
173 ')' ::= RPAREN
174 '{' ::= LBRACE
175 '}' ::= RBRACE
176 '[' ::= LBRACKET
177 ']' ::= RBRACKET
178 ';' ::= SEMICOLON
179 '?' ::= QUESTION
180 ':' ::= COLON
181 ',' ::= COMMA
182 '.' ::= DOT
183 '=' ::= EQUAL
184 '@' ::= AT
185 '...' ::= ELLIPSIS
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200186 '@308' ::= AT308
187 '@308...' ::= AT308DOTDOTDOT
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000188
189-- {ObjectTeams
190 '<-' ::= BINDIN
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000191 '=>' ::= CALLOUT_OVERRIDE
192-- Markus Witte}
193
194$Start
195 Goal
196
197$Rules
198
Stephan Herrmann44109d32011-08-02 14:34:26 +0000199/.// This method is part of an automatic generation : do NOT edit-modify
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000200protected void consumeRule(int act) {
201 switch ( act ) {
202./
203
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000204Goal ::= '++' CompilationUnit
205Goal ::= '--' MethodBody
206-- Initializer
207Goal ::= '>>' StaticInitializer
208Goal ::= '>>' Initializer
209-- error recovery
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200210-- Modifiersopt is used to properly consume a header and exit the rule reduction at the end of the parse() method
211Goal ::= '>>>' Header1 Modifiersopt
212Goal ::= '!' Header2 Modifiersopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000213Goal ::= '*' BlockStatements
214Goal ::= '*' CatchHeader
215-- JDOM
216Goal ::= '&&' FieldDeclaration
217Goal ::= '||' ImportDeclaration
218Goal ::= '?' PackageDeclaration
219Goal ::= '+' TypeDeclaration
220Goal ::= '/' GenericMethodDeclaration
221Goal ::= '&' ClassBodyDeclarations
222-- code snippet
223Goal ::= '%' Expression
224Goal ::= '%' ArrayInitializer
225-- completion parser
226Goal ::= '~' BlockStatementsopt
227-- source type converter
228Goal ::= '||' MemberValue
229-- syntax diagnosis
230Goal ::= '?' AnnotationTypeMemberDeclaration
Stephan Herrmann1460a602012-07-19 20:01:10 +0200231-- JSR 335 Reconnaissance missions.
232Goal ::= '->' ParenthesizedLambdaParameterList
233Goal ::= '::' ReferenceExpressionTypeArgumentsAndTrunk
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200234-- JSR 308 Reconnaissance mission.
235Goal ::= '...' TypeAnnotations
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000236--{ObjectTeams new goals:
237Goal ::= ':' CallinParameterMappings
238Goal ::= ';' CalloutParameterMappings
239Goal ::= '^' ParameterMapping
240Goal ::= '<' MethodSpecShort
241Goal ::= '>' MethodSpecLong
242-- SH}
243/:$readableName Goal:/
244
245-- {ObjectTeams
246-- insert new Goals for Delta-Compiling
247-- for Callin/Callout-Binding
248-- Markus Witte}
249
250Literal -> IntegerLiteral
251Literal -> LongLiteral
252Literal -> FloatingPointLiteral
253Literal -> DoubleLiteral
254Literal -> CharacterLiteral
255Literal -> StringLiteral
256Literal -> null
257Literal -> BooleanLiteral
258/:$readableName Literal:/
259BooleanLiteral -> true
260BooleanLiteral -> false
261/:$readableName BooleanLiteral:/
262
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200263Type ::= PrimitiveType
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000264/.$putCase consumePrimitiveType(); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200265Type -> ReferenceType
Stephan Herrmannc4817302012-07-13 01:31:42 +0200266/:$readableName Type:/
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000267
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200268PrimitiveType -> TypeAnnotationsopt NumericType
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000269/:$readableName PrimitiveType:/
270NumericType -> IntegralType
271NumericType -> FloatingPointType
272/:$readableName NumericType:/
273
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200274PrimitiveType -> TypeAnnotationsopt 'boolean'
275PrimitiveType -> TypeAnnotationsopt 'void'
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000276IntegralType -> 'byte'
277IntegralType -> 'short'
278IntegralType -> 'int'
279IntegralType -> 'long'
280IntegralType -> 'char'
281/:$readableName IntegralType:/
282FloatingPointType -> 'float'
283FloatingPointType -> 'double'
284/:$readableName FloatingPointType:/
285
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200286ReferenceType ::= ClassOrInterfaceType
287/.$putCase consumeReferenceType(); $break ./
288ReferenceType -> ArrayType
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000289/:$readableName ReferenceType:/
290
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200291---------------------------------------------------------------
292-- 1.5 feature
293---------------------------------------------------------------
294ClassOrInterfaceType -> ClassOrInterface
295ClassOrInterfaceType -> GenericType
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000296/:$readableName Type:/
297
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200298ClassOrInterface ::= Name
299/.$putCase consumeClassOrInterfaceName(); $break ./
300ClassOrInterface ::= GenericType '.' Name
301/.$putCase consumeClassOrInterface(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000302/:$readableName Type:/
303
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200304GenericType ::= ClassOrInterface TypeArguments
305/.$putCase consumeGenericType(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000306/:$readableName GenericType:/
307
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200308GenericType ::= ClassOrInterface '<' '>'
Stephan Herrmann44109d32011-08-02 14:34:26 +0000309/.$putCase consumeGenericTypeWithDiamond(); $break ./
310/:$readableName GenericType:/
311/:$compliance 1.7:/
312
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000313-- {ObjectTeams: "Base as Role" types:
Stephan Herrmann5fa7f312012-07-13 01:52:51 +0200314LiftingTypeopt ::= $empty
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000315
Stephan Herrmanna30fa6a2012-07-15 13:54:47 +0200316LiftingTypeopt ::= 'as' BeginLiftingType Type
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000317/.$putCase consumeLiftingType(); $break ./
318/:$readableName LiftingType:/
319
Stephan Herrmanna30fa6a2012-07-15 13:54:47 +0200320BeginLiftingType ::= $empty
321/.$putCase consumeBeginLiftingType(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000322
Stephan Herrmann197438c2012-07-15 22:54:37 +0200323CatchLiftingTypeopt ::= $empty
324
325CatchLiftingTypeopt ::= 'as' Type
326/.$putCase consumeLiftingType(); $break ./
327/:$readableName LiftingType:/
328-- SH}
329
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000330-- {ObjectTeams: "base.R" types:
331
332BaseAnchoredType ::= 'base' '.' SimpleName
333/.$putCase consumeBaseAnchoredType(); $break ./
334/:$readableName QualifiedName:/
335
336-- Connecting BaseAnchoredType to other rules (2 variants):
337-- 1.) connect via Type->ReferenceType->ClassOrInterfaceType
338-- as well as via ClassType->ClassOrInterfaceType
Stephan Herrmann358a2882012-07-16 01:40:15 +0200339ClassOrInterfaceType0 -> BaseAnchoredType
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000340/:$readableName BaseAnchoredType:/
341
342-- 2.) via ReferenceType we may add dimensions:
Stephan Herrmann358a2882012-07-16 01:40:15 +0200343ReferenceType0 -> BaseAnchoredType Dims
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000344/:$readableName ArrayOfBaseAnchoredType:/
345-- SH}
346
347--
348-- These rules have been rewritten to avoid some conflicts introduced
349-- by adding the 1.1 features
350--
351-- ArrayType ::= PrimitiveType '[' ']'
352-- ArrayType ::= Name '[' ']'
353-- ArrayType ::= ArrayType '[' ']'
354--
355
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200356ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name
357/.$putCase consumeArrayTypeWithTypeArgumentsName(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000358/:$readableName ArrayTypeWithTypeArgumentsName:/
359
360ArrayType ::= PrimitiveType Dims
Stephan Herrmann44109d32011-08-02 14:34:26 +0000361/.$putCase consumePrimitiveArrayType(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000362ArrayType ::= Name Dims
Stephan Herrmann44109d32011-08-02 14:34:26 +0000363/.$putCase consumeNameArrayType(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000364ArrayType ::= ArrayTypeWithTypeArgumentsName Dims
Stephan Herrmann44109d32011-08-02 14:34:26 +0000365/.$putCase consumeGenericTypeNameArrayType(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000366ArrayType ::= GenericType Dims
Stephan Herrmann44109d32011-08-02 14:34:26 +0000367/.$putCase consumeGenericTypeArrayType(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000368/:$readableName ArrayType:/
369
370ClassType -> ClassOrInterfaceType
371/:$readableName ClassType:/
372
373--------------------------------------------------------------
374--------------------------------------------------------------
375
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200376Name ::= SimpleName
377/.$putCase consumeZeroTypeAnnotations(); $break ./
378Name -> TypeAnnotations SimpleName
379/:$compliance 1.8:/
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000380Name -> QualifiedName
381/:$readableName Name:/
382/:$recovery_template Identifier:/
383
384SimpleName -> 'Identifier'
385/:$readableName SimpleName:/
386
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200387UnannotatableName -> SimpleName
388UnannotatableName ::= UnannotatableName '.' SimpleName
389/.$putCase consumeUnannotatableQualifiedName(); $break ./
390/:$readableName UnannotatableQualifiedName:/
391
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000392QualifiedName ::= Name '.' SimpleName
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200393/.$putCase consumeQualifiedName(false); $break ./
394QualifiedName ::= Name '.' TypeAnnotations SimpleName
395/.$putCase consumeQualifiedName(true); $break ./
396/:$compliance 1.8:/
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000397/:$readableName QualifiedName:/
398
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200399TypeAnnotationsopt ::= $empty
400/.$putCase consumeZeroTypeAnnotations(); $break ./
401TypeAnnotationsopt -> TypeAnnotations
402/:$compliance 1.8:/
403/:$readableName TypeAnnotationsopt:/
404
405TypeAnnotations -> TypeAnnotation
406/:$compliance 1.8:/
407TypeAnnotations ::= TypeAnnotations TypeAnnotation
408/. $putCase consumeOneMoreTypeAnnotation(); $break ./
409/:$compliance 1.8:/
410/:$readableName TypeAnnotations:/
411
412TypeAnnotation ::= NormalTypeAnnotation
413/. $putCase consumeTypeAnnotation(); $break ./
414/:$compliance 1.8:/
415TypeAnnotation ::= MarkerTypeAnnotation
416/. $putCase consumeTypeAnnotation(); $break ./
417/:$compliance 1.8:/
418TypeAnnotation ::= SingleMemberTypeAnnotation
419/. $putCase consumeTypeAnnotation(); $break ./
420/:$compliance 1.8:/
421/:$readableName TypeAnnotation:/
422
423TypeAnnotationName ::= @308 UnannotatableName
424/.$putCase consumeAnnotationName() ; $break ./
425/:$readableName AnnotationName:/
426/:$compliance 1.8:/
427/:$recovery_template @ Identifier:/
428NormalTypeAnnotation ::= TypeAnnotationName '(' MemberValuePairsopt ')'
429/.$putCase consumeNormalAnnotation(true) ; $break ./
430/:$readableName NormalAnnotation:/
431/:$compliance 1.8:/
432MarkerTypeAnnotation ::= TypeAnnotationName
433/.$putCase consumeMarkerAnnotation(true) ; $break ./
434/:$readableName MarkerAnnotation:/
435/:$compliance 1.8:/
436SingleMemberTypeAnnotation ::= TypeAnnotationName '(' SingleMemberAnnotationMemberValue ')'
437/.$putCase consumeSingleMemberAnnotation(true) ; $break ./
438/:$readableName SingleMemberAnnotation:/
439/:$compliance 1.8:/
440
441RejectTypeAnnotations ::= $empty
442/.$putCase consumeNonTypeUseName(); $break ./
443/:$readableName RejectTypeAnnotations:/
444
445PushZeroTypeAnnotations ::= $empty
446/.$putCase consumeZeroTypeAnnotations(); $break ./
447/:$readableName ZeroTypeAnnotations:/
448
449VariableDeclaratorIdOrThis ::= 'this'
450/.$putCase consumeExplicitThisParameter(false); $break ./
451/:$compliance 1.8:/
452VariableDeclaratorIdOrThis ::= UnannotatableName '.' 'this'
453/.$putCase consumeExplicitThisParameter(true); $break ./
454/:$compliance 1.8:/
455VariableDeclaratorIdOrThis ::= VariableDeclaratorId
456/.$putCase consumeVariableDeclaratorIdParameter(); $break ./
457/:$readableName VariableDeclaratorId:/
458
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000459CompilationUnit ::= EnterCompilationUnit InternalCompilationUnit
460/.$putCase consumeCompilationUnit(); $break ./
461/:$readableName CompilationUnit:/
462
463InternalCompilationUnit ::= PackageDeclaration
464/.$putCase consumeInternalCompilationUnit(); $break ./
465InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports
466/.$putCase consumeInternalCompilationUnit(); $break ./
467InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations
468/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
469InternalCompilationUnit ::= PackageDeclaration TypeDeclarations
470/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
471InternalCompilationUnit ::= ImportDeclarations ReduceImports
472/.$putCase consumeInternalCompilationUnit(); $break ./
473InternalCompilationUnit ::= TypeDeclarations
474/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
475InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations
476/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
477InternalCompilationUnit ::= $empty
478/.$putCase consumeEmptyInternalCompilationUnit(); $break ./
479/:$readableName CompilationUnit:/
480
481ReduceImports ::= $empty
482/.$putCase consumeReduceImports(); $break ./
483/:$readableName ReduceImports:/
484
485EnterCompilationUnit ::= $empty
486/.$putCase consumeEnterCompilationUnit(); $break ./
487/:$readableName EnterCompilationUnit:/
488
489Header -> ImportDeclaration
490Header -> PackageDeclaration
491Header -> ClassHeader
492Header -> InterfaceHeader
493Header -> EnumHeader
494Header -> AnnotationTypeDeclarationHeader
495Header -> StaticInitializer
496Header -> RecoveryMethodHeader
497Header -> FieldDeclaration
498Header -> AllocationHeader
499Header -> ArrayCreationHeader
500--{ObjectTeams:
501Header -> RecoveryBindingHeader
502Header -> PrecedenceDeclaration
503-- SH}
504/:$readableName Header:/
505
506Header1 -> Header
507Header1 -> ConstructorHeader
508/:$readableName Header1:/
509
510Header2 -> Header
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200511Header2 -> EnumConstantHeader
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000512/:$readableName Header2:/
513
Stephan Herrmann29b019c2011-04-26 10:30:44 +0000514CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{'
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000515/.$putCase consumeCatchHeader(); $break ./
516/:$readableName CatchHeader:/
517
518ImportDeclarations -> ImportDeclaration
519ImportDeclarations ::= ImportDeclarations ImportDeclaration
520/.$putCase consumeImportDeclarations(); $break ./
521/:$readableName ImportDeclarations:/
522
523TypeDeclarations -> TypeDeclaration
524TypeDeclarations ::= TypeDeclarations TypeDeclaration
525/.$putCase consumeTypeDeclarations(); $break ./
526/:$readableName TypeDeclarations:/
527
528PackageDeclaration ::= PackageDeclarationName ';'
Stephan Herrmann44109d32011-08-02 14:34:26 +0000529/.$putCase consumePackageDeclaration(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000530/:$readableName PackageDeclaration:/
531
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200532PackageDeclarationName ::= Modifiers 'package' PushRealModifiers Name RejectTypeAnnotations
Stephan Herrmann44109d32011-08-02 14:34:26 +0000533/.$putCase consumePackageDeclarationNameWithModifiers(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000534/:$readableName PackageDeclarationName:/
535/:$compliance 1.5:/
536
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200537PackageDeclarationName ::= PackageComment 'package' Name RejectTypeAnnotations
538/.$putCase consumePackageDeclarationName(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000539/:$readableName PackageDeclarationName:/
540
541PackageComment ::= $empty
Stephan Herrmann44109d32011-08-02 14:34:26 +0000542/.$putCase consumePackageComment(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000543/:$readableName PackageComment:/
544
545ImportDeclaration -> SingleTypeImportDeclaration
546ImportDeclaration -> TypeImportOnDemandDeclaration
547-----------------------------------------------
548-- 1.5 feature
549-----------------------------------------------
550ImportDeclaration -> SingleStaticImportDeclaration
551--{ObjectTeams: base import:
552ImportDeclaration -> SingleBaseImportDeclaration
553-- SH}
554ImportDeclaration -> StaticImportOnDemandDeclaration
555/:$readableName ImportDeclaration:/
556
557SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';'
558/.$putCase consumeImportDeclaration(); $break ./
559/:$readableName SingleTypeImportDeclaration:/
560
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200561-- {ObjectTeams: special case: allow 'team' in imported package/type name:
562-- orig: SingleTypeImportDeclarationName ::= 'import' Name RejectTypeAnnotations
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000563SingleTypeImportDeclarationName ::= 'import' ImportName
564/.$putCase consumeSingleTypeImportDeclarationName(); $break ./
565/:$readableName SingleTypeImportDeclarationName:/
566
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200567ImportName -> Name RejectTypeAnnotations
568ImportName ::= Name RejectTypeAnnotations '.' 'team' '.' Name RejectTypeAnnotations
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000569/.$putCase consumeNameContainingTeam(); $break ./
570/:$readableName Name:/
571-- SH}
572
573TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName ';'
574/.$putCase consumeImportDeclaration(); $break ./
575/:$readableName TypeImportOnDemandDeclaration:/
576
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200577TypeImportOnDemandDeclarationName ::= 'import' Name '.' RejectTypeAnnotations '*'
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000578/.$putCase consumeTypeImportOnDemandDeclarationName(); $break ./
579/:$readableName TypeImportOnDemandDeclarationName:/
580
581TypeDeclaration -> ClassDeclaration
582TypeDeclaration -> InterfaceDeclaration
583-- this declaration in part of a list od declaration and we will
584-- use and optimized list length calculation process
585-- thus we decrement the number while it will be incremend.....
586TypeDeclaration ::= ';'
587/. $putCase consumeEmptyTypeDeclaration(); $break ./
588-----------------------------------------------
589-- 1.5 feature
590-----------------------------------------------
591TypeDeclaration -> EnumDeclaration
592TypeDeclaration -> AnnotationTypeDeclaration
593/:$readableName TypeDeclaration:/
594
595--18.7 Only in the LALR(1) Grammar
596
597Modifiers -> Modifier
598Modifiers ::= Modifiers Modifier
599/.$putCase consumeModifiers2(); $break ./
600/:$readableName Modifiers:/
601
602Modifier -> 'public'
603Modifier -> 'protected'
604Modifier -> 'private'
605Modifier -> 'static'
606Modifier -> 'abstract'
607Modifier -> 'final'
608Modifier -> 'native'
609Modifier -> 'synchronized'
610Modifier -> 'transient'
611Modifier -> 'volatile'
612Modifier -> 'strictfp'
613Modifier ::= Annotation
614/.$putCase consumeAnnotationAsModifier(); $break ./
615-- {ObjectTeams
616Modifier -> 'team'
617Modifier -> 'callin'
618Modifier -> 'readonly'
619-- Markus Witte}
620/:$readableName Modifier:/
621
622--18.8 Productions from 8: Class Declarations
623--ClassModifier ::=
624-- 'abstract'
625-- | 'final'
626-- | 'public'
627--18.8.1 Productions from 8.1: Class Declarations
628
629ClassDeclaration ::= ClassHeader ClassBody
630/.$putCase consumeClassDeclaration(); $break ./
631/:$readableName ClassDeclaration:/
632
633--{ObjectTeams: playedBy & guard predicate support:
634-- orig: ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt
635ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt ClassHeaderPlayedByopt Predicateopt
636-- MW+SH}
637/.$putCase consumeClassHeader(); $break ./
638/:$readableName ClassHeader:/
639
640-----------------------------------------------
641-- 1.5 features : generics
642-----------------------------------------------
643ClassHeaderName ::= ClassHeaderName1 TypeParameters
644/.$putCase consumeTypeHeaderNameWithTypeParameters(); $break ./
645
646ClassHeaderName -> ClassHeaderName1
647/:$readableName ClassHeaderName:/
648
649ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier'
650/.$putCase consumeClassHeaderName1(); $break ./
651/:$readableName ClassHeaderName:/
652
653ClassHeaderExtends ::= 'extends' ClassType
654/.$putCase consumeClassHeaderExtends(); $break ./
655/:$readableName ClassHeaderExtends:/
656
657ClassHeaderImplements ::= 'implements' InterfaceTypeList
658/.$putCase consumeClassHeaderImplements(); $break ./
659/:$readableName ClassHeaderImplements:/
660
661-- {ObjectTeams: ==== playedBy ====
662ClassHeaderPlayedByopt ::= $empty
663ClassHeaderPlayedByopt -> ClassHeaderPlayedBy
664/:$readableName ClassHeaderPlayedBy:/
665
666ClassHeaderPlayedBy ::= 'playedBy' ClassType
667/.$putCase consumeClassHeaderPlayedBy(); $break ./
668/:$readableName ClassHeaderPlayedBy:/
669
670-- Markus Witte}
671
672--{ObjectTeams: ==== predicates ====
673Predicateopt ::= $empty
674Predicateopt -> Predicate
675
676Predicate -> RolePredicate
677Predicate -> BasePredicate
678
679RolePredicate ::= PredicateHeader PredicateBody
680/:$readableName Predicate:/
681
682PredicateHeader ::= 'when'
683/.$putCase consumePredicate(false); $break ./
684/:$readableName PredicateHeader:/
685
686BasePredicate ::= BasePredicateHeader ForceBaseIsIdentifier PredicateBody RestoreBaseKeyword
687/:$readableName Predicate:/
688
689BasePredicateHeader ::= 'base' 'when'
690/.$putCase consumePredicate(true); $break ./
691/:$readableName PredicateHeader:/
692
693PredicateBody ::= '(' ForceNoDiet Expression RestoreDiet ')'
694/.$putCase consumePredicateExpression(); $break ./
695/:$readableName PredicateBody:/
696
697PredicateBody ::= '(' ')'
698/.$putCase consumePredicateMissingExpression(); $break ./
699
700
701ForceBaseIsIdentifier ::= $empty
702/.$putCase consumeForceBaseIsIdentifier(); $break ./
703/:$readableName ForceBaseIsIdentifier:/
704
705RestoreBaseKeyword ::= $empty
706/.$putCase consumeRestoreBaseKeyword(); $break ./
707/:$readableName RestoreBaseKeyword:/
708-- SH}
709
710InterfaceTypeList -> InterfaceType
711InterfaceTypeList ::= InterfaceTypeList ',' InterfaceType
712/.$putCase consumeInterfaceTypeList(); $break ./
713/:$readableName InterfaceTypeList:/
714
715InterfaceType ::= ClassOrInterfaceType
716/.$putCase consumeInterfaceType(); $break ./
717/:$readableName InterfaceType:/
718
719ClassBody ::= '{' ClassBodyDeclarationsopt '}'
720/:$readableName ClassBody:/
721/:$no_statements_recovery:/
722
723ClassBodyDeclarations ::= ClassBodyDeclaration
724ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
725/.$putCase consumeClassBodyDeclarations(); $break ./
726/:$readableName ClassBodyDeclarations:/
727
728ClassBodyDeclaration -> ClassMemberDeclaration
729ClassBodyDeclaration -> StaticInitializer
730ClassBodyDeclaration -> ConstructorDeclaration
731--1.1 feature
732ClassBodyDeclaration ::= Diet NestedMethod CreateInitializer Block
733/.$putCase consumeClassBodyDeclaration(); $break ./
734/:$readableName ClassBodyDeclaration:/
735
736Diet ::= $empty
737/.$putCase consumeDiet(); $break./
738/:$readableName Diet:/
739
740Initializer ::= Diet NestedMethod CreateInitializer Block
741/.$putCase consumeClassBodyDeclaration(); $break ./
742/:$readableName Initializer:/
743
744CreateInitializer ::= $empty
745/.$putCase consumeCreateInitializer(); $break./
746/:$readableName CreateInitializer:/
747
748ClassMemberDeclaration -> FieldDeclaration
749ClassMemberDeclaration -> MethodDeclaration
750
751-- {ObjectTeams
752ClassMemberDeclaration -> BindingDeclaration
753ClassMemberDeclaration -> PrecedenceDeclaration
754-- Markus Witte}
755
756--1.1 feature
757ClassMemberDeclaration -> ClassDeclaration
758--1.1 feature
759ClassMemberDeclaration -> InterfaceDeclaration
760-- 1.5 feature
761ClassMemberDeclaration -> EnumDeclaration
762ClassMemberDeclaration -> AnnotationTypeDeclaration
763/:$readableName ClassMemberDeclaration:/
764
765-- Empty declarations are not valid Java ClassMemberDeclarations.
766-- However, since the current (2/14/97) Java compiler accepts them
767-- (in fact, some of the official tests contain this erroneous
768-- syntax)
769ClassMemberDeclaration ::= ';'
770/.$putCase consumeEmptyTypeDeclaration(); $break./
771
772GenericMethodDeclaration -> MethodDeclaration
773GenericMethodDeclaration -> ConstructorDeclaration
774/:$readableName GenericMethodDeclaration:/
775
776--18.8.2 Productions from 8.3: Field Declarations
777--VariableModifier ::=
778-- 'public'
779-- | 'protected'
780-- | 'private'
781-- | 'static'
782-- | 'final'
783-- | 'transient'
784-- | 'volatile'
785
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200786FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';'
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000787/.$putCase consumeFieldDeclaration(); $break ./
788/:$readableName FieldDeclaration:/
789
790VariableDeclarators -> VariableDeclarator
791VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator
792/.$putCase consumeVariableDeclarators(); $break ./
793/:$readableName VariableDeclarators:/
Stephan Herrmannc4817302012-07-13 01:31:42 +0200794/:$recovery_template Identifier:/
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000795
796VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization
797VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
798/:$readableName VariableDeclarator:/
799/:$recovery_template Identifier:/
800
801EnterVariable ::= $empty
802/.$putCase consumeEnterVariable(); $break ./
803/:$readableName EnterVariable:/
804
805ExitVariableWithInitialization ::= $empty
806/.$putCase consumeExitVariableWithInitialization(); $break ./
807/:$readableName ExitVariableWithInitialization:/
808
809ExitVariableWithoutInitialization ::= $empty
810/.$putCase consumeExitVariableWithoutInitialization(); $break ./
811/:$readableName ExitVariableWithoutInitialization:/
812
813ForceNoDiet ::= $empty
814/.$putCase consumeForceNoDiet(); $break ./
815/:$readableName ForceNoDiet:/
816RestoreDiet ::= $empty
817/.$putCase consumeRestoreDiet(); $break ./
818/:$readableName RestoreDiet:/
819
820VariableDeclaratorId ::= 'Identifier' Dimsopt
821/:$readableName VariableDeclaratorId:/
822/:$recovery_template Identifier:/
823
824VariableInitializer -> Expression
825VariableInitializer -> ArrayInitializer
826/:$readableName VariableInitializer:/
827/:$recovery_template Identifier:/
828
829--18.8.3 Productions from 8.4: Method Declarations
830--MethodModifier ::=
831-- 'public'
832-- | 'protected'
833-- | 'private'
834-- | 'static'
835-- | 'abstract'
836-- | 'final'
837-- | 'native'
838-- | 'synchronized'
839--
840
841MethodDeclaration -> AbstractMethodDeclaration
842MethodDeclaration ::= MethodHeader MethodBody
843/.$putCase // set to true to consume a method with a body
Stephan Herrmann44109d32011-08-02 14:34:26 +0000844 consumeMethodDeclaration(true); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000845/:$readableName MethodDeclaration:/
846
847AbstractMethodDeclaration ::= MethodHeader ';'
848/.$putCase // set to false to consume a method without body
Stephan Herrmann44109d32011-08-02 14:34:26 +0000849 consumeMethodDeclaration(false); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000850/:$readableName MethodDeclaration:/
851
852MethodHeader ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims MethodHeaderThrowsClauseopt
853/.$putCase consumeMethodHeader(); $break ./
854/:$readableName MethodDeclaration:/
855
856MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '('
857/.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200858MethodHeaderName ::= Modifiersopt Type 'Identifier' '('
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000859/.$putCase consumeMethodHeaderName(false); $break ./
860/:$readableName MethodHeaderName:/
861
862MethodHeaderRightParen ::= ')'
863/.$putCase consumeMethodHeaderRightParen(); $break ./
864/:$readableName ):/
865/:$recovery_template ):/
866
867MethodHeaderExtendedDims ::= Dimsopt
868/.$putCase consumeMethodHeaderExtendedDims(); $break ./
869/:$readableName MethodHeaderExtendedDims:/
870
871MethodHeaderThrowsClause ::= 'throws' ClassTypeList
872/.$putCase consumeMethodHeaderThrowsClause(); $break ./
873/:$readableName MethodHeaderThrowsClause:/
874
875ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt
876/.$putCase consumeConstructorHeader(); $break ./
877/:$readableName ConstructorDeclaration:/
878
Stephan Herrmann44109d32011-08-02 14:34:26 +0000879ConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier' '('
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000880/.$putCase consumeConstructorHeaderNameWithTypeParameters(); $break ./
Stephan Herrmann44109d32011-08-02 14:34:26 +0000881ConstructorHeaderName ::= Modifiersopt 'Identifier' '('
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000882/.$putCase consumeConstructorHeaderName(); $break ./
883/:$readableName ConstructorHeaderName:/
884
885FormalParameterList -> FormalParameter
886FormalParameterList ::= FormalParameterList ',' FormalParameter
887/.$putCase consumeFormalParameterList(); $break ./
888/:$readableName FormalParameterList:/
889
Stephan Herrmannc4817302012-07-13 01:31:42 +0200890PotentialNameArray -> $empty
891/.$putCase consumePotentialNameArrayType(); $break ./
892/:$readableName PotentialNameArray:/
893
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000894--1.1 feature
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200895FormalParameter ::= Modifiersopt Type VariableDeclaratorIdOrThis
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000896/.$putCase consumeFormalParameter(false); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200897FormalParameter ::= Modifiersopt Type PushZeroTypeAnnotations '...' VariableDeclaratorIdOrThis
Stephan Herrmannc4817302012-07-13 01:31:42 +0200898/.$putCase consumeFormalParameter(true); $break ./
899/:$compliance 1.5:/
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200900--{ObjectTeams: inserted LiftingTypeopt: FIXME
901-- example:
Stephan Herrmann5fa7f312012-07-13 01:52:51 +0200902FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt LiftingTypeopt PotentialNameArray VariableDeclaratorIdOrThis
Stephan Herrmannc4817302012-07-13 01:31:42 +0200903/.$putCase consumeFormalParameter(false); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200904-- real:
905FormalParameter ::= Modifiersopt Type @308... TypeAnnotations '...' VariableDeclaratorIdOrThis
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000906/.$putCase consumeFormalParameter(true); $break ./
907/:$readableName FormalParameter:/
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200908/:$compliance 1.8:/
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000909/:$recovery_template Identifier Identifier:/
Stephan Herrmann5fa7f312012-07-13 01:52:51 +0200910-- SH}
Stephan Herrmann197438c2012-07-15 22:54:37 +0200911CatchFormalParameter ::= Modifiersopt CatchType CatchLiftingTypeopt VariableDeclaratorId
Stephan Herrmann44109d32011-08-02 14:34:26 +0000912/.$putCase consumeCatchFormalParameter(); $break ./
913/:$readableName FormalParameter:/
914/:$recovery_template Identifier Identifier:/
915
916CatchType ::= UnionType
917/.$putCase consumeCatchType(); $break ./
918/:$readableName CatchType:/
919
Stephan Herrmannee9076e2013-04-04 16:21:27 +0200920UnionType ::= Type
Stephan Herrmann44109d32011-08-02 14:34:26 +0000921/.$putCase consumeUnionTypeAsClassType(); $break ./
922UnionType ::= UnionType '|' Type
923/.$putCase consumeUnionType(); $break ./
924/:$readableName UnionType:/
925/:$compliance 1.7:/
926
Stephan Herrmann234bfec2011-04-26 08:26:58 +0000927ClassTypeList -> ClassTypeElt
928ClassTypeList ::= ClassTypeList ',' ClassTypeElt
929/.$putCase consumeClassTypeList(); $break ./
930/:$readableName ClassTypeList:/
931
932ClassTypeElt ::= ClassType
933/.$putCase consumeClassTypeElt(); $break ./
934/:$readableName ClassType:/
935
936-- {ObjectTeams: added Predicateopt
937MethodBody ::= Predicateopt NestedMethod '{' BlockStatementsopt '}'
938/.$putCase consumeMethodBody(); $break ./
939/:$readableName MethodBody:/
940/:$no_statements_recovery:/
941-- SH}
942
943NestedMethod ::= $empty
944/.$putCase consumeNestedMethod(); $break ./
945/:$readableName NestedMethod:/
946
947-- {ObjectTeams ========== METHOD BINDINGS ==========
948BindingDeclaration -> CalloutBinding
949BindingDeclaration -> CallinBinding
950BindingDeclaration -> InvalidCallinBinding
951/:$readableName BindingDeclaration:/
952
953-- ==== CALLOUT: ====
954
955-- LONG:
956CalloutBinding ::= CalloutHeaderLong CalloutParameterMappingsopt
957/.$putCase consumeCalloutBindingLong(); $break ./
958/:$readableName CalloutBinding:/
959
960CalloutHeaderLong ::= CalloutBindingLeftLong MethodSpecLong
961/.$putCase consumeCalloutHeader(); $break ./
962/:$readableName CalloutHeader:/
963
964CalloutHeaderLong ::= CalloutBindingLeftLong CalloutFieldSpecLong
965/.$putCase consumeCalloutHeader(); $break ./
966/:$readableName CalloutHeader:/
967
968CalloutBindingLeftLong ::= MethodSpecLong CalloutKind
969/.$putCase consumeCalloutBindingLeft(true); $break ./
970/:$readableName CalloutBindingLeft:/
971
972
973-- SHORT:
974-- Note(SH): Modifiersopt is needed to make grammar LALR(1), in real life modifiers must be empty
975-- Note(SH): This rule includes callout to field short (there cannot be a distinct FieldSpecShort)
976CalloutBinding ::= Modifiersopt CalloutBindingLeftShort CalloutModifieropt MethodSpecShort ';'
977/.$putCase consumeCalloutHeader(); $break ./
978/:$readableName CalloutHeader:/
979
980CalloutBindingLeftShort ::= MethodSpecShort CalloutKind
981/.$putCase consumeCalloutBindingLeft(false); $break ./
982/:$readableName CalloutBindingLeft:/
983
984-- this one added to give better message for parameter mappings despite of missing signatures:
985-- Note(SH): Modifiersopt is needed to make grammar LALR(1), in real life modifiers must be empty
986CalloutBinding ::= Modifiersopt CalloutBindingLeftShort CalloutModifieropt MethodSpecShort CalloutParameterMappings
987/.$putCase consumeCalloutParameterMappingsInvalid(); $break ./
988
989-- SYMBOLS:
990CalloutKind -> '->'
991CalloutKind -> '=>'
992/:$readableName CalloutKind:/
993
994CalloutModifieropt ::= $empty
995CalloutModifieropt -> CalloutModifier
996/:$readableName CalloutModifier:/
997-- get set
998CalloutModifier ::= 'get'
999/.$putCase consumeCalloutModifier(TokenNameget); $break ./
1000/:$readableName CalloutModifier:/
1001CalloutModifier ::= 'set'
1002/.$putCase consumeCalloutModifier(TokenNameset); $break ./
1003/:$readableName CalloutModifier:/
1004
1005
1006---- CALLOUT-BINDING-PARAMETERMAPPING
1007CalloutParameterMappingsopt -> CalloutParameterMappings
1008CalloutParameterMappingsopt ::= ';'
1009/.$putCase consumeParameterMappingsEmpty(); $break ./
1010/:$readableName EmptyParameterMappings:/
1011
1012
1013CalloutParameterMappings ::= 'with' NestedParamMappings '{' CalloutParameterMappingList ,opt '}'
Stephan Herrmann926e1182012-07-20 20:26:32 +02001014/.$putCase consumeParameterMappings(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001015/:$readableName CalloutParameterMappings:/
1016
1017-- note that this rule is needed for diagnose parsing where bodies of parameter mappings are ignored
1018CalloutParameterMappingList ::= $empty
1019/:$readableName EmptyParameterMappings:/
1020
1021CalloutParameterMappingList -> ParameterMapping
1022CalloutParameterMappingList ::= CalloutParameterMappingList ',' ParameterMapping
1023/.$putCase consumeParameterMappingList(); $break ./
1024/:$readableName CalloutParameterMappingList:/
1025
Stephan Herrmann926e1182012-07-20 20:26:32 +02001026
1027ParameterMapping ::= Expression SYNTHBINDOUT 'Identifier'
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001028/.$putCase consumeParameterMappingOut(); $break ./
1029
1030ParameterMapping ::= 'Identifier' '<-' ForceBaseIsIdentifier Expression RestoreBaseKeyword
1031/.$putCase consumeParameterMappingIn(); $break ./
1032/:$readableName ParameterMapping:/
1033
1034
1035NestedParamMappings ::= $empty
1036/.$putCase consumeNestedParamMappings(); $break ./
1037/:$readableName NestedParameterMappings:/
1038
1039-- ==== CALLIN-BINDING: ====
1040
1041-- LONG:
1042CallinBinding ::= CallinHeaderLong CallinParameterMappingsopt
1043/.$putCase consumeCallinBindingLong(); $break ./
1044/:$readableName CallinBinding:/
1045
1046CallinHeaderLong ::= CallinBindingLeftLong CallinModifier MethodSpecsLong Predicateopt
1047/.$putCase consumeCallinHeader(); $break ./
1048/:$readableName CallinHeader:/
1049
1050-- Note(SH): Modifiersopt is needed to make grammar LALR(1), in real life modifiers must be empty
1051CallinHeaderLong ::= Modifiersopt CallinLabel CallinBindingLeftLong CallinModifier MethodSpecsLong Predicateopt
1052/.$putCase consumeCallinHeader(); $break ./
1053
1054CallinBindingLeftLong ::= MethodSpecLong '<-'
1055/.$putCase consumeCallinBindingLeft(true); $break ./
1056/:$readableName CallinBindingLeft:/
1057
1058-- SHORT:
1059-- Note(SH): Modifiersopt is needed to make grammar LALR(1), in real life modifiers must be empty
1060CallinBinding ::= Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort Predicateopt ';'
1061/.$putCase consumeCallinHeader(); $break ./
1062
1063-- Note(SH): Modifiersopt is needed to make grammar LALR(1), in real life modifiers must be empty (2 OCCURENCES!)
1064CallinBinding ::= Modifiersopt CallinLabel Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort Predicateopt ';'
1065/.$putCase consumeCallinHeader(); $break ./
1066
1067CallinBindingLeftShort ::= MethodSpecShort '<-'
1068/.$putCase consumeCallinBindingLeft(false); $break ./
1069/:$readableName CallinBindingLeft:/
1070
1071-- LABEL:
1072CallinLabel ::= SimpleName ':'
1073/.$putCase consumeCallinLabel(); $break ./
1074/:$readableName CallinLabel:/
1075
1076-- MODIFIER:
1077CallinModifier ::= 'replace'
1078/.$putCase consumeCallinModifier(TokenNamereplace); $break ./
1079/:$readableName CallinModifier:/
1080
1081CallinModifier ::= 'before'
1082/.$putCase consumeCallinModifier(TokenNamebefore); $break ./
1083/:$readableName CallinModifier:/
1084
1085CallinModifier ::= 'after'
1086/.$putCase consumeCallinModifier(TokenNameafter); $break ./
1087/:$readableName CallinModifier:/
1088
1089
1090-- These rules are added to parse invalid callin-bindings without replace/before/after modifier
1091InvalidCallinModifier ::= $empty
1092/.$putCase consumeCallinModifierMissing(); $break ./
1093/:$readableName InvalidCallinModifier:/
1094
1095-- Note(SH): Modifiersopt is needed to make grammar LALR(1), in real life modifiers must be empty
1096InvalidCallinBinding ::= Modifiersopt CallinBindingLeftShort InvalidCallinModifier BaseMethodSpecsShort
1097/.$putCase consumeCallinBindingInvalid(false,false); $break ./
1098/:$readableName InvalidCallinBinding:/
1099
1100InvalidCallinBinding ::= Modifiersopt CallinLabel Modifiersopt CallinBindingLeftShort InvalidCallinModifier BaseMethodSpecsShort
1101/.$putCase consumeCallinBindingInvalid(false,false); $break ./
1102/:$readableName InvalidCallinBinding:/
1103
1104InvalidCallinBinding ::= Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort CallinParameterMappings
1105/.$putCase consumeCallinBindingInvalid(false,true); $break ./
1106/:$readableName InvalidCallinBinding:/
1107
1108InvalidCallinBinding ::= Modifiersopt CallinLabel Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort CallinParameterMappings
1109/.$putCase consumeCallinBindingInvalid(false,true); $break ./
1110/:$readableName InvalidCallinBinding:/
1111
1112InvalidCallinBinding ::= CallinBindingLeftLong InvalidCallinModifier MethodSpecsLong CallinParameterMappingsopt
1113/.$putCase consumeCallinBindingInvalid(true,false); $break ./
1114/:$readableName InvalidCallinBinding:/
1115
1116InvalidCallinBinding ::= Modifiersopt CallinLabel CallinBindingLeftLong InvalidCallinModifier MethodSpecsLong CallinParameterMappingsopt
1117/.$putCase consumeCallinBindingInvalid(true,false); $break ./
1118/:$readableName InvalidCallinBinding:/
1119
1120
1121---- CALLIN-BINDING-PARAMETERMAPPING
1122CallinParameterMappingsopt -> CallinParameterMappings
1123CallinParameterMappingsopt ::= ';'
1124/.$putCase consumeParameterMappingsEmpty(); $break ./
1125/:$readableName EmptyParameterMappings:/
1126
1127CallinParameterMappings ::= 'with' NestedParamMappings '{' CallinParameterMappingList ,opt '}'
Stephan Herrmann926e1182012-07-20 20:26:32 +02001128/.$putCase consumeParameterMappings(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001129/:$readableName CallinParameterMappings:/
1130
1131-- note that this rule is needed for diagnose parsing where bodies of parameter mappings are ignored
1132CallinParameterMappingList ::= $empty
1133/:$readableName EmptyParameterMappings:/
1134
1135CallinParameterMappingList -> ParameterMapping
1136CallinParameterMappingList ::= CallinParameterMappingList ',' ParameterMapping
1137/.$putCase consumeParameterMappingList(); $break ./
1138/:$readableName ParameterMappingList:/
1139
1140-- ==== METHOD_SPEC: ====
1141
1142MethodSpecShort ::= SimpleName
1143/.$putCase consumeMethodSpecShort(); $break ./
1144/:$readableName MethodSpecShort:/
1145
1146MethodSpecLong ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen
1147/.$putCase consumeMethodSpecLong(false); $break ./
1148/:$readableName MethodSpecLong:/
1149
1150-- explicitly handle this error case:
1151MethodSpecLong ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen
1152/.$putCase consumeMethodSpecLongCtor(); $break ./
1153/:$readableName IllegalMethodSpecLong:/
1154
1155-- base of callin can use '+' after return type:
1156BaseMethodSpecLong ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen
1157/.$putCase consumeMethodSpecLong(false); $break ./
1158/:$readableName MethodSpecLong:/
1159
1160BaseMethodSpecLong ::= MethodSpecNamePlus FormalParameterListopt MethodHeaderRightParen
1161/.$putCase consumeMethodSpecLong(true); $break ./
1162/:$readableName MethodSpecLong:/
1163
Stephan Herrmann5fa7f312012-07-13 01:52:51 +02001164MethodSpecNamePlus ::= Modifiersopt Type0 '+' 'Identifier' '('
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001165/.$putCase consumeMethodHeaderName(false); $break ./
1166/:$readableName MethodSpecName:/
1167
1168CalloutFieldSpecLong ::= CalloutModifier Type 'Identifier'
1169/.$putCase consumeFieldSpecLong(); $break ./
1170/:$readableName CallloutFieldSpec:/
1171
1172BaseMethodSpecsShort -> BaseMethodSpecListShort
1173/:$readableName MethodSpecsShort:/
1174
1175BaseMethodSpecListShort -> BaseMethodSpecShort
1176BaseMethodSpecListShort ::= BaseMethodSpecListShort ',' BaseMethodSpecShort
1177/.$putCase consumeMethodSpecList(); $break ./
1178/:$readableName MethodSpecListShort:/
1179
1180BaseMethodSpecShort -> MethodSpecShort
1181
1182MethodSpecsLong -> MethodSpecListLong
1183/:$readableName MethodSpecsLong:/
1184
1185MethodSpecListLong -> BaseMethodSpecLong
1186MethodSpecListLong ::= MethodSpecListLong ',' BaseMethodSpecLong
1187/.$putCase consumeMethodSpecList(); $break ./
1188/:$readableName MethodSpecListLong:/
1189
1190-- ==== PRECEDENCE DECLARATION ====
1191PrecedenceDeclaration ::= 'precedence' BindingNames ';'
1192/.$putCase consumePrecedenceDeclaration(false); $break ./
1193/:$readableName PrecedenceDeclaration:/
1194
1195PrecedenceDeclaration ::= 'precedence' 'after' BindingNames ';'
1196/.$putCase consumePrecedenceDeclaration(true); $break ./
1197/:$readableName PrecedenceAfterDeclaration:/
1198
1199BindingNames -> BindingName
1200BindingNames ::= BindingNames ',' BindingName
1201/.$putCase consumeBindingNames(); $break ./
1202/:$readableName CallinBindingNames:/
1203
1204BindingName ::= Name
1205/.$putCase consumeBindingName(); $break ./
1206/:$readableName CallinBindingName:/
1207-- Markus Witte}
1208
1209--18.8.4 Productions from 8.5: Static Initializers
1210
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001211StaticInitializer ::= StaticOnly Block
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001212/.$putCase consumeStaticInitializer(); $break./
1213/:$readableName StaticInitializer:/
1214
1215StaticOnly ::= 'static'
1216/.$putCase consumeStaticOnly(); $break ./
1217/:$readableName StaticOnly:/
1218
1219--18.8.5 Productions from 8.6: Constructor Declarations
1220--ConstructorModifier ::=
1221-- 'public'
1222-- | 'protected'
1223-- | 'private'
1224--
1225--
1226ConstructorDeclaration ::= ConstructorHeader MethodBody
1227/.$putCase consumeConstructorDeclaration() ; $break ./
1228-- These rules are added to be able to parse constructors with no body
1229ConstructorDeclaration ::= ConstructorHeader ';'
1230/.$putCase consumeInvalidConstructorDeclaration() ; $break ./
1231/:$readableName ConstructorDeclaration:/
1232
1233-- the rules ExplicitConstructorInvocationopt has been expanded
1234-- in the rule below in order to make the grammar lalr(1).
1235
1236ExplicitConstructorInvocation ::= 'this' '(' ArgumentListopt ')' ';'
1237/.$putCase consumeExplicitConstructorInvocation(0, THIS_CALL); $break ./
1238
1239ExplicitConstructorInvocation ::= OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';'
1240/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL); $break ./
1241
1242ExplicitConstructorInvocation ::= 'super' '(' ArgumentListopt ')' ';'
1243/.$putCase consumeExplicitConstructorInvocation(0,SUPER_CALL); $break ./
1244
1245ExplicitConstructorInvocation ::= OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';'
1246/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL); $break ./
1247
1248-- {ObjectTeams
1249ExplicitConstructorInvocation ::= 'tsuper' '(' ArgumentListopt ')' ';'
1250/.$putCase consumeExplicitConstructorInvocation(0,TSUPER_CALL); $break ./
1251
1252ExplicitConstructorInvocation ::= Name '.' 'tsuper' '(' ArgumentListopt ')' ';'
1253/.$putCase consumeExplicitConstructorInvocation(2,TSUPER_CALL); $break ./
1254-- Markus Witte}
1255
1256--1.1 feature
1257ExplicitConstructorInvocation ::= Primary '.' 'super' '(' ArgumentListopt ')' ';'
1258/.$putCase consumeExplicitConstructorInvocation(1, SUPER_CALL); $break ./
1259
1260ExplicitConstructorInvocation ::= Primary '.' OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';'
1261/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL); $break ./
1262
1263--1.1 feature
1264ExplicitConstructorInvocation ::= Name '.' 'super' '(' ArgumentListopt ')' ';'
1265/.$putCase consumeExplicitConstructorInvocation(2, SUPER_CALL); $break ./
1266
1267ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';'
1268/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL); $break ./
1269
1270--1.1 feature
1271ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ArgumentListopt ')' ';'
1272/.$putCase consumeExplicitConstructorInvocation(1, THIS_CALL); $break ./
1273
1274ExplicitConstructorInvocation ::= Primary '.' OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';'
1275/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL); $break ./
1276
1277--1.1 feature
1278ExplicitConstructorInvocation ::= Name '.' 'this' '(' ArgumentListopt ')' ';'
1279/.$putCase consumeExplicitConstructorInvocation(2, THIS_CALL); $break ./
1280
1281ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';'
1282/.$putCase consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL); $break ./
1283/:$readableName ExplicitConstructorInvocation:/
1284
1285-- {ObjectTeams
1286BaseConstructorExpression ::= 'base' '(' ArgumentListopt ')'
1287/.$putCase consumeExplicitConstructorInvocationBase(0); $break ./
1288/:$readableName BaseConstructorInvocation:/
1289
1290BaseConstructorInvocation ::= 'base' '(' ArgumentListopt ')'
1291/.$putCase consumeExplicitConstructorInvocationBase(1); $break ./
1292/:$readableName BaseConstructorInvocation:/
1293
1294BaseConstructorInvocation ::= Primary . 'base' '(' ArgumentListopt ')'
1295/.$putCase consumeExplicitConstructorInvocationBase(2); $break ./
1296/:$readableName QualifiedBaseConstructorInvocation:/
1297
1298BaseConstructorInvocation ::= Name . 'base' '(' ArgumentListopt ')'
1299/.$putCase consumeExplicitConstructorInvocationBase(3); $break ./
1300/:$readableName QualifiedBaseConstructorInvocation:/
1301-- Markus Witte}
1302
1303--18.9 Productions from 9: Interface Declarations
1304
1305--18.9.1 Productions from 9.1: Interface Declarations
1306--InterfaceModifier ::=
1307-- 'public'
1308-- | 'abstract'
1309--
1310InterfaceDeclaration ::= InterfaceHeader InterfaceBody
1311/.$putCase consumeInterfaceDeclaration(); $break ./
1312/:$readableName InterfaceDeclaration:/
1313
1314-- {ObjectTeams
1315-- orig: InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt
1316InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt ClassHeaderPlayedByopt
1317-- SH}
1318/.$putCase consumeInterfaceHeader(); $break ./
1319/:$readableName InterfaceHeader:/
1320
1321-----------------------------------------------
1322-- 1.5 features : generics
1323-----------------------------------------------
1324InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters
1325/.$putCase consumeTypeHeaderNameWithTypeParameters(); $break ./
1326
1327InterfaceHeaderName -> InterfaceHeaderName1
1328/:$readableName InterfaceHeaderName:/
1329
1330InterfaceHeaderName1 ::= Modifiersopt interface Identifier
1331/.$putCase consumeInterfaceHeaderName1(); $break ./
1332/:$readableName InterfaceHeaderName:/
1333
1334InterfaceHeaderExtends ::= 'extends' InterfaceTypeList
1335/.$putCase consumeInterfaceHeaderExtends(); $break ./
1336/:$readableName InterfaceHeaderExtends:/
1337
1338InterfaceBody ::= '{' InterfaceMemberDeclarationsopt '}'
1339/:$readableName InterfaceBody:/
1340
1341InterfaceMemberDeclarations -> InterfaceMemberDeclaration
1342InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration
1343/.$putCase consumeInterfaceMemberDeclarations(); $break ./
1344/:$readableName InterfaceMemberDeclarations:/
1345
1346--same as for class members
1347InterfaceMemberDeclaration ::= ';'
1348/.$putCase consumeEmptyTypeDeclaration(); $break ./
1349/:$readableName InterfaceMemberDeclaration:/
1350
Stephan Herrmannc4817302012-07-13 01:31:42 +02001351PushDefault ::= $empty
1352/.$putCase consumeInterfaceMethodDefault(); $break ./
1353/:$readableName PushDefault:/
1354/:$compliance 1.8:/
1355
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001356InterfaceMemberDeclaration -> ConstantDeclaration
Stephan Herrmannc4817302012-07-13 01:31:42 +02001357InterfaceMemberDeclaration ::= MethodHeader 'default' PushDefault MethodBody
1358/:$compliance 1.8:/
1359/.$putCase consumeInterfaceMethodDeclaration(true); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001360InterfaceMemberDeclaration ::= MethodHeader MethodBody
Stephan Herrmannc4817302012-07-13 01:31:42 +02001361/.$putCase consumeInterfaceMethodDeclaration(false); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001362/:$readableName InterfaceMemberDeclaration:/
1363
1364-- These rules are added to be able to parse constructors inside interface and then report a relevent error message
1365InvalidConstructorDeclaration ::= ConstructorHeader MethodBody
Stephan Herrmann44109d32011-08-02 14:34:26 +00001366/.$putCase consumeInvalidConstructorDeclaration(true); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001367InvalidConstructorDeclaration ::= ConstructorHeader ';'
Stephan Herrmann44109d32011-08-02 14:34:26 +00001368/.$putCase consumeInvalidConstructorDeclaration(false); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001369/:$readableName InvalidConstructorDeclaration:/
1370
1371-- These rules are added to be able to parse initializers inside an interface and then report a relevent error message (bug 212713)
1372InvalidInitializer -> StaticInitializer
1373InvalidInitializer -> Initializer
1374/:$readableName InvalidInitializer:/
1375
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001376
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001377InterfaceMemberDeclaration -> AbstractMethodDeclaration
1378InterfaceMemberDeclaration -> InvalidConstructorDeclaration
1379InterfaceMemberDeclaration -> InvalidInitializer
1380--1.1 feature
1381InterfaceMemberDeclaration -> ClassDeclaration
1382--1.1 feature
1383InterfaceMemberDeclaration -> InterfaceDeclaration
1384InterfaceMemberDeclaration -> EnumDeclaration
1385InterfaceMemberDeclaration -> AnnotationTypeDeclaration
1386--{ObjectTeams: bindings in role interfaces:
1387InterfaceMemberDeclaration -> BindingDeclaration
1388-- SH}
1389/:$readableName InterfaceMemberDeclaration:/
1390
1391ConstantDeclaration -> FieldDeclaration
1392/:$readableName ConstantDeclaration:/
1393
1394PushLeftBrace ::= $empty
1395/.$putCase consumePushLeftBrace(); $break ./
1396/:$readableName PushLeftBrace:/
1397
1398ArrayInitializer ::= '{' PushLeftBrace ,opt '}'
1399/.$putCase consumeEmptyArrayInitializer(); $break ./
1400ArrayInitializer ::= '{' PushLeftBrace VariableInitializers '}'
1401/.$putCase consumeArrayInitializer(); $break ./
1402ArrayInitializer ::= '{' PushLeftBrace VariableInitializers , '}'
1403/.$putCase consumeArrayInitializer(); $break ./
1404/:$readableName ArrayInitializer:/
1405/:$recovery_template Identifier:/
1406
1407VariableInitializers ::= VariableInitializer
1408VariableInitializers ::= VariableInitializers ',' VariableInitializer
1409/.$putCase consumeVariableInitializers(); $break ./
1410/:$readableName VariableInitializers:/
1411
1412Block ::= OpenBlock '{' BlockStatementsopt '}'
1413/.$putCase consumeBlock(); $break ./
1414/:$readableName Block:/
1415
1416OpenBlock ::= $empty
1417/.$putCase consumeOpenBlock() ; $break ./
1418/:$readableName OpenBlock:/
1419
1420BlockStatements -> BlockStatement
1421BlockStatements ::= BlockStatements BlockStatement
1422/.$putCase consumeBlockStatements() ; $break ./
1423/:$readableName BlockStatements:/
1424
1425BlockStatement -> LocalVariableDeclarationStatement
1426BlockStatement -> Statement
1427--1.1 feature
1428BlockStatement -> ClassDeclaration
1429BlockStatement ::= InterfaceDeclaration
1430/.$putCase consumeInvalidInterfaceDeclaration(); $break ./
1431/:$readableName BlockStatement:/
1432BlockStatement ::= AnnotationTypeDeclaration
1433/.$putCase consumeInvalidAnnotationTypeDeclaration(); $break ./
1434/:$readableName BlockStatement:/
1435BlockStatement ::= EnumDeclaration
1436/.$putCase consumeInvalidEnumDeclaration(); $break ./
1437/:$readableName BlockStatement:/
1438
1439LocalVariableDeclarationStatement ::= LocalVariableDeclaration ';'
1440/.$putCase consumeLocalVariableDeclarationStatement(); $break ./
1441/:$readableName LocalVariableDeclarationStatement:/
1442
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001443LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001444/.$putCase consumeLocalVariableDeclaration(); $break ./
1445-- 1.1 feature
1446-- The modifiers part of this rule makes the grammar more permissive.
1447-- The only modifier here is final. We put Modifiers to allow multiple modifiers
1448-- This will require to check the validity of the modifier
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001449LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001450/.$putCase consumeLocalVariableDeclaration(); $break ./
1451/:$readableName LocalVariableDeclaration:/
1452
1453PushModifiers ::= $empty
1454/.$putCase consumePushModifiers(); $break ./
1455/:$readableName PushModifiers:/
1456
1457PushModifiersForHeader ::= $empty
1458/.$putCase consumePushModifiersForHeader(); $break ./
1459/:$readableName PushModifiersForHeader:/
1460
1461PushRealModifiers ::= $empty
1462/.$putCase consumePushRealModifiers(); $break ./
1463/:$readableName PushRealModifiers:/
1464
1465Statement -> StatementWithoutTrailingSubstatement
1466Statement -> LabeledStatement
1467Statement -> IfThenStatement
1468Statement -> IfThenElseStatement
1469Statement -> WhileStatement
1470Statement -> ForStatement
1471-- {ObjectTeams
1472Statement -> WithinStatement
1473-- Markus Witte}
1474-----------------------------------------------
1475-- 1.5 feature
1476-----------------------------------------------
1477Statement -> EnhancedForStatement
1478/:$readableName Statement:/
1479/:$recovery_template ;:/
1480
1481StatementNoShortIf -> StatementWithoutTrailingSubstatement
1482StatementNoShortIf -> LabeledStatementNoShortIf
1483StatementNoShortIf -> IfThenElseStatementNoShortIf
1484StatementNoShortIf -> WhileStatementNoShortIf
1485StatementNoShortIf -> ForStatementNoShortIf
1486-----------------------------------------------
1487-- 1.5 feature
1488-----------------------------------------------
1489StatementNoShortIf -> EnhancedForStatementNoShortIf
1490/:$readableName Statement:/
1491
1492StatementWithoutTrailingSubstatement -> AssertStatement
1493StatementWithoutTrailingSubstatement -> Block
1494StatementWithoutTrailingSubstatement -> EmptyStatement
1495StatementWithoutTrailingSubstatement -> ExpressionStatement
1496StatementWithoutTrailingSubstatement -> SwitchStatement
1497StatementWithoutTrailingSubstatement -> DoStatement
1498StatementWithoutTrailingSubstatement -> BreakStatement
1499StatementWithoutTrailingSubstatement -> ContinueStatement
1500StatementWithoutTrailingSubstatement -> ReturnStatement
1501StatementWithoutTrailingSubstatement -> SynchronizedStatement
1502StatementWithoutTrailingSubstatement -> ThrowStatement
1503StatementWithoutTrailingSubstatement -> TryStatement
Stephan Herrmann44109d32011-08-02 14:34:26 +00001504StatementWithoutTrailingSubstatement -> TryStatementWithResources
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001505/:$readableName Statement:/
1506
1507EmptyStatement ::= ';'
1508/.$putCase consumeEmptyStatement(); $break ./
1509/:$readableName EmptyStatement:/
1510
1511LabeledStatement ::= Label ':' Statement
1512/.$putCase consumeStatementLabel() ; $break ./
1513/:$readableName LabeledStatement:/
1514
1515LabeledStatementNoShortIf ::= Label ':' StatementNoShortIf
1516/.$putCase consumeStatementLabel() ; $break ./
1517/:$readableName LabeledStatement:/
1518
1519Label ::= 'Identifier'
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001520/.$putCase consumeLabel() ; $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001521/:$readableName Label:/
1522
1523ExpressionStatement ::= StatementExpression ';'
1524/. $putCase consumeExpressionStatement(); $break ./
1525ExpressionStatement ::= ExplicitConstructorInvocation
1526/:$readableName Statement:/
1527
1528StatementExpression ::= Assignment
1529StatementExpression ::= PreIncrementExpression
1530StatementExpression ::= PreDecrementExpression
1531StatementExpression ::= PostIncrementExpression
1532StatementExpression ::= PostDecrementExpression
1533StatementExpression ::= MethodInvocation
1534StatementExpression ::= ClassInstanceCreationExpression
1535-- {ObjectTeams
1536StatementExpression ::= BaseConstructorInvocation
1537-- SH}
1538/:$readableName Expression:/
1539
Stephan Herrmann44109d32011-08-02 14:34:26 +00001540IfThenStatement ::= 'if' '(' Expression ')' Statement
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001541/.$putCase consumeStatementIfNoElse(); $break ./
1542/:$readableName IfStatement:/
1543
Stephan Herrmann44109d32011-08-02 14:34:26 +00001544IfThenElseStatement ::= 'if' '(' Expression ')' StatementNoShortIf 'else' Statement
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001545/.$putCase consumeStatementIfWithElse(); $break ./
1546/:$readableName IfStatement:/
1547
Stephan Herrmann44109d32011-08-02 14:34:26 +00001548IfThenElseStatementNoShortIf ::= 'if' '(' Expression ')' StatementNoShortIf 'else' StatementNoShortIf
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001549/.$putCase consumeStatementIfWithElse(); $break ./
1550/:$readableName IfStatement:/
1551
1552SwitchStatement ::= 'switch' '(' Expression ')' OpenBlock SwitchBlock
1553/.$putCase consumeStatementSwitch() ; $break ./
1554/:$readableName SwitchStatement:/
1555
1556SwitchBlock ::= '{' '}'
1557/.$putCase consumeEmptySwitchBlock() ; $break ./
1558
1559SwitchBlock ::= '{' SwitchBlockStatements '}'
1560SwitchBlock ::= '{' SwitchLabels '}'
1561SwitchBlock ::= '{' SwitchBlockStatements SwitchLabels '}'
1562/.$putCase consumeSwitchBlock() ; $break ./
1563/:$readableName SwitchBlock:/
1564
1565SwitchBlockStatements -> SwitchBlockStatement
1566SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement
1567/.$putCase consumeSwitchBlockStatements() ; $break ./
1568/:$readableName SwitchBlockStatements:/
1569
1570SwitchBlockStatement ::= SwitchLabels BlockStatements
1571/.$putCase consumeSwitchBlockStatement() ; $break ./
1572/:$readableName SwitchBlockStatement:/
1573
1574SwitchLabels -> SwitchLabel
1575SwitchLabels ::= SwitchLabels SwitchLabel
1576/.$putCase consumeSwitchLabels() ; $break ./
1577/:$readableName SwitchLabels:/
1578
1579SwitchLabel ::= 'case' ConstantExpression ':'
1580/. $putCase consumeCaseLabel(); $break ./
1581
1582SwitchLabel ::= 'default' ':'
1583/. $putCase consumeDefaultLabel(); $break ./
1584/:$readableName SwitchLabel:/
1585
1586WhileStatement ::= 'while' '(' Expression ')' Statement
1587/.$putCase consumeStatementWhile() ; $break ./
1588/:$readableName WhileStatement:/
1589
1590WhileStatementNoShortIf ::= 'while' '(' Expression ')' StatementNoShortIf
1591/.$putCase consumeStatementWhile() ; $break ./
1592/:$readableName WhileStatement:/
1593
1594DoStatement ::= 'do' Statement 'while' '(' Expression ')' ';'
1595/.$putCase consumeStatementDo() ; $break ./
1596/:$readableName DoStatement:/
1597
1598ForStatement ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' Statement
1599/.$putCase consumeStatementFor() ; $break ./
1600/:$readableName ForStatement:/
1601
1602ForStatementNoShortIf ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf
1603/.$putCase consumeStatementFor() ; $break ./
1604/:$readableName ForStatement:/
1605
1606--the minus one allows to avoid a stack-to-stack transfer
1607ForInit ::= StatementExpressionList
1608/.$putCase consumeForInit() ; $break ./
1609ForInit -> LocalVariableDeclaration
1610/:$readableName ForInit:/
1611
1612ForUpdate -> StatementExpressionList
1613/:$readableName ForUpdate:/
1614
1615StatementExpressionList -> StatementExpression
1616StatementExpressionList ::= StatementExpressionList ',' StatementExpression
1617/.$putCase consumeStatementExpressionList() ; $break ./
1618/:$readableName StatementExpressionList:/
1619
1620-- {ObjectTeams
1621WithinStatement ::= 'within' '(' Expression ')' Statement
1622/.$putCase consumeWithinStatement(); $break ./
1623/:$readableName WithinStatement:/
1624-- Markus Witte}
1625
1626-- 1.4 feature
1627AssertStatement ::= 'assert' Expression ';'
1628/.$putCase consumeSimpleAssertStatement() ; $break ./
1629/:$compliance 1.4:/
1630
1631AssertStatement ::= 'assert' Expression ':' Expression ';'
1632/.$putCase consumeAssertStatement() ; $break ./
1633/:$readableName AssertStatement:/
1634/:$compliance 1.4:/
1635
1636BreakStatement ::= 'break' ';'
1637/.$putCase consumeStatementBreak() ; $break ./
1638
1639BreakStatement ::= 'break' Identifier ';'
1640/.$putCase consumeStatementBreakWithLabel() ; $break ./
1641/:$readableName BreakStatement:/
1642
1643ContinueStatement ::= 'continue' ';'
1644/.$putCase consumeStatementContinue() ; $break ./
1645
1646ContinueStatement ::= 'continue' Identifier ';'
1647/.$putCase consumeStatementContinueWithLabel() ; $break ./
1648/:$readableName ContinueStatement:/
1649
1650ReturnStatement ::= 'return' Expressionopt ';'
1651/.$putCase consumeStatementReturn() ; $break ./
1652/:$readableName ReturnStatement:/
1653
1654ThrowStatement ::= 'throw' Expression ';'
1655/.$putCase consumeStatementThrow(); $break ./
1656/:$readableName ThrowStatement:/
1657
Stephan Herrmann44109d32011-08-02 14:34:26 +00001658SynchronizedStatement ::= OnlySynchronized '(' Expression ')' Block
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001659/.$putCase consumeStatementSynchronized(); $break ./
1660/:$readableName SynchronizedStatement:/
1661
1662OnlySynchronized ::= 'synchronized'
1663/.$putCase consumeOnlySynchronized(); $break ./
1664/:$readableName OnlySynchronized:/
1665
1666TryStatement ::= 'try' TryBlock Catches
Stephan Herrmann44109d32011-08-02 14:34:26 +00001667/.$putCase consumeStatementTry(false, false); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001668TryStatement ::= 'try' TryBlock Catchesopt Finally
Stephan Herrmann44109d32011-08-02 14:34:26 +00001669/.$putCase consumeStatementTry(true, false); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001670/:$readableName TryStatement:/
1671
Stephan Herrmann44109d32011-08-02 14:34:26 +00001672TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt
1673/.$putCase consumeStatementTry(false, true); $break ./
1674TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally
1675/.$putCase consumeStatementTry(true, true); $break ./
1676/:$readableName TryStatementWithResources:/
1677/:$compliance 1.7:/
1678
1679ResourceSpecification ::= '(' Resources ;opt ')'
1680/.$putCase consumeResourceSpecification(); $break ./
1681/:$readableName ResourceSpecification:/
1682/:$compliance 1.7:/
1683
1684;opt ::= $empty
1685/.$putCase consumeResourceOptionalTrailingSemiColon(false); $break ./
1686;opt ::= ';'
1687/.$putCase consumeResourceOptionalTrailingSemiColon(true); $break ./
1688/:$readableName ;:/
1689/:$compliance 1.7:/
1690
1691Resources ::= Resource
1692/.$putCase consumeSingleResource(); $break ./
1693Resources ::= Resources TrailingSemiColon Resource
1694/.$putCase consumeMultipleResources(); $break ./
1695/:$readableName Resources:/
1696/:$compliance 1.7:/
1697
1698TrailingSemiColon ::= ';'
1699/.$putCase consumeResourceOptionalTrailingSemiColon(true); $break ./
1700/:$readableName ;:/
1701/:$compliance 1.7:/
1702
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001703Resource ::= Type PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
Stephan Herrmann44109d32011-08-02 14:34:26 +00001704/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
1705/:$readableName Resource:/
1706/:$compliance 1.7:/
1707
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001708Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization
Stephan Herrmann44109d32011-08-02 14:34:26 +00001709/.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./
1710/:$readableName Resource:/
1711/:$compliance 1.7:/
1712
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001713TryBlock ::= Block ExitTryBlock
1714/:$readableName Block:/
1715
1716ExitTryBlock ::= $empty
1717/.$putCase consumeExitTryBlock(); $break ./
1718/:$readableName ExitTryBlock:/
1719
1720Catches -> CatchClause
1721Catches ::= Catches CatchClause
1722/.$putCase consumeCatches(); $break ./
1723/:$readableName Catches:/
1724
Stephan Herrmann29b019c2011-04-26 10:30:44 +00001725CatchClause ::= 'catch' '(' CatchFormalParameter ')' Block
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001726/.$putCase consumeStatementCatch() ; $break ./
1727/:$readableName CatchClause:/
1728
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001729Finally ::= 'finally' Block
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001730/:$readableName Finally:/
1731/:$recovery_template finally { }:/
1732
1733--18.12 Productions from 14: Expressions
1734
1735--for source positioning purpose
1736PushLPAREN ::= '('
1737/.$putCase consumeLeftParen(); $break ./
1738/:$readableName (:/
1739/:$recovery_template (:/
1740PushRPAREN ::= ')'
1741/.$putCase consumeRightParen(); $break ./
1742/:$readableName ):/
1743/:$recovery_template ):/
1744
1745Primary -> PrimaryNoNewArray
1746Primary -> ArrayCreationWithArrayInitializer
1747Primary -> ArrayCreationWithoutArrayInitializer
1748/:$readableName Expression:/
1749
1750PrimaryNoNewArray -> Literal
1751PrimaryNoNewArray ::= 'this'
1752/.$putCase consumePrimaryNoNewArrayThis(); $break ./
1753
Stephan Herrmann44109d32011-08-02 14:34:26 +00001754PrimaryNoNewArray ::= PushLPAREN Expression_NotName PushRPAREN
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001755/.$putCase consumePrimaryNoNewArray(); $break ./
1756
Stephan Herrmann44109d32011-08-02 14:34:26 +00001757PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001758/.$putCase consumePrimaryNoNewArrayWithName(); $break ./
1759
1760PrimaryNoNewArray -> ClassInstanceCreationExpression
1761--{ObjectTeams:
1762PrimaryNoNewArray -> BaseConstructorExpression
1763-- SH}
1764PrimaryNoNewArray -> FieldAccess
1765--1.1 feature
1766PrimaryNoNewArray ::= Name '.' 'this'
1767/.$putCase consumePrimaryNoNewArrayNameThis(); $break ./
1768PrimaryNoNewArray ::= Name '.' 'super'
1769/.$putCase consumePrimaryNoNewArrayNameSuper(); $break ./
1770
1771--1.1 feature
Stephan Herrmann44109d32011-08-02 14:34:26 +00001772--PrimaryNoNewArray ::= Type '.' 'class'
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001773--inline Type in the previous rule in order to make the grammar LL1 instead
1774-- of LL2. The result is the 3 next rules.
1775
1776PrimaryNoNewArray ::= Name '.' 'class'
1777/.$putCase consumePrimaryNoNewArrayName(); $break ./
1778
1779PrimaryNoNewArray ::= Name Dims '.' 'class'
1780/.$putCase consumePrimaryNoNewArrayArrayType(); $break ./
1781
1782PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class'
1783/.$putCase consumePrimaryNoNewArrayPrimitiveArrayType(); $break ./
1784
1785PrimaryNoNewArray ::= PrimitiveType '.' 'class'
1786/.$putCase consumePrimaryNoNewArrayPrimitiveType(); $break ./
1787
1788--{ObjectTeams: R<@t>.class
1789-- (start with RelationalExpression to make the grammer LL1, further syntax checking in Parser)
1790RelationalExpression ::= RelationalExpression '<' TypeAnchor '>' '.' 'class'
1791/.$putCase consumeRoleClassLiteral(); $break ./
1792-- SH}
1793
1794PrimaryNoNewArray -> MethodInvocation
1795PrimaryNoNewArray -> ArrayAccess
Stephan Herrmannc4817302012-07-13 01:31:42 +02001796
1797-----------------------------------------------------------------------
1798-- Start of rules for JSR 335
1799-----------------------------------------------------------------------
1800
1801PrimaryNoNewArray -> LambdaExpression
1802PrimaryNoNewArray -> ReferenceExpression
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001803/:$readableName Expression:/
Stephan Herrmannc4817302012-07-13 01:31:42 +02001804
Stephan Herrmann1460a602012-07-19 20:01:10 +02001805ReferenceExpressionTypeArgumentsAndTrunk ::= OnlyTypeArguments Dimsopt
1806/.$putCase consumeReferenceExpressionTypeArgumentsAndTrunk(false); $break ./
1807/:$compliance 1.8:/
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001808ReferenceExpressionTypeArgumentsAndTrunk ::= OnlyTypeArguments '.' ClassOrInterfaceType Dimsopt
Stephan Herrmann1460a602012-07-19 20:01:10 +02001809/.$putCase consumeReferenceExpressionTypeArgumentsAndTrunk(true); $break ./
1810/:$readableName ReferenceExpressionTypeArgumentsAndTrunk:/
Stephan Herrmannc4817302012-07-13 01:31:42 +02001811/:$compliance 1.8:/
1812
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001813ReferenceExpression ::= PrimitiveType Dims '::' NonWildTypeArgumentsopt IdentifierOrNew
Stephan Herrmann1460a602012-07-19 20:01:10 +02001814/.$putCase consumeReferenceExpressionTypeForm(true, true); $break ./
1815/:$compliance 1.8:/
1816
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001817ReferenceExpression ::= Name Dims '::' NonWildTypeArgumentsopt IdentifierOrNew
Stephan Herrmann1460a602012-07-19 20:01:10 +02001818/.$putCase consumeReferenceExpressionTypeForm(false, true); $break ./
1819/:$compliance 1.8:/
1820
Stephan Herrmann1460a602012-07-19 20:01:10 +02001821ReferenceExpression ::= Name '::' NonWildTypeArgumentsopt IdentifierOrNew
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001822/.$putCase consumeReferenceExpressionTypeForm(false, false); $break ./
Stephan Herrmann1460a602012-07-19 20:01:10 +02001823/:$compliance 1.8:/
1824
1825-- BeginTypeArguments is a synthetic token the scanner concocts to help disambiguate
1826-- between '<' as an operator and '<' in '<' TypeArguments '>'
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001827ReferenceExpression ::= Name BeginTypeArguments ReferenceExpressionTypeArgumentsAndTrunk '::' NonWildTypeArgumentsopt IdentifierOrNew
Stephan Herrmann1460a602012-07-19 20:01:10 +02001828/.$putCase consumeReferenceExpressionGenericTypeForm(); $break ./
1829/:$compliance 1.8:/
1830
Stephan Herrmannc4817302012-07-13 01:31:42 +02001831ReferenceExpression ::= Primary '::' NonWildTypeArgumentsopt Identifier
1832/.$putCase consumeReferenceExpressionPrimaryForm(); $break ./
Stephan Herrmann1460a602012-07-19 20:01:10 +02001833/:$compliance 1.8:/
Stephan Herrmannc4817302012-07-13 01:31:42 +02001834ReferenceExpression ::= 'super' '::' NonWildTypeArgumentsopt Identifier
1835/.$putCase consumeReferenceExpressionSuperForm(); $break ./
1836/:$readableName ReferenceExpression:/
1837/:$compliance 1.8:/
1838
1839NonWildTypeArgumentsopt ::= $empty
1840/.$putCase consumeEmptyTypeArguments(); $break ./
1841NonWildTypeArgumentsopt -> OnlyTypeArguments
1842/:$readableName NonWildTypeArgumentsopt:/
1843/:$compliance 1.8:/
1844
1845IdentifierOrNew ::= 'Identifier'
1846/.$putCase consumeIdentifierOrNew(false); $break ./
1847IdentifierOrNew ::= 'new'
1848/.$putCase consumeIdentifierOrNew(true); $break ./
1849/:$readableName IdentifierOrNew:/
1850/:$compliance 1.8:/
1851
1852LambdaExpression ::= LambdaParameters '->' LambdaBody
1853/.$putCase consumeLambdaExpression(); $break ./
1854/:$readableName LambdaExpression:/
1855/:$compliance 1.8:/
1856
1857LambdaParameters ::= Identifier
1858/.$putCase consumeTypeElidedLambdaParameter(false); $break ./
1859/:$readableName TypeElidedFormalParameter:/
1860/:$compliance 1.8:/
1861
1862-- to make the grammar LALR(1), the scanner transforms the input string to
1863-- contain synthetic tokens to signal start of lambda parameter list.
Stephan Herrmann1460a602012-07-19 20:01:10 +02001864LambdaParameters -> BeginLambda ParenthesizedLambdaParameterList
Stephan Herrmannc4817302012-07-13 01:31:42 +02001865/:$readableName LambdaParameters:/
1866/:$compliance 1.8:/
1867
Stephan Herrmann1460a602012-07-19 20:01:10 +02001868ParenthesizedLambdaParameterList -> PushLPAREN FormalParameterListopt PushRPAREN
1869ParenthesizedLambdaParameterList -> PushLPAREN TypeElidedFormalParameterList PushRPAREN
1870/:$readableName ParenthesizedLambdaParameterList:/
1871/:$compliance 1.8:/
1872
Stephan Herrmannc4817302012-07-13 01:31:42 +02001873TypeElidedFormalParameterList -> TypeElidedFormalParameter
1874TypeElidedFormalParameterList ::= TypeElidedFormalParameterList ',' TypeElidedFormalParameter
1875/.$putCase consumeFormalParameterList(); $break ./
1876/:$readableName TypeElidedFormalParameterList:/
1877/:$compliance 1.8:/
1878
1879-- to work around a shift reduce conflict, we accept Modifiersopt prefixed
1880-- identifier - downstream phases should reject input strings with modifiers.
1881TypeElidedFormalParameter ::= Modifiersopt Identifier
1882/.$putCase consumeTypeElidedLambdaParameter(true); $break ./
1883/:$readableName TypeElidedFormalParameter:/
1884/:$compliance 1.8:/
1885
1886-- A lambda body of the form x is really '{' return x; '}'
1887LambdaBody -> ElidedLeftBraceAndReturn Expression ElidedSemicolonAndRightBrace
1888LambdaBody ::= NestedType NestedMethod '{' BlockStatementsopt '}'
1889/.$putCase consumeBlock(); $break ./
1890/:$readableName LambdaBody:/
1891/:$compliance 1.8:/
1892
1893ElidedLeftBraceAndReturn ::= $empty
1894/.$putCase consumeElidedLeftBraceAndReturn(); $break ./
1895/:$readableName ElidedLeftBraceAndReturn:/
1896/:$compliance 1.8:/
1897
1898-----------------------------------------------------------------------
1899-- End of rules for JSR 335
1900-----------------------------------------------------------------------
1901
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001902--1.1 feature
1903--
1904-- In Java 1.0 a ClassBody could not appear at all in a
1905-- ClassInstanceCreationExpression.
1906--
1907
1908AllocationHeader ::= 'new' ClassType '(' ArgumentListopt ')'
1909/.$putCase consumeAllocationHeader(); $break ./
1910/:$readableName AllocationHeader:/
1911
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001912ClassInstanceCreationExpression ::= 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' UnqualifiedClassBodyopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001913/.$putCase consumeClassInstanceCreationExpressionWithTypeArguments(); $break ./
1914
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001915ClassInstanceCreationExpression ::= 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' UnqualifiedClassBodyopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001916/.$putCase consumeClassInstanceCreationExpression(); $break ./
1917--1.1 feature
1918
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001919ClassInstanceCreationExpression ::= Primary '.' 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001920/.$putCase consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; $break ./
1921
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001922ClassInstanceCreationExpression ::= Primary '.' 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001923/.$putCase consumeClassInstanceCreationExpressionQualified() ; $break ./
1924
1925--1.1 feature
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001926ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001927/.$putCase consumeClassInstanceCreationExpressionQualified() ; $break ./
1928/:$readableName ClassInstanceCreationExpression:/
1929
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001930ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001931/.$putCase consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; $break ./
1932/:$readableName ClassInstanceCreationExpression:/
1933
Stephan Herrmann6cecadb2012-02-26 01:08:39 +01001934EnterInstanceCreationArgumentList ::= $empty
1935/.$putCase consumeEnterInstanceCreationArgumentList(); $break ./
1936/:$readableName EnterInstanceCreationArgumentList:/
1937
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001938ClassInstanceCreationExpressionName ::= Name '.'
1939/.$putCase consumeClassInstanceCreationExpressionName() ; $break ./
1940/:$readableName ClassInstanceCreationExpressionName:/
1941
1942UnqualifiedClassBodyopt ::= $empty --test made using null as contents
1943/.$putCase consumeClassBodyopt(); $break ./
1944UnqualifiedClassBodyopt ::= UnqualifiedEnterAnonymousClassBody ClassBody
1945/:$readableName ClassBody:/
1946/:$no_statements_recovery:/
1947
1948UnqualifiedEnterAnonymousClassBody ::= $empty
1949/.$putCase consumeEnterAnonymousClassBody(false); $break ./
1950/:$readableName EnterAnonymousClassBody:/
1951
1952QualifiedClassBodyopt ::= $empty --test made using null as contents
1953/.$putCase consumeClassBodyopt(); $break ./
1954QualifiedClassBodyopt ::= QualifiedEnterAnonymousClassBody ClassBody
1955/:$readableName ClassBody:/
1956/:$no_statements_recovery:/
1957
1958QualifiedEnterAnonymousClassBody ::= $empty
1959/.$putCase consumeEnterAnonymousClassBody(true); $break ./
1960/:$readableName EnterAnonymousClassBody:/
1961
1962ArgumentList ::= Expression
1963ArgumentList ::= ArgumentList ',' Expression
1964/.$putCase consumeArgumentList(); $break ./
1965/:$readableName ArgumentList:/
1966
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001967ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001968/.$putCase consumeArrayCreationHeader(); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001969
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001970ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
1971/.$putCase consumeArrayCreationHeader(); $break ./
1972/:$readableName ArrayCreationHeader:/
1973
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001974ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001975/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
1976/:$readableName ArrayCreationWithoutArrayInitializer:/
1977
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001978ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001979/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
1980/:$readableName ArrayCreationWithArrayInitializer:/
1981
1982ArrayCreationWithoutArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs
1983/.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./
1984
1985ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer
1986/.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./
1987
1988DimWithOrWithOutExprs ::= DimWithOrWithOutExpr
1989DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr
1990/.$putCase consumeDimWithOrWithOutExprs(); $break ./
1991/:$readableName Dimensions:/
1992
Stephan Herrmannee9076e2013-04-04 16:21:27 +02001993DimWithOrWithOutExpr ::= TypeAnnotationsopt '[' Expression ']'
1994DimWithOrWithOutExpr ::= TypeAnnotationsopt '[' ']'
Stephan Herrmann234bfec2011-04-26 08:26:58 +00001995/. $putCase consumeDimWithOrWithOutExpr(); $break ./
1996/:$readableName Dimension:/
1997-- -----------------------------------------------
1998
1999Dims ::= DimsLoop
2000/. $putCase consumeDims(); $break ./
2001/:$readableName Dimensions:/
2002DimsLoop -> OneDimLoop
2003DimsLoop ::= DimsLoop OneDimLoop
2004/:$readableName Dimensions:/
2005OneDimLoop ::= '[' ']'
Stephan Herrmannc4817302012-07-13 01:31:42 +02002006/. $putCase consumeOneDimLoop(false); $break ./
Stephan Herrmannc4817302012-07-13 01:31:42 +02002007OneDimLoop ::= TypeAnnotations '[' ']'
2008/:$compliance 1.8:/
Stephan Herrmannee9076e2013-04-04 16:21:27 +02002009/. $putCase consumeOneDimLoop(true); $break ./
2010/:$readableName Dimension:/
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002011
2012FieldAccess ::= Primary '.' 'Identifier'
2013/.$putCase consumeFieldAccess(false); $break ./
2014
2015FieldAccess ::= 'super' '.' 'Identifier'
2016/.$putCase consumeFieldAccess(true); $break ./
2017/:$readableName FieldAccess:/
2018
2019MethodInvocation ::= Name '(' ArgumentListopt ')'
2020/.$putCase consumeMethodInvocationName(); $break ./
2021
2022MethodInvocation ::= Name '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2023/.$putCase consumeMethodInvocationNameWithTypeArguments(); $break ./
2024
2025MethodInvocation ::= Primary '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2026/.$putCase consumeMethodInvocationPrimaryWithTypeArguments(); $break ./
2027
2028MethodInvocation ::= Primary '.' 'Identifier' '(' ArgumentListopt ')'
2029/.$putCase consumeMethodInvocationPrimary(); $break ./
2030
2031MethodInvocation ::= 'super' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2032/.$putCase consumeMethodInvocationSuperWithTypeArguments(); $break ./
2033
2034MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')'
2035/.$putCase consumeMethodInvocationSuper(); $break ./
2036
2037-- {ObjectTeams
2038MethodInvocation ::= 'tsuper' '.' 'Identifier' '(' ArgumentListopt ')'
2039/.$putCase consumeMethodInvocationTSuper(UNQUALIFIED); $break ./
2040
2041MethodInvocation ::= 'tsuper' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2042/.$putCase consumeMethodInvocationTSuperWithTypeArguments(0); $break ./
2043
2044MethodInvocation ::= Name '.' 'tsuper' '.' 'Identifier' '(' ArgumentListopt ')'
2045/.$putCase consumeMethodInvocationTSuper(QUALIFIED); $break ./
2046
2047MethodInvocation ::= Name '.' 'tsuper' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2048/.$putCase consumeMethodInvocationTSuperWithTypeArguments(2); $break ./
2049
2050MethodInvocation ::= 'base' '.' 'Identifier' '(' ArgumentListopt ')'
2051/.$putCase consumeMethodInvocationBase(false); $break ./
2052
2053MethodInvocation ::= 'base' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2054/.$putCase consumeMethodInvocationBaseWithTypeArguments(false); $break ./
2055
2056MethodInvocation ::= 'base' '.' 'super' '.' 'Identifier' '(' ArgumentListopt ')'
2057/.$putCase consumeMethodInvocationBase(true); $break ./
2058
2059MethodInvocation ::= 'base' '.' 'super' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')'
2060/.$putCase consumeMethodInvocationBaseWithTypeArguments(true); $break ./
2061-- Markus Witte}
2062
2063/:$readableName MethodInvocation:/
2064
2065ArrayAccess ::= Name '[' Expression ']'
2066/.$putCase consumeArrayAccess(true); $break ./
2067ArrayAccess ::= PrimaryNoNewArray '[' Expression ']'
2068/.$putCase consumeArrayAccess(false); $break ./
2069ArrayAccess ::= ArrayCreationWithArrayInitializer '[' Expression ']'
2070/.$putCase consumeArrayAccess(false); $break ./
2071/:$readableName ArrayAccess:/
2072
2073PostfixExpression -> Primary
2074PostfixExpression ::= Name
2075/.$putCase consumePostfixExpression(); $break ./
2076PostfixExpression -> PostIncrementExpression
2077PostfixExpression -> PostDecrementExpression
2078/:$readableName Expression:/
2079
2080PostIncrementExpression ::= PostfixExpression '++'
2081/.$putCase consumeUnaryExpression(OperatorIds.PLUS,true); $break ./
2082/:$readableName PostIncrementExpression:/
2083
2084PostDecrementExpression ::= PostfixExpression '--'
2085/.$putCase consumeUnaryExpression(OperatorIds.MINUS,true); $break ./
2086/:$readableName PostDecrementExpression:/
2087
2088--for source managment purpose
2089PushPosition ::= $empty
2090 /.$putCase consumePushPosition(); $break ./
2091/:$readableName PushPosition:/
2092
2093UnaryExpression -> PreIncrementExpression
2094UnaryExpression -> PreDecrementExpression
2095UnaryExpression ::= '+' PushPosition UnaryExpression
2096/.$putCase consumeUnaryExpression(OperatorIds.PLUS); $break ./
2097UnaryExpression ::= '-' PushPosition UnaryExpression
2098/.$putCase consumeUnaryExpression(OperatorIds.MINUS); $break ./
2099UnaryExpression -> UnaryExpressionNotPlusMinus
2100/:$readableName Expression:/
2101
2102PreIncrementExpression ::= '++' PushPosition UnaryExpression
2103/.$putCase consumeUnaryExpression(OperatorIds.PLUS,false); $break ./
2104/:$readableName PreIncrementExpression:/
2105
2106PreDecrementExpression ::= '--' PushPosition UnaryExpression
2107/.$putCase consumeUnaryExpression(OperatorIds.MINUS,false); $break ./
2108/:$readableName PreDecrementExpression:/
2109
2110UnaryExpressionNotPlusMinus -> PostfixExpression
2111UnaryExpressionNotPlusMinus ::= '~' PushPosition UnaryExpression
2112/.$putCase consumeUnaryExpression(OperatorIds.TWIDDLE); $break ./
2113UnaryExpressionNotPlusMinus ::= '!' PushPosition UnaryExpression
2114/.$putCase consumeUnaryExpression(OperatorIds.NOT); $break ./
2115UnaryExpressionNotPlusMinus -> CastExpression
2116/:$readableName Expression:/
2117
Stephan Herrmannee9076e2013-04-04 16:21:27 +02002118CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002119/.$putCase consumeCastExpressionWithPrimitiveType(); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +02002120CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002121/.$putCase consumeCastExpressionWithGenericsArray(); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +02002122CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002123/.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +02002124CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002125/.$putCase consumeCastExpressionLL1(); $break ./
Stephan Herrmannee9076e2013-04-04 16:21:27 +02002126CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002127/.$putCase consumeCastExpressionWithNameArray(); $break ./
2128/:$readableName CastExpression:/
2129
2130OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments
2131/.$putCase consumeOnlyTypeArgumentsForCastExpression(); $break ./
2132/:$readableName TypeArguments:/
2133
2134InsideCastExpression ::= $empty
2135/.$putCase consumeInsideCastExpression(); $break ./
2136/:$readableName InsideCastExpression:/
2137InsideCastExpressionLL1 ::= $empty
2138/.$putCase consumeInsideCastExpressionLL1(); $break ./
2139/:$readableName InsideCastExpression:/
2140InsideCastExpressionWithQualifiedGenerics ::= $empty
2141/.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./
2142/:$readableName InsideCastExpression:/
2143
2144MultiplicativeExpression -> UnaryExpression
2145MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression
2146/.$putCase consumeBinaryExpression(OperatorIds.MULTIPLY); $break ./
2147MultiplicativeExpression ::= MultiplicativeExpression '/' UnaryExpression
2148/.$putCase consumeBinaryExpression(OperatorIds.DIVIDE); $break ./
2149MultiplicativeExpression ::= MultiplicativeExpression '%' UnaryExpression
2150/.$putCase consumeBinaryExpression(OperatorIds.REMAINDER); $break ./
2151/:$readableName Expression:/
2152
2153AdditiveExpression -> MultiplicativeExpression
2154AdditiveExpression ::= AdditiveExpression '+' MultiplicativeExpression
2155/.$putCase consumeBinaryExpression(OperatorIds.PLUS); $break ./
2156AdditiveExpression ::= AdditiveExpression '-' MultiplicativeExpression
2157/.$putCase consumeBinaryExpression(OperatorIds.MINUS); $break ./
2158/:$readableName Expression:/
2159
2160ShiftExpression -> AdditiveExpression
Stephan Herrmann44109d32011-08-02 14:34:26 +00002161ShiftExpression ::= ShiftExpression '<<' AdditiveExpression
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002162/.$putCase consumeBinaryExpression(OperatorIds.LEFT_SHIFT); $break ./
Stephan Herrmann44109d32011-08-02 14:34:26 +00002163ShiftExpression ::= ShiftExpression '>>' AdditiveExpression
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002164/.$putCase consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); $break ./
2165ShiftExpression ::= ShiftExpression '>>>' AdditiveExpression
2166/.$putCase consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); $break ./
2167/:$readableName Expression:/
2168
2169RelationalExpression -> ShiftExpression
Stephan Herrmann44109d32011-08-02 14:34:26 +00002170RelationalExpression ::= RelationalExpression '<' ShiftExpression
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002171/.$putCase consumeBinaryExpression(OperatorIds.LESS); $break ./
Stephan Herrmann44109d32011-08-02 14:34:26 +00002172RelationalExpression ::= RelationalExpression '>' ShiftExpression
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002173/.$putCase consumeBinaryExpression(OperatorIds.GREATER); $break ./
2174RelationalExpression ::= RelationalExpression '<=' ShiftExpression
2175/.$putCase consumeBinaryExpression(OperatorIds.LESS_EQUAL); $break ./
2176RelationalExpression ::= RelationalExpression '>=' ShiftExpression
2177/.$putCase consumeBinaryExpression(OperatorIds.GREATER_EQUAL); $break ./
2178/:$readableName Expression:/
2179
2180InstanceofExpression -> RelationalExpression
2181InstanceofExpression ::= InstanceofExpression 'instanceof' ReferenceType
2182/.$putCase consumeInstanceOfExpression(); $break ./
2183/:$readableName Expression:/
2184
2185EqualityExpression -> InstanceofExpression
2186EqualityExpression ::= EqualityExpression '==' InstanceofExpression
2187/.$putCase consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); $break ./
2188EqualityExpression ::= EqualityExpression '!=' InstanceofExpression
2189/.$putCase consumeEqualityExpression(OperatorIds.NOT_EQUAL); $break ./
2190/:$readableName Expression:/
2191
2192AndExpression -> EqualityExpression
2193AndExpression ::= AndExpression '&' EqualityExpression
2194/.$putCase consumeBinaryExpression(OperatorIds.AND); $break ./
2195/:$readableName Expression:/
2196
2197ExclusiveOrExpression -> AndExpression
2198ExclusiveOrExpression ::= ExclusiveOrExpression '^' AndExpression
2199/.$putCase consumeBinaryExpression(OperatorIds.XOR); $break ./
2200/:$readableName Expression:/
2201
2202InclusiveOrExpression -> ExclusiveOrExpression
2203InclusiveOrExpression ::= InclusiveOrExpression '|' ExclusiveOrExpression
2204/.$putCase consumeBinaryExpression(OperatorIds.OR); $break ./
2205/:$readableName Expression:/
2206
2207ConditionalAndExpression -> InclusiveOrExpression
2208ConditionalAndExpression ::= ConditionalAndExpression '&&' InclusiveOrExpression
2209/.$putCase consumeBinaryExpression(OperatorIds.AND_AND); $break ./
2210/:$readableName Expression:/
2211
2212ConditionalOrExpression -> ConditionalAndExpression
2213ConditionalOrExpression ::= ConditionalOrExpression '||' ConditionalAndExpression
2214/.$putCase consumeBinaryExpression(OperatorIds.OR_OR); $break ./
2215/:$readableName Expression:/
2216
2217ConditionalExpression -> ConditionalOrExpression
2218ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' ConditionalExpression
2219/.$putCase consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; $break ./
2220/:$readableName Expression:/
2221
2222AssignmentExpression -> ConditionalExpression
2223AssignmentExpression -> Assignment
2224/:$readableName Expression:/
2225/:$recovery_template Identifier:/
2226
2227Assignment ::= PostfixExpression AssignmentOperator AssignmentExpression
2228/.$putCase consumeAssignment(); $break ./
2229/:$readableName Assignment:/
2230
2231-- this rule is added to parse an array initializer in a assigment and then report a syntax error knowing the exact senario
2232InvalidArrayInitializerAssignement ::= PostfixExpression AssignmentOperator ArrayInitializer
2233/:$readableName ArrayInitializerAssignment:/
2234/:$recovery:/
2235Assignment ::= InvalidArrayInitializerAssignement
2236/.$putcase ignoreExpressionAssignment();$break ./
2237/:$recovery:/
2238
2239AssignmentOperator ::= '='
2240/.$putCase consumeAssignmentOperator(EQUAL); $break ./
2241AssignmentOperator ::= '*='
2242/.$putCase consumeAssignmentOperator(MULTIPLY); $break ./
2243AssignmentOperator ::= '/='
2244/.$putCase consumeAssignmentOperator(DIVIDE); $break ./
2245AssignmentOperator ::= '%='
2246/.$putCase consumeAssignmentOperator(REMAINDER); $break ./
2247AssignmentOperator ::= '+='
2248/.$putCase consumeAssignmentOperator(PLUS); $break ./
2249AssignmentOperator ::= '-='
2250/.$putCase consumeAssignmentOperator(MINUS); $break ./
2251AssignmentOperator ::= '<<='
2252/.$putCase consumeAssignmentOperator(LEFT_SHIFT); $break ./
2253AssignmentOperator ::= '>>='
2254/.$putCase consumeAssignmentOperator(RIGHT_SHIFT); $break ./
2255AssignmentOperator ::= '>>>='
2256/.$putCase consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); $break ./
2257AssignmentOperator ::= '&='
2258/.$putCase consumeAssignmentOperator(AND); $break ./
2259AssignmentOperator ::= '^='
2260/.$putCase consumeAssignmentOperator(XOR); $break ./
2261AssignmentOperator ::= '|='
2262/.$putCase consumeAssignmentOperator(OR); $break ./
2263/:$readableName AssignmentOperator:/
2264/:$recovery_template =:/
2265
Stephan Herrmannc4817302012-07-13 01:31:42 +02002266-- For handling lambda expressions, we need to know when a full Expression
2267-- has been reduced.
2268Expression ::= AssignmentExpression
2269/.$putCase consumeExpression(); $break ./
Stephan Herrmann234bfec2011-04-26 08:26:58 +00002270/:$readableName Expression:/
2271/:$recovery_template Identifier:/
2272
2273-- The following rules are for optional nonterminals.
2274--
2275ClassHeaderExtendsopt ::= $empty
2276ClassHeaderExtendsopt -> ClassHeaderExtends
2277/:$readableName ClassHeaderExtends:/
2278
2279Expressionopt ::= $empty
2280/.$putCase consumeEmptyExpression(); $break ./
2281Expressionopt -> Expression
2282/:$readableName Expression:/
2283
2284ConstantExpression -> Expression
2285/:$readableName ConstantExpression:/
2286
2287---------------------------------------------------------------------------------------
2288--
2289-- The rules below are for optional terminal symbols. An optional comma,
2290-- is only used in the context of an array initializer - It is a
2291-- "syntactic sugar" that otherwise serves no other purpose. By contrast,
2292-- an optional identifier is used in the definition of a break and
2293-- continue statement. When the identifier does not appear, a NULL
2294-- is produced. When the identifier is present, the user should use the
2295-- corresponding TOKEN(i) method. See break statement as an example.
2296--
2297---------------------------------------------------------------------------------------
2298
2299,opt -> $empty
2300,opt -> ,
2301/:$readableName ,:/
2302
2303ClassBodyDeclarationsopt ::= $empty
2304/.$putCase consumeEmptyClassBodyDeclarationsopt(); $break ./
2305ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations
2306/.$putCase consumeClassBodyDeclarationsopt(); $break ./
2307/:$readableName ClassBodyDeclarations:/
2308
2309Modifiersopt ::= $empty
2310/. $putCase consumeDefaultModifiers(); $break ./
2311Modifiersopt ::= Modifiers
2312/.$putCase consumeModifiers(); $break ./
2313/:$readableName Modifiers:/
2314
2315BlockStatementsopt ::= $empty
2316/.$putCase consumeEmptyBlockStatementsopt(); $break ./
2317BlockStatementsopt -> BlockStatements
2318/:$readableName BlockStatements:/
2319
2320Dimsopt ::= $empty
2321/. $putCase consumeEmptyDimsopt(); $break ./
2322Dimsopt -> Dims
2323/:$readableName Dimensions:/
2324
2325ArgumentListopt ::= $empty
2326/. $putCase consumeEmptyArgumentListopt(); $break ./
2327ArgumentListopt -> ArgumentList
2328/:$readableName ArgumentList:/
2329
2330MethodHeaderThrowsClauseopt ::= $empty
2331MethodHeaderThrowsClauseopt -> MethodHeaderThrowsClause
2332/:$readableName MethodHeaderThrowsClause:/
2333
2334FormalParameterListopt ::= $empty
2335/.$putcase consumeFormalParameterListopt(); $break ./
2336FormalParameterListopt -> FormalParameterList
2337/:$readableName FormalParameterList:/
2338
2339ClassHeaderImplementsopt ::= $empty
2340ClassHeaderImplementsopt -> ClassHeaderImplements
2341/:$readableName ClassHeaderImplements:/
2342
2343InterfaceMemberDeclarationsopt ::= $empty
2344/. $putCase consumeEmptyInterfaceMemberDeclarationsopt(); $break ./
2345InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations
2346/. $putCase consumeInterfaceMemberDeclarationsopt(); $break ./
2347/:$readableName InterfaceMemberDeclarations:/
2348
2349NestedType ::= $empty
2350/.$putCase consumeNestedType(); $break./
2351/:$readableName NestedType:/
2352
2353ForInitopt ::= $empty
2354/. $putCase consumeEmptyForInitopt(); $break ./
2355ForInitopt -> ForInit
2356/:$readableName ForInit:/
2357
2358ForUpdateopt ::= $empty
2359/. $putCase consumeEmptyForUpdateopt(); $break ./
2360ForUpdateopt -> ForUpdate
2361/:$readableName ForUpdate:/
2362
2363InterfaceHeaderExtendsopt ::= $empty
2364InterfaceHeaderExtendsopt -> InterfaceHeaderExtends
2365/:$readableName InterfaceHeaderExtends:/
2366
2367Catchesopt ::= $empty
2368/. $putCase consumeEmptyCatchesopt(); $break ./
2369Catchesopt -> Catches
2370/:$readableName Catches:/
2371
2372-----------------------------------------------
2373-- 1.5 features : enum type
2374-----------------------------------------------
2375EnumDeclaration ::= EnumHeader EnumBody
2376/. $putCase consumeEnumDeclaration(); $break ./
2377/:$readableName EnumDeclaration:/
2378
2379EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt
2380/. $putCase consumeEnumHeader(); $break ./
2381/:$readableName EnumHeader:/
2382
2383EnumHeaderName ::= Modifiersopt 'enum' Identifier
2384/. $putCase consumeEnumHeaderName(); $break ./
2385/:$compliance 1.5:/
2386EnumHeaderName ::= Modifiersopt 'enum' Identifier TypeParameters
2387/. $putCase consumeEnumHeaderNameWithTypeParameters(); $break ./
2388/:$readableName EnumHeaderName:/
2389/:$compliance 1.5:/
2390
2391EnumBody ::= '{' EnumBodyDeclarationsopt '}'
2392/. $putCase consumeEnumBodyNoConstants(); $break ./
2393EnumBody ::= '{' ',' EnumBodyDeclarationsopt '}'
2394/. $putCase consumeEnumBodyNoConstants(); $break ./
2395EnumBody ::= '{' EnumConstants ',' EnumBodyDeclarationsopt '}'
2396/. $putCase consumeEnumBodyWithConstants(); $break ./
2397EnumBody ::= '{' EnumConstants EnumBodyDeclarationsopt '}'
2398/. $putCase consumeEnumBodyWithConstants(); $break ./
2399/:$readableName EnumBody:/
2400
2401EnumConstants -> EnumConstant
2402EnumConstants ::= EnumConstants ',' EnumConstant
2403/.$putCase consumeEnumConstants(); $break ./
2404/:$readableName EnumConstants:/
2405
2406EnumConstantHeaderName ::= Modifiersopt Identifier
2407/.$putCase consumeEnumConstantHeaderName(); $break ./
2408/:$readableName EnumConstantHeaderName:/
2409
2410EnumConstantHeader ::= EnumConstantHeaderName ForceNoDiet Argumentsopt RestoreDiet
2411/.$putCase consumeEnumConstantHeader(); $break ./
2412/:$readableName EnumConstantHeader:/
2413