View Javadoc
1   // $ANTLR 2.7.7 (20060906): "distinguishedName.g" -> "AntlrDnLexer.java"$
2   
3   /*
4    *  Licensed to the Apache Software Foundation (ASF) under one
5    *  or more contributor license agreements.  See the NOTICE file
6    *  distributed with this work for additional information
7    *  regarding copyright ownership.  The ASF licenses this file
8    *  to you under the Apache License, Version 2.0 (the
9    *  "License"); you may not use this file except in compliance
10   *  with the License.  You may obtain a copy of the License at
11   *  
12   *    https://www.apache.org/licenses/LICENSE-2.0
13   *  
14   *  Unless required by applicable law or agreed to in writing,
15   *  software distributed under the License is distributed on an
16   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   *  KIND, either express or implied.  See the License for the
18   *  specific language governing permissions and limitations
19   *  under the License. 
20   *  
21   */
22  package org.apache.directory.api.ldap.model.name;
23  
24  import java.io.StringReader;
25  import java.util.ArrayList;
26  import java.util.HashMap;
27  import java.util.List;
28  import java.util.Map;
29  
30  import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
31  import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
32  import javax.naming.NameParser;
33  import org.apache.directory.api.ldap.model.entry.Value;
34  import org.apache.directory.api.ldap.model.schema.SchemaManager;
35  import org.apache.directory.api.ldap.model.schema.AttributeType;
36  import org.apache.directory.api.util.ExpansibleByteBuffer;
37  import org.apache.directory.api.util.Strings;
38  import org.apache.directory.api.util.Unicode;
39  
40  import java.io.InputStream;
41  import antlr.TokenStreamException;
42  import antlr.TokenStreamIOException;
43  import antlr.TokenStreamRecognitionException;
44  import antlr.CharStreamException;
45  import antlr.CharStreamIOException;
46  import antlr.ANTLRException;
47  import java.io.Reader;
48  import java.util.Hashtable;
49  import antlr.CharScanner;
50  import antlr.InputBuffer;
51  import antlr.ByteBuffer;
52  import antlr.CharBuffer;
53  import antlr.Token;
54  import antlr.CommonToken;
55  import antlr.RecognitionException;
56  import antlr.NoViableAltForCharException;
57  import antlr.MismatchedCharException;
58  import antlr.TokenStream;
59  import antlr.ANTLRHashString;
60  import antlr.LexerSharedInputState;
61  import antlr.collections.impl.BitSet;
62  import antlr.SemanticException;
63  
64  /**
65   * An antlr generated Dn lexer.
66   *
67   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
68   */
69  public class AntlrDnLexer extends antlr.CharScanner implements AntlrDnTokenTypes, TokenStream
70   {
71  public AntlrDnLexer(InputStream in) {
72  	this(new ByteBuffer(in));
73  }
74  public AntlrDnLexer(Reader in) {
75  	this(new CharBuffer(in));
76  }
77  public AntlrDnLexer(InputBuffer ib) {
78  	this(new LexerSharedInputState(ib));
79  }
80  public AntlrDnLexer(LexerSharedInputState state) {
81  	super(state);
82  	caseSensitiveLiterals = true;
83  	setCaseSensitive(false);
84  	literals = new Hashtable();
85  }
86  
87  public Token nextToken() throws TokenStreamException {
88  	Token theRetToken=null;
89  tryAgain:
90  	for (;;) {
91  		Token _token = null;
92  		int _ttype = Token.INVALID_TYPE;
93  		resetText();
94  		try {   // for char stream error handling
95  			try {   // for lexical error handling
96  				switch ( LA(1)) {
97  				case ',':
98  				{
99  					mCOMMA(true);
100 					theRetToken=_returnToken;
101 					break;
102 				}
103 				case '=':
104 				{
105 					mEQUALS(true);
106 					theRetToken=_returnToken;
107 					break;
108 				}
109 				case '+':
110 				{
111 					mPLUS(true);
112 					theRetToken=_returnToken;
113 					break;
114 				}
115 				case '-':
116 				{
117 					mHYPHEN(true);
118 					theRetToken=_returnToken;
119 					break;
120 				}
121 				case '_':
122 				{
123 					mUNDERSCORE(true);
124 					theRetToken=_returnToken;
125 					break;
126 				}
127 				case '"':
128 				{
129 					mDQUOTE(true);
130 					theRetToken=_returnToken;
131 					break;
132 				}
133 				case ';':
134 				{
135 					mSEMI(true);
136 					theRetToken=_returnToken;
137 					break;
138 				}
139 				case '<':
140 				{
141 					mLANGLE(true);
142 					theRetToken=_returnToken;
143 					break;
144 				}
145 				case '>':
146 				{
147 					mRANGLE(true);
148 					theRetToken=_returnToken;
149 					break;
150 				}
151 				case ' ':
152 				{
153 					mSPACE(true);
154 					theRetToken=_returnToken;
155 					break;
156 				}
157 				case '0':  case '1':  case '2':  case '3':
158 				case '4':  case '5':  case '6':  case '7':
159 				case '8':  case '9':  case 'a':  case 'b':
160 				case 'c':  case 'd':  case 'e':  case 'f':
161 				case 'g':  case 'h':  case 'i':  case 'j':
162 				case 'k':  case 'l':  case 'm':  case 'n':
163 				case 'o':  case 'p':  case 'q':  case 'r':
164 				case 's':  case 't':  case 'u':  case 'v':
165 				case 'w':  case 'x':  case 'y':  case 'z':
166 				{
167 					mNUMERICOID_OR_ALPHA_OR_DIGIT(true);
168 					theRetToken=_returnToken;
169 					break;
170 				}
171 				case '\\':
172 				{
173 					mHEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC(true);
174 					theRetToken=_returnToken;
175 					break;
176 				}
177 				case '#':
178 				{
179 					mHEXVALUE_OR_SHARP(true);
180 					theRetToken=_returnToken;
181 					break;
182 				}
183 				case '\u0001':  case '\u0002':  case '\u0003':  case '\u0004':
184 				case '\u0005':  case '\u0006':  case '\u0007':  case '\u0008':
185 				case '\t':  case '\n':  case '\u000b':  case '\u000c':
186 				case '\r':  case '\u000e':  case '\u000f':  case '\u0010':
187 				case '\u0011':  case '\u0012':  case '\u0013':  case '\u0014':
188 				case '\u0015':  case '\u0016':  case '\u0017':  case '\u0018':
189 				case '\u0019':  case '\u001a':  case '\u001b':  case '\u001c':
190 				case '\u001d':  case '\u001e':  case '\u001f':  case '!':
191 				case '$':  case '%':  case '&':  case '\'':
192 				case '(':  case ')':  case '*':  case '.':
193 				case '/':  case ':':  case '?':  case '@':
194 				case '[':  case ']':  case '^':  case '`':
195 				case '{':  case '|':  case '}':  case '~':
196 				case '\u007f':
197 				{
198 					mCHAR_REST(true);
199 					theRetToken=_returnToken;
200 					break;
201 				}
202 				default:
203 					if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) {
204 						mUTFMB(true);
205 						theRetToken=_returnToken;
206 					}
207 				else {
208 					if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
209 				else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
210 				}
211 				}
212 				if ( _returnToken==null ) continue tryAgain; // found SKIP token
213 				_ttype = _returnToken.getType();
214 				_ttype = testLiteralsTable(_ttype);
215 				_returnToken.setType(_ttype);
216 				return _returnToken;
217 			}
218 			catch (RecognitionException e) {
219 				throw new TokenStreamRecognitionException(e);
220 			}
221 		}
222 		catch (CharStreamException cse) {
223 			if ( cse instanceof CharStreamIOException ) {
224 				throw new TokenStreamIOException(((CharStreamIOException)cse).io);
225 			}
226 			else {
227 				throw new TokenStreamException(cse.getMessage());
228 			}
229 		}
230 	}
231 }
232 
233 	public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
234 		int _ttype; Token _token=null; int _begin=text.length();
235 		_ttype = COMMA;
236 		int _saveIndex;
237 		
238 		match(',');
239 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
240 			_token = makeToken(_ttype);
241 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
242 		}
243 		_returnToken = _token;
244 	}
245 	
246 	public final void mEQUALS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
247 		int _ttype; Token _token=null; int _begin=text.length();
248 		_ttype = EQUALS;
249 		int _saveIndex;
250 		
251 		match('=');
252 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
253 			_token = makeToken(_ttype);
254 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
255 		}
256 		_returnToken = _token;
257 	}
258 	
259 	public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
260 		int _ttype; Token _token=null; int _begin=text.length();
261 		_ttype = PLUS;
262 		int _saveIndex;
263 		
264 		match('+');
265 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
266 			_token = makeToken(_ttype);
267 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
268 		}
269 		_returnToken = _token;
270 	}
271 	
272 	public final void mHYPHEN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
273 		int _ttype; Token _token=null; int _begin=text.length();
274 		_ttype = HYPHEN;
275 		int _saveIndex;
276 		
277 		match('-');
278 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
279 			_token = makeToken(_ttype);
280 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
281 		}
282 		_returnToken = _token;
283 	}
284 	
285 	public final void mUNDERSCORE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
286 		int _ttype; Token _token=null; int _begin=text.length();
287 		_ttype = UNDERSCORE;
288 		int _saveIndex;
289 		
290 		match('_');
291 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
292 			_token = makeToken(_ttype);
293 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
294 		}
295 		_returnToken = _token;
296 	}
297 	
298 	public final void mDQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
299 		int _ttype; Token _token=null; int _begin=text.length();
300 		_ttype = DQUOTE;
301 		int _saveIndex;
302 		
303 		match('"');
304 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
305 			_token = makeToken(_ttype);
306 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
307 		}
308 		_returnToken = _token;
309 	}
310 	
311 	public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
312 		int _ttype; Token _token=null; int _begin=text.length();
313 		_ttype = SEMI;
314 		int _saveIndex;
315 		
316 		match(';');
317 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
318 			_token = makeToken(_ttype);
319 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
320 		}
321 		_returnToken = _token;
322 	}
323 	
324 	public final void mLANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
325 		int _ttype; Token _token=null; int _begin=text.length();
326 		_ttype = LANGLE;
327 		int _saveIndex;
328 		
329 		match('<');
330 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
331 			_token = makeToken(_ttype);
332 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
333 		}
334 		_returnToken = _token;
335 	}
336 	
337 	public final void mRANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
338 		int _ttype; Token _token=null; int _begin=text.length();
339 		_ttype = RANGLE;
340 		int _saveIndex;
341 		
342 		match('>');
343 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
344 			_token = makeToken(_ttype);
345 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
346 		}
347 		_returnToken = _token;
348 	}
349 	
350 	public final void mSPACE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
351 		int _ttype; Token _token=null; int _begin=text.length();
352 		_ttype = SPACE;
353 		int _saveIndex;
354 		
355 		match(' ');
356 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
357 			_token = makeToken(_ttype);
358 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
359 		}
360 		_returnToken = _token;
361 	}
362 	
363 	public final void mNUMERICOID_OR_ALPHA_OR_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
364 		int _ttype; Token _token=null; int _begin=text.length();
365 		_ttype = NUMERICOID_OR_ALPHA_OR_DIGIT;
366 		int _saveIndex;
367 		
368 		boolean synPredMatched13 = false;
369 		if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))))) {
370 			int _m13 = mark();
371 			synPredMatched13 = true;
372 			inputState.guessing++;
373 			try {
374 				{
375 				mNUMERICOID(false);
376 				}
377 			}
378 			catch (RecognitionException pe) {
379 				synPredMatched13 = false;
380 			}
381 			rewind(_m13);
382 inputState.guessing--;
383 		}
384 		if ( synPredMatched13 ) {
385 			mNUMERICOID(false);
386 			if ( inputState.guessing==0 ) {
387 				_ttype = NUMERICOID;
388 			}
389 		}
390 		else {
391 			boolean synPredMatched15 = false;
392 			if ((((LA(1) >= '0' && LA(1) <= '9')) && (true))) {
393 				int _m15 = mark();
394 				synPredMatched15 = true;
395 				inputState.guessing++;
396 				try {
397 					{
398 					mDIGIT(false);
399 					}
400 				}
401 				catch (RecognitionException pe) {
402 					synPredMatched15 = false;
403 				}
404 				rewind(_m15);
405 inputState.guessing--;
406 			}
407 			if ( synPredMatched15 ) {
408 				mDIGIT(false);
409 				if ( inputState.guessing==0 ) {
410 					_ttype = DIGIT;
411 				}
412 			}
413 			else {
414 				boolean synPredMatched17 = false;
415 				if ((((LA(1) >= 'a' && LA(1) <= 'z')) && (true))) {
416 					int _m17 = mark();
417 					synPredMatched17 = true;
418 					inputState.guessing++;
419 					try {
420 						{
421 						mALPHA(false);
422 						}
423 					}
424 					catch (RecognitionException pe) {
425 						synPredMatched17 = false;
426 					}
427 					rewind(_m17);
428 inputState.guessing--;
429 				}
430 				if ( synPredMatched17 ) {
431 					mALPHA(false);
432 					if ( inputState.guessing==0 ) {
433 						_ttype = ALPHA;
434 					}
435 				}
436 				else {
437 					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
438 				}
439 				}}
440 				if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
441 					_token = makeToken(_ttype);
442 					_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
443 				}
444 				_returnToken = _token;
445 			}
446 			
447 	protected final void mNUMERICOID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
448 		int _ttype; Token _token=null; int _begin=text.length();
449 		_ttype = NUMERICOID;
450 		int _saveIndex;
451 		
452 		{
453 		switch ( LA(1)) {
454 		case 'o':
455 		{
456 			match("oid.");
457 			break;
458 		}
459 		case '0':  case '1':  case '2':  case '3':
460 		case '4':  case '5':  case '6':  case '7':
461 		case '8':  case '9':
462 		{
463 			break;
464 		}
465 		default:
466 		{
467 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
468 		}
469 		}
470 		}
471 		mNUMBER(false);
472 		{
473 		int _cnt21=0;
474 		_loop21:
475 		do {
476 			if ((LA(1)=='.')) {
477 				mDOT(false);
478 				mNUMBER(false);
479 			}
480 			else {
481 				if ( _cnt21>=1 ) { break _loop21; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
482 			}
483 			
484 			_cnt21++;
485 		} while (true);
486 		}
487 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
488 			_token = makeToken(_ttype);
489 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
490 		}
491 		_returnToken = _token;
492 	}
493 	
494 	protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
495 		int _ttype; Token _token=null; int _begin=text.length();
496 		_ttype = DIGIT;
497 		int _saveIndex;
498 		
499 		matchRange('0','9');
500 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
501 			_token = makeToken(_ttype);
502 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
503 		}
504 		_returnToken = _token;
505 	}
506 	
507 	protected final void mALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
508 		int _ttype; Token _token=null; int _begin=text.length();
509 		_ttype = ALPHA;
510 		int _saveIndex;
511 		
512 		matchRange('a','z');
513 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
514 			_token = makeToken(_ttype);
515 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
516 		}
517 		_returnToken = _token;
518 	}
519 	
520 	protected final void mNUMBER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
521 		int _ttype; Token _token=null; int _begin=text.length();
522 		_ttype = NUMBER;
523 		int _saveIndex;
524 		
525 		if (((LA(1) >= '1' && LA(1) <= '9')) && ((LA(2) >= '0' && LA(2) <= '9'))) {
526 			{
527 			mLDIGIT(false);
528 			{
529 			int _cnt26=0;
530 			_loop26:
531 			do {
532 				if (((LA(1) >= '0' && LA(1) <= '9'))) {
533 					mDIGIT(false);
534 				}
535 				else {
536 					if ( _cnt26>=1 ) { break _loop26; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
537 				}
538 				
539 				_cnt26++;
540 			} while (true);
541 			}
542 			}
543 		}
544 		else if (((LA(1) >= '0' && LA(1) <= '9')) && (true)) {
545 			mDIGIT(false);
546 		}
547 		else {
548 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
549 		}
550 		
551 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
552 			_token = makeToken(_ttype);
553 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
554 		}
555 		_returnToken = _token;
556 	}
557 	
558 	protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
559 		int _ttype; Token _token=null; int _begin=text.length();
560 		_ttype = DOT;
561 		int _saveIndex;
562 		
563 		match('.');
564 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
565 			_token = makeToken(_ttype);
566 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
567 		}
568 		_returnToken = _token;
569 	}
570 	
571 	protected final void mLDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
572 		int _ttype; Token _token=null; int _begin=text.length();
573 		_ttype = LDIGIT;
574 		int _saveIndex;
575 		
576 		matchRange('1','9');
577 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
578 			_token = makeToken(_ttype);
579 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
580 		}
581 		_returnToken = _token;
582 	}
583 	
584 	public final void mHEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
585 		int _ttype; Token _token=null; int _begin=text.length();
586 		_ttype = HEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC;
587 		int _saveIndex;
588 		
589 		boolean synPredMatched32 = false;
590 		if (((LA(1)=='\\') && (_tokenSet_2.member(LA(2))))) {
591 			int _m32 = mark();
592 			synPredMatched32 = true;
593 			inputState.guessing++;
594 			try {
595 				{
596 				mESC(false);
597 				mHEX(false);
598 				mHEX(false);
599 				}
600 			}
601 			catch (RecognitionException pe) {
602 				synPredMatched32 = false;
603 			}
604 			rewind(_m32);
605 inputState.guessing--;
606 		}
607 		if ( synPredMatched32 ) {
608 			mHEXPAIR(false);
609 			if ( inputState.guessing==0 ) {
610 				_ttype = HEXPAIR;
611 			}
612 		}
613 		else if ((LA(1)=='\\') && (LA(2)=='\\')) {
614 			mESCESC(false);
615 			if ( inputState.guessing==0 ) {
616 				_ttype = ESCESC;
617 			}
618 		}
619 		else if ((LA(1)=='\\') && (LA(2)=='#')) {
620 			mESCSHARP(false);
621 			if ( inputState.guessing==0 ) {
622 				_ttype = ESCSHARP;
623 			}
624 		}
625 		else if ((LA(1)=='\\') && (true)) {
626 			mESC(false);
627 			if ( inputState.guessing==0 ) {
628 				_ttype = ESC;
629 			}
630 		}
631 		else {
632 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
633 		}
634 		
635 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
636 			_token = makeToken(_ttype);
637 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
638 		}
639 		_returnToken = _token;
640 	}
641 	
642 	protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
643 		int _ttype; Token _token=null; int _begin=text.length();
644 		_ttype = ESC;
645 		int _saveIndex;
646 		
647 		match('\\');
648 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
649 			_token = makeToken(_ttype);
650 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
651 		}
652 		_returnToken = _token;
653 	}
654 	
655 	protected final void mHEX(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
656 		int _ttype; Token _token=null; int _begin=text.length();
657 		_ttype = HEX;
658 		int _saveIndex;
659 		
660 		switch ( LA(1)) {
661 		case '0':  case '1':  case '2':  case '3':
662 		case '4':  case '5':  case '6':  case '7':
663 		case '8':  case '9':
664 		{
665 			mDIGIT(false);
666 			break;
667 		}
668 		case 'a':  case 'b':  case 'c':  case 'd':
669 		case 'e':  case 'f':
670 		{
671 			matchRange('a','f');
672 			break;
673 		}
674 		default:
675 		{
676 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
677 		}
678 		}
679 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
680 			_token = makeToken(_ttype);
681 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
682 		}
683 		_returnToken = _token;
684 	}
685 	
686 	protected final void mHEXPAIR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
687 		int _ttype; Token _token=null; int _begin=text.length();
688 		_ttype = HEXPAIR;
689 		int _saveIndex;
690 		
691 		_saveIndex=text.length();
692 		mESC(false);
693 		text.setLength(_saveIndex);
694 		mHEX(false);
695 		mHEX(false);
696 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
697 			_token = makeToken(_ttype);
698 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
699 		}
700 		_returnToken = _token;
701 	}
702 	
703 	protected final void mESCESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
704 		int _ttype; Token _token=null; int _begin=text.length();
705 		_ttype = ESCESC;
706 		int _saveIndex;
707 		
708 		mESC(false);
709 		mESC(false);
710 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
711 			_token = makeToken(_ttype);
712 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
713 		}
714 		_returnToken = _token;
715 	}
716 	
717 	protected final void mESCSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
718 		int _ttype; Token _token=null; int _begin=text.length();
719 		_ttype = ESCSHARP;
720 		int _saveIndex;
721 		
722 		mESC(false);
723 		mSHARP(false);
724 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
725 			_token = makeToken(_ttype);
726 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
727 		}
728 		_returnToken = _token;
729 	}
730 	
731 	protected final void mSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
732 		int _ttype; Token _token=null; int _begin=text.length();
733 		_ttype = SHARP;
734 		int _saveIndex;
735 		
736 		match('#');
737 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
738 			_token = makeToken(_ttype);
739 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
740 		}
741 		_returnToken = _token;
742 	}
743 	
744 	public final void mHEXVALUE_OR_SHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
745 		int _ttype; Token _token=null; int _begin=text.length();
746 		_ttype = HEXVALUE_OR_SHARP;
747 		int _saveIndex;
748 		
749 		boolean synPredMatched42 = false;
750 		if (((LA(1)=='#') && (_tokenSet_2.member(LA(2))))) {
751 			int _m42 = mark();
752 			synPredMatched42 = true;
753 			inputState.guessing++;
754 			try {
755 				{
756 				mSHARP(false);
757 				{
758 				int _cnt41=0;
759 				_loop41:
760 				do {
761 					if ((_tokenSet_2.member(LA(1)))) {
762 						mHEX(false);
763 						mHEX(false);
764 					}
765 					else {
766 						if ( _cnt41>=1 ) { break _loop41; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
767 					}
768 					
769 					_cnt41++;
770 				} while (true);
771 				}
772 				}
773 			}
774 			catch (RecognitionException pe) {
775 				synPredMatched42 = false;
776 			}
777 			rewind(_m42);
778 inputState.guessing--;
779 		}
780 		if ( synPredMatched42 ) {
781 			mHEXVALUE(false);
782 			if ( inputState.guessing==0 ) {
783 				_ttype = HEXVALUE;
784 			}
785 		}
786 		else if ((LA(1)=='#') && (true)) {
787 			mSHARP(false);
788 			if ( inputState.guessing==0 ) {
789 				_ttype = SHARP;
790 			}
791 		}
792 		else {
793 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
794 		}
795 		
796 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
797 			_token = makeToken(_ttype);
798 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
799 		}
800 		_returnToken = _token;
801 	}
802 	
803 	protected final void mHEXVALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
804 		int _ttype; Token _token=null; int _begin=text.length();
805 		_ttype = HEXVALUE;
806 		int _saveIndex;
807 		
808 		_saveIndex=text.length();
809 		mSHARP(false);
810 		text.setLength(_saveIndex);
811 		{
812 		int _cnt45=0;
813 		_loop45:
814 		do {
815 			if ((_tokenSet_2.member(LA(1)))) {
816 				mHEX(false);
817 				mHEX(false);
818 			}
819 			else {
820 				if ( _cnt45>=1 ) { break _loop45; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
821 			}
822 			
823 			_cnt45++;
824 		} while (true);
825 		}
826 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
827 			_token = makeToken(_ttype);
828 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
829 		}
830 		_returnToken = _token;
831 	}
832 	
833 	public final void mUTFMB(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
834 		int _ttype; Token _token=null; int _begin=text.length();
835 		_ttype = UTFMB;
836 		int _saveIndex;
837 		
838 		matchRange('\u0080','\uFFFE');
839 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
840 			_token = makeToken(_ttype);
841 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
842 		}
843 		_returnToken = _token;
844 	}
845 	
846 /**
847  * RFC 4514, Section 3:
848  * <pre>
849  * LUTF1 = %x01-1F / %x21 / %x24-2A / %x2D-3A /
850  *    %x3D / %x3F-5B / %x5D-7F
851  *
852  * To avoid nondeterminism the following 
853  * rules are excluded. These rules are 
854  * explicitly added in the productions.
855  *   EQUALS (0x3D)
856  *   HYPHEN (0x2D)
857  *   UNDERSCORE (0x5F)
858  *   DIGIT (0x30-0x39)
859  *   ALPHA (0x41-0x5A and 0x61-0x7A)
860  * </pre>
861  *
862  * @param _createToken If a Token is to be to created
863  * @throws RecognitionException If the token is invalid
864  * @throws TokenStreamException When we weren't able to fetch a token
865  * @throws CharStreamException If we can't process the stream
866  */
867 	public final void mCHAR_REST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
868 		int _ttype; Token _token=null; int _begin=text.length();
869 		_ttype = CHAR_REST;
870 		int _saveIndex;
871 		
872 		switch ( LA(1)) {
873 		case '\u0001':  case '\u0002':  case '\u0003':  case '\u0004':
874 		case '\u0005':  case '\u0006':  case '\u0007':  case '\u0008':
875 		case '\t':  case '\n':  case '\u000b':  case '\u000c':
876 		case '\r':  case '\u000e':  case '\u000f':  case '\u0010':
877 		case '\u0011':  case '\u0012':  case '\u0013':  case '\u0014':
878 		case '\u0015':  case '\u0016':  case '\u0017':  case '\u0018':
879 		case '\u0019':  case '\u001a':  case '\u001b':  case '\u001c':
880 		case '\u001d':  case '\u001e':  case '\u001f':
881 		{
882 			matchRange('\u0001','\u001F');
883 			break;
884 		}
885 		case '!':
886 		{
887 			match('\u0021');
888 			break;
889 		}
890 		case '$':  case '%':  case '&':  case '\'':
891 		case '(':  case ')':  case '*':
892 		{
893 			matchRange('\u0024','\u002A');
894 			break;
895 		}
896 		case '.':  case '/':
897 		{
898 			matchRange('\u002E','\u002F');
899 			break;
900 		}
901 		case ':':
902 		{
903 			match('\u003A');
904 			break;
905 		}
906 		case '?':  case '@':
907 		{
908 			matchRange('\u003F','\u0040');
909 			break;
910 		}
911 		case '[':
912 		{
913 			match('\u005B');
914 			break;
915 		}
916 		case ']':  case '^':
917 		{
918 			matchRange('\u005D','\u005E');
919 			break;
920 		}
921 		case '`':
922 		{
923 			match('\u0060');
924 			break;
925 		}
926 		case '{':  case '|':  case '}':  case '~':
927 		case '\u007f':
928 		{
929 			matchRange('\u007B','\u007F');
930 			break;
931 		}
932 		default:
933 		{
934 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
935 		}
936 		}
937 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
938 			_token = makeToken(_ttype);
939 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
940 		}
941 		_returnToken = _token;
942 	}
943 	
944 	
945 	private static final long[] mk_tokenSet_0() {
946 		long[] data = new long[1025];
947 		data[0]=287948901175001088L;
948 		data[1]=140737488355328L;
949 		return data;
950 	}
951 	public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
952 	private static final long[] mk_tokenSet_1() {
953 		long[] data = new long[1025];
954 		data[0]=288019269919178752L;
955 		data[1]=2199023255552L;
956 		return data;
957 	}
958 	public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
959 	private static final long[] mk_tokenSet_2() {
960 		long[] data = new long[1025];
961 		data[0]=287948901175001088L;
962 		data[1]=541165879296L;
963 		return data;
964 	}
965 	public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
966 	
967 	}