Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1 | --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 Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 56 | -- The following symbols are recognized as keywords only in specific contexts: |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 57 | -- 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 Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 119 | ARROW |
| 120 | COLON_COLON |
| 121 | BeginLambda |
| 122 | BeginTypeArguments |
| 123 | ElidedSemicolonAndRightBrace |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 124 | AT308 |
| 125 | AT308DOTDOTDOT |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 126 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 127 | -- {ObjectTeams |
| 128 | BINDIN |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 129 | CALLOUT_OVERRIDE |
Stephan Herrmann | 926e118 | 2012-07-20 20:26:32 +0200 | [diff] [blame] | 130 | SYNTHBINDOUT |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 131 | -- Markus Witte} |
| 132 | -- BodyMarker |
| 133 | |
| 134 | $Alias |
| 135 | |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 136 | '::' ::= COLON_COLON |
| 137 | '->' ::= ARROW |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 138 | '++' ::= 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 Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 186 | '@308' ::= AT308 |
| 187 | '@308...' ::= AT308DOTDOTDOT |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 188 | |
| 189 | -- {ObjectTeams |
| 190 | '<-' ::= BINDIN |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 191 | '=>' ::= CALLOUT_OVERRIDE |
| 192 | -- Markus Witte} |
| 193 | |
| 194 | $Start |
| 195 | Goal |
| 196 | |
| 197 | $Rules |
| 198 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 199 | /.// This method is part of an automatic generation : do NOT edit-modify |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 200 | protected void consumeRule(int act) { |
| 201 | switch ( act ) { |
| 202 | ./ |
| 203 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 204 | Goal ::= '++' CompilationUnit |
| 205 | Goal ::= '--' MethodBody |
| 206 | -- Initializer |
| 207 | Goal ::= '>>' StaticInitializer |
| 208 | Goal ::= '>>' Initializer |
| 209 | -- error recovery |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 210 | -- Modifiersopt is used to properly consume a header and exit the rule reduction at the end of the parse() method |
| 211 | Goal ::= '>>>' Header1 Modifiersopt |
| 212 | Goal ::= '!' Header2 Modifiersopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 213 | Goal ::= '*' BlockStatements |
| 214 | Goal ::= '*' CatchHeader |
| 215 | -- JDOM |
| 216 | Goal ::= '&&' FieldDeclaration |
| 217 | Goal ::= '||' ImportDeclaration |
| 218 | Goal ::= '?' PackageDeclaration |
| 219 | Goal ::= '+' TypeDeclaration |
| 220 | Goal ::= '/' GenericMethodDeclaration |
| 221 | Goal ::= '&' ClassBodyDeclarations |
| 222 | -- code snippet |
| 223 | Goal ::= '%' Expression |
| 224 | Goal ::= '%' ArrayInitializer |
| 225 | -- completion parser |
| 226 | Goal ::= '~' BlockStatementsopt |
| 227 | -- source type converter |
| 228 | Goal ::= '||' MemberValue |
| 229 | -- syntax diagnosis |
| 230 | Goal ::= '?' AnnotationTypeMemberDeclaration |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 231 | -- JSR 335 Reconnaissance missions. |
| 232 | Goal ::= '->' ParenthesizedLambdaParameterList |
| 233 | Goal ::= '::' ReferenceExpressionTypeArgumentsAndTrunk |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 234 | -- JSR 308 Reconnaissance mission. |
| 235 | Goal ::= '...' TypeAnnotations |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 236 | --{ObjectTeams new goals: |
| 237 | Goal ::= ':' CallinParameterMappings |
| 238 | Goal ::= ';' CalloutParameterMappings |
| 239 | Goal ::= '^' ParameterMapping |
| 240 | Goal ::= '<' MethodSpecShort |
| 241 | Goal ::= '>' 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 | |
| 250 | Literal -> IntegerLiteral |
| 251 | Literal -> LongLiteral |
| 252 | Literal -> FloatingPointLiteral |
| 253 | Literal -> DoubleLiteral |
| 254 | Literal -> CharacterLiteral |
| 255 | Literal -> StringLiteral |
| 256 | Literal -> null |
| 257 | Literal -> BooleanLiteral |
| 258 | /:$readableName Literal:/ |
| 259 | BooleanLiteral -> true |
| 260 | BooleanLiteral -> false |
| 261 | /:$readableName BooleanLiteral:/ |
| 262 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 263 | Type ::= PrimitiveType |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 264 | /.$putCase consumePrimitiveType(); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 265 | Type -> ReferenceType |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 266 | /:$readableName Type:/ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 267 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 268 | PrimitiveType -> TypeAnnotationsopt NumericType |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 269 | /:$readableName PrimitiveType:/ |
| 270 | NumericType -> IntegralType |
| 271 | NumericType -> FloatingPointType |
| 272 | /:$readableName NumericType:/ |
| 273 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 274 | PrimitiveType -> TypeAnnotationsopt 'boolean' |
| 275 | PrimitiveType -> TypeAnnotationsopt 'void' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 276 | IntegralType -> 'byte' |
| 277 | IntegralType -> 'short' |
| 278 | IntegralType -> 'int' |
| 279 | IntegralType -> 'long' |
| 280 | IntegralType -> 'char' |
| 281 | /:$readableName IntegralType:/ |
| 282 | FloatingPointType -> 'float' |
| 283 | FloatingPointType -> 'double' |
| 284 | /:$readableName FloatingPointType:/ |
| 285 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 286 | ReferenceType ::= ClassOrInterfaceType |
| 287 | /.$putCase consumeReferenceType(); $break ./ |
| 288 | ReferenceType -> ArrayType |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 289 | /:$readableName ReferenceType:/ |
| 290 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 291 | --------------------------------------------------------------- |
| 292 | -- 1.5 feature |
| 293 | --------------------------------------------------------------- |
| 294 | ClassOrInterfaceType -> ClassOrInterface |
| 295 | ClassOrInterfaceType -> GenericType |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 296 | /:$readableName Type:/ |
| 297 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 298 | ClassOrInterface ::= Name |
| 299 | /.$putCase consumeClassOrInterfaceName(); $break ./ |
| 300 | ClassOrInterface ::= GenericType '.' Name |
| 301 | /.$putCase consumeClassOrInterface(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 302 | /:$readableName Type:/ |
| 303 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 304 | GenericType ::= ClassOrInterface TypeArguments |
| 305 | /.$putCase consumeGenericType(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 306 | /:$readableName GenericType:/ |
| 307 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 308 | GenericType ::= ClassOrInterface '<' '>' |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 309 | /.$putCase consumeGenericTypeWithDiamond(); $break ./ |
| 310 | /:$readableName GenericType:/ |
| 311 | /:$compliance 1.7:/ |
| 312 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 313 | -- {ObjectTeams: "Base as Role" types: |
Stephan Herrmann | 5fa7f31 | 2012-07-13 01:52:51 +0200 | [diff] [blame] | 314 | LiftingTypeopt ::= $empty |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 315 | |
Stephan Herrmann | a30fa6a | 2012-07-15 13:54:47 +0200 | [diff] [blame] | 316 | LiftingTypeopt ::= 'as' BeginLiftingType Type |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 317 | /.$putCase consumeLiftingType(); $break ./ |
| 318 | /:$readableName LiftingType:/ |
| 319 | |
Stephan Herrmann | a30fa6a | 2012-07-15 13:54:47 +0200 | [diff] [blame] | 320 | BeginLiftingType ::= $empty |
| 321 | /.$putCase consumeBeginLiftingType(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 322 | |
Stephan Herrmann | 197438c | 2012-07-15 22:54:37 +0200 | [diff] [blame] | 323 | CatchLiftingTypeopt ::= $empty |
| 324 | |
| 325 | CatchLiftingTypeopt ::= 'as' Type |
| 326 | /.$putCase consumeLiftingType(); $break ./ |
| 327 | /:$readableName LiftingType:/ |
| 328 | -- SH} |
| 329 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 330 | -- {ObjectTeams: "base.R" types: |
| 331 | |
| 332 | BaseAnchoredType ::= '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 Herrmann | 358a288 | 2012-07-16 01:40:15 +0200 | [diff] [blame] | 339 | ClassOrInterfaceType0 -> BaseAnchoredType |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 340 | /:$readableName BaseAnchoredType:/ |
| 341 | |
| 342 | -- 2.) via ReferenceType we may add dimensions: |
Stephan Herrmann | 358a288 | 2012-07-16 01:40:15 +0200 | [diff] [blame] | 343 | ReferenceType0 -> BaseAnchoredType Dims |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 344 | /:$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 Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 356 | ArrayTypeWithTypeArgumentsName ::= GenericType '.' Name |
| 357 | /.$putCase consumeArrayTypeWithTypeArgumentsName(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 358 | /:$readableName ArrayTypeWithTypeArgumentsName:/ |
| 359 | |
| 360 | ArrayType ::= PrimitiveType Dims |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 361 | /.$putCase consumePrimitiveArrayType(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 362 | ArrayType ::= Name Dims |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 363 | /.$putCase consumeNameArrayType(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 364 | ArrayType ::= ArrayTypeWithTypeArgumentsName Dims |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 365 | /.$putCase consumeGenericTypeNameArrayType(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 366 | ArrayType ::= GenericType Dims |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 367 | /.$putCase consumeGenericTypeArrayType(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 368 | /:$readableName ArrayType:/ |
| 369 | |
| 370 | ClassType -> ClassOrInterfaceType |
| 371 | /:$readableName ClassType:/ |
| 372 | |
| 373 | -------------------------------------------------------------- |
| 374 | -------------------------------------------------------------- |
| 375 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 376 | Name ::= SimpleName |
| 377 | /.$putCase consumeZeroTypeAnnotations(); $break ./ |
| 378 | Name -> TypeAnnotations SimpleName |
| 379 | /:$compliance 1.8:/ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 380 | Name -> QualifiedName |
| 381 | /:$readableName Name:/ |
| 382 | /:$recovery_template Identifier:/ |
| 383 | |
| 384 | SimpleName -> 'Identifier' |
| 385 | /:$readableName SimpleName:/ |
| 386 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 387 | UnannotatableName -> SimpleName |
| 388 | UnannotatableName ::= UnannotatableName '.' SimpleName |
| 389 | /.$putCase consumeUnannotatableQualifiedName(); $break ./ |
| 390 | /:$readableName UnannotatableQualifiedName:/ |
| 391 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 392 | QualifiedName ::= Name '.' SimpleName |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 393 | /.$putCase consumeQualifiedName(false); $break ./ |
| 394 | QualifiedName ::= Name '.' TypeAnnotations SimpleName |
| 395 | /.$putCase consumeQualifiedName(true); $break ./ |
| 396 | /:$compliance 1.8:/ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 397 | /:$readableName QualifiedName:/ |
| 398 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 399 | TypeAnnotationsopt ::= $empty |
| 400 | /.$putCase consumeZeroTypeAnnotations(); $break ./ |
| 401 | TypeAnnotationsopt -> TypeAnnotations |
| 402 | /:$compliance 1.8:/ |
| 403 | /:$readableName TypeAnnotationsopt:/ |
| 404 | |
| 405 | TypeAnnotations -> TypeAnnotation |
| 406 | /:$compliance 1.8:/ |
| 407 | TypeAnnotations ::= TypeAnnotations TypeAnnotation |
| 408 | /. $putCase consumeOneMoreTypeAnnotation(); $break ./ |
| 409 | /:$compliance 1.8:/ |
| 410 | /:$readableName TypeAnnotations:/ |
| 411 | |
| 412 | TypeAnnotation ::= NormalTypeAnnotation |
| 413 | /. $putCase consumeTypeAnnotation(); $break ./ |
| 414 | /:$compliance 1.8:/ |
| 415 | TypeAnnotation ::= MarkerTypeAnnotation |
| 416 | /. $putCase consumeTypeAnnotation(); $break ./ |
| 417 | /:$compliance 1.8:/ |
| 418 | TypeAnnotation ::= SingleMemberTypeAnnotation |
| 419 | /. $putCase consumeTypeAnnotation(); $break ./ |
| 420 | /:$compliance 1.8:/ |
| 421 | /:$readableName TypeAnnotation:/ |
| 422 | |
| 423 | TypeAnnotationName ::= @308 UnannotatableName |
| 424 | /.$putCase consumeAnnotationName() ; $break ./ |
| 425 | /:$readableName AnnotationName:/ |
| 426 | /:$compliance 1.8:/ |
| 427 | /:$recovery_template @ Identifier:/ |
| 428 | NormalTypeAnnotation ::= TypeAnnotationName '(' MemberValuePairsopt ')' |
| 429 | /.$putCase consumeNormalAnnotation(true) ; $break ./ |
| 430 | /:$readableName NormalAnnotation:/ |
| 431 | /:$compliance 1.8:/ |
| 432 | MarkerTypeAnnotation ::= TypeAnnotationName |
| 433 | /.$putCase consumeMarkerAnnotation(true) ; $break ./ |
| 434 | /:$readableName MarkerAnnotation:/ |
| 435 | /:$compliance 1.8:/ |
| 436 | SingleMemberTypeAnnotation ::= TypeAnnotationName '(' SingleMemberAnnotationMemberValue ')' |
| 437 | /.$putCase consumeSingleMemberAnnotation(true) ; $break ./ |
| 438 | /:$readableName SingleMemberAnnotation:/ |
| 439 | /:$compliance 1.8:/ |
| 440 | |
| 441 | RejectTypeAnnotations ::= $empty |
| 442 | /.$putCase consumeNonTypeUseName(); $break ./ |
| 443 | /:$readableName RejectTypeAnnotations:/ |
| 444 | |
| 445 | PushZeroTypeAnnotations ::= $empty |
| 446 | /.$putCase consumeZeroTypeAnnotations(); $break ./ |
| 447 | /:$readableName ZeroTypeAnnotations:/ |
| 448 | |
| 449 | VariableDeclaratorIdOrThis ::= 'this' |
| 450 | /.$putCase consumeExplicitThisParameter(false); $break ./ |
| 451 | /:$compliance 1.8:/ |
| 452 | VariableDeclaratorIdOrThis ::= UnannotatableName '.' 'this' |
| 453 | /.$putCase consumeExplicitThisParameter(true); $break ./ |
| 454 | /:$compliance 1.8:/ |
| 455 | VariableDeclaratorIdOrThis ::= VariableDeclaratorId |
| 456 | /.$putCase consumeVariableDeclaratorIdParameter(); $break ./ |
| 457 | /:$readableName VariableDeclaratorId:/ |
| 458 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 459 | CompilationUnit ::= EnterCompilationUnit InternalCompilationUnit |
| 460 | /.$putCase consumeCompilationUnit(); $break ./ |
| 461 | /:$readableName CompilationUnit:/ |
| 462 | |
| 463 | InternalCompilationUnit ::= PackageDeclaration |
| 464 | /.$putCase consumeInternalCompilationUnit(); $break ./ |
| 465 | InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports |
| 466 | /.$putCase consumeInternalCompilationUnit(); $break ./ |
| 467 | InternalCompilationUnit ::= PackageDeclaration ImportDeclarations ReduceImports TypeDeclarations |
| 468 | /.$putCase consumeInternalCompilationUnitWithTypes(); $break ./ |
| 469 | InternalCompilationUnit ::= PackageDeclaration TypeDeclarations |
| 470 | /.$putCase consumeInternalCompilationUnitWithTypes(); $break ./ |
| 471 | InternalCompilationUnit ::= ImportDeclarations ReduceImports |
| 472 | /.$putCase consumeInternalCompilationUnit(); $break ./ |
| 473 | InternalCompilationUnit ::= TypeDeclarations |
| 474 | /.$putCase consumeInternalCompilationUnitWithTypes(); $break ./ |
| 475 | InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations |
| 476 | /.$putCase consumeInternalCompilationUnitWithTypes(); $break ./ |
| 477 | InternalCompilationUnit ::= $empty |
| 478 | /.$putCase consumeEmptyInternalCompilationUnit(); $break ./ |
| 479 | /:$readableName CompilationUnit:/ |
| 480 | |
| 481 | ReduceImports ::= $empty |
| 482 | /.$putCase consumeReduceImports(); $break ./ |
| 483 | /:$readableName ReduceImports:/ |
| 484 | |
| 485 | EnterCompilationUnit ::= $empty |
| 486 | /.$putCase consumeEnterCompilationUnit(); $break ./ |
| 487 | /:$readableName EnterCompilationUnit:/ |
| 488 | |
| 489 | Header -> ImportDeclaration |
| 490 | Header -> PackageDeclaration |
| 491 | Header -> ClassHeader |
| 492 | Header -> InterfaceHeader |
| 493 | Header -> EnumHeader |
| 494 | Header -> AnnotationTypeDeclarationHeader |
| 495 | Header -> StaticInitializer |
| 496 | Header -> RecoveryMethodHeader |
| 497 | Header -> FieldDeclaration |
| 498 | Header -> AllocationHeader |
| 499 | Header -> ArrayCreationHeader |
| 500 | --{ObjectTeams: |
| 501 | Header -> RecoveryBindingHeader |
| 502 | Header -> PrecedenceDeclaration |
| 503 | -- SH} |
| 504 | /:$readableName Header:/ |
| 505 | |
| 506 | Header1 -> Header |
| 507 | Header1 -> ConstructorHeader |
| 508 | /:$readableName Header1:/ |
| 509 | |
| 510 | Header2 -> Header |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 511 | Header2 -> EnumConstantHeader |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 512 | /:$readableName Header2:/ |
| 513 | |
Stephan Herrmann | 29b019c | 2011-04-26 10:30:44 +0000 | [diff] [blame] | 514 | CatchHeader ::= 'catch' '(' CatchFormalParameter ')' '{' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 515 | /.$putCase consumeCatchHeader(); $break ./ |
| 516 | /:$readableName CatchHeader:/ |
| 517 | |
| 518 | ImportDeclarations -> ImportDeclaration |
| 519 | ImportDeclarations ::= ImportDeclarations ImportDeclaration |
| 520 | /.$putCase consumeImportDeclarations(); $break ./ |
| 521 | /:$readableName ImportDeclarations:/ |
| 522 | |
| 523 | TypeDeclarations -> TypeDeclaration |
| 524 | TypeDeclarations ::= TypeDeclarations TypeDeclaration |
| 525 | /.$putCase consumeTypeDeclarations(); $break ./ |
| 526 | /:$readableName TypeDeclarations:/ |
| 527 | |
| 528 | PackageDeclaration ::= PackageDeclarationName ';' |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 529 | /.$putCase consumePackageDeclaration(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 530 | /:$readableName PackageDeclaration:/ |
| 531 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 532 | PackageDeclarationName ::= Modifiers 'package' PushRealModifiers Name RejectTypeAnnotations |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 533 | /.$putCase consumePackageDeclarationNameWithModifiers(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 534 | /:$readableName PackageDeclarationName:/ |
| 535 | /:$compliance 1.5:/ |
| 536 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 537 | PackageDeclarationName ::= PackageComment 'package' Name RejectTypeAnnotations |
| 538 | /.$putCase consumePackageDeclarationName(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 539 | /:$readableName PackageDeclarationName:/ |
| 540 | |
| 541 | PackageComment ::= $empty |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 542 | /.$putCase consumePackageComment(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 543 | /:$readableName PackageComment:/ |
| 544 | |
| 545 | ImportDeclaration -> SingleTypeImportDeclaration |
| 546 | ImportDeclaration -> TypeImportOnDemandDeclaration |
| 547 | ----------------------------------------------- |
| 548 | -- 1.5 feature |
| 549 | ----------------------------------------------- |
| 550 | ImportDeclaration -> SingleStaticImportDeclaration |
| 551 | --{ObjectTeams: base import: |
| 552 | ImportDeclaration -> SingleBaseImportDeclaration |
| 553 | -- SH} |
| 554 | ImportDeclaration -> StaticImportOnDemandDeclaration |
| 555 | /:$readableName ImportDeclaration:/ |
| 556 | |
| 557 | SingleTypeImportDeclaration ::= SingleTypeImportDeclarationName ';' |
| 558 | /.$putCase consumeImportDeclaration(); $break ./ |
| 559 | /:$readableName SingleTypeImportDeclaration:/ |
| 560 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 561 | -- {ObjectTeams: special case: allow 'team' in imported package/type name: |
| 562 | -- orig: SingleTypeImportDeclarationName ::= 'import' Name RejectTypeAnnotations |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 563 | SingleTypeImportDeclarationName ::= 'import' ImportName |
| 564 | /.$putCase consumeSingleTypeImportDeclarationName(); $break ./ |
| 565 | /:$readableName SingleTypeImportDeclarationName:/ |
| 566 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 567 | ImportName -> Name RejectTypeAnnotations |
| 568 | ImportName ::= Name RejectTypeAnnotations '.' 'team' '.' Name RejectTypeAnnotations |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 569 | /.$putCase consumeNameContainingTeam(); $break ./ |
| 570 | /:$readableName Name:/ |
| 571 | -- SH} |
| 572 | |
| 573 | TypeImportOnDemandDeclaration ::= TypeImportOnDemandDeclarationName ';' |
| 574 | /.$putCase consumeImportDeclaration(); $break ./ |
| 575 | /:$readableName TypeImportOnDemandDeclaration:/ |
| 576 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 577 | TypeImportOnDemandDeclarationName ::= 'import' Name '.' RejectTypeAnnotations '*' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 578 | /.$putCase consumeTypeImportOnDemandDeclarationName(); $break ./ |
| 579 | /:$readableName TypeImportOnDemandDeclarationName:/ |
| 580 | |
| 581 | TypeDeclaration -> ClassDeclaration |
| 582 | TypeDeclaration -> 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..... |
| 586 | TypeDeclaration ::= ';' |
| 587 | /. $putCase consumeEmptyTypeDeclaration(); $break ./ |
| 588 | ----------------------------------------------- |
| 589 | -- 1.5 feature |
| 590 | ----------------------------------------------- |
| 591 | TypeDeclaration -> EnumDeclaration |
| 592 | TypeDeclaration -> AnnotationTypeDeclaration |
| 593 | /:$readableName TypeDeclaration:/ |
| 594 | |
| 595 | --18.7 Only in the LALR(1) Grammar |
| 596 | |
| 597 | Modifiers -> Modifier |
| 598 | Modifiers ::= Modifiers Modifier |
| 599 | /.$putCase consumeModifiers2(); $break ./ |
| 600 | /:$readableName Modifiers:/ |
| 601 | |
| 602 | Modifier -> 'public' |
| 603 | Modifier -> 'protected' |
| 604 | Modifier -> 'private' |
| 605 | Modifier -> 'static' |
| 606 | Modifier -> 'abstract' |
| 607 | Modifier -> 'final' |
| 608 | Modifier -> 'native' |
| 609 | Modifier -> 'synchronized' |
| 610 | Modifier -> 'transient' |
| 611 | Modifier -> 'volatile' |
| 612 | Modifier -> 'strictfp' |
| 613 | Modifier ::= Annotation |
| 614 | /.$putCase consumeAnnotationAsModifier(); $break ./ |
| 615 | -- {ObjectTeams |
| 616 | Modifier -> 'team' |
| 617 | Modifier -> 'callin' |
| 618 | Modifier -> '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 | |
| 629 | ClassDeclaration ::= ClassHeader ClassBody |
| 630 | /.$putCase consumeClassDeclaration(); $break ./ |
| 631 | /:$readableName ClassDeclaration:/ |
| 632 | |
| 633 | --{ObjectTeams: playedBy & guard predicate support: |
| 634 | -- orig: ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt |
| 635 | ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt ClassHeaderImplementsopt ClassHeaderPlayedByopt Predicateopt |
| 636 | -- MW+SH} |
| 637 | /.$putCase consumeClassHeader(); $break ./ |
| 638 | /:$readableName ClassHeader:/ |
| 639 | |
| 640 | ----------------------------------------------- |
| 641 | -- 1.5 features : generics |
| 642 | ----------------------------------------------- |
| 643 | ClassHeaderName ::= ClassHeaderName1 TypeParameters |
| 644 | /.$putCase consumeTypeHeaderNameWithTypeParameters(); $break ./ |
| 645 | |
| 646 | ClassHeaderName -> ClassHeaderName1 |
| 647 | /:$readableName ClassHeaderName:/ |
| 648 | |
| 649 | ClassHeaderName1 ::= Modifiersopt 'class' 'Identifier' |
| 650 | /.$putCase consumeClassHeaderName1(); $break ./ |
| 651 | /:$readableName ClassHeaderName:/ |
| 652 | |
| 653 | ClassHeaderExtends ::= 'extends' ClassType |
| 654 | /.$putCase consumeClassHeaderExtends(); $break ./ |
| 655 | /:$readableName ClassHeaderExtends:/ |
| 656 | |
| 657 | ClassHeaderImplements ::= 'implements' InterfaceTypeList |
| 658 | /.$putCase consumeClassHeaderImplements(); $break ./ |
| 659 | /:$readableName ClassHeaderImplements:/ |
| 660 | |
| 661 | -- {ObjectTeams: ==== playedBy ==== |
| 662 | ClassHeaderPlayedByopt ::= $empty |
| 663 | ClassHeaderPlayedByopt -> ClassHeaderPlayedBy |
| 664 | /:$readableName ClassHeaderPlayedBy:/ |
| 665 | |
| 666 | ClassHeaderPlayedBy ::= 'playedBy' ClassType |
| 667 | /.$putCase consumeClassHeaderPlayedBy(); $break ./ |
| 668 | /:$readableName ClassHeaderPlayedBy:/ |
| 669 | |
| 670 | -- Markus Witte} |
| 671 | |
| 672 | --{ObjectTeams: ==== predicates ==== |
| 673 | Predicateopt ::= $empty |
| 674 | Predicateopt -> Predicate |
| 675 | |
| 676 | Predicate -> RolePredicate |
| 677 | Predicate -> BasePredicate |
| 678 | |
| 679 | RolePredicate ::= PredicateHeader PredicateBody |
| 680 | /:$readableName Predicate:/ |
| 681 | |
| 682 | PredicateHeader ::= 'when' |
| 683 | /.$putCase consumePredicate(false); $break ./ |
| 684 | /:$readableName PredicateHeader:/ |
| 685 | |
| 686 | BasePredicate ::= BasePredicateHeader ForceBaseIsIdentifier PredicateBody RestoreBaseKeyword |
| 687 | /:$readableName Predicate:/ |
| 688 | |
| 689 | BasePredicateHeader ::= 'base' 'when' |
| 690 | /.$putCase consumePredicate(true); $break ./ |
| 691 | /:$readableName PredicateHeader:/ |
| 692 | |
| 693 | PredicateBody ::= '(' ForceNoDiet Expression RestoreDiet ')' |
| 694 | /.$putCase consumePredicateExpression(); $break ./ |
| 695 | /:$readableName PredicateBody:/ |
| 696 | |
| 697 | PredicateBody ::= '(' ')' |
| 698 | /.$putCase consumePredicateMissingExpression(); $break ./ |
| 699 | |
| 700 | |
| 701 | ForceBaseIsIdentifier ::= $empty |
| 702 | /.$putCase consumeForceBaseIsIdentifier(); $break ./ |
| 703 | /:$readableName ForceBaseIsIdentifier:/ |
| 704 | |
| 705 | RestoreBaseKeyword ::= $empty |
| 706 | /.$putCase consumeRestoreBaseKeyword(); $break ./ |
| 707 | /:$readableName RestoreBaseKeyword:/ |
| 708 | -- SH} |
| 709 | |
| 710 | InterfaceTypeList -> InterfaceType |
| 711 | InterfaceTypeList ::= InterfaceTypeList ',' InterfaceType |
| 712 | /.$putCase consumeInterfaceTypeList(); $break ./ |
| 713 | /:$readableName InterfaceTypeList:/ |
| 714 | |
| 715 | InterfaceType ::= ClassOrInterfaceType |
| 716 | /.$putCase consumeInterfaceType(); $break ./ |
| 717 | /:$readableName InterfaceType:/ |
| 718 | |
| 719 | ClassBody ::= '{' ClassBodyDeclarationsopt '}' |
| 720 | /:$readableName ClassBody:/ |
| 721 | /:$no_statements_recovery:/ |
| 722 | |
| 723 | ClassBodyDeclarations ::= ClassBodyDeclaration |
| 724 | ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration |
| 725 | /.$putCase consumeClassBodyDeclarations(); $break ./ |
| 726 | /:$readableName ClassBodyDeclarations:/ |
| 727 | |
| 728 | ClassBodyDeclaration -> ClassMemberDeclaration |
| 729 | ClassBodyDeclaration -> StaticInitializer |
| 730 | ClassBodyDeclaration -> ConstructorDeclaration |
| 731 | --1.1 feature |
| 732 | ClassBodyDeclaration ::= Diet NestedMethod CreateInitializer Block |
| 733 | /.$putCase consumeClassBodyDeclaration(); $break ./ |
| 734 | /:$readableName ClassBodyDeclaration:/ |
| 735 | |
| 736 | Diet ::= $empty |
| 737 | /.$putCase consumeDiet(); $break./ |
| 738 | /:$readableName Diet:/ |
| 739 | |
| 740 | Initializer ::= Diet NestedMethod CreateInitializer Block |
| 741 | /.$putCase consumeClassBodyDeclaration(); $break ./ |
| 742 | /:$readableName Initializer:/ |
| 743 | |
| 744 | CreateInitializer ::= $empty |
| 745 | /.$putCase consumeCreateInitializer(); $break./ |
| 746 | /:$readableName CreateInitializer:/ |
| 747 | |
| 748 | ClassMemberDeclaration -> FieldDeclaration |
| 749 | ClassMemberDeclaration -> MethodDeclaration |
| 750 | |
| 751 | -- {ObjectTeams |
| 752 | ClassMemberDeclaration -> BindingDeclaration |
| 753 | ClassMemberDeclaration -> PrecedenceDeclaration |
| 754 | -- Markus Witte} |
| 755 | |
| 756 | --1.1 feature |
| 757 | ClassMemberDeclaration -> ClassDeclaration |
| 758 | --1.1 feature |
| 759 | ClassMemberDeclaration -> InterfaceDeclaration |
| 760 | -- 1.5 feature |
| 761 | ClassMemberDeclaration -> EnumDeclaration |
| 762 | ClassMemberDeclaration -> 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) |
| 769 | ClassMemberDeclaration ::= ';' |
| 770 | /.$putCase consumeEmptyTypeDeclaration(); $break./ |
| 771 | |
| 772 | GenericMethodDeclaration -> MethodDeclaration |
| 773 | GenericMethodDeclaration -> 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 Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 786 | FieldDeclaration ::= Modifiersopt Type VariableDeclarators ';' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 787 | /.$putCase consumeFieldDeclaration(); $break ./ |
| 788 | /:$readableName FieldDeclaration:/ |
| 789 | |
| 790 | VariableDeclarators -> VariableDeclarator |
| 791 | VariableDeclarators ::= VariableDeclarators ',' VariableDeclarator |
| 792 | /.$putCase consumeVariableDeclarators(); $break ./ |
| 793 | /:$readableName VariableDeclarators:/ |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 794 | /:$recovery_template Identifier:/ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 795 | |
| 796 | VariableDeclarator ::= VariableDeclaratorId EnterVariable ExitVariableWithoutInitialization |
| 797 | VariableDeclarator ::= VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization |
| 798 | /:$readableName VariableDeclarator:/ |
| 799 | /:$recovery_template Identifier:/ |
| 800 | |
| 801 | EnterVariable ::= $empty |
| 802 | /.$putCase consumeEnterVariable(); $break ./ |
| 803 | /:$readableName EnterVariable:/ |
| 804 | |
| 805 | ExitVariableWithInitialization ::= $empty |
| 806 | /.$putCase consumeExitVariableWithInitialization(); $break ./ |
| 807 | /:$readableName ExitVariableWithInitialization:/ |
| 808 | |
| 809 | ExitVariableWithoutInitialization ::= $empty |
| 810 | /.$putCase consumeExitVariableWithoutInitialization(); $break ./ |
| 811 | /:$readableName ExitVariableWithoutInitialization:/ |
| 812 | |
| 813 | ForceNoDiet ::= $empty |
| 814 | /.$putCase consumeForceNoDiet(); $break ./ |
| 815 | /:$readableName ForceNoDiet:/ |
| 816 | RestoreDiet ::= $empty |
| 817 | /.$putCase consumeRestoreDiet(); $break ./ |
| 818 | /:$readableName RestoreDiet:/ |
| 819 | |
| 820 | VariableDeclaratorId ::= 'Identifier' Dimsopt |
| 821 | /:$readableName VariableDeclaratorId:/ |
| 822 | /:$recovery_template Identifier:/ |
| 823 | |
| 824 | VariableInitializer -> Expression |
| 825 | VariableInitializer -> 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 | |
| 841 | MethodDeclaration -> AbstractMethodDeclaration |
| 842 | MethodDeclaration ::= MethodHeader MethodBody |
| 843 | /.$putCase // set to true to consume a method with a body |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 844 | consumeMethodDeclaration(true); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 845 | /:$readableName MethodDeclaration:/ |
| 846 | |
| 847 | AbstractMethodDeclaration ::= MethodHeader ';' |
| 848 | /.$putCase // set to false to consume a method without body |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 849 | consumeMethodDeclaration(false); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 850 | /:$readableName MethodDeclaration:/ |
| 851 | |
| 852 | MethodHeader ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderExtendedDims MethodHeaderThrowsClauseopt |
| 853 | /.$putCase consumeMethodHeader(); $break ./ |
| 854 | /:$readableName MethodDeclaration:/ |
| 855 | |
| 856 | MethodHeaderName ::= Modifiersopt TypeParameters Type 'Identifier' '(' |
| 857 | /.$putCase consumeMethodHeaderNameWithTypeParameters(false); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 858 | MethodHeaderName ::= Modifiersopt Type 'Identifier' '(' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 859 | /.$putCase consumeMethodHeaderName(false); $break ./ |
| 860 | /:$readableName MethodHeaderName:/ |
| 861 | |
| 862 | MethodHeaderRightParen ::= ')' |
| 863 | /.$putCase consumeMethodHeaderRightParen(); $break ./ |
| 864 | /:$readableName ):/ |
| 865 | /:$recovery_template ):/ |
| 866 | |
| 867 | MethodHeaderExtendedDims ::= Dimsopt |
| 868 | /.$putCase consumeMethodHeaderExtendedDims(); $break ./ |
| 869 | /:$readableName MethodHeaderExtendedDims:/ |
| 870 | |
| 871 | MethodHeaderThrowsClause ::= 'throws' ClassTypeList |
| 872 | /.$putCase consumeMethodHeaderThrowsClause(); $break ./ |
| 873 | /:$readableName MethodHeaderThrowsClause:/ |
| 874 | |
| 875 | ConstructorHeader ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen MethodHeaderThrowsClauseopt |
| 876 | /.$putCase consumeConstructorHeader(); $break ./ |
| 877 | /:$readableName ConstructorDeclaration:/ |
| 878 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 879 | ConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier' '(' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 880 | /.$putCase consumeConstructorHeaderNameWithTypeParameters(); $break ./ |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 881 | ConstructorHeaderName ::= Modifiersopt 'Identifier' '(' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 882 | /.$putCase consumeConstructorHeaderName(); $break ./ |
| 883 | /:$readableName ConstructorHeaderName:/ |
| 884 | |
| 885 | FormalParameterList -> FormalParameter |
| 886 | FormalParameterList ::= FormalParameterList ',' FormalParameter |
| 887 | /.$putCase consumeFormalParameterList(); $break ./ |
| 888 | /:$readableName FormalParameterList:/ |
| 889 | |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 890 | PotentialNameArray -> $empty |
| 891 | /.$putCase consumePotentialNameArrayType(); $break ./ |
| 892 | /:$readableName PotentialNameArray:/ |
| 893 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 894 | --1.1 feature |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 895 | FormalParameter ::= Modifiersopt Type VariableDeclaratorIdOrThis |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 896 | /.$putCase consumeFormalParameter(false); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 897 | FormalParameter ::= Modifiersopt Type PushZeroTypeAnnotations '...' VariableDeclaratorIdOrThis |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 898 | /.$putCase consumeFormalParameter(true); $break ./ |
| 899 | /:$compliance 1.5:/ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 900 | --{ObjectTeams: inserted LiftingTypeopt: FIXME |
| 901 | -- example: |
Stephan Herrmann | 5fa7f31 | 2012-07-13 01:52:51 +0200 | [diff] [blame] | 902 | FormalParameter ::= Modifiersopt Name DimsoptAnnotsopt LiftingTypeopt PotentialNameArray VariableDeclaratorIdOrThis |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 903 | /.$putCase consumeFormalParameter(false); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 904 | -- real: |
| 905 | FormalParameter ::= Modifiersopt Type @308... TypeAnnotations '...' VariableDeclaratorIdOrThis |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 906 | /.$putCase consumeFormalParameter(true); $break ./ |
| 907 | /:$readableName FormalParameter:/ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 908 | /:$compliance 1.8:/ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 909 | /:$recovery_template Identifier Identifier:/ |
Stephan Herrmann | 5fa7f31 | 2012-07-13 01:52:51 +0200 | [diff] [blame] | 910 | -- SH} |
Stephan Herrmann | 197438c | 2012-07-15 22:54:37 +0200 | [diff] [blame] | 911 | CatchFormalParameter ::= Modifiersopt CatchType CatchLiftingTypeopt VariableDeclaratorId |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 912 | /.$putCase consumeCatchFormalParameter(); $break ./ |
| 913 | /:$readableName FormalParameter:/ |
| 914 | /:$recovery_template Identifier Identifier:/ |
| 915 | |
| 916 | CatchType ::= UnionType |
| 917 | /.$putCase consumeCatchType(); $break ./ |
| 918 | /:$readableName CatchType:/ |
| 919 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 920 | UnionType ::= Type |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 921 | /.$putCase consumeUnionTypeAsClassType(); $break ./ |
| 922 | UnionType ::= UnionType '|' Type |
| 923 | /.$putCase consumeUnionType(); $break ./ |
| 924 | /:$readableName UnionType:/ |
| 925 | /:$compliance 1.7:/ |
| 926 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 927 | ClassTypeList -> ClassTypeElt |
| 928 | ClassTypeList ::= ClassTypeList ',' ClassTypeElt |
| 929 | /.$putCase consumeClassTypeList(); $break ./ |
| 930 | /:$readableName ClassTypeList:/ |
| 931 | |
| 932 | ClassTypeElt ::= ClassType |
| 933 | /.$putCase consumeClassTypeElt(); $break ./ |
| 934 | /:$readableName ClassType:/ |
| 935 | |
| 936 | -- {ObjectTeams: added Predicateopt |
| 937 | MethodBody ::= Predicateopt NestedMethod '{' BlockStatementsopt '}' |
| 938 | /.$putCase consumeMethodBody(); $break ./ |
| 939 | /:$readableName MethodBody:/ |
| 940 | /:$no_statements_recovery:/ |
| 941 | -- SH} |
| 942 | |
| 943 | NestedMethod ::= $empty |
| 944 | /.$putCase consumeNestedMethod(); $break ./ |
| 945 | /:$readableName NestedMethod:/ |
| 946 | |
| 947 | -- {ObjectTeams ========== METHOD BINDINGS ========== |
| 948 | BindingDeclaration -> CalloutBinding |
| 949 | BindingDeclaration -> CallinBinding |
| 950 | BindingDeclaration -> InvalidCallinBinding |
| 951 | /:$readableName BindingDeclaration:/ |
| 952 | |
| 953 | -- ==== CALLOUT: ==== |
| 954 | |
| 955 | -- LONG: |
| 956 | CalloutBinding ::= CalloutHeaderLong CalloutParameterMappingsopt |
| 957 | /.$putCase consumeCalloutBindingLong(); $break ./ |
| 958 | /:$readableName CalloutBinding:/ |
| 959 | |
| 960 | CalloutHeaderLong ::= CalloutBindingLeftLong MethodSpecLong |
| 961 | /.$putCase consumeCalloutHeader(); $break ./ |
| 962 | /:$readableName CalloutHeader:/ |
| 963 | |
| 964 | CalloutHeaderLong ::= CalloutBindingLeftLong CalloutFieldSpecLong |
| 965 | /.$putCase consumeCalloutHeader(); $break ./ |
| 966 | /:$readableName CalloutHeader:/ |
| 967 | |
| 968 | CalloutBindingLeftLong ::= 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) |
| 976 | CalloutBinding ::= Modifiersopt CalloutBindingLeftShort CalloutModifieropt MethodSpecShort ';' |
| 977 | /.$putCase consumeCalloutHeader(); $break ./ |
| 978 | /:$readableName CalloutHeader:/ |
| 979 | |
| 980 | CalloutBindingLeftShort ::= 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 |
| 986 | CalloutBinding ::= Modifiersopt CalloutBindingLeftShort CalloutModifieropt MethodSpecShort CalloutParameterMappings |
| 987 | /.$putCase consumeCalloutParameterMappingsInvalid(); $break ./ |
| 988 | |
| 989 | -- SYMBOLS: |
| 990 | CalloutKind -> '->' |
| 991 | CalloutKind -> '=>' |
| 992 | /:$readableName CalloutKind:/ |
| 993 | |
| 994 | CalloutModifieropt ::= $empty |
| 995 | CalloutModifieropt -> CalloutModifier |
| 996 | /:$readableName CalloutModifier:/ |
| 997 | -- get set |
| 998 | CalloutModifier ::= 'get' |
| 999 | /.$putCase consumeCalloutModifier(TokenNameget); $break ./ |
| 1000 | /:$readableName CalloutModifier:/ |
| 1001 | CalloutModifier ::= 'set' |
| 1002 | /.$putCase consumeCalloutModifier(TokenNameset); $break ./ |
| 1003 | /:$readableName CalloutModifier:/ |
| 1004 | |
| 1005 | |
| 1006 | ---- CALLOUT-BINDING-PARAMETERMAPPING |
| 1007 | CalloutParameterMappingsopt -> CalloutParameterMappings |
| 1008 | CalloutParameterMappingsopt ::= ';' |
| 1009 | /.$putCase consumeParameterMappingsEmpty(); $break ./ |
| 1010 | /:$readableName EmptyParameterMappings:/ |
| 1011 | |
| 1012 | |
| 1013 | CalloutParameterMappings ::= 'with' NestedParamMappings '{' CalloutParameterMappingList ,opt '}' |
Stephan Herrmann | 926e118 | 2012-07-20 20:26:32 +0200 | [diff] [blame] | 1014 | /.$putCase consumeParameterMappings(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1015 | /:$readableName CalloutParameterMappings:/ |
| 1016 | |
| 1017 | -- note that this rule is needed for diagnose parsing where bodies of parameter mappings are ignored |
| 1018 | CalloutParameterMappingList ::= $empty |
| 1019 | /:$readableName EmptyParameterMappings:/ |
| 1020 | |
| 1021 | CalloutParameterMappingList -> ParameterMapping |
| 1022 | CalloutParameterMappingList ::= CalloutParameterMappingList ',' ParameterMapping |
| 1023 | /.$putCase consumeParameterMappingList(); $break ./ |
| 1024 | /:$readableName CalloutParameterMappingList:/ |
| 1025 | |
Stephan Herrmann | 926e118 | 2012-07-20 20:26:32 +0200 | [diff] [blame] | 1026 | |
| 1027 | ParameterMapping ::= Expression SYNTHBINDOUT 'Identifier' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1028 | /.$putCase consumeParameterMappingOut(); $break ./ |
| 1029 | |
| 1030 | ParameterMapping ::= 'Identifier' '<-' ForceBaseIsIdentifier Expression RestoreBaseKeyword |
| 1031 | /.$putCase consumeParameterMappingIn(); $break ./ |
| 1032 | /:$readableName ParameterMapping:/ |
| 1033 | |
| 1034 | |
| 1035 | NestedParamMappings ::= $empty |
| 1036 | /.$putCase consumeNestedParamMappings(); $break ./ |
| 1037 | /:$readableName NestedParameterMappings:/ |
| 1038 | |
| 1039 | -- ==== CALLIN-BINDING: ==== |
| 1040 | |
| 1041 | -- LONG: |
| 1042 | CallinBinding ::= CallinHeaderLong CallinParameterMappingsopt |
| 1043 | /.$putCase consumeCallinBindingLong(); $break ./ |
| 1044 | /:$readableName CallinBinding:/ |
| 1045 | |
| 1046 | CallinHeaderLong ::= 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 |
| 1051 | CallinHeaderLong ::= Modifiersopt CallinLabel CallinBindingLeftLong CallinModifier MethodSpecsLong Predicateopt |
| 1052 | /.$putCase consumeCallinHeader(); $break ./ |
| 1053 | |
| 1054 | CallinBindingLeftLong ::= 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 |
| 1060 | CallinBinding ::= 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!) |
| 1064 | CallinBinding ::= Modifiersopt CallinLabel Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort Predicateopt ';' |
| 1065 | /.$putCase consumeCallinHeader(); $break ./ |
| 1066 | |
| 1067 | CallinBindingLeftShort ::= MethodSpecShort '<-' |
| 1068 | /.$putCase consumeCallinBindingLeft(false); $break ./ |
| 1069 | /:$readableName CallinBindingLeft:/ |
| 1070 | |
| 1071 | -- LABEL: |
| 1072 | CallinLabel ::= SimpleName ':' |
| 1073 | /.$putCase consumeCallinLabel(); $break ./ |
| 1074 | /:$readableName CallinLabel:/ |
| 1075 | |
| 1076 | -- MODIFIER: |
| 1077 | CallinModifier ::= 'replace' |
| 1078 | /.$putCase consumeCallinModifier(TokenNamereplace); $break ./ |
| 1079 | /:$readableName CallinModifier:/ |
| 1080 | |
| 1081 | CallinModifier ::= 'before' |
| 1082 | /.$putCase consumeCallinModifier(TokenNamebefore); $break ./ |
| 1083 | /:$readableName CallinModifier:/ |
| 1084 | |
| 1085 | CallinModifier ::= '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 |
| 1091 | InvalidCallinModifier ::= $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 |
| 1096 | InvalidCallinBinding ::= Modifiersopt CallinBindingLeftShort InvalidCallinModifier BaseMethodSpecsShort |
| 1097 | /.$putCase consumeCallinBindingInvalid(false,false); $break ./ |
| 1098 | /:$readableName InvalidCallinBinding:/ |
| 1099 | |
| 1100 | InvalidCallinBinding ::= Modifiersopt CallinLabel Modifiersopt CallinBindingLeftShort InvalidCallinModifier BaseMethodSpecsShort |
| 1101 | /.$putCase consumeCallinBindingInvalid(false,false); $break ./ |
| 1102 | /:$readableName InvalidCallinBinding:/ |
| 1103 | |
| 1104 | InvalidCallinBinding ::= Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort CallinParameterMappings |
| 1105 | /.$putCase consumeCallinBindingInvalid(false,true); $break ./ |
| 1106 | /:$readableName InvalidCallinBinding:/ |
| 1107 | |
| 1108 | InvalidCallinBinding ::= Modifiersopt CallinLabel Modifiersopt CallinBindingLeftShort CallinModifier BaseMethodSpecsShort CallinParameterMappings |
| 1109 | /.$putCase consumeCallinBindingInvalid(false,true); $break ./ |
| 1110 | /:$readableName InvalidCallinBinding:/ |
| 1111 | |
| 1112 | InvalidCallinBinding ::= CallinBindingLeftLong InvalidCallinModifier MethodSpecsLong CallinParameterMappingsopt |
| 1113 | /.$putCase consumeCallinBindingInvalid(true,false); $break ./ |
| 1114 | /:$readableName InvalidCallinBinding:/ |
| 1115 | |
| 1116 | InvalidCallinBinding ::= Modifiersopt CallinLabel CallinBindingLeftLong InvalidCallinModifier MethodSpecsLong CallinParameterMappingsopt |
| 1117 | /.$putCase consumeCallinBindingInvalid(true,false); $break ./ |
| 1118 | /:$readableName InvalidCallinBinding:/ |
| 1119 | |
| 1120 | |
| 1121 | ---- CALLIN-BINDING-PARAMETERMAPPING |
| 1122 | CallinParameterMappingsopt -> CallinParameterMappings |
| 1123 | CallinParameterMappingsopt ::= ';' |
| 1124 | /.$putCase consumeParameterMappingsEmpty(); $break ./ |
| 1125 | /:$readableName EmptyParameterMappings:/ |
| 1126 | |
| 1127 | CallinParameterMappings ::= 'with' NestedParamMappings '{' CallinParameterMappingList ,opt '}' |
Stephan Herrmann | 926e118 | 2012-07-20 20:26:32 +0200 | [diff] [blame] | 1128 | /.$putCase consumeParameterMappings(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1129 | /:$readableName CallinParameterMappings:/ |
| 1130 | |
| 1131 | -- note that this rule is needed for diagnose parsing where bodies of parameter mappings are ignored |
| 1132 | CallinParameterMappingList ::= $empty |
| 1133 | /:$readableName EmptyParameterMappings:/ |
| 1134 | |
| 1135 | CallinParameterMappingList -> ParameterMapping |
| 1136 | CallinParameterMappingList ::= CallinParameterMappingList ',' ParameterMapping |
| 1137 | /.$putCase consumeParameterMappingList(); $break ./ |
| 1138 | /:$readableName ParameterMappingList:/ |
| 1139 | |
| 1140 | -- ==== METHOD_SPEC: ==== |
| 1141 | |
| 1142 | MethodSpecShort ::= SimpleName |
| 1143 | /.$putCase consumeMethodSpecShort(); $break ./ |
| 1144 | /:$readableName MethodSpecShort:/ |
| 1145 | |
| 1146 | MethodSpecLong ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen |
| 1147 | /.$putCase consumeMethodSpecLong(false); $break ./ |
| 1148 | /:$readableName MethodSpecLong:/ |
| 1149 | |
| 1150 | -- explicitly handle this error case: |
| 1151 | MethodSpecLong ::= ConstructorHeaderName FormalParameterListopt MethodHeaderRightParen |
| 1152 | /.$putCase consumeMethodSpecLongCtor(); $break ./ |
| 1153 | /:$readableName IllegalMethodSpecLong:/ |
| 1154 | |
| 1155 | -- base of callin can use '+' after return type: |
| 1156 | BaseMethodSpecLong ::= MethodHeaderName FormalParameterListopt MethodHeaderRightParen |
| 1157 | /.$putCase consumeMethodSpecLong(false); $break ./ |
| 1158 | /:$readableName MethodSpecLong:/ |
| 1159 | |
| 1160 | BaseMethodSpecLong ::= MethodSpecNamePlus FormalParameterListopt MethodHeaderRightParen |
| 1161 | /.$putCase consumeMethodSpecLong(true); $break ./ |
| 1162 | /:$readableName MethodSpecLong:/ |
| 1163 | |
Stephan Herrmann | 5fa7f31 | 2012-07-13 01:52:51 +0200 | [diff] [blame] | 1164 | MethodSpecNamePlus ::= Modifiersopt Type0 '+' 'Identifier' '(' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1165 | /.$putCase consumeMethodHeaderName(false); $break ./ |
| 1166 | /:$readableName MethodSpecName:/ |
| 1167 | |
| 1168 | CalloutFieldSpecLong ::= CalloutModifier Type 'Identifier' |
| 1169 | /.$putCase consumeFieldSpecLong(); $break ./ |
| 1170 | /:$readableName CallloutFieldSpec:/ |
| 1171 | |
| 1172 | BaseMethodSpecsShort -> BaseMethodSpecListShort |
| 1173 | /:$readableName MethodSpecsShort:/ |
| 1174 | |
| 1175 | BaseMethodSpecListShort -> BaseMethodSpecShort |
| 1176 | BaseMethodSpecListShort ::= BaseMethodSpecListShort ',' BaseMethodSpecShort |
| 1177 | /.$putCase consumeMethodSpecList(); $break ./ |
| 1178 | /:$readableName MethodSpecListShort:/ |
| 1179 | |
| 1180 | BaseMethodSpecShort -> MethodSpecShort |
| 1181 | |
| 1182 | MethodSpecsLong -> MethodSpecListLong |
| 1183 | /:$readableName MethodSpecsLong:/ |
| 1184 | |
| 1185 | MethodSpecListLong -> BaseMethodSpecLong |
| 1186 | MethodSpecListLong ::= MethodSpecListLong ',' BaseMethodSpecLong |
| 1187 | /.$putCase consumeMethodSpecList(); $break ./ |
| 1188 | /:$readableName MethodSpecListLong:/ |
| 1189 | |
| 1190 | -- ==== PRECEDENCE DECLARATION ==== |
| 1191 | PrecedenceDeclaration ::= 'precedence' BindingNames ';' |
| 1192 | /.$putCase consumePrecedenceDeclaration(false); $break ./ |
| 1193 | /:$readableName PrecedenceDeclaration:/ |
| 1194 | |
| 1195 | PrecedenceDeclaration ::= 'precedence' 'after' BindingNames ';' |
| 1196 | /.$putCase consumePrecedenceDeclaration(true); $break ./ |
| 1197 | /:$readableName PrecedenceAfterDeclaration:/ |
| 1198 | |
| 1199 | BindingNames -> BindingName |
| 1200 | BindingNames ::= BindingNames ',' BindingName |
| 1201 | /.$putCase consumeBindingNames(); $break ./ |
| 1202 | /:$readableName CallinBindingNames:/ |
| 1203 | |
| 1204 | BindingName ::= Name |
| 1205 | /.$putCase consumeBindingName(); $break ./ |
| 1206 | /:$readableName CallinBindingName:/ |
| 1207 | -- Markus Witte} |
| 1208 | |
| 1209 | --18.8.4 Productions from 8.5: Static Initializers |
| 1210 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1211 | StaticInitializer ::= StaticOnly Block |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1212 | /.$putCase consumeStaticInitializer(); $break./ |
| 1213 | /:$readableName StaticInitializer:/ |
| 1214 | |
| 1215 | StaticOnly ::= '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 | -- |
| 1226 | ConstructorDeclaration ::= ConstructorHeader MethodBody |
| 1227 | /.$putCase consumeConstructorDeclaration() ; $break ./ |
| 1228 | -- These rules are added to be able to parse constructors with no body |
| 1229 | ConstructorDeclaration ::= 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 | |
| 1236 | ExplicitConstructorInvocation ::= 'this' '(' ArgumentListopt ')' ';' |
| 1237 | /.$putCase consumeExplicitConstructorInvocation(0, THIS_CALL); $break ./ |
| 1238 | |
| 1239 | ExplicitConstructorInvocation ::= OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';' |
| 1240 | /.$putCase consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL); $break ./ |
| 1241 | |
| 1242 | ExplicitConstructorInvocation ::= 'super' '(' ArgumentListopt ')' ';' |
| 1243 | /.$putCase consumeExplicitConstructorInvocation(0,SUPER_CALL); $break ./ |
| 1244 | |
| 1245 | ExplicitConstructorInvocation ::= OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';' |
| 1246 | /.$putCase consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL); $break ./ |
| 1247 | |
| 1248 | -- {ObjectTeams |
| 1249 | ExplicitConstructorInvocation ::= 'tsuper' '(' ArgumentListopt ')' ';' |
| 1250 | /.$putCase consumeExplicitConstructorInvocation(0,TSUPER_CALL); $break ./ |
| 1251 | |
| 1252 | ExplicitConstructorInvocation ::= Name '.' 'tsuper' '(' ArgumentListopt ')' ';' |
| 1253 | /.$putCase consumeExplicitConstructorInvocation(2,TSUPER_CALL); $break ./ |
| 1254 | -- Markus Witte} |
| 1255 | |
| 1256 | --1.1 feature |
| 1257 | ExplicitConstructorInvocation ::= Primary '.' 'super' '(' ArgumentListopt ')' ';' |
| 1258 | /.$putCase consumeExplicitConstructorInvocation(1, SUPER_CALL); $break ./ |
| 1259 | |
| 1260 | ExplicitConstructorInvocation ::= Primary '.' OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';' |
| 1261 | /.$putCase consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL); $break ./ |
| 1262 | |
| 1263 | --1.1 feature |
| 1264 | ExplicitConstructorInvocation ::= Name '.' 'super' '(' ArgumentListopt ')' ';' |
| 1265 | /.$putCase consumeExplicitConstructorInvocation(2, SUPER_CALL); $break ./ |
| 1266 | |
| 1267 | ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'super' '(' ArgumentListopt ')' ';' |
| 1268 | /.$putCase consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL); $break ./ |
| 1269 | |
| 1270 | --1.1 feature |
| 1271 | ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ArgumentListopt ')' ';' |
| 1272 | /.$putCase consumeExplicitConstructorInvocation(1, THIS_CALL); $break ./ |
| 1273 | |
| 1274 | ExplicitConstructorInvocation ::= Primary '.' OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';' |
| 1275 | /.$putCase consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL); $break ./ |
| 1276 | |
| 1277 | --1.1 feature |
| 1278 | ExplicitConstructorInvocation ::= Name '.' 'this' '(' ArgumentListopt ')' ';' |
| 1279 | /.$putCase consumeExplicitConstructorInvocation(2, THIS_CALL); $break ./ |
| 1280 | |
| 1281 | ExplicitConstructorInvocation ::= Name '.' OnlyTypeArguments 'this' '(' ArgumentListopt ')' ';' |
| 1282 | /.$putCase consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL); $break ./ |
| 1283 | /:$readableName ExplicitConstructorInvocation:/ |
| 1284 | |
| 1285 | -- {ObjectTeams |
| 1286 | BaseConstructorExpression ::= 'base' '(' ArgumentListopt ')' |
| 1287 | /.$putCase consumeExplicitConstructorInvocationBase(0); $break ./ |
| 1288 | /:$readableName BaseConstructorInvocation:/ |
| 1289 | |
| 1290 | BaseConstructorInvocation ::= 'base' '(' ArgumentListopt ')' |
| 1291 | /.$putCase consumeExplicitConstructorInvocationBase(1); $break ./ |
| 1292 | /:$readableName BaseConstructorInvocation:/ |
| 1293 | |
| 1294 | BaseConstructorInvocation ::= Primary . 'base' '(' ArgumentListopt ')' |
| 1295 | /.$putCase consumeExplicitConstructorInvocationBase(2); $break ./ |
| 1296 | /:$readableName QualifiedBaseConstructorInvocation:/ |
| 1297 | |
| 1298 | BaseConstructorInvocation ::= 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 | -- |
| 1310 | InterfaceDeclaration ::= InterfaceHeader InterfaceBody |
| 1311 | /.$putCase consumeInterfaceDeclaration(); $break ./ |
| 1312 | /:$readableName InterfaceDeclaration:/ |
| 1313 | |
| 1314 | -- {ObjectTeams |
| 1315 | -- orig: InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt |
| 1316 | InterfaceHeader ::= InterfaceHeaderName InterfaceHeaderExtendsopt ClassHeaderPlayedByopt |
| 1317 | -- SH} |
| 1318 | /.$putCase consumeInterfaceHeader(); $break ./ |
| 1319 | /:$readableName InterfaceHeader:/ |
| 1320 | |
| 1321 | ----------------------------------------------- |
| 1322 | -- 1.5 features : generics |
| 1323 | ----------------------------------------------- |
| 1324 | InterfaceHeaderName ::= InterfaceHeaderName1 TypeParameters |
| 1325 | /.$putCase consumeTypeHeaderNameWithTypeParameters(); $break ./ |
| 1326 | |
| 1327 | InterfaceHeaderName -> InterfaceHeaderName1 |
| 1328 | /:$readableName InterfaceHeaderName:/ |
| 1329 | |
| 1330 | InterfaceHeaderName1 ::= Modifiersopt interface Identifier |
| 1331 | /.$putCase consumeInterfaceHeaderName1(); $break ./ |
| 1332 | /:$readableName InterfaceHeaderName:/ |
| 1333 | |
| 1334 | InterfaceHeaderExtends ::= 'extends' InterfaceTypeList |
| 1335 | /.$putCase consumeInterfaceHeaderExtends(); $break ./ |
| 1336 | /:$readableName InterfaceHeaderExtends:/ |
| 1337 | |
| 1338 | InterfaceBody ::= '{' InterfaceMemberDeclarationsopt '}' |
| 1339 | /:$readableName InterfaceBody:/ |
| 1340 | |
| 1341 | InterfaceMemberDeclarations -> InterfaceMemberDeclaration |
| 1342 | InterfaceMemberDeclarations ::= InterfaceMemberDeclarations InterfaceMemberDeclaration |
| 1343 | /.$putCase consumeInterfaceMemberDeclarations(); $break ./ |
| 1344 | /:$readableName InterfaceMemberDeclarations:/ |
| 1345 | |
| 1346 | --same as for class members |
| 1347 | InterfaceMemberDeclaration ::= ';' |
| 1348 | /.$putCase consumeEmptyTypeDeclaration(); $break ./ |
| 1349 | /:$readableName InterfaceMemberDeclaration:/ |
| 1350 | |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1351 | PushDefault ::= $empty |
| 1352 | /.$putCase consumeInterfaceMethodDefault(); $break ./ |
| 1353 | /:$readableName PushDefault:/ |
| 1354 | /:$compliance 1.8:/ |
| 1355 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1356 | InterfaceMemberDeclaration -> ConstantDeclaration |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1357 | InterfaceMemberDeclaration ::= MethodHeader 'default' PushDefault MethodBody |
| 1358 | /:$compliance 1.8:/ |
| 1359 | /.$putCase consumeInterfaceMethodDeclaration(true); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1360 | InterfaceMemberDeclaration ::= MethodHeader MethodBody |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1361 | /.$putCase consumeInterfaceMethodDeclaration(false); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1362 | /:$readableName InterfaceMemberDeclaration:/ |
| 1363 | |
| 1364 | -- These rules are added to be able to parse constructors inside interface and then report a relevent error message |
| 1365 | InvalidConstructorDeclaration ::= ConstructorHeader MethodBody |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1366 | /.$putCase consumeInvalidConstructorDeclaration(true); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1367 | InvalidConstructorDeclaration ::= ConstructorHeader ';' |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1368 | /.$putCase consumeInvalidConstructorDeclaration(false); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1369 | /:$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) |
| 1372 | InvalidInitializer -> StaticInitializer |
| 1373 | InvalidInitializer -> Initializer |
| 1374 | /:$readableName InvalidInitializer:/ |
| 1375 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1376 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1377 | InterfaceMemberDeclaration -> AbstractMethodDeclaration |
| 1378 | InterfaceMemberDeclaration -> InvalidConstructorDeclaration |
| 1379 | InterfaceMemberDeclaration -> InvalidInitializer |
| 1380 | --1.1 feature |
| 1381 | InterfaceMemberDeclaration -> ClassDeclaration |
| 1382 | --1.1 feature |
| 1383 | InterfaceMemberDeclaration -> InterfaceDeclaration |
| 1384 | InterfaceMemberDeclaration -> EnumDeclaration |
| 1385 | InterfaceMemberDeclaration -> AnnotationTypeDeclaration |
| 1386 | --{ObjectTeams: bindings in role interfaces: |
| 1387 | InterfaceMemberDeclaration -> BindingDeclaration |
| 1388 | -- SH} |
| 1389 | /:$readableName InterfaceMemberDeclaration:/ |
| 1390 | |
| 1391 | ConstantDeclaration -> FieldDeclaration |
| 1392 | /:$readableName ConstantDeclaration:/ |
| 1393 | |
| 1394 | PushLeftBrace ::= $empty |
| 1395 | /.$putCase consumePushLeftBrace(); $break ./ |
| 1396 | /:$readableName PushLeftBrace:/ |
| 1397 | |
| 1398 | ArrayInitializer ::= '{' PushLeftBrace ,opt '}' |
| 1399 | /.$putCase consumeEmptyArrayInitializer(); $break ./ |
| 1400 | ArrayInitializer ::= '{' PushLeftBrace VariableInitializers '}' |
| 1401 | /.$putCase consumeArrayInitializer(); $break ./ |
| 1402 | ArrayInitializer ::= '{' PushLeftBrace VariableInitializers , '}' |
| 1403 | /.$putCase consumeArrayInitializer(); $break ./ |
| 1404 | /:$readableName ArrayInitializer:/ |
| 1405 | /:$recovery_template Identifier:/ |
| 1406 | |
| 1407 | VariableInitializers ::= VariableInitializer |
| 1408 | VariableInitializers ::= VariableInitializers ',' VariableInitializer |
| 1409 | /.$putCase consumeVariableInitializers(); $break ./ |
| 1410 | /:$readableName VariableInitializers:/ |
| 1411 | |
| 1412 | Block ::= OpenBlock '{' BlockStatementsopt '}' |
| 1413 | /.$putCase consumeBlock(); $break ./ |
| 1414 | /:$readableName Block:/ |
| 1415 | |
| 1416 | OpenBlock ::= $empty |
| 1417 | /.$putCase consumeOpenBlock() ; $break ./ |
| 1418 | /:$readableName OpenBlock:/ |
| 1419 | |
| 1420 | BlockStatements -> BlockStatement |
| 1421 | BlockStatements ::= BlockStatements BlockStatement |
| 1422 | /.$putCase consumeBlockStatements() ; $break ./ |
| 1423 | /:$readableName BlockStatements:/ |
| 1424 | |
| 1425 | BlockStatement -> LocalVariableDeclarationStatement |
| 1426 | BlockStatement -> Statement |
| 1427 | --1.1 feature |
| 1428 | BlockStatement -> ClassDeclaration |
| 1429 | BlockStatement ::= InterfaceDeclaration |
| 1430 | /.$putCase consumeInvalidInterfaceDeclaration(); $break ./ |
| 1431 | /:$readableName BlockStatement:/ |
| 1432 | BlockStatement ::= AnnotationTypeDeclaration |
| 1433 | /.$putCase consumeInvalidAnnotationTypeDeclaration(); $break ./ |
| 1434 | /:$readableName BlockStatement:/ |
| 1435 | BlockStatement ::= EnumDeclaration |
| 1436 | /.$putCase consumeInvalidEnumDeclaration(); $break ./ |
| 1437 | /:$readableName BlockStatement:/ |
| 1438 | |
| 1439 | LocalVariableDeclarationStatement ::= LocalVariableDeclaration ';' |
| 1440 | /.$putCase consumeLocalVariableDeclarationStatement(); $break ./ |
| 1441 | /:$readableName LocalVariableDeclarationStatement:/ |
| 1442 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1443 | LocalVariableDeclaration ::= Type PushModifiers VariableDeclarators |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1444 | /.$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 Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1449 | LocalVariableDeclaration ::= Modifiers Type PushRealModifiers VariableDeclarators |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1450 | /.$putCase consumeLocalVariableDeclaration(); $break ./ |
| 1451 | /:$readableName LocalVariableDeclaration:/ |
| 1452 | |
| 1453 | PushModifiers ::= $empty |
| 1454 | /.$putCase consumePushModifiers(); $break ./ |
| 1455 | /:$readableName PushModifiers:/ |
| 1456 | |
| 1457 | PushModifiersForHeader ::= $empty |
| 1458 | /.$putCase consumePushModifiersForHeader(); $break ./ |
| 1459 | /:$readableName PushModifiersForHeader:/ |
| 1460 | |
| 1461 | PushRealModifiers ::= $empty |
| 1462 | /.$putCase consumePushRealModifiers(); $break ./ |
| 1463 | /:$readableName PushRealModifiers:/ |
| 1464 | |
| 1465 | Statement -> StatementWithoutTrailingSubstatement |
| 1466 | Statement -> LabeledStatement |
| 1467 | Statement -> IfThenStatement |
| 1468 | Statement -> IfThenElseStatement |
| 1469 | Statement -> WhileStatement |
| 1470 | Statement -> ForStatement |
| 1471 | -- {ObjectTeams |
| 1472 | Statement -> WithinStatement |
| 1473 | -- Markus Witte} |
| 1474 | ----------------------------------------------- |
| 1475 | -- 1.5 feature |
| 1476 | ----------------------------------------------- |
| 1477 | Statement -> EnhancedForStatement |
| 1478 | /:$readableName Statement:/ |
| 1479 | /:$recovery_template ;:/ |
| 1480 | |
| 1481 | StatementNoShortIf -> StatementWithoutTrailingSubstatement |
| 1482 | StatementNoShortIf -> LabeledStatementNoShortIf |
| 1483 | StatementNoShortIf -> IfThenElseStatementNoShortIf |
| 1484 | StatementNoShortIf -> WhileStatementNoShortIf |
| 1485 | StatementNoShortIf -> ForStatementNoShortIf |
| 1486 | ----------------------------------------------- |
| 1487 | -- 1.5 feature |
| 1488 | ----------------------------------------------- |
| 1489 | StatementNoShortIf -> EnhancedForStatementNoShortIf |
| 1490 | /:$readableName Statement:/ |
| 1491 | |
| 1492 | StatementWithoutTrailingSubstatement -> AssertStatement |
| 1493 | StatementWithoutTrailingSubstatement -> Block |
| 1494 | StatementWithoutTrailingSubstatement -> EmptyStatement |
| 1495 | StatementWithoutTrailingSubstatement -> ExpressionStatement |
| 1496 | StatementWithoutTrailingSubstatement -> SwitchStatement |
| 1497 | StatementWithoutTrailingSubstatement -> DoStatement |
| 1498 | StatementWithoutTrailingSubstatement -> BreakStatement |
| 1499 | StatementWithoutTrailingSubstatement -> ContinueStatement |
| 1500 | StatementWithoutTrailingSubstatement -> ReturnStatement |
| 1501 | StatementWithoutTrailingSubstatement -> SynchronizedStatement |
| 1502 | StatementWithoutTrailingSubstatement -> ThrowStatement |
| 1503 | StatementWithoutTrailingSubstatement -> TryStatement |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1504 | StatementWithoutTrailingSubstatement -> TryStatementWithResources |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1505 | /:$readableName Statement:/ |
| 1506 | |
| 1507 | EmptyStatement ::= ';' |
| 1508 | /.$putCase consumeEmptyStatement(); $break ./ |
| 1509 | /:$readableName EmptyStatement:/ |
| 1510 | |
| 1511 | LabeledStatement ::= Label ':' Statement |
| 1512 | /.$putCase consumeStatementLabel() ; $break ./ |
| 1513 | /:$readableName LabeledStatement:/ |
| 1514 | |
| 1515 | LabeledStatementNoShortIf ::= Label ':' StatementNoShortIf |
| 1516 | /.$putCase consumeStatementLabel() ; $break ./ |
| 1517 | /:$readableName LabeledStatement:/ |
| 1518 | |
| 1519 | Label ::= 'Identifier' |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1520 | /.$putCase consumeLabel() ; $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1521 | /:$readableName Label:/ |
| 1522 | |
| 1523 | ExpressionStatement ::= StatementExpression ';' |
| 1524 | /. $putCase consumeExpressionStatement(); $break ./ |
| 1525 | ExpressionStatement ::= ExplicitConstructorInvocation |
| 1526 | /:$readableName Statement:/ |
| 1527 | |
| 1528 | StatementExpression ::= Assignment |
| 1529 | StatementExpression ::= PreIncrementExpression |
| 1530 | StatementExpression ::= PreDecrementExpression |
| 1531 | StatementExpression ::= PostIncrementExpression |
| 1532 | StatementExpression ::= PostDecrementExpression |
| 1533 | StatementExpression ::= MethodInvocation |
| 1534 | StatementExpression ::= ClassInstanceCreationExpression |
| 1535 | -- {ObjectTeams |
| 1536 | StatementExpression ::= BaseConstructorInvocation |
| 1537 | -- SH} |
| 1538 | /:$readableName Expression:/ |
| 1539 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1540 | IfThenStatement ::= 'if' '(' Expression ')' Statement |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1541 | /.$putCase consumeStatementIfNoElse(); $break ./ |
| 1542 | /:$readableName IfStatement:/ |
| 1543 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1544 | IfThenElseStatement ::= 'if' '(' Expression ')' StatementNoShortIf 'else' Statement |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1545 | /.$putCase consumeStatementIfWithElse(); $break ./ |
| 1546 | /:$readableName IfStatement:/ |
| 1547 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1548 | IfThenElseStatementNoShortIf ::= 'if' '(' Expression ')' StatementNoShortIf 'else' StatementNoShortIf |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1549 | /.$putCase consumeStatementIfWithElse(); $break ./ |
| 1550 | /:$readableName IfStatement:/ |
| 1551 | |
| 1552 | SwitchStatement ::= 'switch' '(' Expression ')' OpenBlock SwitchBlock |
| 1553 | /.$putCase consumeStatementSwitch() ; $break ./ |
| 1554 | /:$readableName SwitchStatement:/ |
| 1555 | |
| 1556 | SwitchBlock ::= '{' '}' |
| 1557 | /.$putCase consumeEmptySwitchBlock() ; $break ./ |
| 1558 | |
| 1559 | SwitchBlock ::= '{' SwitchBlockStatements '}' |
| 1560 | SwitchBlock ::= '{' SwitchLabels '}' |
| 1561 | SwitchBlock ::= '{' SwitchBlockStatements SwitchLabels '}' |
| 1562 | /.$putCase consumeSwitchBlock() ; $break ./ |
| 1563 | /:$readableName SwitchBlock:/ |
| 1564 | |
| 1565 | SwitchBlockStatements -> SwitchBlockStatement |
| 1566 | SwitchBlockStatements ::= SwitchBlockStatements SwitchBlockStatement |
| 1567 | /.$putCase consumeSwitchBlockStatements() ; $break ./ |
| 1568 | /:$readableName SwitchBlockStatements:/ |
| 1569 | |
| 1570 | SwitchBlockStatement ::= SwitchLabels BlockStatements |
| 1571 | /.$putCase consumeSwitchBlockStatement() ; $break ./ |
| 1572 | /:$readableName SwitchBlockStatement:/ |
| 1573 | |
| 1574 | SwitchLabels -> SwitchLabel |
| 1575 | SwitchLabels ::= SwitchLabels SwitchLabel |
| 1576 | /.$putCase consumeSwitchLabels() ; $break ./ |
| 1577 | /:$readableName SwitchLabels:/ |
| 1578 | |
| 1579 | SwitchLabel ::= 'case' ConstantExpression ':' |
| 1580 | /. $putCase consumeCaseLabel(); $break ./ |
| 1581 | |
| 1582 | SwitchLabel ::= 'default' ':' |
| 1583 | /. $putCase consumeDefaultLabel(); $break ./ |
| 1584 | /:$readableName SwitchLabel:/ |
| 1585 | |
| 1586 | WhileStatement ::= 'while' '(' Expression ')' Statement |
| 1587 | /.$putCase consumeStatementWhile() ; $break ./ |
| 1588 | /:$readableName WhileStatement:/ |
| 1589 | |
| 1590 | WhileStatementNoShortIf ::= 'while' '(' Expression ')' StatementNoShortIf |
| 1591 | /.$putCase consumeStatementWhile() ; $break ./ |
| 1592 | /:$readableName WhileStatement:/ |
| 1593 | |
| 1594 | DoStatement ::= 'do' Statement 'while' '(' Expression ')' ';' |
| 1595 | /.$putCase consumeStatementDo() ; $break ./ |
| 1596 | /:$readableName DoStatement:/ |
| 1597 | |
| 1598 | ForStatement ::= 'for' '(' ForInitopt ';' Expressionopt ';' ForUpdateopt ')' Statement |
| 1599 | /.$putCase consumeStatementFor() ; $break ./ |
| 1600 | /:$readableName ForStatement:/ |
| 1601 | |
| 1602 | ForStatementNoShortIf ::= '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 |
| 1607 | ForInit ::= StatementExpressionList |
| 1608 | /.$putCase consumeForInit() ; $break ./ |
| 1609 | ForInit -> LocalVariableDeclaration |
| 1610 | /:$readableName ForInit:/ |
| 1611 | |
| 1612 | ForUpdate -> StatementExpressionList |
| 1613 | /:$readableName ForUpdate:/ |
| 1614 | |
| 1615 | StatementExpressionList -> StatementExpression |
| 1616 | StatementExpressionList ::= StatementExpressionList ',' StatementExpression |
| 1617 | /.$putCase consumeStatementExpressionList() ; $break ./ |
| 1618 | /:$readableName StatementExpressionList:/ |
| 1619 | |
| 1620 | -- {ObjectTeams |
| 1621 | WithinStatement ::= 'within' '(' Expression ')' Statement |
| 1622 | /.$putCase consumeWithinStatement(); $break ./ |
| 1623 | /:$readableName WithinStatement:/ |
| 1624 | -- Markus Witte} |
| 1625 | |
| 1626 | -- 1.4 feature |
| 1627 | AssertStatement ::= 'assert' Expression ';' |
| 1628 | /.$putCase consumeSimpleAssertStatement() ; $break ./ |
| 1629 | /:$compliance 1.4:/ |
| 1630 | |
| 1631 | AssertStatement ::= 'assert' Expression ':' Expression ';' |
| 1632 | /.$putCase consumeAssertStatement() ; $break ./ |
| 1633 | /:$readableName AssertStatement:/ |
| 1634 | /:$compliance 1.4:/ |
| 1635 | |
| 1636 | BreakStatement ::= 'break' ';' |
| 1637 | /.$putCase consumeStatementBreak() ; $break ./ |
| 1638 | |
| 1639 | BreakStatement ::= 'break' Identifier ';' |
| 1640 | /.$putCase consumeStatementBreakWithLabel() ; $break ./ |
| 1641 | /:$readableName BreakStatement:/ |
| 1642 | |
| 1643 | ContinueStatement ::= 'continue' ';' |
| 1644 | /.$putCase consumeStatementContinue() ; $break ./ |
| 1645 | |
| 1646 | ContinueStatement ::= 'continue' Identifier ';' |
| 1647 | /.$putCase consumeStatementContinueWithLabel() ; $break ./ |
| 1648 | /:$readableName ContinueStatement:/ |
| 1649 | |
| 1650 | ReturnStatement ::= 'return' Expressionopt ';' |
| 1651 | /.$putCase consumeStatementReturn() ; $break ./ |
| 1652 | /:$readableName ReturnStatement:/ |
| 1653 | |
| 1654 | ThrowStatement ::= 'throw' Expression ';' |
| 1655 | /.$putCase consumeStatementThrow(); $break ./ |
| 1656 | /:$readableName ThrowStatement:/ |
| 1657 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1658 | SynchronizedStatement ::= OnlySynchronized '(' Expression ')' Block |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1659 | /.$putCase consumeStatementSynchronized(); $break ./ |
| 1660 | /:$readableName SynchronizedStatement:/ |
| 1661 | |
| 1662 | OnlySynchronized ::= 'synchronized' |
| 1663 | /.$putCase consumeOnlySynchronized(); $break ./ |
| 1664 | /:$readableName OnlySynchronized:/ |
| 1665 | |
| 1666 | TryStatement ::= 'try' TryBlock Catches |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1667 | /.$putCase consumeStatementTry(false, false); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1668 | TryStatement ::= 'try' TryBlock Catchesopt Finally |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1669 | /.$putCase consumeStatementTry(true, false); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1670 | /:$readableName TryStatement:/ |
| 1671 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1672 | TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt |
| 1673 | /.$putCase consumeStatementTry(false, true); $break ./ |
| 1674 | TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally |
| 1675 | /.$putCase consumeStatementTry(true, true); $break ./ |
| 1676 | /:$readableName TryStatementWithResources:/ |
| 1677 | /:$compliance 1.7:/ |
| 1678 | |
| 1679 | ResourceSpecification ::= '(' 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 | |
| 1691 | Resources ::= Resource |
| 1692 | /.$putCase consumeSingleResource(); $break ./ |
| 1693 | Resources ::= Resources TrailingSemiColon Resource |
| 1694 | /.$putCase consumeMultipleResources(); $break ./ |
| 1695 | /:$readableName Resources:/ |
| 1696 | /:$compliance 1.7:/ |
| 1697 | |
| 1698 | TrailingSemiColon ::= ';' |
| 1699 | /.$putCase consumeResourceOptionalTrailingSemiColon(true); $break ./ |
| 1700 | /:$readableName ;:/ |
| 1701 | /:$compliance 1.7:/ |
| 1702 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1703 | Resource ::= Type PushModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1704 | /.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./ |
| 1705 | /:$readableName Resource:/ |
| 1706 | /:$compliance 1.7:/ |
| 1707 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1708 | Resource ::= Modifiers Type PushRealModifiers VariableDeclaratorId EnterVariable '=' ForceNoDiet VariableInitializer RestoreDiet ExitVariableWithInitialization |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1709 | /.$putCase consumeResourceAsLocalVariableDeclaration(); $break ./ |
| 1710 | /:$readableName Resource:/ |
| 1711 | /:$compliance 1.7:/ |
| 1712 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1713 | TryBlock ::= Block ExitTryBlock |
| 1714 | /:$readableName Block:/ |
| 1715 | |
| 1716 | ExitTryBlock ::= $empty |
| 1717 | /.$putCase consumeExitTryBlock(); $break ./ |
| 1718 | /:$readableName ExitTryBlock:/ |
| 1719 | |
| 1720 | Catches -> CatchClause |
| 1721 | Catches ::= Catches CatchClause |
| 1722 | /.$putCase consumeCatches(); $break ./ |
| 1723 | /:$readableName Catches:/ |
| 1724 | |
Stephan Herrmann | 29b019c | 2011-04-26 10:30:44 +0000 | [diff] [blame] | 1725 | CatchClause ::= 'catch' '(' CatchFormalParameter ')' Block |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1726 | /.$putCase consumeStatementCatch() ; $break ./ |
| 1727 | /:$readableName CatchClause:/ |
| 1728 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1729 | Finally ::= 'finally' Block |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1730 | /:$readableName Finally:/ |
| 1731 | /:$recovery_template finally { }:/ |
| 1732 | |
| 1733 | --18.12 Productions from 14: Expressions |
| 1734 | |
| 1735 | --for source positioning purpose |
| 1736 | PushLPAREN ::= '(' |
| 1737 | /.$putCase consumeLeftParen(); $break ./ |
| 1738 | /:$readableName (:/ |
| 1739 | /:$recovery_template (:/ |
| 1740 | PushRPAREN ::= ')' |
| 1741 | /.$putCase consumeRightParen(); $break ./ |
| 1742 | /:$readableName ):/ |
| 1743 | /:$recovery_template ):/ |
| 1744 | |
| 1745 | Primary -> PrimaryNoNewArray |
| 1746 | Primary -> ArrayCreationWithArrayInitializer |
| 1747 | Primary -> ArrayCreationWithoutArrayInitializer |
| 1748 | /:$readableName Expression:/ |
| 1749 | |
| 1750 | PrimaryNoNewArray -> Literal |
| 1751 | PrimaryNoNewArray ::= 'this' |
| 1752 | /.$putCase consumePrimaryNoNewArrayThis(); $break ./ |
| 1753 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1754 | PrimaryNoNewArray ::= PushLPAREN Expression_NotName PushRPAREN |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1755 | /.$putCase consumePrimaryNoNewArray(); $break ./ |
| 1756 | |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1757 | PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1758 | /.$putCase consumePrimaryNoNewArrayWithName(); $break ./ |
| 1759 | |
| 1760 | PrimaryNoNewArray -> ClassInstanceCreationExpression |
| 1761 | --{ObjectTeams: |
| 1762 | PrimaryNoNewArray -> BaseConstructorExpression |
| 1763 | -- SH} |
| 1764 | PrimaryNoNewArray -> FieldAccess |
| 1765 | --1.1 feature |
| 1766 | PrimaryNoNewArray ::= Name '.' 'this' |
| 1767 | /.$putCase consumePrimaryNoNewArrayNameThis(); $break ./ |
| 1768 | PrimaryNoNewArray ::= Name '.' 'super' |
| 1769 | /.$putCase consumePrimaryNoNewArrayNameSuper(); $break ./ |
| 1770 | |
| 1771 | --1.1 feature |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 1772 | --PrimaryNoNewArray ::= Type '.' 'class' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1773 | --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 | |
| 1776 | PrimaryNoNewArray ::= Name '.' 'class' |
| 1777 | /.$putCase consumePrimaryNoNewArrayName(); $break ./ |
| 1778 | |
| 1779 | PrimaryNoNewArray ::= Name Dims '.' 'class' |
| 1780 | /.$putCase consumePrimaryNoNewArrayArrayType(); $break ./ |
| 1781 | |
| 1782 | PrimaryNoNewArray ::= PrimitiveType Dims '.' 'class' |
| 1783 | /.$putCase consumePrimaryNoNewArrayPrimitiveArrayType(); $break ./ |
| 1784 | |
| 1785 | PrimaryNoNewArray ::= 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) |
| 1790 | RelationalExpression ::= RelationalExpression '<' TypeAnchor '>' '.' 'class' |
| 1791 | /.$putCase consumeRoleClassLiteral(); $break ./ |
| 1792 | -- SH} |
| 1793 | |
| 1794 | PrimaryNoNewArray -> MethodInvocation |
| 1795 | PrimaryNoNewArray -> ArrayAccess |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1796 | |
| 1797 | ----------------------------------------------------------------------- |
| 1798 | -- Start of rules for JSR 335 |
| 1799 | ----------------------------------------------------------------------- |
| 1800 | |
| 1801 | PrimaryNoNewArray -> LambdaExpression |
| 1802 | PrimaryNoNewArray -> ReferenceExpression |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1803 | /:$readableName Expression:/ |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1804 | |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1805 | ReferenceExpressionTypeArgumentsAndTrunk ::= OnlyTypeArguments Dimsopt |
| 1806 | /.$putCase consumeReferenceExpressionTypeArgumentsAndTrunk(false); $break ./ |
| 1807 | /:$compliance 1.8:/ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1808 | ReferenceExpressionTypeArgumentsAndTrunk ::= OnlyTypeArguments '.' ClassOrInterfaceType Dimsopt |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1809 | /.$putCase consumeReferenceExpressionTypeArgumentsAndTrunk(true); $break ./ |
| 1810 | /:$readableName ReferenceExpressionTypeArgumentsAndTrunk:/ |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1811 | /:$compliance 1.8:/ |
| 1812 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1813 | ReferenceExpression ::= PrimitiveType Dims '::' NonWildTypeArgumentsopt IdentifierOrNew |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1814 | /.$putCase consumeReferenceExpressionTypeForm(true, true); $break ./ |
| 1815 | /:$compliance 1.8:/ |
| 1816 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1817 | ReferenceExpression ::= Name Dims '::' NonWildTypeArgumentsopt IdentifierOrNew |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1818 | /.$putCase consumeReferenceExpressionTypeForm(false, true); $break ./ |
| 1819 | /:$compliance 1.8:/ |
| 1820 | |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1821 | ReferenceExpression ::= Name '::' NonWildTypeArgumentsopt IdentifierOrNew |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1822 | /.$putCase consumeReferenceExpressionTypeForm(false, false); $break ./ |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1823 | /:$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 Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1827 | ReferenceExpression ::= Name BeginTypeArguments ReferenceExpressionTypeArgumentsAndTrunk '::' NonWildTypeArgumentsopt IdentifierOrNew |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1828 | /.$putCase consumeReferenceExpressionGenericTypeForm(); $break ./ |
| 1829 | /:$compliance 1.8:/ |
| 1830 | |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1831 | ReferenceExpression ::= Primary '::' NonWildTypeArgumentsopt Identifier |
| 1832 | /.$putCase consumeReferenceExpressionPrimaryForm(); $break ./ |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1833 | /:$compliance 1.8:/ |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1834 | ReferenceExpression ::= 'super' '::' NonWildTypeArgumentsopt Identifier |
| 1835 | /.$putCase consumeReferenceExpressionSuperForm(); $break ./ |
| 1836 | /:$readableName ReferenceExpression:/ |
| 1837 | /:$compliance 1.8:/ |
| 1838 | |
| 1839 | NonWildTypeArgumentsopt ::= $empty |
| 1840 | /.$putCase consumeEmptyTypeArguments(); $break ./ |
| 1841 | NonWildTypeArgumentsopt -> OnlyTypeArguments |
| 1842 | /:$readableName NonWildTypeArgumentsopt:/ |
| 1843 | /:$compliance 1.8:/ |
| 1844 | |
| 1845 | IdentifierOrNew ::= 'Identifier' |
| 1846 | /.$putCase consumeIdentifierOrNew(false); $break ./ |
| 1847 | IdentifierOrNew ::= 'new' |
| 1848 | /.$putCase consumeIdentifierOrNew(true); $break ./ |
| 1849 | /:$readableName IdentifierOrNew:/ |
| 1850 | /:$compliance 1.8:/ |
| 1851 | |
| 1852 | LambdaExpression ::= LambdaParameters '->' LambdaBody |
| 1853 | /.$putCase consumeLambdaExpression(); $break ./ |
| 1854 | /:$readableName LambdaExpression:/ |
| 1855 | /:$compliance 1.8:/ |
| 1856 | |
| 1857 | LambdaParameters ::= 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 Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1864 | LambdaParameters -> BeginLambda ParenthesizedLambdaParameterList |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1865 | /:$readableName LambdaParameters:/ |
| 1866 | /:$compliance 1.8:/ |
| 1867 | |
Stephan Herrmann | 1460a60 | 2012-07-19 20:01:10 +0200 | [diff] [blame] | 1868 | ParenthesizedLambdaParameterList -> PushLPAREN FormalParameterListopt PushRPAREN |
| 1869 | ParenthesizedLambdaParameterList -> PushLPAREN TypeElidedFormalParameterList PushRPAREN |
| 1870 | /:$readableName ParenthesizedLambdaParameterList:/ |
| 1871 | /:$compliance 1.8:/ |
| 1872 | |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 1873 | TypeElidedFormalParameterList -> TypeElidedFormalParameter |
| 1874 | TypeElidedFormalParameterList ::= 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. |
| 1881 | TypeElidedFormalParameter ::= 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; '}' |
| 1887 | LambdaBody -> ElidedLeftBraceAndReturn Expression ElidedSemicolonAndRightBrace |
| 1888 | LambdaBody ::= NestedType NestedMethod '{' BlockStatementsopt '}' |
| 1889 | /.$putCase consumeBlock(); $break ./ |
| 1890 | /:$readableName LambdaBody:/ |
| 1891 | /:$compliance 1.8:/ |
| 1892 | |
| 1893 | ElidedLeftBraceAndReturn ::= $empty |
| 1894 | /.$putCase consumeElidedLeftBraceAndReturn(); $break ./ |
| 1895 | /:$readableName ElidedLeftBraceAndReturn:/ |
| 1896 | /:$compliance 1.8:/ |
| 1897 | |
| 1898 | ----------------------------------------------------------------------- |
| 1899 | -- End of rules for JSR 335 |
| 1900 | ----------------------------------------------------------------------- |
| 1901 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1902 | --1.1 feature |
| 1903 | -- |
| 1904 | -- In Java 1.0 a ClassBody could not appear at all in a |
| 1905 | -- ClassInstanceCreationExpression. |
| 1906 | -- |
| 1907 | |
| 1908 | AllocationHeader ::= 'new' ClassType '(' ArgumentListopt ')' |
| 1909 | /.$putCase consumeAllocationHeader(); $break ./ |
| 1910 | /:$readableName AllocationHeader:/ |
| 1911 | |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1912 | ClassInstanceCreationExpression ::= 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' UnqualifiedClassBodyopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1913 | /.$putCase consumeClassInstanceCreationExpressionWithTypeArguments(); $break ./ |
| 1914 | |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1915 | ClassInstanceCreationExpression ::= 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' UnqualifiedClassBodyopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1916 | /.$putCase consumeClassInstanceCreationExpression(); $break ./ |
| 1917 | --1.1 feature |
| 1918 | |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1919 | ClassInstanceCreationExpression ::= Primary '.' 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1920 | /.$putCase consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; $break ./ |
| 1921 | |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1922 | ClassInstanceCreationExpression ::= Primary '.' 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1923 | /.$putCase consumeClassInstanceCreationExpressionQualified() ; $break ./ |
| 1924 | |
| 1925 | --1.1 feature |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1926 | ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1927 | /.$putCase consumeClassInstanceCreationExpressionQualified() ; $break ./ |
| 1928 | /:$readableName ClassInstanceCreationExpression:/ |
| 1929 | |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1930 | ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' OnlyTypeArguments ClassType EnterInstanceCreationArgumentList '(' ArgumentListopt ')' QualifiedClassBodyopt |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1931 | /.$putCase consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; $break ./ |
| 1932 | /:$readableName ClassInstanceCreationExpression:/ |
| 1933 | |
Stephan Herrmann | 6cecadb | 2012-02-26 01:08:39 +0100 | [diff] [blame] | 1934 | EnterInstanceCreationArgumentList ::= $empty |
| 1935 | /.$putCase consumeEnterInstanceCreationArgumentList(); $break ./ |
| 1936 | /:$readableName EnterInstanceCreationArgumentList:/ |
| 1937 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1938 | ClassInstanceCreationExpressionName ::= Name '.' |
| 1939 | /.$putCase consumeClassInstanceCreationExpressionName() ; $break ./ |
| 1940 | /:$readableName ClassInstanceCreationExpressionName:/ |
| 1941 | |
| 1942 | UnqualifiedClassBodyopt ::= $empty --test made using null as contents |
| 1943 | /.$putCase consumeClassBodyopt(); $break ./ |
| 1944 | UnqualifiedClassBodyopt ::= UnqualifiedEnterAnonymousClassBody ClassBody |
| 1945 | /:$readableName ClassBody:/ |
| 1946 | /:$no_statements_recovery:/ |
| 1947 | |
| 1948 | UnqualifiedEnterAnonymousClassBody ::= $empty |
| 1949 | /.$putCase consumeEnterAnonymousClassBody(false); $break ./ |
| 1950 | /:$readableName EnterAnonymousClassBody:/ |
| 1951 | |
| 1952 | QualifiedClassBodyopt ::= $empty --test made using null as contents |
| 1953 | /.$putCase consumeClassBodyopt(); $break ./ |
| 1954 | QualifiedClassBodyopt ::= QualifiedEnterAnonymousClassBody ClassBody |
| 1955 | /:$readableName ClassBody:/ |
| 1956 | /:$no_statements_recovery:/ |
| 1957 | |
| 1958 | QualifiedEnterAnonymousClassBody ::= $empty |
| 1959 | /.$putCase consumeEnterAnonymousClassBody(true); $break ./ |
| 1960 | /:$readableName EnterAnonymousClassBody:/ |
| 1961 | |
| 1962 | ArgumentList ::= Expression |
| 1963 | ArgumentList ::= ArgumentList ',' Expression |
| 1964 | /.$putCase consumeArgumentList(); $break ./ |
| 1965 | /:$readableName ArgumentList:/ |
| 1966 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1967 | ArrayCreationHeader ::= 'new' PrimitiveType DimWithOrWithOutExprs |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1968 | /.$putCase consumeArrayCreationHeader(); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1969 | |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1970 | ArrayCreationHeader ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs |
| 1971 | /.$putCase consumeArrayCreationHeader(); $break ./ |
| 1972 | /:$readableName ArrayCreationHeader:/ |
| 1973 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1974 | ArrayCreationWithoutArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1975 | /.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./ |
| 1976 | /:$readableName ArrayCreationWithoutArrayInitializer:/ |
| 1977 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1978 | ArrayCreationWithArrayInitializer ::= 'new' PrimitiveType DimWithOrWithOutExprs ArrayInitializer |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1979 | /.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./ |
| 1980 | /:$readableName ArrayCreationWithArrayInitializer:/ |
| 1981 | |
| 1982 | ArrayCreationWithoutArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs |
| 1983 | /.$putCase consumeArrayCreationExpressionWithoutInitializer(); $break ./ |
| 1984 | |
| 1985 | ArrayCreationWithArrayInitializer ::= 'new' ClassOrInterfaceType DimWithOrWithOutExprs ArrayInitializer |
| 1986 | /.$putCase consumeArrayCreationExpressionWithInitializer(); $break ./ |
| 1987 | |
| 1988 | DimWithOrWithOutExprs ::= DimWithOrWithOutExpr |
| 1989 | DimWithOrWithOutExprs ::= DimWithOrWithOutExprs DimWithOrWithOutExpr |
| 1990 | /.$putCase consumeDimWithOrWithOutExprs(); $break ./ |
| 1991 | /:$readableName Dimensions:/ |
| 1992 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 1993 | DimWithOrWithOutExpr ::= TypeAnnotationsopt '[' Expression ']' |
| 1994 | DimWithOrWithOutExpr ::= TypeAnnotationsopt '[' ']' |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 1995 | /. $putCase consumeDimWithOrWithOutExpr(); $break ./ |
| 1996 | /:$readableName Dimension:/ |
| 1997 | -- ----------------------------------------------- |
| 1998 | |
| 1999 | Dims ::= DimsLoop |
| 2000 | /. $putCase consumeDims(); $break ./ |
| 2001 | /:$readableName Dimensions:/ |
| 2002 | DimsLoop -> OneDimLoop |
| 2003 | DimsLoop ::= DimsLoop OneDimLoop |
| 2004 | /:$readableName Dimensions:/ |
| 2005 | OneDimLoop ::= '[' ']' |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 2006 | /. $putCase consumeOneDimLoop(false); $break ./ |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 2007 | OneDimLoop ::= TypeAnnotations '[' ']' |
| 2008 | /:$compliance 1.8:/ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 2009 | /. $putCase consumeOneDimLoop(true); $break ./ |
| 2010 | /:$readableName Dimension:/ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2011 | |
| 2012 | FieldAccess ::= Primary '.' 'Identifier' |
| 2013 | /.$putCase consumeFieldAccess(false); $break ./ |
| 2014 | |
| 2015 | FieldAccess ::= 'super' '.' 'Identifier' |
| 2016 | /.$putCase consumeFieldAccess(true); $break ./ |
| 2017 | /:$readableName FieldAccess:/ |
| 2018 | |
| 2019 | MethodInvocation ::= Name '(' ArgumentListopt ')' |
| 2020 | /.$putCase consumeMethodInvocationName(); $break ./ |
| 2021 | |
| 2022 | MethodInvocation ::= Name '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2023 | /.$putCase consumeMethodInvocationNameWithTypeArguments(); $break ./ |
| 2024 | |
| 2025 | MethodInvocation ::= Primary '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2026 | /.$putCase consumeMethodInvocationPrimaryWithTypeArguments(); $break ./ |
| 2027 | |
| 2028 | MethodInvocation ::= Primary '.' 'Identifier' '(' ArgumentListopt ')' |
| 2029 | /.$putCase consumeMethodInvocationPrimary(); $break ./ |
| 2030 | |
| 2031 | MethodInvocation ::= 'super' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2032 | /.$putCase consumeMethodInvocationSuperWithTypeArguments(); $break ./ |
| 2033 | |
| 2034 | MethodInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')' |
| 2035 | /.$putCase consumeMethodInvocationSuper(); $break ./ |
| 2036 | |
| 2037 | -- {ObjectTeams |
| 2038 | MethodInvocation ::= 'tsuper' '.' 'Identifier' '(' ArgumentListopt ')' |
| 2039 | /.$putCase consumeMethodInvocationTSuper(UNQUALIFIED); $break ./ |
| 2040 | |
| 2041 | MethodInvocation ::= 'tsuper' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2042 | /.$putCase consumeMethodInvocationTSuperWithTypeArguments(0); $break ./ |
| 2043 | |
| 2044 | MethodInvocation ::= Name '.' 'tsuper' '.' 'Identifier' '(' ArgumentListopt ')' |
| 2045 | /.$putCase consumeMethodInvocationTSuper(QUALIFIED); $break ./ |
| 2046 | |
| 2047 | MethodInvocation ::= Name '.' 'tsuper' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2048 | /.$putCase consumeMethodInvocationTSuperWithTypeArguments(2); $break ./ |
| 2049 | |
| 2050 | MethodInvocation ::= 'base' '.' 'Identifier' '(' ArgumentListopt ')' |
| 2051 | /.$putCase consumeMethodInvocationBase(false); $break ./ |
| 2052 | |
| 2053 | MethodInvocation ::= 'base' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2054 | /.$putCase consumeMethodInvocationBaseWithTypeArguments(false); $break ./ |
| 2055 | |
| 2056 | MethodInvocation ::= 'base' '.' 'super' '.' 'Identifier' '(' ArgumentListopt ')' |
| 2057 | /.$putCase consumeMethodInvocationBase(true); $break ./ |
| 2058 | |
| 2059 | MethodInvocation ::= 'base' '.' 'super' '.' OnlyTypeArguments 'Identifier' '(' ArgumentListopt ')' |
| 2060 | /.$putCase consumeMethodInvocationBaseWithTypeArguments(true); $break ./ |
| 2061 | -- Markus Witte} |
| 2062 | |
| 2063 | /:$readableName MethodInvocation:/ |
| 2064 | |
| 2065 | ArrayAccess ::= Name '[' Expression ']' |
| 2066 | /.$putCase consumeArrayAccess(true); $break ./ |
| 2067 | ArrayAccess ::= PrimaryNoNewArray '[' Expression ']' |
| 2068 | /.$putCase consumeArrayAccess(false); $break ./ |
| 2069 | ArrayAccess ::= ArrayCreationWithArrayInitializer '[' Expression ']' |
| 2070 | /.$putCase consumeArrayAccess(false); $break ./ |
| 2071 | /:$readableName ArrayAccess:/ |
| 2072 | |
| 2073 | PostfixExpression -> Primary |
| 2074 | PostfixExpression ::= Name |
| 2075 | /.$putCase consumePostfixExpression(); $break ./ |
| 2076 | PostfixExpression -> PostIncrementExpression |
| 2077 | PostfixExpression -> PostDecrementExpression |
| 2078 | /:$readableName Expression:/ |
| 2079 | |
| 2080 | PostIncrementExpression ::= PostfixExpression '++' |
| 2081 | /.$putCase consumeUnaryExpression(OperatorIds.PLUS,true); $break ./ |
| 2082 | /:$readableName PostIncrementExpression:/ |
| 2083 | |
| 2084 | PostDecrementExpression ::= PostfixExpression '--' |
| 2085 | /.$putCase consumeUnaryExpression(OperatorIds.MINUS,true); $break ./ |
| 2086 | /:$readableName PostDecrementExpression:/ |
| 2087 | |
| 2088 | --for source managment purpose |
| 2089 | PushPosition ::= $empty |
| 2090 | /.$putCase consumePushPosition(); $break ./ |
| 2091 | /:$readableName PushPosition:/ |
| 2092 | |
| 2093 | UnaryExpression -> PreIncrementExpression |
| 2094 | UnaryExpression -> PreDecrementExpression |
| 2095 | UnaryExpression ::= '+' PushPosition UnaryExpression |
| 2096 | /.$putCase consumeUnaryExpression(OperatorIds.PLUS); $break ./ |
| 2097 | UnaryExpression ::= '-' PushPosition UnaryExpression |
| 2098 | /.$putCase consumeUnaryExpression(OperatorIds.MINUS); $break ./ |
| 2099 | UnaryExpression -> UnaryExpressionNotPlusMinus |
| 2100 | /:$readableName Expression:/ |
| 2101 | |
| 2102 | PreIncrementExpression ::= '++' PushPosition UnaryExpression |
| 2103 | /.$putCase consumeUnaryExpression(OperatorIds.PLUS,false); $break ./ |
| 2104 | /:$readableName PreIncrementExpression:/ |
| 2105 | |
| 2106 | PreDecrementExpression ::= '--' PushPosition UnaryExpression |
| 2107 | /.$putCase consumeUnaryExpression(OperatorIds.MINUS,false); $break ./ |
| 2108 | /:$readableName PreDecrementExpression:/ |
| 2109 | |
| 2110 | UnaryExpressionNotPlusMinus -> PostfixExpression |
| 2111 | UnaryExpressionNotPlusMinus ::= '~' PushPosition UnaryExpression |
| 2112 | /.$putCase consumeUnaryExpression(OperatorIds.TWIDDLE); $break ./ |
| 2113 | UnaryExpressionNotPlusMinus ::= '!' PushPosition UnaryExpression |
| 2114 | /.$putCase consumeUnaryExpression(OperatorIds.NOT); $break ./ |
| 2115 | UnaryExpressionNotPlusMinus -> CastExpression |
| 2116 | /:$readableName Expression:/ |
| 2117 | |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 2118 | CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN InsideCastExpression UnaryExpression |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2119 | /.$putCase consumeCastExpressionWithPrimitiveType(); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 2120 | CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression Dimsopt PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2121 | /.$putCase consumeCastExpressionWithGenericsArray(); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 2122 | CastExpression ::= PushLPAREN Name OnlyTypeArgumentsForCastExpression '.' ClassOrInterfaceType Dimsopt PushRPAREN InsideCastExpressionWithQualifiedGenerics UnaryExpressionNotPlusMinus |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2123 | /.$putCase consumeCastExpressionWithQualifiedGenericsArray(); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 2124 | CastExpression ::= PushLPAREN Name PushRPAREN InsideCastExpressionLL1 UnaryExpressionNotPlusMinus |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2125 | /.$putCase consumeCastExpressionLL1(); $break ./ |
Stephan Herrmann | ee9076e | 2013-04-04 16:21:27 +0200 | [diff] [blame^] | 2126 | CastExpression ::= PushLPAREN Name Dims PushRPAREN InsideCastExpression UnaryExpressionNotPlusMinus |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2127 | /.$putCase consumeCastExpressionWithNameArray(); $break ./ |
| 2128 | /:$readableName CastExpression:/ |
| 2129 | |
| 2130 | OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments |
| 2131 | /.$putCase consumeOnlyTypeArgumentsForCastExpression(); $break ./ |
| 2132 | /:$readableName TypeArguments:/ |
| 2133 | |
| 2134 | InsideCastExpression ::= $empty |
| 2135 | /.$putCase consumeInsideCastExpression(); $break ./ |
| 2136 | /:$readableName InsideCastExpression:/ |
| 2137 | InsideCastExpressionLL1 ::= $empty |
| 2138 | /.$putCase consumeInsideCastExpressionLL1(); $break ./ |
| 2139 | /:$readableName InsideCastExpression:/ |
| 2140 | InsideCastExpressionWithQualifiedGenerics ::= $empty |
| 2141 | /.$putCase consumeInsideCastExpressionWithQualifiedGenerics(); $break ./ |
| 2142 | /:$readableName InsideCastExpression:/ |
| 2143 | |
| 2144 | MultiplicativeExpression -> UnaryExpression |
| 2145 | MultiplicativeExpression ::= MultiplicativeExpression '*' UnaryExpression |
| 2146 | /.$putCase consumeBinaryExpression(OperatorIds.MULTIPLY); $break ./ |
| 2147 | MultiplicativeExpression ::= MultiplicativeExpression '/' UnaryExpression |
| 2148 | /.$putCase consumeBinaryExpression(OperatorIds.DIVIDE); $break ./ |
| 2149 | MultiplicativeExpression ::= MultiplicativeExpression '%' UnaryExpression |
| 2150 | /.$putCase consumeBinaryExpression(OperatorIds.REMAINDER); $break ./ |
| 2151 | /:$readableName Expression:/ |
| 2152 | |
| 2153 | AdditiveExpression -> MultiplicativeExpression |
| 2154 | AdditiveExpression ::= AdditiveExpression '+' MultiplicativeExpression |
| 2155 | /.$putCase consumeBinaryExpression(OperatorIds.PLUS); $break ./ |
| 2156 | AdditiveExpression ::= AdditiveExpression '-' MultiplicativeExpression |
| 2157 | /.$putCase consumeBinaryExpression(OperatorIds.MINUS); $break ./ |
| 2158 | /:$readableName Expression:/ |
| 2159 | |
| 2160 | ShiftExpression -> AdditiveExpression |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 2161 | ShiftExpression ::= ShiftExpression '<<' AdditiveExpression |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2162 | /.$putCase consumeBinaryExpression(OperatorIds.LEFT_SHIFT); $break ./ |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 2163 | ShiftExpression ::= ShiftExpression '>>' AdditiveExpression |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2164 | /.$putCase consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); $break ./ |
| 2165 | ShiftExpression ::= ShiftExpression '>>>' AdditiveExpression |
| 2166 | /.$putCase consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); $break ./ |
| 2167 | /:$readableName Expression:/ |
| 2168 | |
| 2169 | RelationalExpression -> ShiftExpression |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 2170 | RelationalExpression ::= RelationalExpression '<' ShiftExpression |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2171 | /.$putCase consumeBinaryExpression(OperatorIds.LESS); $break ./ |
Stephan Herrmann | 44109d3 | 2011-08-02 14:34:26 +0000 | [diff] [blame] | 2172 | RelationalExpression ::= RelationalExpression '>' ShiftExpression |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2173 | /.$putCase consumeBinaryExpression(OperatorIds.GREATER); $break ./ |
| 2174 | RelationalExpression ::= RelationalExpression '<=' ShiftExpression |
| 2175 | /.$putCase consumeBinaryExpression(OperatorIds.LESS_EQUAL); $break ./ |
| 2176 | RelationalExpression ::= RelationalExpression '>=' ShiftExpression |
| 2177 | /.$putCase consumeBinaryExpression(OperatorIds.GREATER_EQUAL); $break ./ |
| 2178 | /:$readableName Expression:/ |
| 2179 | |
| 2180 | InstanceofExpression -> RelationalExpression |
| 2181 | InstanceofExpression ::= InstanceofExpression 'instanceof' ReferenceType |
| 2182 | /.$putCase consumeInstanceOfExpression(); $break ./ |
| 2183 | /:$readableName Expression:/ |
| 2184 | |
| 2185 | EqualityExpression -> InstanceofExpression |
| 2186 | EqualityExpression ::= EqualityExpression '==' InstanceofExpression |
| 2187 | /.$putCase consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); $break ./ |
| 2188 | EqualityExpression ::= EqualityExpression '!=' InstanceofExpression |
| 2189 | /.$putCase consumeEqualityExpression(OperatorIds.NOT_EQUAL); $break ./ |
| 2190 | /:$readableName Expression:/ |
| 2191 | |
| 2192 | AndExpression -> EqualityExpression |
| 2193 | AndExpression ::= AndExpression '&' EqualityExpression |
| 2194 | /.$putCase consumeBinaryExpression(OperatorIds.AND); $break ./ |
| 2195 | /:$readableName Expression:/ |
| 2196 | |
| 2197 | ExclusiveOrExpression -> AndExpression |
| 2198 | ExclusiveOrExpression ::= ExclusiveOrExpression '^' AndExpression |
| 2199 | /.$putCase consumeBinaryExpression(OperatorIds.XOR); $break ./ |
| 2200 | /:$readableName Expression:/ |
| 2201 | |
| 2202 | InclusiveOrExpression -> ExclusiveOrExpression |
| 2203 | InclusiveOrExpression ::= InclusiveOrExpression '|' ExclusiveOrExpression |
| 2204 | /.$putCase consumeBinaryExpression(OperatorIds.OR); $break ./ |
| 2205 | /:$readableName Expression:/ |
| 2206 | |
| 2207 | ConditionalAndExpression -> InclusiveOrExpression |
| 2208 | ConditionalAndExpression ::= ConditionalAndExpression '&&' InclusiveOrExpression |
| 2209 | /.$putCase consumeBinaryExpression(OperatorIds.AND_AND); $break ./ |
| 2210 | /:$readableName Expression:/ |
| 2211 | |
| 2212 | ConditionalOrExpression -> ConditionalAndExpression |
| 2213 | ConditionalOrExpression ::= ConditionalOrExpression '||' ConditionalAndExpression |
| 2214 | /.$putCase consumeBinaryExpression(OperatorIds.OR_OR); $break ./ |
| 2215 | /:$readableName Expression:/ |
| 2216 | |
| 2217 | ConditionalExpression -> ConditionalOrExpression |
| 2218 | ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' ConditionalExpression |
| 2219 | /.$putCase consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; $break ./ |
| 2220 | /:$readableName Expression:/ |
| 2221 | |
| 2222 | AssignmentExpression -> ConditionalExpression |
| 2223 | AssignmentExpression -> Assignment |
| 2224 | /:$readableName Expression:/ |
| 2225 | /:$recovery_template Identifier:/ |
| 2226 | |
| 2227 | Assignment ::= 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 |
| 2232 | InvalidArrayInitializerAssignement ::= PostfixExpression AssignmentOperator ArrayInitializer |
| 2233 | /:$readableName ArrayInitializerAssignment:/ |
| 2234 | /:$recovery:/ |
| 2235 | Assignment ::= InvalidArrayInitializerAssignement |
| 2236 | /.$putcase ignoreExpressionAssignment();$break ./ |
| 2237 | /:$recovery:/ |
| 2238 | |
| 2239 | AssignmentOperator ::= '=' |
| 2240 | /.$putCase consumeAssignmentOperator(EQUAL); $break ./ |
| 2241 | AssignmentOperator ::= '*=' |
| 2242 | /.$putCase consumeAssignmentOperator(MULTIPLY); $break ./ |
| 2243 | AssignmentOperator ::= '/=' |
| 2244 | /.$putCase consumeAssignmentOperator(DIVIDE); $break ./ |
| 2245 | AssignmentOperator ::= '%=' |
| 2246 | /.$putCase consumeAssignmentOperator(REMAINDER); $break ./ |
| 2247 | AssignmentOperator ::= '+=' |
| 2248 | /.$putCase consumeAssignmentOperator(PLUS); $break ./ |
| 2249 | AssignmentOperator ::= '-=' |
| 2250 | /.$putCase consumeAssignmentOperator(MINUS); $break ./ |
| 2251 | AssignmentOperator ::= '<<=' |
| 2252 | /.$putCase consumeAssignmentOperator(LEFT_SHIFT); $break ./ |
| 2253 | AssignmentOperator ::= '>>=' |
| 2254 | /.$putCase consumeAssignmentOperator(RIGHT_SHIFT); $break ./ |
| 2255 | AssignmentOperator ::= '>>>=' |
| 2256 | /.$putCase consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); $break ./ |
| 2257 | AssignmentOperator ::= '&=' |
| 2258 | /.$putCase consumeAssignmentOperator(AND); $break ./ |
| 2259 | AssignmentOperator ::= '^=' |
| 2260 | /.$putCase consumeAssignmentOperator(XOR); $break ./ |
| 2261 | AssignmentOperator ::= '|=' |
| 2262 | /.$putCase consumeAssignmentOperator(OR); $break ./ |
| 2263 | /:$readableName AssignmentOperator:/ |
| 2264 | /:$recovery_template =:/ |
| 2265 | |
Stephan Herrmann | c481730 | 2012-07-13 01:31:42 +0200 | [diff] [blame] | 2266 | -- For handling lambda expressions, we need to know when a full Expression |
| 2267 | -- has been reduced. |
| 2268 | Expression ::= AssignmentExpression |
| 2269 | /.$putCase consumeExpression(); $break ./ |
Stephan Herrmann | 234bfec | 2011-04-26 08:26:58 +0000 | [diff] [blame] | 2270 | /:$readableName Expression:/ |
| 2271 | /:$recovery_template Identifier:/ |
| 2272 | |
| 2273 | -- The following rules are for optional nonterminals. |
| 2274 | -- |
| 2275 | ClassHeaderExtendsopt ::= $empty |
| 2276 | ClassHeaderExtendsopt -> ClassHeaderExtends |
| 2277 | /:$readableName ClassHeaderExtends:/ |
| 2278 | |
| 2279 | Expressionopt ::= $empty |
| 2280 | /.$putCase consumeEmptyExpression(); $break ./ |
| 2281 | Expressionopt -> Expression |
| 2282 | /:$readableName Expression:/ |
| 2283 | |
| 2284 | ConstantExpression -> 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 | |
| 2303 | ClassBodyDeclarationsopt ::= $empty |
| 2304 | /.$putCase consumeEmptyClassBodyDeclarationsopt(); $break ./ |
| 2305 | ClassBodyDeclarationsopt ::= NestedType ClassBodyDeclarations |
| 2306 | /.$putCase consumeClassBodyDeclarationsopt(); $break ./ |
| 2307 | /:$readableName ClassBodyDeclarations:/ |
| 2308 | |
| 2309 | Modifiersopt ::= $empty |
| 2310 | /. $putCase consumeDefaultModifiers(); $break ./ |
| 2311 | Modifiersopt ::= Modifiers |
| 2312 | /.$putCase consumeModifiers(); $break ./ |
| 2313 | /:$readableName Modifiers:/ |
| 2314 | |
| 2315 | BlockStatementsopt ::= $empty |
| 2316 | /.$putCase consumeEmptyBlockStatementsopt(); $break ./ |
| 2317 | BlockStatementsopt -> BlockStatements |
| 2318 | /:$readableName BlockStatements:/ |
| 2319 | |
| 2320 | Dimsopt ::= $empty |
| 2321 | /. $putCase consumeEmptyDimsopt(); $break ./ |
| 2322 | Dimsopt -> Dims |
| 2323 | /:$readableName Dimensions:/ |
| 2324 | |
| 2325 | ArgumentListopt ::= $empty |
| 2326 | /. $putCase consumeEmptyArgumentListopt(); $break ./ |
| 2327 | ArgumentListopt -> ArgumentList |
| 2328 | /:$readableName ArgumentList:/ |
| 2329 | |
| 2330 | MethodHeaderThrowsClauseopt ::= $empty |
| 2331 | MethodHeaderThrowsClauseopt -> MethodHeaderThrowsClause |
| 2332 | /:$readableName MethodHeaderThrowsClause:/ |
| 2333 | |
| 2334 | FormalParameterListopt ::= $empty |
| 2335 | /.$putcase consumeFormalParameterListopt(); $break ./ |
| 2336 | FormalParameterListopt -> FormalParameterList |
| 2337 | /:$readableName FormalParameterList:/ |
| 2338 | |
| 2339 | ClassHeaderImplementsopt ::= $empty |
| 2340 | ClassHeaderImplementsopt -> ClassHeaderImplements |
| 2341 | /:$readableName ClassHeaderImplements:/ |
| 2342 | |
| 2343 | InterfaceMemberDeclarationsopt ::= $empty |
| 2344 | /. $putCase consumeEmptyInterfaceMemberDeclarationsopt(); $break ./ |
| 2345 | InterfaceMemberDeclarationsopt ::= NestedType InterfaceMemberDeclarations |
| 2346 | /. $putCase consumeInterfaceMemberDeclarationsopt(); $break ./ |
| 2347 | /:$readableName InterfaceMemberDeclarations:/ |
| 2348 | |
| 2349 | NestedType ::= $empty |
| 2350 | /.$putCase consumeNestedType(); $break./ |
| 2351 | /:$readableName NestedType:/ |
| 2352 | |
| 2353 | ForInitopt ::= $empty |
| 2354 | /. $putCase consumeEmptyForInitopt(); $break ./ |
| 2355 | ForInitopt -> ForInit |
| 2356 | /:$readableName ForInit:/ |
| 2357 | |
| 2358 | ForUpdateopt ::= $empty |
| 2359 | /. $putCase consumeEmptyForUpdateopt(); $break ./ |
| 2360 | ForUpdateopt -> ForUpdate |
| 2361 | /:$readableName ForUpdate:/ |
| 2362 | |
| 2363 | InterfaceHeaderExtendsopt ::= $empty |
| 2364 | InterfaceHeaderExtendsopt -> InterfaceHeaderExtends |
| 2365 | /:$readableName InterfaceHeaderExtends:/ |
| 2366 | |
| 2367 | Catchesopt ::= $empty |
| 2368 | /. $putCase consumeEmptyCatchesopt(); $break ./ |
| 2369 | Catchesopt -> Catches |
| 2370 | /:$readableName Catches:/ |
| 2371 | |
| 2372 | ----------------------------------------------- |
| 2373 | -- 1.5 features : enum type |
| 2374 | ----------------------------------------------- |
| 2375 | EnumDeclaration ::= EnumHeader EnumBody |
| 2376 | /. $putCase consumeEnumDeclaration(); $break ./ |
| 2377 | /:$readableName EnumDeclaration:/ |
| 2378 | |
| 2379 | EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt |
| 2380 | /. $putCase consumeEnumHeader(); $break ./ |
| 2381 | /:$readableName EnumHeader:/ |
| 2382 | |
| 2383 | EnumHeaderName ::= Modifiersopt 'enum' Identifier |
| 2384 | /. $putCase consumeEnumHeaderName(); $break ./ |
| 2385 | /:$compliance 1.5:/ |
| 2386 | EnumHeaderName ::= Modifiersopt 'enum' Identifier TypeParameters |
| 2387 | /. $putCase consumeEnumHeaderNameWithTypeParameters(); $break ./ |
| 2388 | /:$readableName EnumHeaderName:/ |
| 2389 | /:$compliance 1.5:/ |
| 2390 | |
| 2391 | EnumBody ::= '{' EnumBodyDeclarationsopt '}' |
| 2392 | /. $putCase consumeEnumBodyNoConstants(); $break ./ |
| 2393 | EnumBody ::= '{' ',' EnumBodyDeclarationsopt '}' |
| 2394 | /. $putCase consumeEnumBodyNoConstants(); $break ./ |
| 2395 | EnumBody ::= '{' EnumConstants ',' EnumBodyDeclarationsopt '}' |
| 2396 | /. $putCase consumeEnumBodyWithConstants(); $break ./ |
| 2397 | EnumBody ::= '{' EnumConstants EnumBodyDeclarationsopt '}' |
| 2398 | /. $putCase consumeEnumBodyWithConstants(); $break ./ |
| 2399 | /:$readableName EnumBody:/ |
| 2400 | |
| 2401 | EnumConstants -> EnumConstant |
| 2402 | EnumConstants ::= EnumConstants ',' EnumConstant |
| 2403 | /.$putCase consumeEnumConstants(); $break ./ |
| 2404 | /:$readableName EnumConstants:/ |
| 2405 | |
| 2406 | EnumConstantHeaderName ::= Modifiersopt Identifier |
| 2407 | /.$putCase consumeEnumConstantHeaderName(); $break ./ |
| 2408 | /:$readableName EnumConstantHeaderName:/ |
| 2409 | |
| 2410 | EnumConstantHeader ::= EnumConstantHeaderName ForceNoDiet Argumentsopt RestoreDiet |
| 2411 | /.$putCase consumeEnumConstantHeader(); $break ./ |
| 2412 | /:$readableName EnumConstantHeader:/ |
| 2413 | |