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.api.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.api.ldap.model.exception.LdapInvalidDnException;
031import javax.naming.NameParser;
032import org.apache.directory.api.ldap.model.entry.StringValue;
033import org.apache.directory.api.ldap.model.entry.BinaryValue;
034import org.apache.directory.api.ldap.model.schema.parsers.ParserMonitor;
035import org.apache.directory.api.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                                        mUNDERSCORE(true);
122                                        theRetToken=_returnToken;
123                                        break;
124                                }
125                                case '"':
126                                {
127                                        mDQUOTE(true);
128                                        theRetToken=_returnToken;
129                                        break;
130                                }
131                                case ';':
132                                {
133                                        mSEMI(true);
134                                        theRetToken=_returnToken;
135                                        break;
136                                }
137                                case '<':
138                                {
139                                        mLANGLE(true);
140                                        theRetToken=_returnToken;
141                                        break;
142                                }
143                                case '>':
144                                {
145                                        mRANGLE(true);
146                                        theRetToken=_returnToken;
147                                        break;
148                                }
149                                case ' ':
150                                {
151                                        mSPACE(true);
152                                        theRetToken=_returnToken;
153                                        break;
154                                }
155                                case '0':  case '1':  case '2':  case '3':
156                                case '4':  case '5':  case '6':  case '7':
157                                case '8':  case '9':  case 'a':  case 'b':
158                                case 'c':  case 'd':  case 'e':  case 'f':
159                                case 'g':  case 'h':  case 'i':  case 'j':
160                                case 'k':  case 'l':  case 'm':  case 'n':
161                                case 'o':  case 'p':  case 'q':  case 'r':
162                                case 's':  case 't':  case 'u':  case 'v':
163                                case 'w':  case 'x':  case 'y':  case 'z':
164                                {
165                                        mNUMERICOID_OR_ALPHA_OR_DIGIT(true);
166                                        theRetToken=_returnToken;
167                                        break;
168                                }
169                                case '\\':
170                                {
171                                        mHEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC(true);
172                                        theRetToken=_returnToken;
173                                        break;
174                                }
175                                case '#':
176                                {
177                                        mHEXVALUE_OR_SHARP(true);
178                                        theRetToken=_returnToken;
179                                        break;
180                                }
181                                case '\u0001':  case '\u0002':  case '\u0003':  case '\u0004':
182                                case '\u0005':  case '\u0006':  case '\u0007':  case '\u0008':
183                                case '\t':  case '\n':  case '\u000b':  case '\u000c':
184                                case '\r':  case '\u000e':  case '\u000f':  case '\u0010':
185                                case '\u0011':  case '\u0012':  case '\u0013':  case '\u0014':
186                                case '\u0015':  case '\u0016':  case '\u0017':  case '\u0018':
187                                case '\u0019':  case '\u001a':  case '\u001b':  case '\u001c':
188                                case '\u001d':  case '\u001e':  case '\u001f':  case '!':
189                                case '$':  case '%':  case '&':  case '\'':
190                                case '(':  case ')':  case '*':  case '.':
191                                case '/':  case ':':  case '?':  case '@':
192                                case '[':  case ']':  case '^':  case '`':
193                                case '{':  case '|':  case '}':  case '~':
194                                case '\u007f':
195                                {
196                                        mLUTF1_REST(true);
197                                        theRetToken=_returnToken;
198                                        break;
199                                }
200                                default:
201                                        if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) {
202                                                mUTFMB(true);
203                                                theRetToken=_returnToken;
204                                        }
205                                else {
206                                        if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
207                                else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
208                                }
209                                }
210                                if ( _returnToken==null ) continue tryAgain; // found SKIP token
211                                _ttype = _returnToken.getType();
212                                _ttype = testLiteralsTable(_ttype);
213                                _returnToken.setType(_ttype);
214                                return _returnToken;
215                        }
216                        catch (RecognitionException e) {
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 mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
232                int _ttype; Token _token=null; int _begin=text.length();
233                _ttype = COMMA;
234                int _saveIndex;
235                
236                match(',');
237                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
238                        _token = makeToken(_ttype);
239                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
240                }
241                _returnToken = _token;
242        }
243        
244        public final void mEQUALS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
245                int _ttype; Token _token=null; int _begin=text.length();
246                _ttype = EQUALS;
247                int _saveIndex;
248                
249                match('=');
250                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
251                        _token = makeToken(_ttype);
252                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
253                }
254                _returnToken = _token;
255        }
256        
257        public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
258                int _ttype; Token _token=null; int _begin=text.length();
259                _ttype = PLUS;
260                int _saveIndex;
261                
262                match('+');
263                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
264                        _token = makeToken(_ttype);
265                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
266                }
267                _returnToken = _token;
268        }
269        
270        public final void mHYPHEN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
271                int _ttype; Token _token=null; int _begin=text.length();
272                _ttype = HYPHEN;
273                int _saveIndex;
274                
275                match('-');
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 mUNDERSCORE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
284                int _ttype; Token _token=null; int _begin=text.length();
285                _ttype = UNDERSCORE;
286                int _saveIndex;
287                
288                match('_');
289                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
290                        _token = makeToken(_ttype);
291                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
292                }
293                _returnToken = _token;
294        }
295        
296        public final void mDQUOTE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
297                int _ttype; Token _token=null; int _begin=text.length();
298                _ttype = DQUOTE;
299                int _saveIndex;
300                
301                match('"');
302                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
303                        _token = makeToken(_ttype);
304                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
305                }
306                _returnToken = _token;
307        }
308        
309        public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
310                int _ttype; Token _token=null; int _begin=text.length();
311                _ttype = SEMI;
312                int _saveIndex;
313                
314                match(';');
315                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
316                        _token = makeToken(_ttype);
317                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
318                }
319                _returnToken = _token;
320        }
321        
322        public final void mLANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
323                int _ttype; Token _token=null; int _begin=text.length();
324                _ttype = LANGLE;
325                int _saveIndex;
326                
327                match('<');
328                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
329                        _token = makeToken(_ttype);
330                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
331                }
332                _returnToken = _token;
333        }
334        
335        public final void mRANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
336                int _ttype; Token _token=null; int _begin=text.length();
337                _ttype = RANGLE;
338                int _saveIndex;
339                
340                match('>');
341                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
342                        _token = makeToken(_ttype);
343                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
344                }
345                _returnToken = _token;
346        }
347        
348        public final void mSPACE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
349                int _ttype; Token _token=null; int _begin=text.length();
350                _ttype = SPACE;
351                int _saveIndex;
352                
353                match(' ');
354                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
355                        _token = makeToken(_ttype);
356                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
357                }
358                _returnToken = _token;
359        }
360        
361        public final void mNUMERICOID_OR_ALPHA_OR_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
362                int _ttype; Token _token=null; int _begin=text.length();
363                _ttype = NUMERICOID_OR_ALPHA_OR_DIGIT;
364                int _saveIndex;
365                
366                boolean synPredMatched13 = false;
367                if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))))) {
368                        int _m13 = mark();
369                        synPredMatched13 = true;
370                        inputState.guessing++;
371                        try {
372                                {
373                                mNUMERICOID(false);
374                                }
375                        }
376                        catch (RecognitionException pe) {
377                                synPredMatched13 = false;
378                        }
379                        rewind(_m13);
380inputState.guessing--;
381                }
382                if ( synPredMatched13 ) {
383                        mNUMERICOID(false);
384                        if ( inputState.guessing==0 ) {
385                                _ttype = NUMERICOID;
386                        }
387                }
388                else {
389                        boolean synPredMatched15 = false;
390                        if ((((LA(1) >= '0' && LA(1) <= '9')) && (true))) {
391                                int _m15 = mark();
392                                synPredMatched15 = true;
393                                inputState.guessing++;
394                                try {
395                                        {
396                                        mDIGIT(false);
397                                        }
398                                }
399                                catch (RecognitionException pe) {
400                                        synPredMatched15 = false;
401                                }
402                                rewind(_m15);
403inputState.guessing--;
404                        }
405                        if ( synPredMatched15 ) {
406                                mDIGIT(false);
407                                if ( inputState.guessing==0 ) {
408                                        _ttype = DIGIT;
409                                }
410                        }
411                        else {
412                                boolean synPredMatched17 = false;
413                                if ((((LA(1) >= 'a' && LA(1) <= 'z')) && (true))) {
414                                        int _m17 = mark();
415                                        synPredMatched17 = true;
416                                        inputState.guessing++;
417                                        try {
418                                                {
419                                                mALPHA(false);
420                                                }
421                                        }
422                                        catch (RecognitionException pe) {
423                                                synPredMatched17 = false;
424                                        }
425                                        rewind(_m17);
426inputState.guessing--;
427                                }
428                                if ( synPredMatched17 ) {
429                                        mALPHA(false);
430                                        if ( inputState.guessing==0 ) {
431                                                _ttype = ALPHA;
432                                        }
433                                }
434                                else {
435                                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
436                                }
437                                }}
438                                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
439                                        _token = makeToken(_ttype);
440                                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
441                                }
442                                _returnToken = _token;
443                        }
444                        
445        protected final void mNUMERICOID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
446                int _ttype; Token _token=null; int _begin=text.length();
447                _ttype = NUMERICOID;
448                int _saveIndex;
449                
450                {
451                switch ( LA(1)) {
452                case 'o':
453                {
454                        match("oid.");
455                        break;
456                }
457                case '0':  case '1':  case '2':  case '3':
458                case '4':  case '5':  case '6':  case '7':
459                case '8':  case '9':
460                {
461                        break;
462                }
463                default:
464                {
465                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
466                }
467                }
468                }
469                mNUMBER(false);
470                {
471                int _cnt21=0;
472                _loop21:
473                do {
474                        if ((LA(1)=='.')) {
475                                mDOT(false);
476                                mNUMBER(false);
477                        }
478                        else {
479                                if ( _cnt21>=1 ) { break _loop21; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
480                        }
481                        
482                        _cnt21++;
483                } while (true);
484                }
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        protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
493                int _ttype; Token _token=null; int _begin=text.length();
494                _ttype = DIGIT;
495                int _saveIndex;
496                
497                matchRange('0','9');
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        protected final void mALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
506                int _ttype; Token _token=null; int _begin=text.length();
507                _ttype = ALPHA;
508                int _saveIndex;
509                
510                matchRange('a','z');
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        protected final void mNUMBER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
519                int _ttype; Token _token=null; int _begin=text.length();
520                _ttype = NUMBER;
521                int _saveIndex;
522                
523                if (((LA(1) >= '1' && LA(1) <= '9')) && ((LA(2) >= '0' && LA(2) <= '9'))) {
524                        {
525                        mLDIGIT(false);
526                        {
527                        int _cnt26=0;
528                        _loop26:
529                        do {
530                                if (((LA(1) >= '0' && LA(1) <= '9'))) {
531                                        mDIGIT(false);
532                                }
533                                else {
534                                        if ( _cnt26>=1 ) { break _loop26; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
535                                }
536                                
537                                _cnt26++;
538                        } while (true);
539                        }
540                        }
541                }
542                else if (((LA(1) >= '0' && LA(1) <= '9')) && (true)) {
543                        mDIGIT(false);
544                }
545                else {
546                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
547                }
548                
549                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
550                        _token = makeToken(_ttype);
551                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
552                }
553                _returnToken = _token;
554        }
555        
556        protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
557                int _ttype; Token _token=null; int _begin=text.length();
558                _ttype = DOT;
559                int _saveIndex;
560                
561                match('.');
562                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
563                        _token = makeToken(_ttype);
564                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
565                }
566                _returnToken = _token;
567        }
568        
569        protected final void mLDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
570                int _ttype; Token _token=null; int _begin=text.length();
571                _ttype = LDIGIT;
572                int _saveIndex;
573                
574                matchRange('1','9');
575                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
576                        _token = makeToken(_ttype);
577                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
578                }
579                _returnToken = _token;
580        }
581        
582        public final void mHEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
583                int _ttype; Token _token=null; int _begin=text.length();
584                _ttype = HEXPAIR_OR_ESCESC_ESCSHARP_OR_ESC;
585                int _saveIndex;
586                
587                boolean synPredMatched32 = false;
588                if (((LA(1)=='\\') && (_tokenSet_2.member(LA(2))))) {
589                        int _m32 = mark();
590                        synPredMatched32 = true;
591                        inputState.guessing++;
592                        try {
593                                {
594                                mESC(false);
595                                mHEX(false);
596                                mHEX(false);
597                                }
598                        }
599                        catch (RecognitionException pe) {
600                                synPredMatched32 = false;
601                        }
602                        rewind(_m32);
603inputState.guessing--;
604                }
605                if ( synPredMatched32 ) {
606                        mHEXPAIR(false);
607                        if ( inputState.guessing==0 ) {
608                                _ttype = HEXPAIR;
609                        }
610                }
611                else if ((LA(1)=='\\') && (LA(2)=='\\')) {
612                        mESCESC(false);
613                        if ( inputState.guessing==0 ) {
614                                _ttype = ESCESC;
615                        }
616                }
617                else if ((LA(1)=='\\') && (LA(2)=='#')) {
618                        mESCSHARP(false);
619                        if ( inputState.guessing==0 ) {
620                                _ttype = ESCSHARP;
621                        }
622                }
623                else if ((LA(1)=='\\') && (true)) {
624                        mESC(false);
625                        if ( inputState.guessing==0 ) {
626                                _ttype = ESC;
627                        }
628                }
629                else {
630                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
631                }
632                
633                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
634                        _token = makeToken(_ttype);
635                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
636                }
637                _returnToken = _token;
638        }
639        
640        protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
641                int _ttype; Token _token=null; int _begin=text.length();
642                _ttype = ESC;
643                int _saveIndex;
644                
645                match('\\');
646                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
647                        _token = makeToken(_ttype);
648                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
649                }
650                _returnToken = _token;
651        }
652        
653        protected final void mHEX(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
654                int _ttype; Token _token=null; int _begin=text.length();
655                _ttype = HEX;
656                int _saveIndex;
657                
658                switch ( LA(1)) {
659                case '0':  case '1':  case '2':  case '3':
660                case '4':  case '5':  case '6':  case '7':
661                case '8':  case '9':
662                {
663                        mDIGIT(false);
664                        break;
665                }
666                case 'a':  case 'b':  case 'c':  case 'd':
667                case 'e':  case 'f':
668                {
669                        matchRange('a','f');
670                        break;
671                }
672                default:
673                {
674                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
675                }
676                }
677                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
678                        _token = makeToken(_ttype);
679                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
680                }
681                _returnToken = _token;
682        }
683        
684        protected final void mHEXPAIR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
685                int _ttype; Token _token=null; int _begin=text.length();
686                _ttype = HEXPAIR;
687                int _saveIndex;
688                
689                _saveIndex=text.length();
690                mESC(false);
691                text.setLength(_saveIndex);
692                mHEX(false);
693                mHEX(false);
694                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
695                        _token = makeToken(_ttype);
696                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
697                }
698                _returnToken = _token;
699        }
700        
701        protected final void mESCESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
702                int _ttype; Token _token=null; int _begin=text.length();
703                _ttype = ESCESC;
704                int _saveIndex;
705                
706                mESC(false);
707                mESC(false);
708                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
709                        _token = makeToken(_ttype);
710                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
711                }
712                _returnToken = _token;
713        }
714        
715        protected final void mESCSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
716                int _ttype; Token _token=null; int _begin=text.length();
717                _ttype = ESCSHARP;
718                int _saveIndex;
719                
720                mESC(false);
721                mSHARP(false);
722                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
723                        _token = makeToken(_ttype);
724                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
725                }
726                _returnToken = _token;
727        }
728        
729        protected final void mSHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
730                int _ttype; Token _token=null; int _begin=text.length();
731                _ttype = SHARP;
732                int _saveIndex;
733                
734                match('#');
735                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
736                        _token = makeToken(_ttype);
737                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
738                }
739                _returnToken = _token;
740        }
741        
742        public final void mHEXVALUE_OR_SHARP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
743                int _ttype; Token _token=null; int _begin=text.length();
744                _ttype = HEXVALUE_OR_SHARP;
745                int _saveIndex;
746                
747                boolean synPredMatched42 = false;
748                if (((LA(1)=='#') && (_tokenSet_2.member(LA(2))))) {
749                        int _m42 = mark();
750                        synPredMatched42 = true;
751                        inputState.guessing++;
752                        try {
753                                {
754                                mSHARP(false);
755                                {
756                                int _cnt41=0;
757                                _loop41:
758                                do {
759                                        if ((_tokenSet_2.member(LA(1)))) {
760                                                mHEX(false);
761                                                mHEX(false);
762                                        }
763                                        else {
764                                                if ( _cnt41>=1 ) { break _loop41; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
765                                        }
766                                        
767                                        _cnt41++;
768                                } while (true);
769                                }
770                                }
771                        }
772                        catch (RecognitionException pe) {
773                                synPredMatched42 = false;
774                        }
775                        rewind(_m42);
776inputState.guessing--;
777                }
778                if ( synPredMatched42 ) {
779                        mHEXVALUE(false);
780                        if ( inputState.guessing==0 ) {
781                                _ttype = HEXVALUE;
782                        }
783                }
784                else if ((LA(1)=='#') && (true)) {
785                        mSHARP(false);
786                        if ( inputState.guessing==0 ) {
787                                _ttype = SHARP;
788                        }
789                }
790                else {
791                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
792                }
793                
794                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
795                        _token = makeToken(_ttype);
796                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
797                }
798                _returnToken = _token;
799        }
800        
801        protected final void mHEXVALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
802                int _ttype; Token _token=null; int _begin=text.length();
803                _ttype = HEXVALUE;
804                int _saveIndex;
805                
806                _saveIndex=text.length();
807                mSHARP(false);
808                text.setLength(_saveIndex);
809                {
810                int _cnt45=0;
811                _loop45:
812                do {
813                        if ((_tokenSet_2.member(LA(1)))) {
814                                mHEX(false);
815                                mHEX(false);
816                        }
817                        else {
818                                if ( _cnt45>=1 ) { break _loop45; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
819                        }
820                        
821                        _cnt45++;
822                } while (true);
823                }
824                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
825                        _token = makeToken(_ttype);
826                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
827                }
828                _returnToken = _token;
829        }
830        
831        public final void mUTFMB(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
832                int _ttype; Token _token=null; int _begin=text.length();
833                _ttype = UTFMB;
834                int _saveIndex;
835                
836                matchRange('\u0080','\uFFFE');
837                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
838                        _token = makeToken(_ttype);
839                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
840                }
841                _returnToken = _token;
842        }
843        
844/**
845 * RFC 4514, Section 3:
846 * LUTF1 = %x01-1F / %x21 / %x24-2A / %x2D-3A /
847 *    %x3D / %x3F-5B / %x5D-7F
848 *
849 * To avoid nondeterminism the following 
850 * rules are excluded. These rules are 
851 * explicitly added in the productions.
852 *   EQUALS (0x3D)
853 *   HYPHEN (0x2D)
854 *   UNDERSCORE (0x5F)
855 *   DIGIT (0x30-0x39)
856 *   ALPHA (0x41-0x5A and 0x61-0x7A)
857 */
858        public final void mLUTF1_REST(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
859                int _ttype; Token _token=null; int _begin=text.length();
860                _ttype = LUTF1_REST;
861                int _saveIndex;
862                
863                switch ( LA(1)) {
864                case '\u0001':  case '\u0002':  case '\u0003':  case '\u0004':
865                case '\u0005':  case '\u0006':  case '\u0007':  case '\u0008':
866                case '\t':  case '\n':  case '\u000b':  case '\u000c':
867                case '\r':  case '\u000e':  case '\u000f':  case '\u0010':
868                case '\u0011':  case '\u0012':  case '\u0013':  case '\u0014':
869                case '\u0015':  case '\u0016':  case '\u0017':  case '\u0018':
870                case '\u0019':  case '\u001a':  case '\u001b':  case '\u001c':
871                case '\u001d':  case '\u001e':  case '\u001f':
872                {
873                        matchRange('\u0001','\u001F');
874                        break;
875                }
876                case '!':
877                {
878                        match('\u0021');
879                        break;
880                }
881                case '$':  case '%':  case '&':  case '\'':
882                case '(':  case ')':  case '*':
883                {
884                        matchRange('\u0024','\u002A');
885                        break;
886                }
887                case '.':  case '/':
888                {
889                        matchRange('\u002E','\u002F');
890                        break;
891                }
892                case ':':
893                {
894                        match('\u003A');
895                        break;
896                }
897                case '?':  case '@':
898                {
899                        matchRange('\u003F','\u0040');
900                        break;
901                }
902                case '[':
903                {
904                        match('\u005B');
905                        break;
906                }
907                case ']':  case '^':
908                {
909                        matchRange('\u005D','\u005E');
910                        break;
911                }
912                case '`':
913                {
914                        match('\u0060');
915                        break;
916                }
917                case '{':  case '|':  case '}':  case '~':
918                case '\u007f':
919                {
920                        matchRange('\u007B','\u007F');
921                        break;
922                }
923                default:
924                {
925                        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
926                }
927                }
928                if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
929                        _token = makeToken(_ttype);
930                        _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
931                }
932                _returnToken = _token;
933        }
934        
935        
936        private static final long[] mk_tokenSet_0() {
937                long[] data = new long[1025];
938                data[0]=287948901175001088L;
939                data[1]=140737488355328L;
940                return data;
941        }
942        public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
943        private static final long[] mk_tokenSet_1() {
944                long[] data = new long[1025];
945                data[0]=288019269919178752L;
946                data[1]=2199023255552L;
947                return data;
948        }
949        public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
950        private static final long[] mk_tokenSet_2() {
951                long[] data = new long[1025];
952                data[0]=287948901175001088L;
953                data[1]=541165879296L;
954                return data;
955        }
956        public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
957        
958        }