1 3 package antlr.preprocessor; 4 5 import java.io.InputStream ; 6 import antlr.TokenStreamException; 7 import antlr.TokenStreamIOException; 8 import antlr.TokenStreamRecognitionException; 9 import antlr.CharStreamException; 10 import antlr.CharStreamIOException; 11 import antlr.ANTLRException; 12 import java.io.Reader ; 13 import java.util.Hashtable ; 14 import antlr.CharScanner; 15 import antlr.InputBuffer; 16 import antlr.ByteBuffer; 17 import antlr.CharBuffer; 18 import antlr.Token; 19 import antlr.CommonToken; 20 import antlr.RecognitionException; 21 import antlr.NoViableAltForCharException; 22 import antlr.MismatchedCharException; 23 import antlr.TokenStream; 24 import antlr.ANTLRHashString; 25 import antlr.LexerSharedInputState; 26 import antlr.collections.impl.BitSet; 27 import antlr.SemanticException; 28 29 public class PreprocessorLexer extends antlr.CharScanner implements PreprocessorTokenTypes, TokenStream 30 { 31 public PreprocessorLexer(InputStream in) { 32 this(new ByteBuffer(in)); 33 } 34 public PreprocessorLexer(Reader in) { 35 this(new CharBuffer(in)); 36 } 37 public PreprocessorLexer(InputBuffer ib) { 38 this(new LexerSharedInputState(ib)); 39 } 40 public PreprocessorLexer(LexerSharedInputState state) { 41 super(state); 42 caseSensitiveLiterals = true; 43 setCaseSensitive(true); 44 literals = new Hashtable (); 45 literals.put(new ANTLRHashString("public", this), new Integer (17)); 46 literals.put(new ANTLRHashString("class", this), new Integer (7)); 47 literals.put(new ANTLRHashString("throws", this), new Integer (22)); 48 literals.put(new ANTLRHashString("catch", this), new Integer (25)); 49 literals.put(new ANTLRHashString("private", this), new Integer (16)); 50 literals.put(new ANTLRHashString("extends", this), new Integer (9)); 51 literals.put(new ANTLRHashString("protected", this), new Integer (15)); 52 literals.put(new ANTLRHashString("returns", this), new Integer (20)); 53 literals.put(new ANTLRHashString("tokens", this), new Integer (4)); 54 literals.put(new ANTLRHashString("exception", this), new Integer (24)); 55 } 56 57 public Token nextToken() throws TokenStreamException { 58 Token theRetToken=null; 59 tryAgain: 60 for (;;) { 61 Token _token = null; 62 int _ttype = Token.INVALID_TYPE; 63 resetText(); 64 try { try { switch ( LA(1)) { 67 case ':': 68 { 69 mRULE_BLOCK(true); 70 theRetToken=_returnToken; 71 break; 72 } 73 case '\t': case '\n': case '\r': case ' ': 74 { 75 mWS(true); 76 theRetToken=_returnToken; 77 break; 78 } 79 case '(': 80 { 81 mSUBRULE_BLOCK(true); 82 theRetToken=_returnToken; 83 break; 84 } 85 case '/': 86 { 87 mCOMMENT(true); 88 theRetToken=_returnToken; 89 break; 90 } 91 case '{': 92 { 93 mACTION(true); 94 theRetToken=_returnToken; 95 break; 96 } 97 case '"': 98 { 99 mSTRING_LITERAL(true); 100 theRetToken=_returnToken; 101 break; 102 } 103 case '\'': 104 { 105 mCHAR_LITERAL(true); 106 theRetToken=_returnToken; 107 break; 108 } 109 case '!': 110 { 111 mBANG(true); 112 theRetToken=_returnToken; 113 break; 114 } 115 case ';': 116 { 117 mSEMI(true); 118 theRetToken=_returnToken; 119 break; 120 } 121 case ',': 122 { 123 mCOMMA(true); 124 theRetToken=_returnToken; 125 break; 126 } 127 case '}': 128 { 129 mRCURLY(true); 130 theRetToken=_returnToken; 131 break; 132 } 133 case 'A': case 'B': case 'C': case 'D': 134 case 'E': case 'F': case 'G': case 'H': 135 case 'I': case 'J': case 'K': case 'L': 136 case 'M': case 'N': case 'O': case 'P': 137 case 'Q': case 'R': case 'S': case 'T': 138 case 'U': case 'V': case 'W': case 'X': 139 case 'Y': case 'Z': case '_': case 'a': 140 case 'b': case 'c': case 'd': case 'e': 141 case 'f': case 'g': case 'h': case 'i': 142 case 'j': case 'k': case 'l': case 'm': 143 case 'n': case 'o': case 'p': case 'q': 144 case 'r': case 's': case 't': case 'u': 145 case 'v': case 'w': case 'x': case 'y': 146 case 'z': 147 { 148 mID_OR_KEYWORD(true); 149 theRetToken=_returnToken; 150 break; 151 } 152 case '=': 153 { 154 mASSIGN_RHS(true); 155 theRetToken=_returnToken; 156 break; 157 } 158 case '[': 159 { 160 mARG_ACTION(true); 161 theRetToken=_returnToken; 162 break; 163 } 164 default: 165 { 166 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} 167 else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 168 } 169 } 170 if ( _returnToken==null ) continue tryAgain; _ttype = _returnToken.getType(); 172 _ttype = testLiteralsTable(_ttype); 173 _returnToken.setType(_ttype); 174 return _returnToken; 175 } 176 catch (RecognitionException e) { 177 throw new TokenStreamRecognitionException(e); 178 } 179 } 180 catch (CharStreamException cse) { 181 if ( cse instanceof CharStreamIOException ) { 182 throw new TokenStreamIOException(((CharStreamIOException)cse).io); 183 } 184 else { 185 throw new TokenStreamException(cse.getMessage()); 186 } 187 } 188 } 189 } 190 191 public final void mRULE_BLOCK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 192 int _ttype; Token _token=null; int _begin=text.length(); 193 _ttype = RULE_BLOCK; 194 int _saveIndex; 195 196 match(':'); 197 { 198 if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) { 199 _saveIndex=text.length(); 200 mWS(false); 201 text.setLength(_saveIndex); 202 } 203 else if ((_tokenSet_1.member(LA(1))) && (true)) { 204 } 205 else { 206 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 207 } 208 209 } 210 mALT(false); 211 { 212 switch ( LA(1)) { 213 case '\t': case '\n': case '\r': case ' ': 214 { 215 _saveIndex=text.length(); 216 mWS(false); 217 text.setLength(_saveIndex); 218 break; 219 } 220 case ';': case '|': 221 { 222 break; 223 } 224 default: 225 { 226 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 227 } 228 } 229 } 230 { 231 _loop42: 232 do { 233 if ((LA(1)=='|')) { 234 match('|'); 235 { 236 if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2)))) { 237 _saveIndex=text.length(); 238 mWS(false); 239 text.setLength(_saveIndex); 240 } 241 else if ((_tokenSet_1.member(LA(1))) && (true)) { 242 } 243 else { 244 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 245 } 246 247 } 248 mALT(false); 249 { 250 switch ( LA(1)) { 251 case '\t': case '\n': case '\r': case ' ': 252 { 253 _saveIndex=text.length(); 254 mWS(false); 255 text.setLength(_saveIndex); 256 break; 257 } 258 case ';': case '|': 259 { 260 break; 261 } 262 default: 263 { 264 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 265 } 266 } 267 } 268 } 269 else { 270 break _loop42; 271 } 272 273 } while (true); 274 } 275 match(';'); 276 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 277 _token = makeToken(_ttype); 278 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 279 } 280 _returnToken = _token; 281 } 282 283 public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 284 int _ttype; Token _token=null; int _begin=text.length(); 285 _ttype = WS; 286 int _saveIndex; 287 288 { 289 int _cnt82=0; 290 _loop82: 291 do { 292 if ((LA(1)==' ') && (true)) { 293 match(' '); 294 } 295 else if ((LA(1)=='\t') && (true)) { 296 match('\t'); 297 } 298 else if ((LA(1)=='\n'||LA(1)=='\r') && (true)) { 299 mNEWLINE(false); 300 } 301 else { 302 if ( _cnt82>=1 ) { break _loop82; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 303 } 304 305 _cnt82++; 306 } while (true); 307 } 308 _ttype = Token.SKIP; 309 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 310 _token = makeToken(_ttype); 311 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 312 } 313 _returnToken = _token; 314 } 315 316 protected final void mALT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 317 int _ttype; Token _token=null; int _begin=text.length(); 318 _ttype = ALT; 319 int _saveIndex; 320 321 { 322 _loop53: 323 do { 324 if ((_tokenSet_2.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 325 mELEMENT(false); 326 } 327 else { 328 break _loop53; 329 } 330 331 } while (true); 332 } 333 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 334 _token = makeToken(_ttype); 335 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 336 } 337 _returnToken = _token; 338 } 339 340 public final void mSUBRULE_BLOCK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 341 int _ttype; Token _token=null; int _begin=text.length(); 342 _ttype = SUBRULE_BLOCK; 343 int _saveIndex; 344 345 match('('); 346 { 347 if ((_tokenSet_0.member(LA(1))) && (_tokenSet_3.member(LA(2)))) { 348 mWS(false); 349 } 350 else if ((_tokenSet_3.member(LA(1))) && (true)) { 351 } 352 else { 353 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 354 } 355 356 } 357 mALT(false); 358 { 359 _loop48: 360 do { 361 if ((_tokenSet_4.member(LA(1))) && (_tokenSet_3.member(LA(2)))) { 362 { 363 switch ( LA(1)) { 364 case '\t': case '\n': case '\r': case ' ': 365 { 366 mWS(false); 367 break; 368 } 369 case '|': 370 { 371 break; 372 } 373 default: 374 { 375 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 376 } 377 } 378 } 379 match('|'); 380 { 381 if ((_tokenSet_0.member(LA(1))) && (_tokenSet_3.member(LA(2)))) { 382 mWS(false); 383 } 384 else if ((_tokenSet_3.member(LA(1))) && (true)) { 385 } 386 else { 387 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 388 } 389 390 } 391 mALT(false); 392 } 393 else { 394 break _loop48; 395 } 396 397 } while (true); 398 } 399 { 400 switch ( LA(1)) { 401 case '\t': case '\n': case '\r': case ' ': 402 { 403 mWS(false); 404 break; 405 } 406 case ')': 407 { 408 break; 409 } 410 default: 411 { 412 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 413 } 414 } 415 } 416 match(')'); 417 { 418 if ((LA(1)=='=') && (LA(2)=='>')) { 419 match("=>"); 420 } 421 else if ((LA(1)=='*') && (true)) { 422 match('*'); 423 } 424 else if ((LA(1)=='+') && (true)) { 425 match('+'); 426 } 427 else if ((LA(1)=='?') && (true)) { 428 match('?'); 429 } 430 else { 431 } 432 433 } 434 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 435 _token = makeToken(_ttype); 436 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 437 } 438 _returnToken = _token; 439 } 440 441 protected final void mELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 442 int _ttype; Token _token=null; int _begin=text.length(); 443 _ttype = ELEMENT; 444 int _saveIndex; 445 446 switch ( LA(1)) { 447 case '/': 448 { 449 mCOMMENT(false); 450 break; 451 } 452 case '{': 453 { 454 mACTION(false); 455 break; 456 } 457 case '"': 458 { 459 mSTRING_LITERAL(false); 460 break; 461 } 462 case '\'': 463 { 464 mCHAR_LITERAL(false); 465 break; 466 } 467 case '(': 468 { 469 mSUBRULE_BLOCK(false); 470 break; 471 } 472 case '\n': case '\r': 473 { 474 mNEWLINE(false); 475 break; 476 } 477 case '\u0003': case '\u0004': case '\u0005': case '\u0006': 478 case '\u0007': case '\u0008': case '\t': case '\u000b': 479 case '\u000c': case '\u000e': case '\u000f': case '\u0010': 480 case '\u0011': case '\u0012': case '\u0013': case '\u0014': 481 case '\u0015': case '\u0016': case '\u0017': case '\u0018': 482 case '\u0019': case '\u001a': case '\u001b': case '\u001c': 483 case '\u001d': case '\u001e': case '\u001f': case ' ': 484 case '!': case '#': case '$': case '%': 485 case '&': case '*': case '+': case ',': 486 case '-': case '.': case '0': case '1': 487 case '2': case '3': case '4': case '5': 488 case '6': case '7': case '8': case '9': 489 case ':': case '<': case '=': case '>': 490 case '?': case '@': case 'A': case 'B': 491 case 'C': case 'D': case 'E': case 'F': 492 case 'G': case 'H': case 'I': case 'J': 493 case 'K': case 'L': case 'M': case 'N': 494 case 'O': case 'P': case 'Q': case 'R': 495 case 'S': case 'T': case 'U': case 'V': 496 case 'W': case 'X': case 'Y': case 'Z': 497 case '[': case '\\': case ']': case '^': 498 case '_': case '`': case 'a': case 'b': 499 case 'c': case 'd': case 'e': case 'f': 500 case 'g': case 'h': case 'i': case 'j': 501 case 'k': case 'l': case 'm': case 'n': 502 case 'o': case 'p': case 'q': case 'r': 503 case 's': case 't': case 'u': case 'v': 504 case 'w': case 'x': case 'y': case 'z': 505 case '|': case '}': case '~': 506 { 507 { 508 match(_tokenSet_5); 509 } 510 break; 511 } 512 default: 513 { 514 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 515 } 516 } 517 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 518 _token = makeToken(_ttype); 519 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 520 } 521 _returnToken = _token; 522 } 523 524 public final void mCOMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 525 int _ttype; Token _token=null; int _begin=text.length(); 526 _ttype = COMMENT; 527 int _saveIndex; 528 529 { 530 if ((LA(1)=='/') && (LA(2)=='/')) { 531 mSL_COMMENT(false); 532 } 533 else if ((LA(1)=='/') && (LA(2)=='*')) { 534 mML_COMMENT(false); 535 } 536 else { 537 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 538 } 539 540 } 541 _ttype = Token.SKIP; 542 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 543 _token = makeToken(_ttype); 544 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 545 } 546 _returnToken = _token; 547 } 548 549 public final void mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 550 int _ttype; Token _token=null; int _begin=text.length(); 551 _ttype = ACTION; 552 int _saveIndex; 553 554 match('{'); 555 { 556 _loop112: 557 do { 558 if ((LA(1)=='}') && (true)) break _loop112; 560 if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 561 mNEWLINE(false); 562 } 563 else if ((LA(1)=='{') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 564 mACTION(false); 565 } 566 else if ((LA(1)=='\'') && (_tokenSet_6.member(LA(2)))) { 567 mCHAR_LITERAL(false); 568 } 569 else if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) { 570 mCOMMENT(false); 571 } 572 else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 573 mSTRING_LITERAL(false); 574 } 575 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 576 matchNot(EOF_CHAR); 577 } 578 else { 579 break _loop112; 580 } 581 582 } while (true); 583 } 584 match('}'); 585 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 586 _token = makeToken(_ttype); 587 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 588 } 589 _returnToken = _token; 590 } 591 592 public final void mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 593 int _ttype; Token _token=null; int _begin=text.length(); 594 _ttype = STRING_LITERAL; 595 int _saveIndex; 596 597 match('"'); 598 { 599 _loop97: 600 do { 601 switch ( LA(1)) { 602 case '\\': 603 { 604 mESC(false); 605 break; 606 } 607 case '\u0003': case '\u0004': case '\u0005': case '\u0006': 608 case '\u0007': case '\u0008': case '\t': case '\n': 609 case '\u000b': case '\u000c': case '\r': case '\u000e': 610 case '\u000f': case '\u0010': case '\u0011': case '\u0012': 611 case '\u0013': case '\u0014': case '\u0015': case '\u0016': 612 case '\u0017': case '\u0018': case '\u0019': case '\u001a': 613 case '\u001b': case '\u001c': case '\u001d': case '\u001e': 614 case '\u001f': case ' ': case '!': case '#': 615 case '$': case '%': case '&': case '\'': 616 case '(': case ')': case '*': case '+': 617 case ',': case '-': case '.': case '/': 618 case '0': case '1': case '2': case '3': 619 case '4': case '5': case '6': case '7': 620 case '8': case '9': case ':': case ';': 621 case '<': case '=': case '>': case '?': 622 case '@': case 'A': case 'B': case 'C': 623 case 'D': case 'E': case 'F': case 'G': 624 case 'H': case 'I': case 'J': case 'K': 625 case 'L': case 'M': case 'N': case 'O': 626 case 'P': case 'Q': case 'R': case 'S': 627 case 'T': case 'U': case 'V': case 'W': 628 case 'X': case 'Y': case 'Z': case '[': 629 case ']': case '^': case '_': case '`': 630 case 'a': case 'b': case 'c': case 'd': 631 case 'e': case 'f': case 'g': case 'h': 632 case 'i': case 'j': case 'k': case 'l': 633 case 'm': case 'n': case 'o': case 'p': 634 case 'q': case 'r': case 's': case 't': 635 case 'u': case 'v': case 'w': case 'x': 636 case 'y': case 'z': case '{': case '|': 637 case '}': case '~': 638 { 639 matchNot('"'); 640 break; 641 } 642 default: 643 { 644 break _loop97; 645 } 646 } 647 } while (true); 648 } 649 match('"'); 650 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 651 _token = makeToken(_ttype); 652 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 653 } 654 _returnToken = _token; 655 } 656 657 public final void mCHAR_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 658 int _ttype; Token _token=null; int _begin=text.length(); 659 _ttype = CHAR_LITERAL; 660 int _saveIndex; 661 662 match('\''); 663 { 664 switch ( LA(1)) { 665 case '\\': 666 { 667 mESC(false); 668 break; 669 } 670 case '\u0003': case '\u0004': case '\u0005': case '\u0006': 671 case '\u0007': case '\u0008': case '\t': case '\n': 672 case '\u000b': case '\u000c': case '\r': case '\u000e': 673 case '\u000f': case '\u0010': case '\u0011': case '\u0012': 674 case '\u0013': case '\u0014': case '\u0015': case '\u0016': 675 case '\u0017': case '\u0018': case '\u0019': case '\u001a': 676 case '\u001b': case '\u001c': case '\u001d': case '\u001e': 677 case '\u001f': case ' ': case '!': case '"': 678 case '#': case '$': case '%': case '&': 679 case '(': case ')': case '*': case '+': 680 case ',': case '-': case '.': case '/': 681 case '0': case '1': case '2': case '3': 682 case '4': case '5': case '6': case '7': 683 case '8': case '9': case ':': case ';': 684 case '<': case '=': case '>': case '?': 685 case '@': case 'A': case 'B': case 'C': 686 case 'D': case 'E': case 'F': case 'G': 687 case 'H': case 'I': case 'J': case 'K': 688 case 'L': case 'M': case 'N': case 'O': 689 case 'P': case 'Q': case 'R': case 'S': 690 case 'T': case 'U': case 'V': case 'W': 691 case 'X': case 'Y': case 'Z': case '[': 692 case ']': case '^': case '_': case '`': 693 case 'a': case 'b': case 'c': case 'd': 694 case 'e': case 'f': case 'g': case 'h': 695 case 'i': case 'j': case 'k': case 'l': 696 case 'm': case 'n': case 'o': case 'p': 697 case 'q': case 'r': case 's': case 't': 698 case 'u': case 'v': case 'w': case 'x': 699 case 'y': case 'z': case '{': case '|': 700 case '}': case '~': 701 { 702 matchNot('\''); 703 break; 704 } 705 default: 706 { 707 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 708 } 709 } 710 } 711 match('\''); 712 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 713 _token = makeToken(_ttype); 714 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 715 } 716 _returnToken = _token; 717 } 718 719 protected final void mNEWLINE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 720 int _ttype; Token _token=null; int _begin=text.length(); 721 _ttype = NEWLINE; 722 int _saveIndex; 723 724 { 725 if ((LA(1)=='\r') && (LA(2)=='\n')) { 726 match('\r'); 727 match('\n'); 728 newline(); 729 } 730 else if ((LA(1)=='\r') && (true)) { 731 match('\r'); 732 newline(); 733 } 734 else if ((LA(1)=='\n')) { 735 match('\n'); 736 newline(); 737 } 738 else { 739 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 740 } 741 742 } 743 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 744 _token = makeToken(_ttype); 745 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 746 } 747 _returnToken = _token; 748 } 749 750 public final void mBANG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 751 int _ttype; Token _token=null; int _begin=text.length(); 752 _ttype = BANG; 753 int _saveIndex; 754 755 match('!'); 756 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 757 _token = makeToken(_ttype); 758 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 759 } 760 _returnToken = _token; 761 } 762 763 public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 764 int _ttype; Token _token=null; int _begin=text.length(); 765 _ttype = SEMI; 766 int _saveIndex; 767 768 match(';'); 769 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 770 _token = makeToken(_ttype); 771 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 772 } 773 _returnToken = _token; 774 } 775 776 public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 777 int _ttype; Token _token=null; int _begin=text.length(); 778 _ttype = COMMA; 779 int _saveIndex; 780 781 match(','); 782 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 783 _token = makeToken(_ttype); 784 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 785 } 786 _returnToken = _token; 787 } 788 789 public final void mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 790 int _ttype; Token _token=null; int _begin=text.length(); 791 _ttype = RCURLY; 792 int _saveIndex; 793 794 match('}'); 795 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 796 _token = makeToken(_ttype); 797 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 798 } 799 _returnToken = _token; 800 } 801 802 809 public final void mID_OR_KEYWORD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 810 int _ttype; Token _token=null; int _begin=text.length(); 811 _ttype = ID_OR_KEYWORD; 812 int _saveIndex; 813 Token id=null; 814 815 mID(true); 816 id=_returnToken; 817 _ttype = id.getType(); 818 { 819 if (((_tokenSet_7.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~')))&&(id.getText().equals("header"))) { 820 { 821 if ((_tokenSet_0.member(LA(1))) && (_tokenSet_7.member(LA(2)))) { 822 mWS(false); 823 } 824 else if ((_tokenSet_7.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 825 } 826 else { 827 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 828 } 829 830 } 831 { 832 switch ( LA(1)) { 833 case '"': 834 { 835 mSTRING_LITERAL(false); 836 break; 837 } 838 case '\t': case '\n': case '\r': case ' ': 839 case '/': case '{': 840 { 841 break; 842 } 843 default: 844 { 845 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 846 } 847 } 848 } 849 { 850 _loop65: 851 do { 852 switch ( LA(1)) { 853 case '\t': case '\n': case '\r': case ' ': 854 { 855 mWS(false); 856 break; 857 } 858 case '/': 859 { 860 mCOMMENT(false); 861 break; 862 } 863 default: 864 { 865 break _loop65; 866 } 867 } 868 } while (true); 869 } 870 mACTION(false); 871 _ttype = HEADER_ACTION; 872 } 873 else if (((_tokenSet_8.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~')))&&(id.getText().equals("tokens"))) { 874 { 875 _loop67: 876 do { 877 switch ( LA(1)) { 878 case '\t': case '\n': case '\r': case ' ': 879 { 880 mWS(false); 881 break; 882 } 883 case '/': 884 { 885 mCOMMENT(false); 886 break; 887 } 888 default: 889 { 890 break _loop67; 891 } 892 } 893 } while (true); 894 } 895 mCURLY_BLOCK_SCARF(false); 896 _ttype = TOKENS_SPEC; 897 } 898 else if (((_tokenSet_8.member(LA(1))) && (true))&&(id.getText().equals("options"))) { 899 { 900 _loop69: 901 do { 902 switch ( LA(1)) { 903 case '\t': case '\n': case '\r': case ' ': 904 { 905 mWS(false); 906 break; 907 } 908 case '/': 909 { 910 mCOMMENT(false); 911 break; 912 } 913 default: 914 { 915 break _loop69; 916 } 917 } 918 } while (true); 919 } 920 match('{'); 921 _ttype = OPTIONS_START; 922 } 923 else { 924 } 925 926 } 927 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 928 _token = makeToken(_ttype); 929 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 930 } 931 _returnToken = _token; 932 } 933 934 protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 935 int _ttype; Token _token=null; int _begin=text.length(); 936 _ttype = ID; 937 int _saveIndex; 938 939 { 940 switch ( LA(1)) { 941 case 'a': case 'b': case 'c': case 'd': 942 case 'e': case 'f': case 'g': case 'h': 943 case 'i': case 'j': case 'k': case 'l': 944 case 'm': case 'n': case 'o': case 'p': 945 case 'q': case 'r': case 's': case 't': 946 case 'u': case 'v': case 'w': case 'x': 947 case 'y': case 'z': 948 { 949 matchRange('a','z'); 950 break; 951 } 952 case 'A': case 'B': case 'C': case 'D': 953 case 'E': case 'F': case 'G': case 'H': 954 case 'I': case 'J': case 'K': case 'L': 955 case 'M': case 'N': case 'O': case 'P': 956 case 'Q': case 'R': case 'S': case 'T': 957 case 'U': case 'V': case 'W': case 'X': 958 case 'Y': case 'Z': 959 { 960 matchRange('A','Z'); 961 break; 962 } 963 case '_': 964 { 965 match('_'); 966 break; 967 } 968 default: 969 { 970 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 971 } 972 } 973 } 974 { 975 _loop76: 976 do { 977 switch ( LA(1)) { 978 case 'a': case 'b': case 'c': case 'd': 979 case 'e': case 'f': case 'g': case 'h': 980 case 'i': case 'j': case 'k': case 'l': 981 case 'm': case 'n': case 'o': case 'p': 982 case 'q': case 'r': case 's': case 't': 983 case 'u': case 'v': case 'w': case 'x': 984 case 'y': case 'z': 985 { 986 matchRange('a','z'); 987 break; 988 } 989 case 'A': case 'B': case 'C': case 'D': 990 case 'E': case 'F': case 'G': case 'H': 991 case 'I': case 'J': case 'K': case 'L': 992 case 'M': case 'N': case 'O': case 'P': 993 case 'Q': case 'R': case 'S': case 'T': 994 case 'U': case 'V': case 'W': case 'X': 995 case 'Y': case 'Z': 996 { 997 matchRange('A','Z'); 998 break; 999 } 1000 case '_': 1001 { 1002 match('_'); 1003 break; 1004 } 1005 case '0': case '1': case '2': case '3': 1006 case '4': case '5': case '6': case '7': 1007 case '8': case '9': 1008 { 1009 matchRange('0','9'); 1010 break; 1011 } 1012 default: 1013 { 1014 break _loop76; 1015 } 1016 } 1017 } while (true); 1018 } 1019 _ttype = testLiteralsTable(new String (text.getBuffer(),_begin,text.length()-_begin),_ttype); 1020 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1021 _token = makeToken(_ttype); 1022 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1023 } 1024 _returnToken = _token; 1025 } 1026 1027 protected final void mCURLY_BLOCK_SCARF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1028 int _ttype; Token _token=null; int _begin=text.length(); 1029 _ttype = CURLY_BLOCK_SCARF; 1030 int _saveIndex; 1031 1032 match('{'); 1033 { 1034 _loop72: 1035 do { 1036 if ((LA(1)=='}') && (true)) break _loop72; 1038 if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1039 mNEWLINE(false); 1040 } 1041 else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1042 mSTRING_LITERAL(false); 1043 } 1044 else if ((LA(1)=='\'') && (_tokenSet_6.member(LA(2)))) { 1045 mCHAR_LITERAL(false); 1046 } 1047 else if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) { 1048 mCOMMENT(false); 1049 } 1050 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1051 matchNot(EOF_CHAR); 1052 } 1053 else { 1054 break _loop72; 1055 } 1056 1057 } while (true); 1058 } 1059 match('}'); 1060 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1061 _token = makeToken(_ttype); 1062 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1063 } 1064 _returnToken = _token; 1065 } 1066 1067 public final void mASSIGN_RHS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1068 int _ttype; Token _token=null; int _begin=text.length(); 1069 _ttype = ASSIGN_RHS; 1070 int _saveIndex; 1071 1072 _saveIndex=text.length(); 1073 match('='); 1074 text.setLength(_saveIndex); 1075 { 1076 _loop79: 1077 do { 1078 if ((LA(1)==';') && (true)) break _loop79; 1080 if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1081 mSTRING_LITERAL(false); 1082 } 1083 else if ((LA(1)=='\'') && (_tokenSet_6.member(LA(2)))) { 1084 mCHAR_LITERAL(false); 1085 } 1086 else if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1087 mNEWLINE(false); 1088 } 1089 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1090 matchNot(EOF_CHAR); 1091 } 1092 else { 1093 break _loop79; 1094 } 1095 1096 } while (true); 1097 } 1098 match(';'); 1099 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1100 _token = makeToken(_ttype); 1101 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1102 } 1103 _returnToken = _token; 1104 } 1105 1106 protected final void mSL_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1107 int _ttype; Token _token=null; int _begin=text.length(); 1108 _ttype = SL_COMMENT; 1109 int _saveIndex; 1110 1111 match("//"); 1112 { 1113 _loop89: 1114 do { 1115 if ((LA(1)=='\n'||LA(1)=='\r') && (true)) break _loop89; 1117 if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1118 matchNot(EOF_CHAR); 1119 } 1120 else { 1121 break _loop89; 1122 } 1123 1124 } while (true); 1125 } 1126 mNEWLINE(false); 1127 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1128 _token = makeToken(_ttype); 1129 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1130 } 1131 _returnToken = _token; 1132 } 1133 1134 protected final void mML_COMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1135 int _ttype; Token _token=null; int _begin=text.length(); 1136 _ttype = ML_COMMENT; 1137 int _saveIndex; 1138 1139 match("/*"); 1140 { 1141 _loop92: 1142 do { 1143 if ((LA(1)=='*') && (LA(2)=='/')) break _loop92; 1145 if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1146 mNEWLINE(false); 1147 } 1148 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1149 matchNot(EOF_CHAR); 1150 } 1151 else { 1152 break _loop92; 1153 } 1154 1155 } while (true); 1156 } 1157 match("*/"); 1158 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1159 _token = makeToken(_ttype); 1160 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1161 } 1162 _returnToken = _token; 1163 } 1164 1165 protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1166 int _ttype; Token _token=null; int _begin=text.length(); 1167 _ttype = ESC; 1168 int _saveIndex; 1169 1170 match('\\'); 1171 { 1172 switch ( LA(1)) { 1173 case 'n': 1174 { 1175 match('n'); 1176 break; 1177 } 1178 case 'r': 1179 { 1180 match('r'); 1181 break; 1182 } 1183 case 't': 1184 { 1185 match('t'); 1186 break; 1187 } 1188 case 'b': 1189 { 1190 match('b'); 1191 break; 1192 } 1193 case 'f': 1194 { 1195 match('f'); 1196 break; 1197 } 1198 case 'w': 1199 { 1200 match('w'); 1201 break; 1202 } 1203 case 'a': 1204 { 1205 match('a'); 1206 break; 1207 } 1208 case '"': 1209 { 1210 match('"'); 1211 break; 1212 } 1213 case '\'': 1214 { 1215 match('\''); 1216 break; 1217 } 1218 case '\\': 1219 { 1220 match('\\'); 1221 break; 1222 } 1223 case '0': case '1': case '2': case '3': 1224 { 1225 { 1226 matchRange('0','3'); 1227 } 1228 { 1229 if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1230 mDIGIT(false); 1231 { 1232 if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1233 mDIGIT(false); 1234 } 1235 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) { 1236 } 1237 else { 1238 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 1239 } 1240 1241 } 1242 } 1243 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) { 1244 } 1245 else { 1246 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 1247 } 1248 1249 } 1250 break; 1251 } 1252 case '4': case '5': case '6': case '7': 1253 { 1254 { 1255 matchRange('4','7'); 1256 } 1257 { 1258 if (((LA(1) >= '0' && LA(1) <= '9')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1259 mDIGIT(false); 1260 } 1261 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) { 1262 } 1263 else { 1264 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 1265 } 1266 1267 } 1268 break; 1269 } 1270 case 'u': 1271 { 1272 match('u'); 1273 mXDIGIT(false); 1274 mXDIGIT(false); 1275 mXDIGIT(false); 1276 mXDIGIT(false); 1277 break; 1278 } 1279 default: 1280 { 1281 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 1282 } 1283 } 1284 } 1285 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1286 _token = makeToken(_ttype); 1287 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1288 } 1289 _returnToken = _token; 1290 } 1291 1292 protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1293 int _ttype; Token _token=null; int _begin=text.length(); 1294 _ttype = DIGIT; 1295 int _saveIndex; 1296 1297 matchRange('0','9'); 1298 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1299 _token = makeToken(_ttype); 1300 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1301 } 1302 _returnToken = _token; 1303 } 1304 1305 protected final void mXDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1306 int _ttype; Token _token=null; int _begin=text.length(); 1307 _ttype = XDIGIT; 1308 int _saveIndex; 1309 1310 switch ( LA(1)) { 1311 case '0': case '1': case '2': case '3': 1312 case '4': case '5': case '6': case '7': 1313 case '8': case '9': 1314 { 1315 matchRange('0','9'); 1316 break; 1317 } 1318 case 'a': case 'b': case 'c': case 'd': 1319 case 'e': case 'f': 1320 { 1321 matchRange('a','f'); 1322 break; 1323 } 1324 case 'A': case 'B': case 'C': case 'D': 1325 case 'E': case 'F': 1326 { 1327 matchRange('A','F'); 1328 break; 1329 } 1330 default: 1331 { 1332 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 1333 } 1334 } 1335 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1336 _token = makeToken(_ttype); 1337 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1338 } 1339 _returnToken = _token; 1340 } 1341 1342 public final void mARG_ACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 1343 int _ttype; Token _token=null; int _begin=text.length(); 1344 _ttype = ARG_ACTION; 1345 int _saveIndex; 1346 1347 match('['); 1348 { 1349 _loop109: 1350 do { 1351 if ((LA(1)==']') && (true)) break _loop109; 1353 if ((LA(1)=='[') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1354 mARG_ACTION(false); 1355 } 1356 else if ((LA(1)=='\n'||LA(1)=='\r') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1357 mNEWLINE(false); 1358 } 1359 else if ((LA(1)=='\'') && (_tokenSet_6.member(LA(2)))) { 1360 mCHAR_LITERAL(false); 1361 } 1362 else if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1363 mSTRING_LITERAL(false); 1364 } 1365 else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) { 1366 matchNot(EOF_CHAR); 1367 } 1368 else { 1369 break _loop109; 1370 } 1371 1372 } while (true); 1373 } 1374 match(']'); 1375 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 1376 _token = makeToken(_ttype); 1377 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 1378 } 1379 _returnToken = _token; 1380 } 1381 1382 1383 private static final long[] mk_tokenSet_0() { long[] data = { 4294977024L, 0L, 0L }; return data; } 1384 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); 1385 private static final long[] mk_tokenSet_1() { long[] data = { -2199023255560L, 9223372036854775807L, 0L, 0L }; return data; } 1386 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); 1387 private static final long[] mk_tokenSet_2() { long[] data = { -576462951326679048L, 9223372036854775807L, 0L, 0L }; return data; } 1388 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); 1389 private static final long[] mk_tokenSet_3() { long[] data = { -576460752303423496L, 9223372036854775807L, 0L, 0L }; return data; } 1390 public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3()); 1391 private static final long[] mk_tokenSet_4() { long[] data = { 4294977024L, 1152921504606846976L, 0L, 0L }; return data; } 1392 public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4()); 1393 private static final long[] mk_tokenSet_5() { long[] data = { -576605355262354440L, 8646911284551352319L, 0L, 0L }; return data; } 1394 public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5()); 1395 private static final long[] mk_tokenSet_6() { long[] data = { -549755813896L, 9223372036854775807L, 0L, 0L }; return data; } 1396 public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6()); 1397 private static final long[] mk_tokenSet_7() { long[] data = { 140758963201536L, 576460752303423488L, 0L, 0L }; return data; } 1398 public static final BitSet _tokenSet_7 = new BitSet(mk_tokenSet_7()); 1399 private static final long[] mk_tokenSet_8() { long[] data = { 140741783332352L, 576460752303423488L, 0L, 0L }; return data; } 1400 public static final BitSet _tokenSet_8 = new BitSet(mk_tokenSet_8()); 1401 1402 } 1403 | Popular Tags |