1 package org.objectweb.modfact.qvt.syntaxe; 3 4 import java.io.InputStream ; 5 import antlr.TokenStreamException; 6 import antlr.TokenStreamIOException; 7 import antlr.TokenStreamRecognitionException; 8 import antlr.CharStreamException; 9 import antlr.CharStreamIOException; 10 import antlr.ANTLRException; 11 import java.io.Reader ; 12 import java.util.Hashtable ; 13 import antlr.CharScanner; 14 import antlr.InputBuffer; 15 import antlr.ByteBuffer; 16 import antlr.CharBuffer; 17 import antlr.Token; 18 import antlr.CommonToken; 19 import antlr.RecognitionException; 20 import antlr.NoViableAltForCharException; 21 import antlr.MismatchedCharException; 22 import antlr.TokenStream; 23 import antlr.ANTLRHashString; 24 import antlr.LexerSharedInputState; 25 import antlr.collections.impl.BitSet; 26 import antlr.SemanticException; 27 28 public class STRLLexer extends antlr.CharScanner implements STRLParserTokenTypes, TokenStream 29 { 30 public STRLLexer(InputStream in) { 31 this(new ByteBuffer(in)); 32 } 33 public STRLLexer(Reader in) { 34 this(new CharBuffer(in)); 35 } 36 public STRLLexer(InputBuffer ib) { 37 this(new LexerSharedInputState(ib)); 38 } 39 public STRLLexer(LexerSharedInputState state) { 40 super(state); 41 caseSensitiveLiterals = true; 42 setCaseSensitive(true); 43 literals = new Hashtable (); 44 literals.put(new ANTLRHashString("isOfType", this), new Integer (29)); 45 literals.put(new ANTLRHashString("creates", this), new Integer (22)); 46 literals.put(new ANTLRHashString("if", this), new Integer (33)); 47 literals.put(new ANTLRHashString("Rule", this), new Integer (14)); 48 literals.put(new ANTLRHashString("RulesUnit", this), new Integer (4)); 49 literals.put(new ANTLRHashString("enum", this), new Integer (39)); 50 literals.put(new ANTLRHashString("else", this), new Integer (34)); 51 literals.put(new ANTLRHashString("equals", this), new Integer (30)); 52 literals.put(new ANTLRHashString("allOfType", this), new Integer (26)); 53 literals.put(new ANTLRHashString("EntryPointRule", this), new Integer (12)); 54 literals.put(new ANTLRHashString("remove", this), new Integer (28)); 55 literals.put(new ANTLRHashString("context", this), new Integer (13)); 56 literals.put(new ANTLRHashString("return", this), new Integer (23)); 57 literals.put(new ANTLRHashString("result", this), new Integer (21)); 58 literals.put(new ANTLRHashString("add", this), new Integer (27)); 59 } 60 61 public Token nextToken() throws TokenStreamException { 62 Token theRetToken=null; 63 tryAgain: 64 for (;;) { 65 Token _token = null; 66 int _ttype = Token.INVALID_TYPE; 67 setCommitToPath(false); 68 resetText(); 69 try { try { switch ( LA(1)) { 72 case 'A': case 'B': case 'C': case 'D': 73 case 'E': case 'F': case 'G': case 'H': 74 case 'I': case 'J': case 'K': case 'L': 75 case 'M': case 'N': case 'O': case 'P': 76 case 'Q': case 'R': case 'S': case 'T': 77 case 'U': case 'V': case 'W': case 'X': 78 case 'Y': case 'Z': case '_': case 'a': 79 case 'b': case 'c': case 'd': case 'e': 80 case 'f': case 'g': case 'h': case 'i': 81 case 'j': case 'k': case 'l': case 'm': 82 case 'n': case 'o': case 'p': case 'q': 83 case 'r': case 's': case 't': case 'u': 84 case 'v': case 'w': case 'x': case 'y': 85 case 'z': 86 { 87 mNAME(true); 88 theRetToken=_returnToken; 89 break; 90 } 91 case '{': 92 { 93 mOPENBRACKET(true); 94 theRetToken=_returnToken; 95 break; 96 } 97 case '}': 98 { 99 mCLOSEBRACKET(true); 100 theRetToken=_returnToken; 101 break; 102 } 103 case '(': 104 { 105 mOPENPARENT(true); 106 theRetToken=_returnToken; 107 break; 108 } 109 case ')': 110 { 111 mCLOSEPARENT(true); 112 theRetToken=_returnToken; 113 break; 114 } 115 case '[': 116 { 117 mOPENCROCHET(true); 118 theRetToken=_returnToken; 119 break; 120 } 121 case ']': 122 { 123 mCLOSECROCHET(true); 124 theRetToken=_returnToken; 125 break; 126 } 127 case '#': 128 { 129 mDIEZ(true); 130 theRetToken=_returnToken; 131 break; 132 } 133 case ',': 134 { 135 mCOMMA(true); 136 theRetToken=_returnToken; 137 break; 138 } 139 case '.': 140 { 141 mPOINT(true); 142 theRetToken=_returnToken; 143 break; 144 } 145 case '"': 146 { 147 mGUILL(true); 148 theRetToken=_returnToken; 149 break; 150 } 151 case '?': 152 { 153 mINTERO(true); 154 theRetToken=_returnToken; 155 break; 156 } 157 case ':': 158 { 159 mTOWPOINT(true); 160 theRetToken=_returnToken; 161 break; 162 } 163 case '!': 164 { 165 mPOINTEXCLAM(true); 166 theRetToken=_returnToken; 167 break; 168 } 169 case '=': 170 { 171 mEQUAL(true); 172 theRetToken=_returnToken; 173 break; 174 } 175 case '\t': case ' ': 176 { 177 mWS(true); 178 theRetToken=_returnToken; 179 break; 180 } 181 case '\n': case '\r': 182 { 183 mNEWLINE(true); 184 theRetToken=_returnToken; 185 break; 186 } 187 default: 188 if ((LA(1)=='@') && (LA(2)=='S')) { 189 mSOURCE(true); 190 theRetToken=_returnToken; 191 } 192 else if ((LA(1)=='@') && (LA(2)=='T')) { 193 mTARGET(true); 194 theRetToken=_returnToken; 195 } 196 else if ((LA(1)=='0'||LA(1)=='1') && (LA(2)=='F'||LA(2)=='T')) { 197 mBOOLEAN(true); 198 theRetToken=_returnToken; 199 } 200 else if ((_tokenSet_0.member(LA(1))) && (true)) { 201 mDOUBLE(true); 202 theRetToken=_returnToken; 203 } 204 else { 205 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} 206 else {consume(); continue tryAgain;} 207 } 208 } 209 if ( _returnToken==null ) continue tryAgain; _ttype = _returnToken.getType(); 211 _ttype = testLiteralsTable(_ttype); 212 _returnToken.setType(_ttype); 213 return _returnToken; 214 } 215 catch (RecognitionException e) { 216 if ( !getCommitToPath() ) {consume(); continue tryAgain;} 217 throw new TokenStreamRecognitionException(e); 218 } 219 } 220 catch (CharStreamException cse) { 221 if ( cse instanceof CharStreamIOException ) { 222 throw new TokenStreamIOException(((CharStreamIOException)cse).io); 223 } 224 else { 225 throw new TokenStreamException(cse.getMessage()); 226 } 227 } 228 } 229 } 230 231 public final void mNAME(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 232 int _ttype; Token _token=null; int _begin=text.length(); 233 _ttype = NAME; 234 int _saveIndex; 235 236 { 237 int _cnt476=0; 238 _loop476: 239 do { 240 switch ( LA(1)) { 241 case 'a': case 'b': case 'c': case 'd': 242 case 'e': case 'f': case 'g': case 'h': 243 case 'i': case 'j': case 'k': case 'l': 244 case 'm': case 'n': case 'o': case 'p': 245 case 'q': case 'r': case 's': case 't': 246 case 'u': case 'v': case 'w': case 'x': 247 case 'y': case 'z': 248 { 249 matchRange('a','z'); 250 break; 251 } 252 case 'A': case 'B': case 'C': case 'D': 253 case 'E': case 'F': case 'G': case 'H': 254 case 'I': case 'J': case 'K': case 'L': 255 case 'M': case 'N': case 'O': case 'P': 256 case 'Q': case 'R': case 'S': case 'T': 257 case 'U': case 'V': case 'W': case 'X': 258 case 'Y': case 'Z': 259 { 260 matchRange('A','Z'); 261 break; 262 } 263 case '_': 264 { 265 match('_'); 266 break; 267 } 268 default: 269 { 270 if ( _cnt476>=1 ) { break _loop476; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 271 } 272 } 273 _cnt476++; 274 } while (true); 275 } 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 mDOUBLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 284 int _ttype; Token _token=null; int _begin=text.length(); 285 _ttype = DOUBLE; 286 int _saveIndex; 287 288 boolean synPredMatched482 = false; 289 if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))) && (_tokenSet_1.member(LA(3))))) { 290 int _m482 = mark(); 291 synPredMatched482 = true; 292 inputState.guessing++; 293 try { 294 { 295 { 296 switch ( LA(1)) { 297 case '-': 298 { 299 match('-'); 300 break; 301 } 302 case '0': case '1': case '2': case '3': 303 case '4': case '5': case '6': case '7': 304 case '8': case '9': 305 { 306 break; 307 } 308 default: 309 { 310 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 311 } 312 } 313 } 314 { 315 int _cnt481=0; 316 _loop481: 317 do { 318 if (((LA(1) >= '0' && LA(1) <= '9'))) { 319 matchRange('0','9'); 320 } 321 else { 322 if ( _cnt481>=1 ) { break _loop481; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 323 } 324 325 _cnt481++; 326 } while (true); 327 } 328 match('.'); 329 } 330 } 331 catch (RecognitionException pe) { 332 synPredMatched482 = false; 333 } 334 rewind(_m482); 335 inputState.guessing--; 336 } 337 if ( synPredMatched482 ) { 338 { 339 { 340 switch ( LA(1)) { 341 case '-': 342 { 343 match('-'); 344 break; 345 } 346 case '0': case '1': case '2': case '3': 347 case '4': case '5': case '6': case '7': 348 case '8': case '9': 349 { 350 break; 351 } 352 default: 353 { 354 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 355 } 356 } 357 } 358 { 359 int _cnt486=0; 360 _loop486: 361 do { 362 if (((LA(1) >= '0' && LA(1) <= '9'))) { 363 matchRange('0','9'); 364 } 365 else { 366 if ( _cnt486>=1 ) { break _loop486; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 367 } 368 369 _cnt486++; 370 } while (true); 371 } 372 match('.'); 373 { 374 int _cnt488=0; 375 _loop488: 376 do { 377 if (((LA(1) >= '0' && LA(1) <= '9'))) { 378 matchRange('0','9'); 379 } 380 else { 381 if ( _cnt488>=1 ) { break _loop488; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 382 } 383 384 _cnt488++; 385 } while (true); 386 } 387 } 388 } 389 else if ((_tokenSet_0.member(LA(1))) && (true) && (true)) { 390 { 391 switch ( LA(1)) { 392 case '-': 393 { 394 match('-'); 395 break; 396 } 397 case '0': case '1': case '2': case '3': 398 case '4': case '5': case '6': case '7': 399 case '8': case '9': 400 { 401 break; 402 } 403 default: 404 { 405 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 406 } 407 } 408 } 409 { 410 int _cnt491=0; 411 _loop491: 412 do { 413 if (((LA(1) >= '0' && LA(1) <= '9'))) { 414 matchRange('0','9'); 415 } 416 else { 417 if ( _cnt491>=1 ) { break _loop491; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 418 } 419 420 _cnt491++; 421 } while (true); 422 } 423 if ( inputState.guessing==0 ) { 424 _ttype = INTEGER; 425 } 426 } 427 else { 428 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 429 } 430 431 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 432 _token = makeToken(_ttype); 433 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 434 } 435 _returnToken = _token; 436 } 437 438 public final void mSOURCE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 439 int _ttype; Token _token=null; int _begin=text.length(); 440 _ttype = SOURCE; 441 int _saveIndex; 442 443 match('@'); 444 match('S'); 445 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 446 _token = makeToken(_ttype); 447 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 448 } 449 _returnToken = _token; 450 } 451 452 public final void mTARGET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 453 int _ttype; Token _token=null; int _begin=text.length(); 454 _ttype = TARGET; 455 int _saveIndex; 456 457 match('@'); 458 match('T'); 459 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 460 _token = makeToken(_ttype); 461 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 462 } 463 _returnToken = _token; 464 } 465 466 public final void mOPENBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 467 int _ttype; Token _token=null; int _begin=text.length(); 468 _ttype = OPENBRACKET; 469 int _saveIndex; 470 471 match('{'); 472 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 473 _token = makeToken(_ttype); 474 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 475 } 476 _returnToken = _token; 477 } 478 479 public final void mCLOSEBRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 480 int _ttype; Token _token=null; int _begin=text.length(); 481 _ttype = CLOSEBRACKET; 482 int _saveIndex; 483 484 match('}'); 485 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 486 _token = makeToken(_ttype); 487 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 488 } 489 _returnToken = _token; 490 } 491 492 public final void mOPENPARENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 493 int _ttype; Token _token=null; int _begin=text.length(); 494 _ttype = OPENPARENT; 495 int _saveIndex; 496 497 match('('); 498 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 499 _token = makeToken(_ttype); 500 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 501 } 502 _returnToken = _token; 503 } 504 505 public final void mCLOSEPARENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 506 int _ttype; Token _token=null; int _begin=text.length(); 507 _ttype = CLOSEPARENT; 508 int _saveIndex; 509 510 match(')'); 511 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 512 _token = makeToken(_ttype); 513 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 514 } 515 _returnToken = _token; 516 } 517 518 public final void mOPENCROCHET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 519 int _ttype; Token _token=null; int _begin=text.length(); 520 _ttype = OPENCROCHET; 521 int _saveIndex; 522 523 match('['); 524 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 525 _token = makeToken(_ttype); 526 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 527 } 528 _returnToken = _token; 529 } 530 531 public final void mCLOSECROCHET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 532 int _ttype; Token _token=null; int _begin=text.length(); 533 _ttype = CLOSECROCHET; 534 int _saveIndex; 535 536 match(']'); 537 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 538 _token = makeToken(_ttype); 539 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 540 } 541 _returnToken = _token; 542 } 543 544 public final void mDIEZ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 545 int _ttype; Token _token=null; int _begin=text.length(); 546 _ttype = DIEZ; 547 int _saveIndex; 548 549 match('#'); 550 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 551 _token = makeToken(_ttype); 552 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 553 } 554 _returnToken = _token; 555 } 556 557 public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 558 int _ttype; Token _token=null; int _begin=text.length(); 559 _ttype = COMMA; 560 int _saveIndex; 561 562 match(','); 563 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 564 _token = makeToken(_ttype); 565 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 566 } 567 _returnToken = _token; 568 } 569 570 public final void mPOINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 571 int _ttype; Token _token=null; int _begin=text.length(); 572 _ttype = POINT; 573 int _saveIndex; 574 575 match('.'); 576 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 577 _token = makeToken(_ttype); 578 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 579 } 580 _returnToken = _token; 581 } 582 583 public final void mBOOLEAN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 584 int _ttype; Token _token=null; int _begin=text.length(); 585 _ttype = BOOLEAN; 586 int _saveIndex; 587 588 switch ( LA(1)) { 589 case '1': 590 { 591 match('1'); 592 match('T'); 593 break; 594 } 595 case '0': 596 { 597 match('0'); 598 match('F'); 599 break; 600 } 601 default: 602 { 603 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 604 } 605 } 606 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 607 _token = makeToken(_ttype); 608 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 609 } 610 _returnToken = _token; 611 } 612 613 public final void mGUILL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 614 int _ttype; Token _token=null; int _begin=text.length(); 615 _ttype = GUILL; 616 int _saveIndex; 617 618 match('"'); 619 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 620 _token = makeToken(_ttype); 621 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 622 } 623 _returnToken = _token; 624 } 625 626 public final void mINTERO(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 627 int _ttype; Token _token=null; int _begin=text.length(); 628 _ttype = INTERO; 629 int _saveIndex; 630 631 match('?'); 632 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 633 _token = makeToken(_ttype); 634 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 635 } 636 _returnToken = _token; 637 } 638 639 public final void mTOWPOINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 640 int _ttype; Token _token=null; int _begin=text.length(); 641 _ttype = TOWPOINT; 642 int _saveIndex; 643 644 match(':'); 645 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 646 _token = makeToken(_ttype); 647 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 648 } 649 _returnToken = _token; 650 } 651 652 public final void mPOINTEXCLAM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 653 int _ttype; Token _token=null; int _begin=text.length(); 654 _ttype = POINTEXCLAM; 655 int _saveIndex; 656 657 match('!'); 658 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 659 _token = makeToken(_ttype); 660 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 661 } 662 _returnToken = _token; 663 } 664 665 public final void mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 666 int _ttype; Token _token=null; int _begin=text.length(); 667 _ttype = EQUAL; 668 int _saveIndex; 669 670 match('='); 671 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 672 _token = makeToken(_ttype); 673 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 674 } 675 _returnToken = _token; 676 } 677 678 public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 679 int _ttype; Token _token=null; int _begin=text.length(); 680 _ttype = WS; 681 int _saveIndex; 682 683 { 684 switch ( LA(1)) { 685 case ' ': 686 { 687 match(' '); 688 break; 689 } 690 case '\t': 691 { 692 match('\t'); 693 break; 694 } 695 default: 696 { 697 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 698 } 699 } 700 } 701 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 702 _token = makeToken(_ttype); 703 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 704 } 705 _returnToken = _token; 706 } 707 708 public final void mNEWLINE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 709 int _ttype; Token _token=null; int _begin=text.length(); 710 _ttype = NEWLINE; 711 int _saveIndex; 712 713 switch ( LA(1)) { 714 case '\r': 715 { 716 match('\r'); 717 match('\n'); 718 break; 719 } 720 case '\n': 721 { 722 match('\n'); 723 break; 724 } 725 default: 726 { 727 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 728 } 729 } 730 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 731 _token = makeToken(_ttype); 732 _token.setText(new String (text.getBuffer(), _begin, text.length()-_begin)); 733 } 734 _returnToken = _token; 735 } 736 737 738 private static final long[] mk_tokenSet_0() { 739 long[] data = { 287984085547089920L, 0L, 0L}; 740 return data; 741 } 742 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); 743 private static final long[] mk_tokenSet_1() { 744 long[] data = { 288019269919178752L, 0L, 0L}; 745 return data; 746 } 747 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); 748 749 } 750 | Popular Tags |