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