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