| 1 | |
|
| 2 | |
|
| 3 | |
package org.apache.commons.flatfile.dsl; |
| 4 | |
|
| 5 | |
import java.io.IOException; |
| 6 | |
import java.util.Map; |
| 7 | |
|
| 8 | |
import org.apache.commons.flatfile.*; |
| 9 | |
|
| 10 | |
import antlr.TokenBuffer; |
| 11 | |
import antlr.TokenStreamException; |
| 12 | |
import antlr.TokenStreamIOException; |
| 13 | |
import antlr.ANTLRException; |
| 14 | |
import antlr.LLkParser; |
| 15 | |
import antlr.Token; |
| 16 | |
import antlr.TokenStream; |
| 17 | |
import antlr.RecognitionException; |
| 18 | |
import antlr.NoViableAltException; |
| 19 | |
import antlr.MismatchedTokenException; |
| 20 | |
import antlr.SemanticException; |
| 21 | |
import antlr.ParserSharedInputState; |
| 22 | |
import antlr.collections.impl.BitSet; |
| 23 | |
import antlr.collections.AST; |
| 24 | |
import java.util.Hashtable; |
| 25 | |
import antlr.ASTFactory; |
| 26 | |
import antlr.ASTPair; |
| 27 | |
import antlr.collections.impl.ASTArray; |
| 28 | |
|
| 29 | |
public class EntityParser extends antlr.LLkParser implements EntityTokenTypes |
| 30 | |
{ |
| 31 | |
|
| 32 | |
protected EntityParser(TokenBuffer tokenBuf, int k) { |
| 33 | 192 | super(tokenBuf,k); |
| 34 | 192 | tokenNames = _tokenNames; |
| 35 | 192 | buildTokenTypeASTClassMap(); |
| 36 | 192 | astFactory = new ASTFactory(getTokenTypeToASTClassMap()); |
| 37 | 192 | } |
| 38 | |
|
| 39 | |
public EntityParser(TokenBuffer tokenBuf) { |
| 40 | 192 | this(tokenBuf,2); |
| 41 | 192 | } |
| 42 | |
|
| 43 | |
protected EntityParser(TokenStream lexer, int k) { |
| 44 | 0 | super(lexer,k); |
| 45 | 0 | tokenNames = _tokenNames; |
| 46 | 0 | buildTokenTypeASTClassMap(); |
| 47 | 0 | astFactory = new ASTFactory(getTokenTypeToASTClassMap()); |
| 48 | 0 | } |
| 49 | |
|
| 50 | |
public EntityParser(TokenStream lexer) { |
| 51 | 0 | this(lexer,2); |
| 52 | 0 | } |
| 53 | |
|
| 54 | |
public EntityParser(ParserSharedInputState state) { |
| 55 | 0 | super(state,2); |
| 56 | 0 | tokenNames = _tokenNames; |
| 57 | 0 | buildTokenTypeASTClassMap(); |
| 58 | 0 | astFactory = new ASTFactory(getTokenTypeToASTClassMap()); |
| 59 | 0 | } |
| 60 | |
|
| 61 | |
public final void parse() throws RecognitionException, TokenStreamException { |
| 62 | |
|
| 63 | 192 | returnAST = null; |
| 64 | 192 | ASTPair currentAST = new ASTPair(); |
| 65 | 192 | AST parse_AST = null; |
| 66 | |
|
| 67 | |
{ |
| 68 | |
_loop3: |
| 69 | |
do { |
| 70 | 210 | if ((LA(1)==OPTION_BLOCK)) { |
| 71 | 18 | optionBlock(); |
| 72 | 18 | astFactory.addASTChild(currentAST, returnAST); |
| 73 | |
} |
| 74 | |
else { |
| 75 | |
break _loop3; |
| 76 | |
} |
| 77 | |
|
| 78 | 6 | } while (true); |
| 79 | |
} |
| 80 | |
{ |
| 81 | 192 | int _cnt6=0; |
| 82 | |
_loop6: |
| 83 | |
do { |
| 84 | 1830 | if ((LA(1)==IDENT)) { |
| 85 | 1638 | explicitAssign(); |
| 86 | 1638 | astFactory.addASTChild(currentAST, returnAST); |
| 87 | |
{ |
| 88 | 1638 | switch ( LA(1)) { |
| 89 | |
case COLON: |
| 90 | |
{ |
| 91 | 60 | lengthcheck(); |
| 92 | 60 | astFactory.addASTChild(currentAST, returnAST); |
| 93 | 60 | break; |
| 94 | |
} |
| 95 | |
case EOF: |
| 96 | |
case IDENT: |
| 97 | |
{ |
| 98 | 1578 | break; |
| 99 | |
} |
| 100 | |
default: |
| 101 | |
{ |
| 102 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 103 | |
} |
| 104 | |
} |
| 105 | |
} |
| 106 | 0 | } |
| 107 | |
else { |
| 108 | 192 | if ( _cnt6>=1 ) { break _loop6; } else {throw new NoViableAltException(LT(1), getFilename());} |
| 109 | |
} |
| 110 | |
|
| 111 | 1638 | _cnt6++; |
| 112 | 1638 | } while (true); |
| 113 | |
} |
| 114 | 192 | match(Token.EOF_TYPE); |
| 115 | 192 | parse_AST = (AST)currentAST.root; |
| 116 | 192 | parse_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(ROOT,"root")).add(parse_AST)); |
| 117 | 192 | currentAST.root = parse_AST; |
| 118 | 256 | currentAST.child = parse_AST!=null &&parse_AST.getFirstChild()!=null ? |
| 119 | 64 | parse_AST.getFirstChild() : parse_AST; |
| 120 | 192 | currentAST.advanceChildToEnd(); |
| 121 | 192 | parse_AST = (AST)currentAST.root; |
| 122 | 192 | returnAST = parse_AST; |
| 123 | 192 | } |
| 124 | |
|
| 125 | |
protected final void optionBlock() throws RecognitionException, TokenStreamException { |
| 126 | |
|
| 127 | 18 | returnAST = null; |
| 128 | 18 | ASTPair currentAST = new ASTPair(); |
| 129 | 18 | AST optionBlock_AST = null; |
| 130 | 18 | Token o = null; |
| 131 | 18 | AST o_AST = null; |
| 132 | |
|
| 133 | 18 | o = LT(1); |
| 134 | 18 | o_AST = astFactory.create(o); |
| 135 | 18 | astFactory.makeASTRoot(currentAST, o_AST); |
| 136 | 18 | match(OPTION_BLOCK); |
| 137 | 18 | o_AST.setType(OPTIONS); |
| 138 | |
{ |
| 139 | 18 | int _cnt9=0; |
| 140 | |
_loop9: |
| 141 | |
do { |
| 142 | 42 | if ((_tokenSet_0.member(LA(1)))) { |
| 143 | 24 | entityOption(); |
| 144 | 24 | astFactory.addASTChild(currentAST, returnAST); |
| 145 | 8 | } |
| 146 | |
else { |
| 147 | 18 | if ( _cnt9>=1 ) { break _loop9; } else {throw new NoViableAltException(LT(1), getFilename());} |
| 148 | |
} |
| 149 | |
|
| 150 | 24 | _cnt9++; |
| 151 | 24 | } while (true); |
| 152 | |
} |
| 153 | 18 | match(SEMI); |
| 154 | 18 | optionBlock_AST = (AST)currentAST.root; |
| 155 | 18 | returnAST = optionBlock_AST; |
| 156 | 18 | } |
| 157 | |
|
| 158 | |
protected final void explicitAssign() throws RecognitionException, TokenStreamException { |
| 159 | |
|
| 160 | 2412 | returnAST = null; |
| 161 | 2412 | ASTPair currentAST = new ASTPair(); |
| 162 | 2412 | AST explicitAssign_AST = null; |
| 163 | |
|
| 164 | 2412 | AST tmp3_AST = null; |
| 165 | 2412 | tmp3_AST = astFactory.create(LT(1)); |
| 166 | 2412 | astFactory.addASTChild(currentAST, tmp3_AST); |
| 167 | 2412 | match(IDENT); |
| 168 | 2412 | entity(); |
| 169 | 2412 | astFactory.addASTChild(currentAST, returnAST); |
| 170 | 2412 | explicitAssign_AST = (AST)currentAST.root; |
| 171 | 2412 | explicitAssign_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(ASSIGN,"=")).add(explicitAssign_AST)); |
| 172 | 2412 | currentAST.root = explicitAssign_AST; |
| 173 | 3216 | currentAST.child = explicitAssign_AST!=null &&explicitAssign_AST.getFirstChild()!=null ? |
| 174 | 804 | explicitAssign_AST.getFirstChild() : explicitAssign_AST; |
| 175 | 2412 | currentAST.advanceChildToEnd(); |
| 176 | 2412 | explicitAssign_AST = (AST)currentAST.root; |
| 177 | 2412 | returnAST = explicitAssign_AST; |
| 178 | 2412 | } |
| 179 | |
|
| 180 | |
protected final void lengthcheck() throws RecognitionException, TokenStreamException { |
| 181 | |
|
| 182 | 60 | returnAST = null; |
| 183 | 60 | ASTPair currentAST = new ASTPair(); |
| 184 | 60 | AST lengthcheck_AST = null; |
| 185 | 60 | Token c = null; |
| 186 | 60 | AST c_AST = null; |
| 187 | |
|
| 188 | 60 | c = LT(1); |
| 189 | 60 | c_AST = astFactory.create(c); |
| 190 | 60 | astFactory.addASTChild(currentAST, c_AST); |
| 191 | 60 | match(COLON); |
| 192 | 60 | c_AST.setType(CHECK); |
| 193 | 60 | length(); |
| 194 | 60 | astFactory.addASTChild(currentAST, returnAST); |
| 195 | 60 | lengthcheck_AST = (AST)currentAST.root; |
| 196 | 60 | returnAST = lengthcheck_AST; |
| 197 | 60 | } |
| 198 | |
|
| 199 | |
protected final void entityOption() throws RecognitionException, TokenStreamException { |
| 200 | |
|
| 201 | 654 | returnAST = null; |
| 202 | 654 | ASTPair currentAST = new ASTPair(); |
| 203 | 654 | AST entityOption_AST = null; |
| 204 | |
|
| 205 | |
{ |
| 206 | 654 | switch ( LA(1)) { |
| 207 | |
case IDENT: |
| 208 | |
{ |
| 209 | 624 | AST tmp4_AST = null; |
| 210 | 624 | tmp4_AST = astFactory.create(LT(1)); |
| 211 | 624 | astFactory.addASTChild(currentAST, tmp4_AST); |
| 212 | 624 | match(IDENT); |
| 213 | 624 | break; |
| 214 | |
} |
| 215 | |
case STRING_LITERAL: |
| 216 | |
{ |
| 217 | 30 | AST tmp5_AST = null; |
| 218 | 30 | tmp5_AST = astFactory.create(LT(1)); |
| 219 | 30 | astFactory.addASTChild(currentAST, tmp5_AST); |
| 220 | 30 | match(STRING_LITERAL); |
| 221 | 30 | break; |
| 222 | |
} |
| 223 | |
case CHAR_LITERAL: |
| 224 | |
{ |
| 225 | 0 | AST tmp6_AST = null; |
| 226 | 0 | tmp6_AST = astFactory.create(LT(1)); |
| 227 | 0 | astFactory.addASTChild(currentAST, tmp6_AST); |
| 228 | 0 | match(CHAR_LITERAL); |
| 229 | 0 | break; |
| 230 | |
} |
| 231 | |
case NUMBER: |
| 232 | |
{ |
| 233 | 0 | AST tmp7_AST = null; |
| 234 | 0 | tmp7_AST = astFactory.create(LT(1)); |
| 235 | 0 | astFactory.addASTChild(currentAST, tmp7_AST); |
| 236 | 0 | match(NUMBER); |
| 237 | 0 | break; |
| 238 | |
} |
| 239 | |
default: |
| 240 | |
{ |
| 241 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 242 | |
} |
| 243 | |
} |
| 244 | |
} |
| 245 | 654 | AST tmp8_AST = null; |
| 246 | 654 | tmp8_AST = astFactory.create(LT(1)); |
| 247 | 654 | astFactory.makeASTRoot(currentAST, tmp8_AST); |
| 248 | 654 | match(ASSIGN); |
| 249 | |
{ |
| 250 | 654 | switch ( LA(1)) { |
| 251 | |
case IDENT: |
| 252 | |
{ |
| 253 | 372 | AST tmp9_AST = null; |
| 254 | 372 | tmp9_AST = astFactory.create(LT(1)); |
| 255 | 372 | astFactory.addASTChild(currentAST, tmp9_AST); |
| 256 | 372 | match(IDENT); |
| 257 | 372 | break; |
| 258 | |
} |
| 259 | |
case STRING_LITERAL: |
| 260 | |
{ |
| 261 | 42 | AST tmp10_AST = null; |
| 262 | 42 | tmp10_AST = astFactory.create(LT(1)); |
| 263 | 42 | astFactory.addASTChild(currentAST, tmp10_AST); |
| 264 | 42 | match(STRING_LITERAL); |
| 265 | 42 | break; |
| 266 | |
} |
| 267 | |
case CHAR_LITERAL: |
| 268 | |
{ |
| 269 | 240 | AST tmp11_AST = null; |
| 270 | 240 | tmp11_AST = astFactory.create(LT(1)); |
| 271 | 240 | astFactory.addASTChild(currentAST, tmp11_AST); |
| 272 | 240 | match(CHAR_LITERAL); |
| 273 | 240 | break; |
| 274 | |
} |
| 275 | |
case NUMBER: |
| 276 | |
{ |
| 277 | 0 | AST tmp12_AST = null; |
| 278 | 0 | tmp12_AST = astFactory.create(LT(1)); |
| 279 | 0 | astFactory.addASTChild(currentAST, tmp12_AST); |
| 280 | 0 | match(NUMBER); |
| 281 | 0 | break; |
| 282 | |
} |
| 283 | |
default: |
| 284 | |
{ |
| 285 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 286 | |
} |
| 287 | |
} |
| 288 | |
} |
| 289 | 654 | entityOption_AST = (AST)currentAST.root; |
| 290 | 654 | returnAST = entityOption_AST; |
| 291 | 654 | } |
| 292 | |
|
| 293 | |
protected final void entity() throws RecognitionException, TokenStreamException { |
| 294 | |
|
| 295 | 2604 | returnAST = null; |
| 296 | 2604 | ASTPair currentAST = new ASTPair(); |
| 297 | 2604 | AST entity_AST = null; |
| 298 | 2604 | String junk = null; |
| 299 | |
|
| 300 | 2604 | switch ( LA(1)) { |
| 301 | |
case CHAR_LITERAL: |
| 302 | |
case STRING_LITERAL: |
| 303 | |
{ |
| 304 | 432 | valueOnlyEntity(); |
| 305 | 432 | astFactory.addASTChild(currentAST, returnAST); |
| 306 | 432 | entity_AST = (AST)currentAST.root; |
| 307 | 432 | break; |
| 308 | |
} |
| 309 | |
case TYPEREF: |
| 310 | |
{ |
| 311 | 108 | junk=typeRefEntity(); |
| 312 | 108 | astFactory.addASTChild(currentAST, returnAST); |
| 313 | 108 | entity_AST = (AST)currentAST.root; |
| 314 | 108 | break; |
| 315 | |
} |
| 316 | |
case LPAREN: |
| 317 | |
case LCURLY: |
| 318 | |
{ |
| 319 | 2064 | fieldOrMapEntity(); |
| 320 | 2064 | astFactory.addASTChild(currentAST, returnAST); |
| 321 | 2064 | entity_AST = (AST)currentAST.root; |
| 322 | 2064 | break; |
| 323 | |
} |
| 324 | |
default: |
| 325 | |
{ |
| 326 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 327 | |
} |
| 328 | |
} |
| 329 | 2604 | returnAST = entity_AST; |
| 330 | 2604 | } |
| 331 | |
|
| 332 | |
protected final void anonymousAssign() throws RecognitionException, TokenStreamException { |
| 333 | |
|
| 334 | 192 | returnAST = null; |
| 335 | 192 | ASTPair currentAST = new ASTPair(); |
| 336 | 192 | AST anonymousAssign_AST = null; |
| 337 | |
|
| 338 | 192 | AST tmp13_AST = null; |
| 339 | 192 | tmp13_AST = astFactory.create(LT(1)); |
| 340 | 192 | astFactory.addASTChild(currentAST, tmp13_AST); |
| 341 | 192 | match(ANON); |
| 342 | 192 | entity(); |
| 343 | 192 | astFactory.addASTChild(currentAST, returnAST); |
| 344 | 192 | anonymousAssign_AST = (AST)currentAST.root; |
| 345 | 192 | anonymousAssign_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(ASSIGN,"=")).add(anonymousAssign_AST)); |
| 346 | 192 | currentAST.root = anonymousAssign_AST; |
| 347 | 256 | currentAST.child = anonymousAssign_AST!=null &&anonymousAssign_AST.getFirstChild()!=null ? |
| 348 | 64 | anonymousAssign_AST.getFirstChild() : anonymousAssign_AST; |
| 349 | 192 | currentAST.advanceChildToEnd(); |
| 350 | 192 | anonymousAssign_AST = (AST)currentAST.root; |
| 351 | 192 | returnAST = anonymousAssign_AST; |
| 352 | 192 | } |
| 353 | |
|
| 354 | |
protected final void length() throws RecognitionException, TokenStreamException { |
| 355 | |
|
| 356 | 1296 | returnAST = null; |
| 357 | 1296 | ASTPair currentAST = new ASTPair(); |
| 358 | 1296 | AST length_AST = null; |
| 359 | 1296 | Token n = null; |
| 360 | 1296 | AST n_AST = null; |
| 361 | |
|
| 362 | 1296 | n = LT(1); |
| 363 | 1296 | n_AST = astFactory.create(n); |
| 364 | 1296 | astFactory.addASTChild(currentAST, n_AST); |
| 365 | 1296 | match(NUMBER); |
| 366 | 1296 | n_AST.setType(LENGTH); |
| 367 | 1296 | length_AST = (AST)currentAST.root; |
| 368 | 1296 | returnAST = length_AST; |
| 369 | 1296 | } |
| 370 | |
|
| 371 | |
protected final void valueOnlyEntity() throws RecognitionException, TokenStreamException { |
| 372 | |
|
| 373 | 432 | returnAST = null; |
| 374 | 432 | ASTPair currentAST = new ASTPair(); |
| 375 | 432 | AST valueOnlyEntity_AST = null; |
| 376 | 432 | AST a_AST = null; |
| 377 | 432 | AST ast = null; |
| 378 | |
|
| 379 | 432 | explicitValue(); |
| 380 | 432 | astFactory.addASTChild(currentAST, returnAST); |
| 381 | 432 | valueOnlyEntity_AST = (AST)currentAST.root; |
| 382 | 432 | valueOnlyEntity_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(FIELD,"field")).add(valueOnlyEntity_AST)); ast = valueOnlyEntity_AST; |
| 383 | 432 | currentAST.root = valueOnlyEntity_AST; |
| 384 | 576 | currentAST.child = valueOnlyEntity_AST!=null &&valueOnlyEntity_AST.getFirstChild()!=null ? |
| 385 | 144 | valueOnlyEntity_AST.getFirstChild() : valueOnlyEntity_AST; |
| 386 | 432 | currentAST.advanceChildToEnd(); |
| 387 | |
{ |
| 388 | 432 | switch ( LA(1)) { |
| 389 | |
case BANG: |
| 390 | |
{ |
| 391 | 144 | immutable(); |
| 392 | 144 | astFactory.addASTChild(currentAST, returnAST); |
| 393 | 144 | break; |
| 394 | |
} |
| 395 | |
case EOF: |
| 396 | |
case IDENT: |
| 397 | |
case ANON: |
| 398 | |
case COLON: |
| 399 | |
case TYPEREF: |
| 400 | |
case LBRACK: |
| 401 | |
case COMMA: |
| 402 | |
case RCURLY: |
| 403 | |
{ |
| 404 | 288 | break; |
| 405 | |
} |
| 406 | |
default: |
| 407 | |
{ |
| 408 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 409 | |
} |
| 410 | |
} |
| 411 | |
} |
| 412 | |
{ |
| 413 | 432 | switch ( LA(1)) { |
| 414 | |
case LBRACK: |
| 415 | |
{ |
| 416 | 30 | array(ast); |
| 417 | 30 | a_AST = (AST)returnAST; |
| 418 | 30 | valueOnlyEntity_AST = (AST)currentAST.root; |
| 419 | 30 | valueOnlyEntity_AST = a_AST; |
| 420 | 30 | currentAST.root = valueOnlyEntity_AST; |
| 421 | 40 | currentAST.child = valueOnlyEntity_AST!=null &&valueOnlyEntity_AST.getFirstChild()!=null ? |
| 422 | 10 | valueOnlyEntity_AST.getFirstChild() : valueOnlyEntity_AST; |
| 423 | 30 | currentAST.advanceChildToEnd(); |
| 424 | 30 | break; |
| 425 | |
} |
| 426 | |
case EOF: |
| 427 | |
case IDENT: |
| 428 | |
case ANON: |
| 429 | |
case COLON: |
| 430 | |
case TYPEREF: |
| 431 | |
case COMMA: |
| 432 | |
case RCURLY: |
| 433 | |
{ |
| 434 | 402 | break; |
| 435 | |
} |
| 436 | |
default: |
| 437 | |
{ |
| 438 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 439 | |
} |
| 440 | |
} |
| 441 | |
} |
| 442 | 432 | valueOnlyEntity_AST = (AST)currentAST.root; |
| 443 | 432 | returnAST = valueOnlyEntity_AST; |
| 444 | 432 | } |
| 445 | |
|
| 446 | |
protected final String typeRefEntity() throws RecognitionException, TokenStreamException { |
| 447 | |
String name; |
| 448 | |
|
| 449 | 162 | returnAST = null; |
| 450 | 162 | ASTPair currentAST = new ASTPair(); |
| 451 | 162 | AST typeRefEntity_AST = null; |
| 452 | 162 | Token t = null; |
| 453 | 162 | AST t_AST = null; |
| 454 | 162 | AST a_AST = null; |
| 455 | 162 | AST ast = null; |
| 456 | |
|
| 457 | |
{ |
| 458 | 162 | t = LT(1); |
| 459 | 162 | t_AST = astFactory.create(t); |
| 460 | 162 | astFactory.makeASTRoot(currentAST, t_AST); |
| 461 | 162 | match(TYPEREF); |
| 462 | 162 | name = t.getText(); |
| 463 | |
{ |
| 464 | 162 | if ((_tokenSet_0.member(LA(1))) && (LA(2)==ASSIGN)) { |
| 465 | 0 | entityOptions(); |
| 466 | 0 | astFactory.addASTChild(currentAST, returnAST); |
| 467 | 0 | } |
| 468 | 162 | else if ((_tokenSet_1.member(LA(1))) && (_tokenSet_2.member(LA(2)))) { |
| 469 | |
} |
| 470 | |
else { |
| 471 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 472 | |
} |
| 473 | |
|
| 474 | |
} |
| 475 | |
{ |
| 476 | 162 | switch ( LA(1)) { |
| 477 | |
case CHAR_LITERAL: |
| 478 | |
case STRING_LITERAL: |
| 479 | |
{ |
| 480 | 36 | value(); |
| 481 | 36 | astFactory.addASTChild(currentAST, returnAST); |
| 482 | 36 | break; |
| 483 | |
} |
| 484 | |
case EOF: |
| 485 | |
case IDENT: |
| 486 | |
case ANON: |
| 487 | |
case COLON: |
| 488 | |
case TYPEREF: |
| 489 | |
case LBRACK: |
| 490 | |
case COMMA: |
| 491 | |
case RCURLY: |
| 492 | |
{ |
| 493 | 126 | break; |
| 494 | |
} |
| 495 | |
default: |
| 496 | |
{ |
| 497 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 498 | |
} |
| 499 | |
} |
| 500 | |
} |
| 501 | |
} |
| 502 | 162 | typeRefEntity_AST = (AST)currentAST.root; |
| 503 | 162 | ast = typeRefEntity_AST; |
| 504 | |
{ |
| 505 | 162 | switch ( LA(1)) { |
| 506 | |
case LBRACK: |
| 507 | |
{ |
| 508 | 60 | array(ast); |
| 509 | 60 | a_AST = (AST)returnAST; |
| 510 | 60 | typeRefEntity_AST = (AST)currentAST.root; |
| 511 | 60 | typeRefEntity_AST = a_AST; |
| 512 | 60 | currentAST.root = typeRefEntity_AST; |
| 513 | 80 | currentAST.child = typeRefEntity_AST!=null &&typeRefEntity_AST.getFirstChild()!=null ? |
| 514 | 20 | typeRefEntity_AST.getFirstChild() : typeRefEntity_AST; |
| 515 | 60 | currentAST.advanceChildToEnd(); |
| 516 | 60 | break; |
| 517 | |
} |
| 518 | |
case EOF: |
| 519 | |
case IDENT: |
| 520 | |
case ANON: |
| 521 | |
case COLON: |
| 522 | |
case TYPEREF: |
| 523 | |
case COMMA: |
| 524 | |
case RCURLY: |
| 525 | |
{ |
| 526 | 102 | break; |
| 527 | |
} |
| 528 | |
default: |
| 529 | |
{ |
| 530 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 531 | |
} |
| 532 | |
} |
| 533 | |
} |
| 534 | 162 | typeRefEntity_AST = (AST)currentAST.root; |
| 535 | 162 | returnAST = typeRefEntity_AST; |
| 536 | 162 | return name; |
| 537 | |
} |
| 538 | |
|
| 539 | |
protected final void fieldOrMapEntity() throws RecognitionException, TokenStreamException { |
| 540 | |
|
| 541 | 2064 | returnAST = null; |
| 542 | 2064 | ASTPair currentAST = new ASTPair(); |
| 543 | 2064 | AST fieldOrMapEntity_AST = null; |
| 544 | 2064 | AST a_AST = null; |
| 545 | 2064 | AST ast = null; |
| 546 | |
|
| 547 | |
{ |
| 548 | 2064 | switch ( LA(1)) { |
| 549 | |
case LPAREN: |
| 550 | |
{ |
| 551 | 1800 | field(); |
| 552 | 1800 | astFactory.addASTChild(currentAST, returnAST); |
| 553 | 1800 | break; |
| 554 | |
} |
| 555 | |
case LCURLY: |
| 556 | |
{ |
| 557 | 264 | map(); |
| 558 | 264 | astFactory.addASTChild(currentAST, returnAST); |
| 559 | 264 | break; |
| 560 | |
} |
| 561 | |
default: |
| 562 | |
{ |
| 563 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 564 | |
} |
| 565 | |
} |
| 566 | |
} |
| 567 | 2064 | fieldOrMapEntity_AST = (AST)currentAST.root; |
| 568 | 2064 | ast = fieldOrMapEntity_AST; |
| 569 | |
{ |
| 570 | 2064 | switch ( LA(1)) { |
| 571 | |
case LBRACK: |
| 572 | |
{ |
| 573 | 642 | array(ast); |
| 574 | 642 | a_AST = (AST)returnAST; |
| 575 | 642 | fieldOrMapEntity_AST = (AST)currentAST.root; |
| 576 | 642 | fieldOrMapEntity_AST = a_AST; |
| 577 | 642 | currentAST.root = fieldOrMapEntity_AST; |
| 578 | 856 | currentAST.child = fieldOrMapEntity_AST!=null &&fieldOrMapEntity_AST.getFirstChild()!=null ? |
| 579 | 214 | fieldOrMapEntity_AST.getFirstChild() : fieldOrMapEntity_AST; |
| 580 | 642 | currentAST.advanceChildToEnd(); |
| 581 | 642 | break; |
| 582 | |
} |
| 583 | |
case EOF: |
| 584 | |
case IDENT: |
| 585 | |
case ANON: |
| 586 | |
case COLON: |
| 587 | |
case TYPEREF: |
| 588 | |
case COMMA: |
| 589 | |
case RCURLY: |
| 590 | |
{ |
| 591 | 1422 | break; |
| 592 | |
} |
| 593 | |
default: |
| 594 | |
{ |
| 595 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 596 | |
} |
| 597 | |
} |
| 598 | |
} |
| 599 | 2064 | fieldOrMapEntity_AST = (AST)currentAST.root; |
| 600 | 2064 | returnAST = fieldOrMapEntity_AST; |
| 601 | 2064 | } |
| 602 | |
|
| 603 | |
protected final void explicitValue() throws RecognitionException, TokenStreamException { |
| 604 | |
|
| 605 | 882 | returnAST = null; |
| 606 | 882 | ASTPair currentAST = new ASTPair(); |
| 607 | 882 | AST explicitValue_AST = null; |
| 608 | 882 | Token c = null; |
| 609 | 882 | AST c_AST = null; |
| 610 | 882 | Token s = null; |
| 611 | 882 | AST s_AST = null; |
| 612 | |
|
| 613 | 882 | switch ( LA(1)) { |
| 614 | |
case CHAR_LITERAL: |
| 615 | |
{ |
| 616 | 48 | c = LT(1); |
| 617 | 48 | c_AST = astFactory.create(c); |
| 618 | 48 | astFactory.addASTChild(currentAST, c_AST); |
| 619 | 48 | match(CHAR_LITERAL); |
| 620 | 48 | c_AST.setType(VALUE); |
| 621 | 48 | explicitValue_AST = (AST)currentAST.root; |
| 622 | 48 | break; |
| 623 | |
} |
| 624 | |
case STRING_LITERAL: |
| 625 | |
{ |
| 626 | 834 | s = LT(1); |
| 627 | 834 | s_AST = astFactory.create(s); |
| 628 | 834 | astFactory.addASTChild(currentAST, s_AST); |
| 629 | 834 | match(STRING_LITERAL); |
| 630 | 834 | s_AST.setType(VALUE); |
| 631 | 834 | explicitValue_AST = (AST)currentAST.root; |
| 632 | 834 | break; |
| 633 | |
} |
| 634 | |
default: |
| 635 | |
{ |
| 636 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 637 | |
} |
| 638 | |
} |
| 639 | 882 | returnAST = explicitValue_AST; |
| 640 | 882 | } |
| 641 | |
|
| 642 | |
protected final void immutable() throws RecognitionException, TokenStreamException { |
| 643 | |
|
| 644 | 192 | returnAST = null; |
| 645 | 192 | ASTPair currentAST = new ASTPair(); |
| 646 | 192 | AST immutable_AST = null; |
| 647 | 192 | Token b = null; |
| 648 | 192 | AST b_AST = null; |
| 649 | |
|
| 650 | 192 | b = LT(1); |
| 651 | 192 | b_AST = astFactory.create(b); |
| 652 | 192 | astFactory.addASTChild(currentAST, b_AST); |
| 653 | 192 | match(BANG); |
| 654 | 192 | b_AST.setType(IMMUTABLE); |
| 655 | 192 | immutable_AST = (AST)currentAST.root; |
| 656 | 192 | returnAST = immutable_AST; |
| 657 | 192 | } |
| 658 | |
|
| 659 | |
protected final void array( |
| 660 | |
AST p |
| 661 | |
) throws RecognitionException, TokenStreamException { |
| 662 | |
|
| 663 | 732 | returnAST = null; |
| 664 | 732 | ASTPair currentAST = new ASTPair(); |
| 665 | 732 | AST array_AST = null; |
| 666 | 732 | Token a = null; |
| 667 | 732 | AST a_AST = null; |
| 668 | 732 | AST o_AST = null; |
| 669 | 732 | AST v_AST = null; |
| 670 | |
|
| 671 | 732 | a = LT(1); |
| 672 | 732 | a_AST = astFactory.create(a); |
| 673 | 732 | astFactory.makeASTRoot(currentAST, a_AST); |
| 674 | 732 | match(LBRACK); |
| 675 | 732 | a_AST.setType(ARRAY); |
| 676 | |
{ |
| 677 | 732 | switch ( LA(1)) { |
| 678 | |
case NUMBER: |
| 679 | |
case RANGE: |
| 680 | |
{ |
| 681 | 636 | arrayLength(); |
| 682 | 636 | astFactory.addASTChild(currentAST, returnAST); |
| 683 | 636 | break; |
| 684 | |
} |
| 685 | |
case RBRACK: |
| 686 | |
{ |
| 687 | 96 | break; |
| 688 | |
} |
| 689 | |
default: |
| 690 | |
{ |
| 691 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 692 | |
} |
| 693 | |
} |
| 694 | |
} |
| 695 | 732 | match(RBRACK); |
| 696 | 732 | array_AST = (AST)currentAST.root; |
| 697 | 732 | array_AST.addChild((AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(PROTOTYPE,"prototype")).add(p))); |
| 698 | |
{ |
| 699 | 732 | if ((_tokenSet_0.member(LA(1))) && (LA(2)==ASSIGN)) { |
| 700 | 204 | entityOptions(); |
| 701 | 204 | o_AST = (AST)returnAST; |
| 702 | 204 | array_AST = (AST)currentAST.root; |
| 703 | 204 | array_AST.addChild(o_AST); |
| 704 | 68 | } |
| 705 | 528 | else if ((_tokenSet_3.member(LA(1))) && (_tokenSet_4.member(LA(2)))) { |
| 706 | |
} |
| 707 | |
else { |
| 708 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 709 | |
} |
| 710 | |
|
| 711 | |
} |
| 712 | |
{ |
| 713 | 732 | switch ( LA(1)) { |
| 714 | |
case CHAR_LITERAL: |
| 715 | |
case STRING_LITERAL: |
| 716 | |
{ |
| 717 | 78 | value(); |
| 718 | 78 | v_AST = (AST)returnAST; |
| 719 | 78 | array_AST = (AST)currentAST.root; |
| 720 | 78 | array_AST.addChild(v_AST); |
| 721 | 78 | break; |
| 722 | |
} |
| 723 | |
case EOF: |
| 724 | |
case IDENT: |
| 725 | |
case ANON: |
| 726 | |
case COLON: |
| 727 | |
case TYPEREF: |
| 728 | |
case COMMA: |
| 729 | |
case RCURLY: |
| 730 | |
{ |
| 731 | 654 | break; |
| 732 | |
} |
| 733 | |
default: |
| 734 | |
{ |
| 735 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 736 | |
} |
| 737 | |
} |
| 738 | |
} |
| 739 | 732 | array_AST = (AST)currentAST.root; |
| 740 | 732 | returnAST = array_AST; |
| 741 | 732 | } |
| 742 | |
|
| 743 | |
protected final void entityOptions() throws RecognitionException, TokenStreamException { |
| 744 | |
|
| 745 | 348 | returnAST = null; |
| 746 | 348 | ASTPair currentAST = new ASTPair(); |
| 747 | 348 | AST entityOptions_AST = null; |
| 748 | |
|
| 749 | |
{ |
| 750 | 348 | int _cnt53=0; |
| 751 | |
_loop53: |
| 752 | |
do { |
| 753 | 978 | if ((_tokenSet_0.member(LA(1))) && (LA(2)==ASSIGN)) { |
| 754 | 630 | entityOption(); |
| 755 | 630 | astFactory.addASTChild(currentAST, returnAST); |
| 756 | 210 | } |
| 757 | |
else { |
| 758 | 348 | if ( _cnt53>=1 ) { break _loop53; } else {throw new NoViableAltException(LT(1), getFilename());} |
| 759 | |
} |
| 760 | |
|
| 761 | 630 | _cnt53++; |
| 762 | 630 | } while (true); |
| 763 | |
} |
| 764 | 348 | entityOptions_AST = (AST)currentAST.root; |
| 765 | 348 | entityOptions_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(OPTIONS,"options")).add(entityOptions_AST)); |
| 766 | 348 | currentAST.root = entityOptions_AST; |
| 767 | 464 | currentAST.child = entityOptions_AST!=null &&entityOptions_AST.getFirstChild()!=null ? |
| 768 | 116 | entityOptions_AST.getFirstChild() : entityOptions_AST; |
| 769 | 348 | currentAST.advanceChildToEnd(); |
| 770 | 348 | entityOptions_AST = (AST)currentAST.root; |
| 771 | 348 | returnAST = entityOptions_AST; |
| 772 | 348 | } |
| 773 | |
|
| 774 | |
protected final void value() throws RecognitionException, TokenStreamException { |
| 775 | |
|
| 776 | 582 | returnAST = null; |
| 777 | 582 | ASTPair currentAST = new ASTPair(); |
| 778 | 582 | AST value_AST = null; |
| 779 | |
|
| 780 | |
{ |
| 781 | 582 | if ((LA(1)==CHAR_LITERAL) && (LA(2)==STAR)) { |
| 782 | 132 | fillValue(); |
| 783 | 132 | astFactory.addASTChild(currentAST, returnAST); |
| 784 | 44 | } |
| 785 | 450 | else if ((LA(1)==CHAR_LITERAL||LA(1)==STRING_LITERAL) && (_tokenSet_5.member(LA(2)))) { |
| 786 | 450 | explicitValue(); |
| 787 | 450 | astFactory.addASTChild(currentAST, returnAST); |
| 788 | 150 | } |
| 789 | |
else { |
| 790 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 791 | |
} |
| 792 | |
|
| 793 | |
} |
| 794 | |
{ |
| 795 | 582 | switch ( LA(1)) { |
| 796 | |
case BANG: |
| 797 | |
{ |
| 798 | 48 | immutable(); |
| 799 | 48 | astFactory.addASTChild(currentAST, returnAST); |
| 800 | 48 | break; |
| 801 | |
} |
| 802 | |
case EOF: |
| 803 | |
case IDENT: |
| 804 | |
case ANON: |
| 805 | |
case COLON: |
| 806 | |
case TYPEREF: |
| 807 | |
case LBRACK: |
| 808 | |
case COMMA: |
| 809 | |
case RCURLY: |
| 810 | |
{ |
| 811 | 534 | break; |
| 812 | |
} |
| 813 | |
default: |
| 814 | |
{ |
| 815 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 816 | |
} |
| 817 | |
} |
| 818 | |
} |
| 819 | 582 | value_AST = (AST)currentAST.root; |
| 820 | 582 | returnAST = value_AST; |
| 821 | 582 | } |
| 822 | |
|
| 823 | |
protected final void field() throws RecognitionException, TokenStreamException { |
| 824 | |
|
| 825 | 1800 | returnAST = null; |
| 826 | 1800 | ASTPair currentAST = new ASTPair(); |
| 827 | 1800 | AST field_AST = null; |
| 828 | |
|
| 829 | 1800 | match(LPAREN); |
| 830 | |
{ |
| 831 | 1800 | switch ( LA(1)) { |
| 832 | |
case NUMBER: |
| 833 | |
case RANGE: |
| 834 | |
{ |
| 835 | 1380 | arrayLength(); |
| 836 | 1380 | astFactory.addASTChild(currentAST, returnAST); |
| 837 | 1380 | break; |
| 838 | |
} |
| 839 | |
case STAR: |
| 840 | |
{ |
| 841 | 420 | unboundedDynamicField(); |
| 842 | 420 | astFactory.addASTChild(currentAST, returnAST); |
| 843 | 420 | break; |
| 844 | |
} |
| 845 | |
default: |
| 846 | |
{ |
| 847 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 848 | |
} |
| 849 | |
} |
| 850 | |
} |
| 851 | 1800 | match(RPAREN); |
| 852 | |
{ |
| 853 | 1800 | if ((_tokenSet_0.member(LA(1))) && (LA(2)==ASSIGN)) { |
| 854 | 102 | entityOptions(); |
| 855 | 102 | astFactory.addASTChild(currentAST, returnAST); |
| 856 | 34 | } |
| 857 | 1698 | else if ((_tokenSet_1.member(LA(1))) && (_tokenSet_2.member(LA(2)))) { |
| 858 | |
} |
| 859 | |
else { |
| 860 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 861 | |
} |
| 862 | |
|
| 863 | |
} |
| 864 | |
{ |
| 865 | 1800 | switch ( LA(1)) { |
| 866 | |
case CHAR_LITERAL: |
| 867 | |
case STRING_LITERAL: |
| 868 | |
{ |
| 869 | 354 | value(); |
| 870 | 354 | astFactory.addASTChild(currentAST, returnAST); |
| 871 | 354 | break; |
| 872 | |
} |
| 873 | |
case EOF: |
| 874 | |
case IDENT: |
| 875 | |
case ANON: |
| 876 | |
case COLON: |
| 877 | |
case TYPEREF: |
| 878 | |
case LBRACK: |
| 879 | |
case COMMA: |
| 880 | |
case RCURLY: |
| 881 | |
{ |
| 882 | 1446 | break; |
| 883 | |
} |
| 884 | |
default: |
| 885 | |
{ |
| 886 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 887 | |
} |
| 888 | |
} |
| 889 | |
} |
| 890 | 1800 | field_AST = (AST)currentAST.root; |
| 891 | 1800 | field_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(FIELD,"field")).add(field_AST)); |
| 892 | 1800 | currentAST.root = field_AST; |
| 893 | 2400 | currentAST.child = field_AST!=null &&field_AST.getFirstChild()!=null ? |
| 894 | 600 | field_AST.getFirstChild() : field_AST; |
| 895 | 1800 | currentAST.advanceChildToEnd(); |
| 896 | 1800 | field_AST = (AST)currentAST.root; |
| 897 | 1800 | returnAST = field_AST; |
| 898 | 1800 | } |
| 899 | |
|
| 900 | |
protected final void map() throws RecognitionException, TokenStreamException { |
| 901 | |
|
| 902 | 264 | returnAST = null; |
| 903 | 264 | ASTPair currentAST = new ASTPair(); |
| 904 | 264 | AST map_AST = null; |
| 905 | 264 | Token m = null; |
| 906 | 264 | AST m_AST = null; |
| 907 | |
|
| 908 | 264 | m = LT(1); |
| 909 | 264 | m_AST = astFactory.create(m); |
| 910 | 264 | astFactory.makeASTRoot(currentAST, m_AST); |
| 911 | 264 | match(LCURLY); |
| 912 | 264 | m_AST.setType(MAP); |
| 913 | 264 | mapChild(); |
| 914 | 264 | astFactory.addASTChild(currentAST, returnAST); |
| 915 | |
{ |
| 916 | |
_loop42: |
| 917 | |
do { |
| 918 | 1020 | if ((_tokenSet_6.member(LA(1)))) { |
| 919 | |
{ |
| 920 | 756 | switch ( LA(1)) { |
| 921 | |
case COMMA: |
| 922 | |
{ |
| 923 | 54 | match(COMMA); |
| 924 | 54 | break; |
| 925 | |
} |
| 926 | |
case IDENT: |
| 927 | |
case ANON: |
| 928 | |
case TYPEREF: |
| 929 | |
{ |
| 930 | 702 | break; |
| 931 | |
} |
| 932 | |
default: |
| 933 | |
{ |
| 934 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 935 | |
} |
| 936 | |
} |
| 937 | |
} |
| 938 | 756 | mapChild(); |
| 939 | 756 | astFactory.addASTChild(currentAST, returnAST); |
| 940 | |
} |
| 941 | |
else { |
| 942 | |
break _loop42; |
| 943 | |
} |
| 944 | |
|
| 945 | 252 | } while (true); |
| 946 | |
} |
| 947 | 264 | match(RCURLY); |
| 948 | |
{ |
| 949 | 264 | if ((_tokenSet_0.member(LA(1))) && (LA(2)==ASSIGN)) { |
| 950 | 42 | entityOptions(); |
| 951 | 42 | astFactory.addASTChild(currentAST, returnAST); |
| 952 | 14 | } |
| 953 | 222 | else if ((_tokenSet_1.member(LA(1))) && (_tokenSet_2.member(LA(2)))) { |
| 954 | |
} |
| 955 | |
else { |
| 956 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 957 | |
} |
| 958 | |
|
| 959 | |
} |
| 960 | |
{ |
| 961 | 264 | switch ( LA(1)) { |
| 962 | |
case CHAR_LITERAL: |
| 963 | |
case STRING_LITERAL: |
| 964 | |
{ |
| 965 | 114 | value(); |
| 966 | 114 | astFactory.addASTChild(currentAST, returnAST); |
| 967 | 114 | break; |
| 968 | |
} |
| 969 | |
case EOF: |
| 970 | |
case IDENT: |
| 971 | |
case ANON: |
| 972 | |
case COLON: |
| 973 | |
case TYPEREF: |
| 974 | |
case LBRACK: |
| 975 | |
case COMMA: |
| 976 | |
case RCURLY: |
| 977 | |
{ |
| 978 | 150 | break; |
| 979 | |
} |
| 980 | |
default: |
| 981 | |
{ |
| 982 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 983 | |
} |
| 984 | |
} |
| 985 | |
} |
| 986 | 264 | map_AST = (AST)currentAST.root; |
| 987 | 264 | returnAST = map_AST; |
| 988 | 264 | } |
| 989 | |
|
| 990 | |
protected final void arrayLength() throws RecognitionException, TokenStreamException { |
| 991 | |
|
| 992 | 2016 | returnAST = null; |
| 993 | 2016 | ASTPair currentAST = new ASTPair(); |
| 994 | 2016 | AST arrayLength_AST = null; |
| 995 | 2016 | Token n = null; |
| 996 | 2016 | AST n_AST = null; |
| 997 | 2016 | Token n2 = null; |
| 998 | 2016 | AST n2_AST = null; |
| 999 | 2016 | Token n3 = null; |
| 1000 | 2016 | AST n3_AST = null; |
| 1001 | |
|
| 1002 | 2016 | if ((LA(1)==NUMBER) && (LA(2)==RANGE)) { |
| 1003 | 606 | n = LT(1); |
| 1004 | 606 | n_AST = astFactory.create(n); |
| 1005 | 606 | astFactory.addASTChild(currentAST, n_AST); |
| 1006 | 606 | match(NUMBER); |
| 1007 | 606 | n_AST.setType(MIN); |
| 1008 | 606 | AST tmp19_AST = null; |
| 1009 | 606 | tmp19_AST = astFactory.create(LT(1)); |
| 1010 | 606 | astFactory.makeASTRoot(currentAST, tmp19_AST); |
| 1011 | 606 | match(RANGE); |
| 1012 | |
{ |
| 1013 | 606 | switch ( LA(1)) { |
| 1014 | |
case NUMBER: |
| 1015 | |
{ |
| 1016 | 516 | n2 = LT(1); |
| 1017 | 516 | n2_AST = astFactory.create(n2); |
| 1018 | 516 | astFactory.addASTChild(currentAST, n2_AST); |
| 1019 | 516 | match(NUMBER); |
| 1020 | 516 | n2_AST.setType(MAX); |
| 1021 | 516 | break; |
| 1022 | |
} |
| 1023 | |
case RBRACK: |
| 1024 | |
case RPAREN: |
| 1025 | |
{ |
| 1026 | 90 | break; |
| 1027 | |
} |
| 1028 | |
default: |
| 1029 | |
{ |
| 1030 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 1031 | |
} |
| 1032 | |
} |
| 1033 | |
} |
| 1034 | 606 | arrayLength_AST = (AST)currentAST.root; |
| 1035 | 606 | } |
| 1036 | 1410 | else if ((LA(1)==RANGE)) { |
| 1037 | 174 | AST tmp20_AST = null; |
| 1038 | 174 | tmp20_AST = astFactory.create(LT(1)); |
| 1039 | 174 | astFactory.makeASTRoot(currentAST, tmp20_AST); |
| 1040 | 174 | match(RANGE); |
| 1041 | 174 | n3 = LT(1); |
| 1042 | 174 | n3_AST = astFactory.create(n3); |
| 1043 | 174 | astFactory.addASTChild(currentAST, n3_AST); |
| 1044 | 174 | match(NUMBER); |
| 1045 | 174 | n3_AST.setType(MAX); |
| 1046 | 174 | arrayLength_AST = (AST)currentAST.root; |
| 1047 | 174 | } |
| 1048 | 1236 | else if ((LA(1)==NUMBER) && (LA(2)==RBRACK||LA(2)==RPAREN)) { |
| 1049 | 1236 | length(); |
| 1050 | 1236 | astFactory.addASTChild(currentAST, returnAST); |
| 1051 | 1236 | arrayLength_AST = (AST)currentAST.root; |
| 1052 | 412 | } |
| 1053 | |
else { |
| 1054 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 1055 | |
} |
| 1056 | |
|
| 1057 | 2016 | returnAST = arrayLength_AST; |
| 1058 | 2016 | } |
| 1059 | |
|
| 1060 | |
protected final void fillValue() throws RecognitionException, TokenStreamException { |
| 1061 | |
|
| 1062 | 132 | returnAST = null; |
| 1063 | 132 | ASTPair currentAST = new ASTPair(); |
| 1064 | 132 | AST fillValue_AST = null; |
| 1065 | 132 | Token c = null; |
| 1066 | 132 | AST c_AST = null; |
| 1067 | |
|
| 1068 | 132 | c = LT(1); |
| 1069 | 132 | c_AST = astFactory.create(c); |
| 1070 | 132 | astFactory.addASTChild(currentAST, c_AST); |
| 1071 | 132 | match(CHAR_LITERAL); |
| 1072 | 132 | match(STAR); |
| 1073 | 132 | c_AST.setType(ALL); |
| 1074 | 132 | fillValue_AST = (AST)currentAST.root; |
| 1075 | 132 | returnAST = fillValue_AST; |
| 1076 | 132 | } |
| 1077 | |
|
| 1078 | |
protected final void unboundedDynamicField() throws RecognitionException, TokenStreamException { |
| 1079 | |
|
| 1080 | 420 | returnAST = null; |
| 1081 | 420 | ASTPair currentAST = new ASTPair(); |
| 1082 | 420 | AST unboundedDynamicField_AST = null; |
| 1083 | 420 | Token s = null; |
| 1084 | 420 | AST s_AST = null; |
| 1085 | |
|
| 1086 | 420 | s = LT(1); |
| 1087 | 420 | s_AST = astFactory.create(s); |
| 1088 | 420 | astFactory.makeASTRoot(currentAST, s_AST); |
| 1089 | 420 | match(STAR); |
| 1090 | 420 | s_AST.setType(RANGE); |
| 1091 | 420 | unboundedDynamicField_AST = (AST)currentAST.root; |
| 1092 | 420 | returnAST = unboundedDynamicField_AST; |
| 1093 | 420 | } |
| 1094 | |
|
| 1095 | |
protected final void mapChild() throws RecognitionException, TokenStreamException { |
| 1096 | |
|
| 1097 | 1020 | returnAST = null; |
| 1098 | 1020 | ASTPair currentAST = new ASTPair(); |
| 1099 | 1020 | AST mapChild_AST = null; |
| 1100 | |
|
| 1101 | 1020 | switch ( LA(1)) { |
| 1102 | |
case IDENT: |
| 1103 | |
{ |
| 1104 | 774 | explicitAssign(); |
| 1105 | 774 | astFactory.addASTChild(currentAST, returnAST); |
| 1106 | 774 | mapChild_AST = (AST)currentAST.root; |
| 1107 | 774 | break; |
| 1108 | |
} |
| 1109 | |
case ANON: |
| 1110 | |
{ |
| 1111 | 192 | anonymousAssign(); |
| 1112 | 192 | astFactory.addASTChild(currentAST, returnAST); |
| 1113 | 192 | mapChild_AST = (AST)currentAST.root; |
| 1114 | 192 | break; |
| 1115 | |
} |
| 1116 | |
case TYPEREF: |
| 1117 | |
{ |
| 1118 | 54 | implicitTypeAssign(); |
| 1119 | 54 | astFactory.addASTChild(currentAST, returnAST); |
| 1120 | 54 | mapChild_AST = (AST)currentAST.root; |
| 1121 | 54 | break; |
| 1122 | |
} |
| 1123 | |
default: |
| 1124 | |
{ |
| 1125 | 0 | throw new NoViableAltException(LT(1), getFilename()); |
| 1126 | |
} |
| 1127 | |
} |
| 1128 | 1020 | returnAST = mapChild_AST; |
| 1129 | 1020 | } |
| 1130 | |
|
| 1131 | |
protected final void implicitTypeAssign() throws RecognitionException, TokenStreamException { |
| 1132 | |
|
| 1133 | 54 | returnAST = null; |
| 1134 | 54 | ASTPair currentAST = new ASTPair(); |
| 1135 | 54 | AST implicitTypeAssign_AST = null; |
| 1136 | 54 | String name = null; |
| 1137 | |
|
| 1138 | 54 | name=typeRefEntity(); |
| 1139 | 54 | astFactory.addASTChild(currentAST, returnAST); |
| 1140 | 54 | implicitTypeAssign_AST = (AST)currentAST.root; |
| 1141 | 54 | implicitTypeAssign_AST = (AST)astFactory.make( (new ASTArray(3)).add(astFactory.create(ASSIGN)).add(astFactory.create(IDENT,name)).add(implicitTypeAssign_AST)); |
| 1142 | 54 | currentAST.root = implicitTypeAssign_AST; |
| 1143 | 72 | currentAST.child = implicitTypeAssign_AST!=null &&implicitTypeAssign_AST.getFirstChild()!=null ? |
| 1144 | 18 | implicitTypeAssign_AST.getFirstChild() : implicitTypeAssign_AST; |
| 1145 | 54 | currentAST.advanceChildToEnd(); |
| 1146 | 54 | implicitTypeAssign_AST = (AST)currentAST.root; |
| 1147 | 54 | returnAST = implicitTypeAssign_AST; |
| 1148 | 54 | } |
| 1149 | |
|
| 1150 | |
|
| 1151 | 8 | public static final String[] _tokenNames = { |
| 1152 | 2 | "<0>", |
| 1153 | 2 | "EOF", |
| 1154 | 2 | "<2>", |
| 1155 | 2 | "NULL_TREE_LOOKAHEAD", |
| 1156 | 2 | "ROOT", |
| 1157 | 2 | "CHECK", |
| 1158 | 2 | "VALUE", |
| 1159 | 2 | "ALL", |
| 1160 | 2 | "FIELD", |
| 1161 | 2 | "LENGTH", |
| 1162 | 2 | "ARRAY", |
| 1163 | 2 | "IMMUTABLE", |
| 1164 | 2 | "MAP", |
| 1165 | 2 | "PROTOTYPE", |
| 1166 | 2 | "OPTIONS", |
| 1167 | 2 | "MIN", |
| 1168 | 2 | "MAX", |
| 1169 | 2 | "OPTION_BLOCK", |
| 1170 | 2 | "SEMI", |
| 1171 | 2 | "IDENT", |
| 1172 | 2 | "ANON", |
| 1173 | 2 | "COLON", |
| 1174 | 2 | "TYPEREF", |
| 1175 | 2 | "LBRACK", |
| 1176 | 2 | "RBRACK", |
| 1177 | 2 | "CHAR_LITERAL", |
| 1178 | 2 | "STAR", |
| 1179 | 2 | "STRING_LITERAL", |
| 1180 | 2 | "BANG", |
| 1181 | 2 | "LPAREN", |
| 1182 | 2 | "RPAREN", |
| 1183 | 2 | "LCURLY", |
| 1184 | 2 | "COMMA", |
| 1185 | 2 | "RCURLY", |
| 1186 | 2 | "NUMBER", |
| 1187 | 2 | "RANGE", |
| 1188 | 2 | "ASSIGN", |
| 1189 | 2 | "WS", |
| 1190 | 2 | "SL_COMMENT", |
| 1191 | 2 | "ML_COMMENT", |
| 1192 | 2 | "NL", |
| 1193 | 2 | "PTIDENT", |
| 1194 | 2 | "CHAR_BODY", |
| 1195 | 2 | "STRING_BODY", |
| 1196 | 2 | "ESC", |
| 1197 | 2 | "UNICODE", |
| 1198 | 2 | "OCTAL", |
| 1199 | 2 | "HEX_DIGIT" |
| 1200 | |
}; |
| 1201 | |
|
| 1202 | |
protected void buildTokenTypeASTClassMap() { |
| 1203 | 192 | tokenTypeToASTClassMap=null; |
| 1204 | 192 | }; |
| 1205 | |
|
| 1206 | |
private static final long[] mk_tokenSet_0() { |
| 1207 | 6 | long[] data = { 17348165632L, 0L}; |
| 1208 | 6 | return data; |
| 1209 | |
} |
| 1210 | 6 | public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); |
| 1211 | |
private static final long[] mk_tokenSet_1() { |
| 1212 | 6 | long[] data = { 13068926978L, 0L}; |
| 1213 | 6 | return data; |
| 1214 | |
} |
| 1215 | 6 | public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); |
| 1216 | |
private static final long[] mk_tokenSet_2() { |
| 1217 | 6 | long[] data = { 67645210626L, 0L}; |
| 1218 | 6 | return data; |
| 1219 | |
} |
| 1220 | 6 | public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); |
| 1221 | |
private static final long[] mk_tokenSet_3() { |
| 1222 | 6 | long[] data = { 13060538370L, 0L}; |
| 1223 | 6 | return data; |
| 1224 | |
} |
| 1225 | 6 | public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); |
| 1226 | |
private static final long[] mk_tokenSet_4() { |
| 1227 | 6 | long[] data = { 33268695042L, 0L}; |
| 1228 | 6 | return data; |
| 1229 | |
} |
| 1230 | 6 | public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); |
| 1231 | |
private static final long[] mk_tokenSet_5() { |
| 1232 | 6 | long[] data = { 13169590274L, 0L}; |
| 1233 | 6 | return data; |
| 1234 | |
} |
| 1235 | 6 | public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); |
| 1236 | |
private static final long[] mk_tokenSet_6() { |
| 1237 | 6 | long[] data = { 4300734464L, 0L}; |
| 1238 | 6 | return data; |
| 1239 | |
} |
| 1240 | 6 | public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); |
| 1241 | |
|
| 1242 | |
} |