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