001// $ANTLR 2.7.7 (20060906): "distinguishedName.g" -> "AntlrDnLexer.java"$ 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 * 021 */ 022package org.apache.directory.shared.ldap.model.name; 023 024import java.io.StringReader; 025import java.util.ArrayList; 026import java.util.HashMap; 027import java.util.List; 028import java.util.Map; 029 030import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException; 031import javax.naming.NameParser; 032import org.apache.directory.shared.ldap.model.entry.StringValue; 033import org.apache.directory.shared.ldap.model.entry.BinaryValue; 034import org.apache.directory.shared.ldap.model.schema.parsers.ParserMonitor; 035import org.apache.directory.shared.util.Strings; 036 037 038import java.io.InputStream; 039import antlr.TokenStreamException; 040import antlr.TokenStreamIOException; 041import antlr.TokenStreamRecognitionException; 042import antlr.CharStreamException; 043import antlr.CharStreamIOException; 044import antlr.ANTLRException; 045import java.io.Reader; 046import java.util.Hashtable; 047import antlr.CharScanner; 048import antlr.InputBuffer; 049import antlr.ByteBuffer; 050import antlr.CharBuffer; 051import antlr.Token; 052import antlr.CommonToken; 053import antlr.RecognitionException; 054import antlr.NoViableAltForCharException; 055import antlr.MismatchedCharException; 056import antlr.TokenStream; 057import antlr.ANTLRHashString; 058import antlr.LexerSharedInputState; 059import antlr.collections.impl.BitSet; 060import antlr.SemanticException; 061 062/** 063 * An antlr generated Dn lexer. 064 * 065 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 066 */ 067public class AntlrDnLexer extends antlr.CharScanner implements AntlrDnTokenTypes, TokenStream 068 { 069public AntlrDnLexer(InputStream in) { 070 this(new ByteBuffer(in)); 071} 072public AntlrDnLexer(Reader in) { 073 this(new CharBuffer(in)); 074} 075public AntlrDnLexer(InputBuffer ib) { 076 this(new LexerSharedInputState(ib)); 077} 078public AntlrDnLexer(LexerSharedInputState state) { 079 super(state); 080 caseSensitiveLiterals = true; 081 setCaseSensitive(false); 082 literals = new Hashtable(); 083} 084 085public Token nextToken() throws TokenStreamException { 086 Token theRetToken=null; 087tryAgain: 088 for (;;) { 089 Token _token = null; 090 int _ttype = Token.INVALID_TYPE; 091 resetText(); 092 try { // for char stream error handling 093 try { // for lexical error handling 094 switch ( LA(1)) { 095 case ',': 096 { 097 mCOMMA(true); 098 theRetToken=_returnToken; 099 break; 100 } 101 case '=': 102 { 103 mEQUALS(true); 104 theRetToken=_returnToken; 105 break; 106 } 107 case '+': 108 { 109 mPLUS(true); 110 theRetToken=_returnToken; 111 break; 112 } 113 case '-': 114 { 115 mHYPHEN(true); 116 theRetToken=_returnToken; 117 break; 118 } 119 case '"': 120 { 121 mDQUOTE(true); 122 theRetToken=_returnToken; 123 break; 124 } 125 case ';': 126 { 127 mSEMI(true); 128 theRetToken=_returnToken; 129 break; 130 } 131 case '<': 132 { 133 mLANGLE(true); 134 theRetToken=_returnToken; 135 break; 136 } 137 case '>': 138 { 139 mRANGLE(true); 140 theRetToken=_returnToken; 141 break; 142 } 143 case ' ': 144 { 145 mSPACE(true); 146 theRetToken=_returnToken; 147 break; 148 } 149 case '0': case '1': case '2': case '3': 150 case '4': case '5': case '6': case '7': 151 case '8': case '9': case 'a': case 'b': 152 case 'c': case 'd': case 'e': case 'f': 153 case 'g': case 'h': case 'i': case 'j': 154 case 'k': case 'l': case 'm': case 'n': 155 case 'o': case 'p': case 'q': case 'r': 156 case 's': case 't': case 'u': case 'v': 157 case 'w': case 'x': case 'y': case 'z': 158 { 159 mNUMERICOID_OR_ALPHA_OR_DIGIT(true); 160 theRetToken=_returnToken; 161 break; 162 } 163 case '\\': 164 { 165 mHEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC(true); 166 theRetToken=_returnToken; 167 break; 168 } 169 case '#': 170 { 171 mHEXVALUE_OR_SHARP(true); 172 theRetToken=_returnToken; 173 break; 174 } 175 case '\u0001': case '\u0002': case '\u0003': case '\u0004': 176 case '\u0005': case '\u0006': case '\u0007': case '\u0008': 177 case '\t': case '\n': case '\u000b': case '\u000c': 178 case '\r': case '\u000e': case '\u000f': case '\u0010': 179 case '\u0011': case '\u0012': case '\u0013': case '\u0014': 180 case '\u0015': case '\u0016': case '\u0017': case '\u0018': 181 case '\u0019': case '\u001a': case '\u001b': case '\u001c': 182 case '\u001d': case '\u001e': case '\u001f': case '!': 183 case '$': case '%': case '&': case '\'': 184 case '(': case ')': case '*': case '.': 185 case '/': case ':': case '?': case '@': 186 case '[': case ']': case '^': case '_': 187 case '`': case '{': case '|': case '}': 188 case '~': case '\u007f': 189 { 190 mLUTF1_REST(true); 191 theRetToken=_returnToken; 192 break; 193 } 194 default: 195 if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) { 196 mUTFMB(true); 197 theRetToken=_returnToken; 198 } 199 else { 200 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} 201 else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 202 } 203 } 204 if ( _returnToken==null ) continue tryAgain; // found SKIP token 205 _ttype = _returnToken.getType(); 206 _ttype = testLiteralsTable(_ttype); 207 _returnToken.setType(_ttype); 208 return _returnToken; 209 } 210 catch (RecognitionException e) { 211 throw new TokenStreamRecognitionException(e); 212 } 213 } 214 catch (CharStreamException cse) { 215 if ( cse instanceof CharStreamIOException ) { 216 throw new TokenStreamIOException(((CharStreamIOException)cse).io); 217 } 218 else { 219 throw new TokenStreamException(cse.getMessage()); 220 } 221 } 222 } 223} 224 225 public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 226 int _ttype; Token _token=null; int _begin=text.length(); 227 _ttype = COMMA; 228 int _saveIndex; 229 230 match(','); 231 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 232 _token = makeToken(_ttype); 233 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 234 } 235 _returnToken = _token; 236 } 237 238 public final void mEQUALS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 239 int _ttype; Token _token=null; int _begin=text.length(); 240 _ttype = EQUALS; 241 int _saveIndex; 242 243 match('='); 244 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 245 _token = makeToken(_ttype); 246 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 247 } 248 _returnToken = _token; 249 } 250 251 public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 252 int _ttype; Token _token=null; int _begin=text.length(); 253 _ttype = PLUS; 254 int _saveIndex; 255 256 match('+'); 257 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 258 _token = makeToken(_ttype); 259 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 260 } 261 _returnToken = _token; 262 } 263 264 public final void mHYPHEN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 265 int _ttype; Token _token=null; int _begin=text.length(); 266 _ttype = HYPHEN; 267 int _saveIndex; 268 269 match('-'); 270 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 271 _token = makeToken(_ttype); 272 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 273 } 274 _returnToken = _token; 275 } 276 277 public final void mDQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 278 int _ttype; Token _token=null; int _begin=text.length(); 279 _ttype = DQUOTE; 280 int _saveIndex; 281 282 match('"'); 283 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 284 _token = makeToken(_ttype); 285 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 286 } 287 _returnToken = _token; 288 } 289 290 public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 291 int _ttype; Token _token=null; int _begin=text.length(); 292 _ttype = SEMI; 293 int _saveIndex; 294 295 match(';'); 296 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 297 _token = makeToken(_ttype); 298 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 299 } 300 _returnToken = _token; 301 } 302 303 public final void mLANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 304 int _ttype; Token _token=null; int _begin=text.length(); 305 _ttype = LANGLE; 306 int _saveIndex; 307 308 match('<'); 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 public final void mRANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 317 int _ttype; Token _token=null; int _begin=text.length(); 318 _ttype = RANGLE; 319 int _saveIndex; 320 321 match('>'); 322 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 323 _token = makeToken(_ttype); 324 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 325 } 326 _returnToken = _token; 327 } 328 329 public final void mSPACE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 330 int _ttype; Token _token=null; int _begin=text.length(); 331 _ttype = SPACE; 332 int _saveIndex; 333 334 match(' '); 335 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 336 _token = makeToken(_ttype); 337 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 338 } 339 _returnToken = _token; 340 } 341 342 public final void mNUMERICOID_OR_ALPHA_OR_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 343 int _ttype; Token _token=null; int _begin=text.length(); 344 _ttype = NUMERICOID_OR_ALPHA_OR_DIGIT; 345 int _saveIndex; 346 347 boolean synPredMatched12 = false; 348 if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))))) { 349 int _m12 = mark(); 350 synPredMatched12 = true; 351 inputState.guessing++; 352 try { 353 { 354 mNUMERICOID(false); 355 } 356 } 357 catch (RecognitionException pe) { 358 synPredMatched12 = false; 359 } 360 rewind(_m12); 361inputState.guessing--; 362 } 363 if ( synPredMatched12 ) { 364 mNUMERICOID(false); 365 if ( inputState.guessing==0 ) { 366 _ttype = NUMERICOID; 367 } 368 } 369 else { 370 boolean synPredMatched14 = false; 371 if ((((LA(1) >= '0' && LA(1) <= '9')) && (true))) { 372 int _m14 = mark(); 373 synPredMatched14 = true; 374 inputState.guessing++; 375 try { 376 { 377 mDIGIT(false); 378 } 379 } 380 catch (RecognitionException pe) { 381 synPredMatched14 = false; 382 } 383 rewind(_m14); 384inputState.guessing--; 385 } 386 if ( synPredMatched14 ) { 387 mDIGIT(false); 388 if ( inputState.guessing==0 ) { 389 _ttype = DIGIT; 390 } 391 } 392 else { 393 boolean synPredMatched16 = false; 394 if ((((LA(1) >= 'a' && LA(1) <= 'z')) && (true))) { 395 int _m16 = mark(); 396 synPredMatched16 = true; 397 inputState.guessing++; 398 try { 399 { 400 mALPHA(false); 401 } 402 } 403 catch (RecognitionException pe) { 404 synPredMatched16 = false; 405 } 406 rewind(_m16); 407inputState.guessing--; 408 } 409 if ( synPredMatched16 ) { 410 mALPHA(false); 411 if ( inputState.guessing==0 ) { 412 _ttype = ALPHA; 413 } 414 } 415 else { 416 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 417 } 418 }} 419 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 420 _token = makeToken(_ttype); 421 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 422 } 423 _returnToken = _token; 424 } 425 426 protected final void mNUMERICOID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 427 int _ttype; Token _token=null; int _begin=text.length(); 428 _ttype = NUMERICOID; 429 int _saveIndex; 430 431 { 432 switch ( LA(1)) { 433 case 'o': 434 { 435 match("oid."); 436 break; 437 } 438 case '0': case '1': case '2': case '3': 439 case '4': case '5': case '6': case '7': 440 case '8': case '9': 441 { 442 break; 443 } 444 default: 445 { 446 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 447 } 448 } 449 } 450 mNUMBER(false); 451 { 452 int _cnt20=0; 453 _loop20: 454 do { 455 if ((LA(1)=='.')) { 456 mDOT(false); 457 mNUMBER(false); 458 } 459 else { 460 if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 461 } 462 463 _cnt20++; 464 } while (true); 465 } 466 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 467 _token = makeToken(_ttype); 468 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 469 } 470 _returnToken = _token; 471 } 472 473 protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 474 int _ttype; Token _token=null; int _begin=text.length(); 475 _ttype = DIGIT; 476 int _saveIndex; 477 478 matchRange('0','9'); 479 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 480 _token = makeToken(_ttype); 481 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 482 } 483 _returnToken = _token; 484 } 485 486 protected final void mALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 487 int _ttype; Token _token=null; int _begin=text.length(); 488 _ttype = ALPHA; 489 int _saveIndex; 490 491 matchRange('a','z'); 492 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 493 _token = makeToken(_ttype); 494 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 495 } 496 _returnToken = _token; 497 } 498 499 protected final void mNUMBER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 500 int _ttype; Token _token=null; int _begin=text.length(); 501 _ttype = NUMBER; 502 int _saveIndex; 503 504 if (((LA(1) >= '1' && LA(1) <= '9')) && ((LA(2) >= '0' && LA(2) <= '9'))) { 505 { 506 mLDIGIT(false); 507 { 508 int _cnt25=0; 509 _loop25: 510 do { 511 if (((LA(1) >= '0' && LA(1) <= '9'))) { 512 mDIGIT(false); 513 } 514 else { 515 if ( _cnt25>=1 ) { break _loop25; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 516 } 517 518 _cnt25++; 519 } while (true); 520 } 521 } 522 } 523 else if (((LA(1) >= '0' && LA(1) <= '9')) && (true)) { 524 mDIGIT(false); 525 } 526 else { 527 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 528 } 529 530 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 531 _token = makeToken(_ttype); 532 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 533 } 534 _returnToken = _token; 535 } 536 537 protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 538 int _ttype; Token _token=null; int _begin=text.length(); 539 _ttype = DOT; 540 int _saveIndex; 541 542 match('.'); 543 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 544 _token = makeToken(_ttype); 545 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 546 } 547 _returnToken = _token; 548 } 549 550 protected final void mLDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 551 int _ttype; Token _token=null; int _begin=text.length(); 552 _ttype = LDIGIT; 553 int _saveIndex; 554 555 matchRange('1','9'); 556 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 557 _token = makeToken(_ttype); 558 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 559 } 560 _returnToken = _token; 561 } 562 563 public final void mHEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 564 int _ttype; Token _token=null; int _begin=text.length(); 565 _ttype = HEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC; 566 int _saveIndex; 567 568 boolean synPredMatched31 = false; 569 if (((LA(1)=='\\') && (_tokenSet_2.member(LA(2))))) { 570 int _m31 = mark(); 571 synPredMatched31 = true; 572 inputState.guessing++; 573 try { 574 { 575 mESC(false); 576 mHEX(false); 577 mHEX(false); 578 } 579 } 580 catch (RecognitionException pe) { 581 synPredMatched31 = false; 582 } 583 rewind(_m31); 584inputState.guessing--; 585 } 586 if ( synPredMatched31 ) { 587 mHEXPAIR(false); 588 if ( inputState.guessing==0 ) { 589 _ttype = HEXPAIR; 590 } 591 } 592 else if ((LA(1)=='\\') && (LA(2)=='\\')) { 593 mESCESC(false); 594 if ( inputState.guessing==0 ) { 595 _ttype = ESCESC; 596 } 597 } 598 else if ((LA(1)=='\\') && (LA(2)=='#')) { 599 mESCSHARP(false); 600 if ( inputState.guessing==0 ) { 601 _ttype = ESCSHARP; 602 } 603 } 604 else if ((LA(1)=='\\') && (true)) { 605 mESC(false); 606 if ( inputState.guessing==0 ) { 607 _ttype = ESC; 608 } 609 } 610 else { 611 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 612 } 613 614 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 615 _token = makeToken(_ttype); 616 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 617 } 618 _returnToken = _token; 619 } 620 621 protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 622 int _ttype; Token _token=null; int _begin=text.length(); 623 _ttype = ESC; 624 int _saveIndex; 625 626 match('\\'); 627 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 628 _token = makeToken(_ttype); 629 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 630 } 631 _returnToken = _token; 632 } 633 634 protected final void mHEX(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 635 int _ttype; Token _token=null; int _begin=text.length(); 636 _ttype = HEX; 637 int _saveIndex; 638 639 switch ( LA(1)) { 640 case '0': case '1': case '2': case '3': 641 case '4': case '5': case '6': case '7': 642 case '8': case '9': 643 { 644 mDIGIT(false); 645 break; 646 } 647 case 'a': case 'b': case 'c': case 'd': 648 case 'e': case 'f': 649 { 650 matchRange('a','f'); 651 break; 652 } 653 default: 654 { 655 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 656 } 657 } 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 protected final void mHEXPAIR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 666 int _ttype; Token _token=null; int _begin=text.length(); 667 _ttype = HEXPAIR; 668 int _saveIndex; 669 670 _saveIndex=text.length(); 671 mESC(false); 672 text.setLength(_saveIndex); 673 mHEX(false); 674 mHEX(false); 675 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 676 _token = makeToken(_ttype); 677 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 678 } 679 _returnToken = _token; 680 } 681 682 protected final void mESCESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 683 int _ttype; Token _token=null; int _begin=text.length(); 684 _ttype = ESCESC; 685 int _saveIndex; 686 687 mESC(false); 688 mESC(false); 689 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 690 _token = makeToken(_ttype); 691 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 692 } 693 _returnToken = _token; 694 } 695 696 protected final void mESCSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 697 int _ttype; Token _token=null; int _begin=text.length(); 698 _ttype = ESCSHARP; 699 int _saveIndex; 700 701 mESC(false); 702 mSHARP(false); 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 protected final void mSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 711 int _ttype; Token _token=null; int _begin=text.length(); 712 _ttype = SHARP; 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 mHEXVALUE_OR_SHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 724 int _ttype; Token _token=null; int _begin=text.length(); 725 _ttype = HEXVALUE_OR_SHARP; 726 int _saveIndex; 727 728 boolean synPredMatched41 = false; 729 if (((LA(1)=='#') && (_tokenSet_2.member(LA(2))))) { 730 int _m41 = mark(); 731 synPredMatched41 = true; 732 inputState.guessing++; 733 try { 734 { 735 mSHARP(false); 736 { 737 int _cnt40=0; 738 _loop40: 739 do { 740 if ((_tokenSet_2.member(LA(1)))) { 741 mHEX(false); 742 mHEX(false); 743 } 744 else { 745 if ( _cnt40>=1 ) { break _loop40; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 746 } 747 748 _cnt40++; 749 } while (true); 750 } 751 } 752 } 753 catch (RecognitionException pe) { 754 synPredMatched41 = false; 755 } 756 rewind(_m41); 757inputState.guessing--; 758 } 759 if ( synPredMatched41 ) { 760 mHEXVALUE(false); 761 if ( inputState.guessing==0 ) { 762 _ttype = HEXVALUE; 763 } 764 } 765 else if ((LA(1)=='#') && (true)) { 766 mSHARP(false); 767 if ( inputState.guessing==0 ) { 768 _ttype = SHARP; 769 } 770 } 771 else { 772 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 773 } 774 775 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 776 _token = makeToken(_ttype); 777 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 778 } 779 _returnToken = _token; 780 } 781 782 protected final void mHEXVALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 783 int _ttype; Token _token=null; int _begin=text.length(); 784 _ttype = HEXVALUE; 785 int _saveIndex; 786 787 _saveIndex=text.length(); 788 mSHARP(false); 789 text.setLength(_saveIndex); 790 { 791 int _cnt44=0; 792 _loop44: 793 do { 794 if ((_tokenSet_2.member(LA(1)))) { 795 mHEX(false); 796 mHEX(false); 797 } 798 else { 799 if ( _cnt44>=1 ) { break _loop44; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 800 } 801 802 _cnt44++; 803 } while (true); 804 } 805 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 806 _token = makeToken(_ttype); 807 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 808 } 809 _returnToken = _token; 810 } 811 812 public final void mUTFMB(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 813 int _ttype; Token _token=null; int _begin=text.length(); 814 _ttype = UTFMB; 815 int _saveIndex; 816 817 matchRange('\u0080','\uFFFE'); 818 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 819 _token = makeToken(_ttype); 820 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 821 } 822 _returnToken = _token; 823 } 824 825/** 826 * RFC 4514, Section 3: 827 * LUTF1 = %x01-1F / %x21 / %x24-2A / %x2D-3A / 828 * %x3D / %x3F-5B / %x5D-7F 829 * 830 * To avoid nondeterminism the following 831 * rules are excluded. These rules are 832 * explicitly added in the productions. 833 * EQUALS (0x3D) 834 * HYPHEN (0x2D) 835 * DIGIT (0x30-0x39) 836 * ALPHA (0x41-0x5A and 0x61-0x7A) 837 */ 838 public final void mLUTF1_REST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 839 int _ttype; Token _token=null; int _begin=text.length(); 840 _ttype = LUTF1_REST; 841 int _saveIndex; 842 843 switch ( LA(1)) { 844 case '\u0001': case '\u0002': case '\u0003': case '\u0004': 845 case '\u0005': case '\u0006': case '\u0007': case '\u0008': 846 case '\t': case '\n': case '\u000b': case '\u000c': 847 case '\r': case '\u000e': case '\u000f': case '\u0010': 848 case '\u0011': case '\u0012': case '\u0013': case '\u0014': 849 case '\u0015': case '\u0016': case '\u0017': case '\u0018': 850 case '\u0019': case '\u001a': case '\u001b': case '\u001c': 851 case '\u001d': case '\u001e': case '\u001f': 852 { 853 matchRange('\u0001','\u001F'); 854 break; 855 } 856 case '!': 857 { 858 match('\u0021'); 859 break; 860 } 861 case '$': case '%': case '&': case '\'': 862 case '(': case ')': case '*': 863 { 864 matchRange('\u0024','\u002A'); 865 break; 866 } 867 case '.': case '/': 868 { 869 matchRange('\u002E','\u002F'); 870 break; 871 } 872 case ':': 873 { 874 match('\u003A'); 875 break; 876 } 877 case '?': case '@': 878 { 879 matchRange('\u003F','\u0040'); 880 break; 881 } 882 case '[': 883 { 884 match('\u005B'); 885 break; 886 } 887 case ']': case '^': case '_': case '`': 888 { 889 matchRange('\u005D','\u0060'); 890 break; 891 } 892 case '{': case '|': case '}': case '~': 893 case '\u007f': 894 { 895 matchRange('\u007B','\u007F'); 896 break; 897 } 898 default: 899 { 900 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 901 } 902 } 903 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 904 _token = makeToken(_ttype); 905 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 906 } 907 _returnToken = _token; 908 } 909 910 911 private static final long[] mk_tokenSet_0() { 912 long[] data = new long[1025]; 913 data[0]=287948901175001088L; 914 data[1]=140737488355328L; 915 return data; 916 } 917 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); 918 private static final long[] mk_tokenSet_1() { 919 long[] data = new long[1025]; 920 data[0]=288019269919178752L; 921 data[1]=2199023255552L; 922 return data; 923 } 924 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); 925 private static final long[] mk_tokenSet_2() { 926 long[] data = new long[1025]; 927 data[0]=287948901175001088L; 928 data[1]=541165879296L; 929 return data; 930 } 931 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); 932 933 }