001    // $ANTLR 2.7.4: "ACIItem.g" -> "AntlrACIItemLexer.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    
023    
024    package org.apache.directory.shared.ldap.aci;
025    
026    
027    import java.util.List;
028    import java.util.ArrayList;
029    import java.util.HashSet;
030    import java.util.Map;
031    import java.util.Set;
032    import java.util.Enumeration;
033    
034    import javax.naming.directory.Attribute;
035    import javax.naming.directory.BasicAttribute;
036    
037    import org.apache.directory.shared.ldap.filter.BranchNode;
038    import org.apache.directory.shared.ldap.filter.AndNode;
039    import org.apache.directory.shared.ldap.filter.OrNode;
040    import org.apache.directory.shared.ldap.filter.NotNode;
041    import org.apache.directory.shared.ldap.filter.ExprNode;
042    import org.apache.directory.shared.ldap.filter.LeafNode;
043    import org.apache.directory.shared.ldap.filter.EqualityNode;
044    import org.apache.directory.shared.ldap.filter.FilterParser;
045    import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
046    import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
047    import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
048    import org.apache.directory.shared.ldap.util.ComponentsMonitor;
049    import org.apache.directory.shared.ldap.util.MandatoryAndOptionalComponentsMonitor;
050    import org.apache.directory.shared.ldap.util.MandatoryComponentsMonitor;
051    import org.apache.directory.shared.ldap.util.NamespaceTools;
052    import org.apache.directory.shared.ldap.util.NoDuplicateKeysMap;
053    import org.apache.directory.shared.ldap.util.OptionalComponentsMonitor;
054    import org.apache.directory.shared.ldap.name.LdapDN;
055    import org.apache.directory.shared.ldap.constants.SchemaConstants;
056    import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
057    import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
058    import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
059    
060    import org.slf4j.Logger;
061    import org.slf4j.LoggerFactory;
062    
063    
064    import java.io.InputStream;
065    import antlr.TokenStreamException;
066    import antlr.TokenStreamIOException;
067    import antlr.TokenStreamRecognitionException;
068    import antlr.CharStreamException;
069    import antlr.CharStreamIOException;
070    import antlr.ANTLRException;
071    import java.io.Reader;
072    import java.util.Hashtable;
073    import antlr.CharScanner;
074    import antlr.InputBuffer;
075    import antlr.ByteBuffer;
076    import antlr.CharBuffer;
077    import antlr.Token;
078    import antlr.CommonToken;
079    import antlr.RecognitionException;
080    import antlr.NoViableAltForCharException;
081    import antlr.MismatchedCharException;
082    import antlr.TokenStream;
083    import antlr.ANTLRHashString;
084    import antlr.LexerSharedInputState;
085    import antlr.collections.impl.BitSet;
086    import antlr.SemanticException;
087    
088    /**
089      * The parser's primary lexer.
090      *
091      * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
092      * @version $Rev$
093      */
094    public class AntlrACIItemLexer extends antlr.CharScanner implements AntlrACIItemParserTokenTypes, TokenStream
095     {
096    
097        private static final Logger log = LoggerFactory.getLogger( AntlrACIItemLexer.class );
098    public AntlrACIItemLexer(InputStream in) {
099            this(new ByteBuffer(in));
100    }
101    public AntlrACIItemLexer(Reader in) {
102            this(new CharBuffer(in));
103    }
104    public AntlrACIItemLexer(InputBuffer ib) {
105            this(new LexerSharedInputState(ib));
106    }
107    public AntlrACIItemLexer(LexerSharedInputState state) {
108            super(state);
109            caseSensitiveLiterals = true;
110            setCaseSensitive(true);
111            literals = new Hashtable();
112            literals.put(new ANTLRHashString("type", this), new Integer(30));
113            literals.put(new ANTLRHashString("strong", this), new Integer(17));
114            literals.put(new ANTLRHashString("name", this), new Integer(68));
115            literals.put(new ANTLRHashString("specificExclusions", this), new Integer(73));
116            literals.put(new ANTLRHashString("denyBrowse", this), new Integer(47));
117            literals.put(new ANTLRHashString("denyModify", this), new Integer(53));
118            literals.put(new ANTLRHashString("denyCompare", this), new Integer(59));
119            literals.put(new ANTLRHashString("classes", this), new Integer(35));
120            literals.put(new ANTLRHashString("denyAdd", this), new Integer(39));
121            literals.put(new ANTLRHashString("maximum", this), new Integer(77));
122            literals.put(new ANTLRHashString("grantInvoke", this), new Integer(62));
123            literals.put(new ANTLRHashString("denyDiscloseOnError", this), new Integer(41));
124            literals.put(new ANTLRHashString("rangeOfValues", this), new Integer(90));
125            literals.put(new ANTLRHashString("maxCount", this), new Integer(31));
126            literals.put(new ANTLRHashString("userClasses", this), new Integer(64));
127            literals.put(new ANTLRHashString("denyInvoke", this), new Integer(63));
128            literals.put(new ANTLRHashString("and", this), new Integer(81));
129            literals.put(new ANTLRHashString("denyRead", this), new Integer(43));
130            literals.put(new ANTLRHashString("not", this), new Integer(83));
131            literals.put(new ANTLRHashString("grantReturnDN", this), new Integer(56));
132            literals.put(new ANTLRHashString("maxImmSub", this), new Integer(32));
133            literals.put(new ANTLRHashString("grantCompare", this), new Integer(58));
134            literals.put(new ANTLRHashString("parentOfEntry", this), new Integer(67));
135            literals.put(new ANTLRHashString("precedence", this), new Integer(12));
136            literals.put(new ANTLRHashString("base", this), new Integer(72));
137            literals.put(new ANTLRHashString("minimum", this), new Integer(76));
138            literals.put(new ANTLRHashString("grantsAndDenials", this), new Integer(37));
139            literals.put(new ANTLRHashString("itemOrUserFirst", this), new Integer(18));
140            literals.put(new ANTLRHashString("entry", this), new Integer(23));
141            literals.put(new ANTLRHashString("FALSE", this), new Integer(84));
142            literals.put(new ANTLRHashString("selfValue", this), new Integer(28));
143            literals.put(new ANTLRHashString("specificationFilter", this), new Integer(91));
144            literals.put(new ANTLRHashString("itemPermissions", this), new Integer(36));
145            literals.put(new ANTLRHashString("grantRemove", this), new Integer(44));
146            literals.put(new ANTLRHashString("or", this), new Integer(82));
147            literals.put(new ANTLRHashString("allAttributeValues", this), new Integer(26));
148            literals.put(new ANTLRHashString("none", this), new Integer(15));
149            literals.put(new ANTLRHashString("attributeType", this), new Integer(25));
150            literals.put(new ANTLRHashString("chopAfter", this), new Integer(75));
151            literals.put(new ANTLRHashString("subtree", this), new Integer(70));
152            literals.put(new ANTLRHashString("denyRemove", this), new Integer(45));
153            literals.put(new ANTLRHashString("userFirst", this), new Integer(21));
154            literals.put(new ANTLRHashString("grantAdd", this), new Integer(38));
155            literals.put(new ANTLRHashString("grantFilterMatch", this), new Integer(60));
156            literals.put(new ANTLRHashString("allUserAttributeTypesAndValues", this), new Integer(27));
157            literals.put(new ANTLRHashString("maxValueCount", this), new Integer(29));
158            literals.put(new ANTLRHashString("grantExport", this), new Integer(48));
159            literals.put(new ANTLRHashString("basicLevels", this), new Integer(87));
160            literals.put(new ANTLRHashString("denyFilterMatch", this), new Integer(61));
161            literals.put(new ANTLRHashString("protectedItems", this), new Integer(22));
162            literals.put(new ANTLRHashString("identificationTag", this), new Integer(10));
163            literals.put(new ANTLRHashString("grantRename", this), new Integer(54));
164            literals.put(new ANTLRHashString("grantImport", this), new Integer(50));
165            literals.put(new ANTLRHashString("localQualifier", this), new Integer(88));
166            literals.put(new ANTLRHashString("userPermissions", this), new Integer(71));
167            literals.put(new ANTLRHashString("grantRead", this), new Integer(42));
168            literals.put(new ANTLRHashString("denyExport", this), new Integer(49));
169            literals.put(new ANTLRHashString("denyRename", this), new Integer(55));
170            literals.put(new ANTLRHashString("itemFirst", this), new Integer(19));
171            literals.put(new ANTLRHashString("denyImport", this), new Integer(51));
172            literals.put(new ANTLRHashString("restrictedBy", this), new Integer(33));
173            literals.put(new ANTLRHashString("chopBefore", this), new Integer(74));
174            literals.put(new ANTLRHashString("signed", this), new Integer(89));
175            literals.put(new ANTLRHashString("grantDiscloseOnError", this), new Integer(40));
176            literals.put(new ANTLRHashString("level", this), new Integer(86));
177            literals.put(new ANTLRHashString("allUserAttributeTypes", this), new Integer(24));
178            literals.put(new ANTLRHashString("TRUE", this), new Integer(85));
179            literals.put(new ANTLRHashString("authenticationLevel", this), new Integer(14));
180            literals.put(new ANTLRHashString("denyReturnDN", this), new Integer(57));
181            literals.put(new ANTLRHashString("grantBrowse", this), new Integer(46));
182            literals.put(new ANTLRHashString("thisEntry", this), new Integer(66));
183            literals.put(new ANTLRHashString("grantModify", this), new Integer(52));
184            literals.put(new ANTLRHashString("allUsers", this), new Integer(65));
185            literals.put(new ANTLRHashString("item", this), new Integer(80));
186            literals.put(new ANTLRHashString("userGroup", this), new Integer(69));
187            literals.put(new ANTLRHashString("simple", this), new Integer(16));
188            literals.put(new ANTLRHashString("valuesIn", this), new Integer(34));
189    }
190    
191    public Token nextToken() throws TokenStreamException {
192            Token theRetToken=null;
193    tryAgain:
194            for (;;) {
195                    Token _token = null;
196                    int _ttype = Token.INVALID_TYPE;
197                    resetText();
198                    try {   // for char stream error handling
199                            try {   // for lexical error handling
200                                    switch ( LA(1)) {
201                                    case '{':
202                                    {
203                                            mOPEN_CURLY(true);
204                                            theRetToken=_returnToken;
205                                            break;
206                                    }
207                                    case '}':
208                                    {
209                                            mCLOSE_CURLY(true);
210                                            theRetToken=_returnToken;
211                                            break;
212                                    }
213                                    case ',':
214                                    {
215                                            mSEP(true);
216                                            theRetToken=_returnToken;
217                                            break;
218                                    }
219                                    case '\t':  case '\n':  case '\r':  case ' ':
220                                    {
221                                            mSP(true);
222                                            theRetToken=_returnToken;
223                                            break;
224                                    }
225                                    case ':':
226                                    {
227                                            mCOLON(true);
228                                            theRetToken=_returnToken;
229                                            break;
230                                    }
231                                    case '0':  case '1':  case '2':  case '3':
232                                    case '4':  case '5':  case '6':  case '7':
233                                    case '8':  case '9':
234                                    {
235                                            mINTEGER_OR_NUMERICOID(true);
236                                            theRetToken=_returnToken;
237                                            break;
238                                    }
239                                    case '"':
240                                    {
241                                            mSAFEUTF8STRING(true);
242                                            theRetToken=_returnToken;
243                                            break;
244                                    }
245                                    case 'A':  case 'B':  case 'C':  case 'D':
246                                    case 'E':  case 'F':  case 'G':  case 'H':
247                                    case 'I':  case 'J':  case 'K':  case 'L':
248                                    case 'M':  case 'N':  case 'O':  case 'P':
249                                    case 'Q':  case 'R':  case 'S':  case 'T':
250                                    case 'U':  case 'V':  case 'W':  case 'X':
251                                    case 'Y':  case 'Z':  case 'a':  case 'b':
252                                    case 'c':  case 'd':  case 'e':  case 'f':
253                                    case 'g':  case 'h':  case 'i':  case 'j':
254                                    case 'k':  case 'l':  case 'm':  case 'n':
255                                    case 'o':  case 'p':  case 'q':  case 'r':
256                                    case 's':  case 't':  case 'u':  case 'v':
257                                    case 'w':  case 'x':  case 'y':  case 'z':
258                                    {
259                                            mDESCR(true);
260                                            theRetToken=_returnToken;
261                                            break;
262                                    }
263                                    default:
264                                    {
265                                            if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
266                                    else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
267                                    }
268                                    }
269                                    if ( _returnToken==null ) continue tryAgain; // found SKIP token
270                                    _ttype = _returnToken.getType();
271                                    _ttype = testLiteralsTable(_ttype);
272                                    _returnToken.setType(_ttype);
273                                    return _returnToken;
274                            }
275                            catch (RecognitionException e) {
276                                    throw new TokenStreamRecognitionException(e);
277                            }
278                    }
279                    catch (CharStreamException cse) {
280                            if ( cse instanceof CharStreamIOException ) {
281                                    throw new TokenStreamIOException(((CharStreamIOException)cse).io);
282                            }
283                            else {
284                                    throw new TokenStreamException(cse.getMessage());
285                            }
286                    }
287            }
288    }
289    
290            protected final void mSAFEUTF8CHAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
291                    int _ttype; Token _token=null; int _begin=text.length();
292                    _ttype = SAFEUTF8CHAR;
293                    int _saveIndex;
294                    
295                    switch ( LA(1)) {
296                    case '\u0001':  case '\u0002':  case '\u0003':  case '\u0004':
297                    case '\u0005':  case '\u0006':  case '\u0007':  case '\u0008':
298                    case '\t':  case '\n':  case '\u000b':  case '\u000c':
299                    case '\r':  case '\u000e':  case '\u000f':  case '\u0010':
300                    case '\u0011':  case '\u0012':  case '\u0013':  case '\u0014':
301                    case '\u0015':  case '\u0016':  case '\u0017':  case '\u0018':
302                    case '\u0019':  case '\u001a':  case '\u001b':  case '\u001c':
303                    case '\u001d':  case '\u001e':  case '\u001f':  case ' ':
304                    case '!':
305                    {
306                            matchRange('\u0001','\u0021');
307                            break;
308                    }
309                    case '#':  case '$':  case '%':  case '&':
310                    case '\'':  case '(':  case ')':  case '*':
311                    case '+':  case ',':  case '-':  case '.':
312                    case '/':  case '0':  case '1':  case '2':
313                    case '3':  case '4':  case '5':  case '6':
314                    case '7':  case '8':  case '9':  case ':':
315                    case ';':  case '<':  case '=':  case '>':
316                    case '?':  case '@':  case 'A':  case 'B':
317                    case 'C':  case 'D':  case 'E':  case 'F':
318                    case 'G':  case 'H':  case 'I':  case 'J':
319                    case 'K':  case 'L':  case 'M':  case 'N':
320                    case 'O':  case 'P':  case 'Q':  case 'R':
321                    case 'S':  case 'T':  case 'U':  case 'V':
322                    case 'W':  case 'X':  case 'Y':  case 'Z':
323                    case '[':  case '\\':  case ']':  case '^':
324                    case '_':  case '`':  case 'a':  case 'b':
325                    case 'c':  case 'd':  case 'e':  case 'f':
326                    case 'g':  case 'h':  case 'i':  case 'j':
327                    case 'k':  case 'l':  case 'm':  case 'n':
328                    case 'o':  case 'p':  case 'q':  case 'r':
329                    case 's':  case 't':  case 'u':  case 'v':
330                    case 'w':  case 'x':  case 'y':  case 'z':
331                    case '{':  case '|':  case '}':  case '~':
332                    case '\u007f':
333                    {
334                            matchRange('\u0023','\u007F');
335                            break;
336                    }
337                    case '\u00c0':  case '\u00c1':  case '\u00c2':  case '\u00c3':
338                    case '\u00c4':  case '\u00c5':  case '\u00c6':  case '\u00c7':
339                    case '\u00c8':  case '\u00c9':  case '\u00ca':  case '\u00cb':
340                    case '\u00cc':  case '\u00cd':  case '\u00ce':  case '\u00cf':
341                    case '\u00d0':  case '\u00d1':  case '\u00d2':  case '\u00d3':
342                    case '\u00d4':  case '\u00d5':  case '\u00d6':
343                    {
344                            matchRange('\u00c0','\u00d6');
345                            break;
346                    }
347                    case '\u00d8':  case '\u00d9':  case '\u00da':  case '\u00db':
348                    case '\u00dc':  case '\u00dd':  case '\u00de':  case '\u00df':
349                    case '\u00e0':  case '\u00e1':  case '\u00e2':  case '\u00e3':
350                    case '\u00e4':  case '\u00e5':  case '\u00e6':  case '\u00e7':
351                    case '\u00e8':  case '\u00e9':  case '\u00ea':  case '\u00eb':
352                    case '\u00ec':  case '\u00ed':  case '\u00ee':  case '\u00ef':
353                    case '\u00f0':  case '\u00f1':  case '\u00f2':  case '\u00f3':
354                    case '\u00f4':  case '\u00f5':  case '\u00f6':
355                    {
356                            matchRange('\u00d8','\u00f6');
357                            break;
358                    }
359                    case '\u00f8':  case '\u00f9':  case '\u00fa':  case '\u00fb':
360                    case '\u00fc':  case '\u00fd':  case '\u00fe':  case '\u00ff':
361                    {
362                            matchRange('\u00f8','\u00ff');
363                            break;
364                    }
365                    default:
366                            if (((LA(1) >= '\u0100' && LA(1) <= '\u1fff'))) {
367                                    matchRange('\u0100','\u1fff');
368                            }
369                            else if (((LA(1) >= '\u3040' && LA(1) <= '\u318f'))) {
370                                    matchRange('\u3040','\u318f');
371                            }
372                            else if (((LA(1) >= '\u3300' && LA(1) <= '\u337f'))) {
373                                    matchRange('\u3300','\u337f');
374                            }
375                            else if (((LA(1) >= '\u3400' && LA(1) <= '\u3d2d'))) {
376                                    matchRange('\u3400','\u3d2d');
377                            }
378                            else if (((LA(1) >= '\u4e00' && LA(1) <= '\u9fff'))) {
379                                    matchRange('\u4e00','\u9fff');
380                            }
381                            else if (((LA(1) >= '\uf900' && LA(1) <= '\ufaff'))) {
382                                    matchRange('\uf900','\ufaff');
383                            }
384                    else {
385                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
386                    }
387                    }
388                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
389                            _token = makeToken(_ttype);
390                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
391                    }
392                    _returnToken = _token;
393            }
394            
395            public final void mOPEN_CURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
396                    int _ttype; Token _token=null; int _begin=text.length();
397                    _ttype = OPEN_CURLY;
398                    int _saveIndex;
399                    
400                    match('{');
401                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
402                            _token = makeToken(_ttype);
403                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
404                    }
405                    _returnToken = _token;
406            }
407            
408            public final void mCLOSE_CURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
409                    int _ttype; Token _token=null; int _begin=text.length();
410                    _ttype = CLOSE_CURLY;
411                    int _saveIndex;
412                    
413                    match('}');
414                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
415                            _token = makeToken(_ttype);
416                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
417                    }
418                    _returnToken = _token;
419            }
420            
421            public final void mSEP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
422                    int _ttype; Token _token=null; int _begin=text.length();
423                    _ttype = SEP;
424                    int _saveIndex;
425                    
426                    match(',');
427                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
428                            _token = makeToken(_ttype);
429                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
430                    }
431                    _returnToken = _token;
432            }
433            
434            public final void mSP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
435                    int _ttype; Token _token=null; int _begin=text.length();
436                    _ttype = SP;
437                    int _saveIndex;
438                    
439                    switch ( LA(1)) {
440                    case ' ':
441                    {
442                            match(' ');
443                            break;
444                    }
445                    case '\t':
446                    {
447                            match('\t');
448                            break;
449                    }
450                    case '\n':
451                    {
452                            match('\n');
453                            if ( inputState.guessing==0 ) {
454                                    newline();
455                            }
456                            break;
457                    }
458                    case '\r':
459                    {
460                            match('\r');
461                            break;
462                    }
463                    default:
464                    {
465                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
466                    }
467                    }
468                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
469                            _token = makeToken(_ttype);
470                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
471                    }
472                    _returnToken = _token;
473            }
474            
475            public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
476                    int _ttype; Token _token=null; int _begin=text.length();
477                    _ttype = COLON;
478                    int _saveIndex;
479                    
480                    match(':');
481                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
482                            _token = makeToken(_ttype);
483                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
484                    }
485                    _returnToken = _token;
486            }
487            
488            protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
489                    int _ttype; Token _token=null; int _begin=text.length();
490                    _ttype = DIGIT;
491                    int _saveIndex;
492                    
493                    switch ( LA(1)) {
494                    case '0':
495                    {
496                            match('0');
497                            break;
498                    }
499                    case '1':  case '2':  case '3':  case '4':
500                    case '5':  case '6':  case '7':  case '8':
501                    case '9':
502                    {
503                            mLDIGIT(false);
504                            break;
505                    }
506                    default:
507                    {
508                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
509                    }
510                    }
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 mLDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
519                    int _ttype; Token _token=null; int _begin=text.length();
520                    _ttype = LDIGIT;
521                    int _saveIndex;
522                    
523                    matchRange('1','9');
524                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
525                            _token = makeToken(_ttype);
526                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
527                    }
528                    _returnToken = _token;
529            }
530            
531            protected final void mALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
532                    int _ttype; Token _token=null; int _begin=text.length();
533                    _ttype = ALPHA;
534                    int _saveIndex;
535                    
536                    switch ( LA(1)) {
537                    case 'A':  case 'B':  case 'C':  case 'D':
538                    case 'E':  case 'F':  case 'G':  case 'H':
539                    case 'I':  case 'J':  case 'K':  case 'L':
540                    case 'M':  case 'N':  case 'O':  case 'P':
541                    case 'Q':  case 'R':  case 'S':  case 'T':
542                    case 'U':  case 'V':  case 'W':  case 'X':
543                    case 'Y':  case 'Z':
544                    {
545                            matchRange('A','Z');
546                            break;
547                    }
548                    case 'a':  case 'b':  case 'c':  case 'd':
549                    case 'e':  case 'f':  case 'g':  case 'h':
550                    case 'i':  case 'j':  case 'k':  case 'l':
551                    case 'm':  case 'n':  case 'o':  case 'p':
552                    case 'q':  case 'r':  case 's':  case 't':
553                    case 'u':  case 'v':  case 'w':  case 'x':
554                    case 'y':  case 'z':
555                    {
556                            matchRange('a','z');
557                            break;
558                    }
559                    default:
560                    {
561                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
562                    }
563                    }
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 mINTEGER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
572                    int _ttype; Token _token=null; int _begin=text.length();
573                    _ttype = INTEGER;
574                    int _saveIndex;
575                    
576                    if (((LA(1) >= '1' && LA(1) <= '9')) && ((LA(2) >= '0' && LA(2) <= '9'))) {
577                            {
578                            mLDIGIT(false);
579                            {
580                            int _cnt406=0;
581                            _loop406:
582                            do {
583                                    if (((LA(1) >= '0' && LA(1) <= '9'))) {
584                                            mDIGIT(false);
585                                    }
586                                    else {
587                                            if ( _cnt406>=1 ) { break _loop406; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
588                                    }
589                                    
590                                    _cnt406++;
591                            } while (true);
592                            }
593                            }
594                    }
595                    else if (((LA(1) >= '0' && LA(1) <= '9')) && (true)) {
596                            mDIGIT(false);
597                    }
598                    else {
599                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
600                    }
601                    
602                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
603                            _token = makeToken(_ttype);
604                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
605                    }
606                    _returnToken = _token;
607            }
608            
609            protected final void mHYPHEN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
610                    int _ttype; Token _token=null; int _begin=text.length();
611                    _ttype = HYPHEN;
612                    int _saveIndex;
613                    
614                    match('-');
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 mNUMERICOID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
623                    int _ttype; Token _token=null; int _begin=text.length();
624                    _ttype = NUMERICOID;
625                    int _saveIndex;
626                    
627                    mINTEGER(false);
628                    {
629                    int _cnt410=0;
630                    _loop410:
631                    do {
632                            if ((LA(1)=='.')) {
633                                    mDOT(false);
634                                    mINTEGER(false);
635                            }
636                            else {
637                                    if ( _cnt410>=1 ) { break _loop410; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
638                            }
639                            
640                            _cnt410++;
641                    } while (true);
642                    }
643                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
644                            _token = makeToken(_ttype);
645                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
646                    }
647                    _returnToken = _token;
648            }
649            
650            protected final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
651                    int _ttype; Token _token=null; int _begin=text.length();
652                    _ttype = DOT;
653                    int _saveIndex;
654                    
655                    match('.');
656                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
657                            _token = makeToken(_ttype);
658                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
659                    }
660                    _returnToken = _token;
661            }
662            
663            public final void mINTEGER_OR_NUMERICOID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
664                    int _ttype; Token _token=null; int _begin=text.length();
665                    _ttype = INTEGER_OR_NUMERICOID;
666                    int _saveIndex;
667                    
668                    boolean synPredMatched414 = false;
669                    if ((((LA(1) >= '0' && LA(1) <= '9')) && (_tokenSet_0.member(LA(2))))) {
670                            int _m414 = mark();
671                            synPredMatched414 = true;
672                            inputState.guessing++;
673                            try {
674                                    {
675                                    mINTEGER(false);
676                                    mDOT(false);
677                                    }
678                            }
679                            catch (RecognitionException pe) {
680                                    synPredMatched414 = false;
681                            }
682                            rewind(_m414);
683                            inputState.guessing--;
684                    }
685                    if ( synPredMatched414 ) {
686                            mNUMERICOID(false);
687                            if ( inputState.guessing==0 ) {
688                                    
689                                    _ttype =  NUMERICOID;
690                                    
691                            }
692                    }
693                    else if (((LA(1) >= '0' && LA(1) <= '9')) && (true)) {
694                            mINTEGER(false);
695                            if ( inputState.guessing==0 ) {
696                                    
697                                    _ttype =  INTEGER;
698                                    
699                            }
700                    }
701                    else {
702                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
703                    }
704                    
705                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
706                            _token = makeToken(_ttype);
707                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
708                    }
709                    _returnToken = _token;
710            }
711            
712            public final void mSAFEUTF8STRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
713                    int _ttype; Token _token=null; int _begin=text.length();
714                    _ttype = SAFEUTF8STRING;
715                    int _saveIndex;
716                    
717                    _saveIndex=text.length();
718                    match('"');
719                    text.setLength(_saveIndex);
720                    {
721                    _loop417:
722                    do {
723                            if ((_tokenSet_1.member(LA(1)))) {
724                                    mSAFEUTF8CHAR(false);
725                            }
726                            else {
727                                    break _loop417;
728                            }
729                            
730                    } while (true);
731                    }
732                    _saveIndex=text.length();
733                    match('"');
734                    text.setLength(_saveIndex);
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 mDESCR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
743                    int _ttype; Token _token=null; int _begin=text.length();
744                    _ttype = DESCR;
745                    int _saveIndex;
746                    
747                    boolean synPredMatched422 = false;
748                    if (((LA(1)=='a') && (LA(2)=='t'))) {
749                            int _m422 = mark();
750                            synPredMatched422 = true;
751                            inputState.guessing++;
752                            try {
753                                    {
754                                    match("attributeValue");
755                                    {
756                                    int _cnt421=0;
757                                    _loop421:
758                                    do {
759                                            if ((_tokenSet_2.member(LA(1)))) {
760                                                    _saveIndex=text.length();
761                                                    mSP(false);
762                                                    text.setLength(_saveIndex);
763                                            }
764                                            else {
765                                                    if ( _cnt421>=1 ) { break _loop421; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
766                                            }
767                                            
768                                            _cnt421++;
769                                    } while (true);
770                                    }
771                                    match('{');
772                                    }
773                            }
774                            catch (RecognitionException pe) {
775                                    synPredMatched422 = false;
776                            }
777                            rewind(_m422);
778                            inputState.guessing--;
779                    }
780                    if ( synPredMatched422 ) {
781                            _saveIndex=text.length();
782                            match("attributeValue");
783                            text.setLength(_saveIndex);
784                            {
785                            int _cnt424=0;
786                            _loop424:
787                            do {
788                                    if ((_tokenSet_2.member(LA(1)))) {
789                                            _saveIndex=text.length();
790                                            mSP(false);
791                                            text.setLength(_saveIndex);
792                                    }
793                                    else {
794                                            if ( _cnt424>=1 ) { break _loop424; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
795                                    }
796                                    
797                                    _cnt424++;
798                            } while (true);
799                            }
800                            _saveIndex=text.length();
801                            match('{');
802                            text.setLength(_saveIndex);
803                            {
804                            _loop426:
805                            do {
806                                    // nongreedy exit test
807                                    if ((LA(1)=='}') && (true)) break _loop426;
808                                    if ((_tokenSet_3.member(LA(1))) && (_tokenSet_3.member(LA(2)))) {
809                                            matchNot(EOF_CHAR);
810                                    }
811                                    else {
812                                            break _loop426;
813                                    }
814                                    
815                            } while (true);
816                            }
817                            _saveIndex=text.length();
818                            match('}');
819                            text.setLength(_saveIndex);
820                            if ( inputState.guessing==0 ) {
821                                    _ttype =  ATTRIBUTE_VALUE_CANDIDATE;
822                            }
823                    }
824                    else {
825                            boolean synPredMatched430 = false;
826                            if (((LA(1)=='r') && (LA(2)=='a'))) {
827                                    int _m430 = mark();
828                                    synPredMatched430 = true;
829                                    inputState.guessing++;
830                                    try {
831                                            {
832                                            match("rangeOfValues");
833                                            {
834                                            int _cnt429=0;
835                                            _loop429:
836                                            do {
837                                                    if ((_tokenSet_2.member(LA(1)))) {
838                                                            _saveIndex=text.length();
839                                                            mSP(false);
840                                                            text.setLength(_saveIndex);
841                                                    }
842                                                    else {
843                                                            if ( _cnt429>=1 ) { break _loop429; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
844                                                    }
845                                                    
846                                                    _cnt429++;
847                                            } while (true);
848                                            }
849                                            match('(');
850                                            }
851                                    }
852                                    catch (RecognitionException pe) {
853                                            synPredMatched430 = false;
854                                    }
855                                    rewind(_m430);
856                                    inputState.guessing--;
857                            }
858                            if ( synPredMatched430 ) {
859                                    _saveIndex=text.length();
860                                    match("rangeOfValues");
861                                    text.setLength(_saveIndex);
862                                    {
863                                    int _cnt432=0;
864                                    _loop432:
865                                    do {
866                                            if ((_tokenSet_2.member(LA(1)))) {
867                                                    _saveIndex=text.length();
868                                                    mSP(false);
869                                                    text.setLength(_saveIndex);
870                                            }
871                                            else {
872                                                    if ( _cnt432>=1 ) { break _loop432; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
873                                            }
874                                            
875                                            _cnt432++;
876                                    } while (true);
877                                    }
878                                    mFILTER(false);
879                                    if ( inputState.guessing==0 ) {
880                                            _ttype =  RANGE_OF_VALUES_CANDIDATE;
881                                    }
882                            }
883                            else if ((_tokenSet_4.member(LA(1))) && (true)) {
884                                    mALPHA(false);
885                                    {
886                                    _loop434:
887                                    do {
888                                            switch ( LA(1)) {
889                                            case 'A':  case 'B':  case 'C':  case 'D':
890                                            case 'E':  case 'F':  case 'G':  case 'H':
891                                            case 'I':  case 'J':  case 'K':  case 'L':
892                                            case 'M':  case 'N':  case 'O':  case 'P':
893                                            case 'Q':  case 'R':  case 'S':  case 'T':
894                                            case 'U':  case 'V':  case 'W':  case 'X':
895                                            case 'Y':  case 'Z':  case 'a':  case 'b':
896                                            case 'c':  case 'd':  case 'e':  case 'f':
897                                            case 'g':  case 'h':  case 'i':  case 'j':
898                                            case 'k':  case 'l':  case 'm':  case 'n':
899                                            case 'o':  case 'p':  case 'q':  case 'r':
900                                            case 's':  case 't':  case 'u':  case 'v':
901                                            case 'w':  case 'x':  case 'y':  case 'z':
902                                            {
903                                                    mALPHA(false);
904                                                    break;
905                                            }
906                                            case '0':  case '1':  case '2':  case '3':
907                                            case '4':  case '5':  case '6':  case '7':
908                                            case '8':  case '9':
909                                            {
910                                                    mDIGIT(false);
911                                                    break;
912                                            }
913                                            case '-':
914                                            {
915                                                    mHYPHEN(false);
916                                                    break;
917                                            }
918                                            default:
919                                            {
920                                                    break _loop434;
921                                            }
922                                            }
923                                    } while (true);
924                                    }
925                            }
926                            else {
927                                    throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
928                            }
929                            }
930                            if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
931                                    _token = makeToken(_ttype);
932                                    _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
933                            }
934                            _returnToken = _token;
935                    }
936                    
937            protected final void mFILTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
938                    int _ttype; Token _token=null; int _begin=text.length();
939                    _ttype = FILTER;
940                    int _saveIndex;
941                    
942                    match('(');
943                    {
944                    switch ( LA(1)) {
945                    case '&':
946                    {
947                            {
948                            match('&');
949                            {
950                            _loop439:
951                            do {
952                                    if ((_tokenSet_2.member(LA(1)))) {
953                                            mSP(false);
954                                    }
955                                    else {
956                                            break _loop439;
957                                    }
958                                    
959                            } while (true);
960                            }
961                            {
962                            int _cnt441=0;
963                            _loop441:
964                            do {
965                                    if ((LA(1)=='(')) {
966                                            mFILTER(false);
967                                    }
968                                    else {
969                                            if ( _cnt441>=1 ) { break _loop441; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
970                                    }
971                                    
972                                    _cnt441++;
973                            } while (true);
974                            }
975                            }
976                            break;
977                    }
978                    case '|':
979                    {
980                            {
981                            match('|');
982                            {
983                            _loop444:
984                            do {
985                                    if ((_tokenSet_2.member(LA(1)))) {
986                                            mSP(false);
987                                    }
988                                    else {
989                                            break _loop444;
990                                    }
991                                    
992                            } while (true);
993                            }
994                            {
995                            int _cnt446=0;
996                            _loop446:
997                            do {
998                                    if ((LA(1)=='(')) {
999                                            mFILTER(false);
1000                                    }
1001                                    else {
1002                                            if ( _cnt446>=1 ) { break _loop446; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
1003                                    }
1004                                    
1005                                    _cnt446++;
1006                            } while (true);
1007                            }
1008                            }
1009                            break;
1010                    }
1011                    case '!':
1012                    {
1013                            {
1014                            match('!');
1015                            {
1016                            _loop449:
1017                            do {
1018                                    if ((_tokenSet_2.member(LA(1)))) {
1019                                            mSP(false);
1020                                    }
1021                                    else {
1022                                            break _loop449;
1023                                    }
1024                                    
1025                            } while (true);
1026                            }
1027                            mFILTER(false);
1028                            }
1029                            break;
1030                    }
1031                    default:
1032                            if ((_tokenSet_5.member(LA(1)))) {
1033                                    mFILTER_VALUE(false);
1034                            }
1035                    else {
1036                            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
1037                    }
1038                    }
1039                    }
1040                    match(')');
1041                    {
1042                    _loop451:
1043                    do {
1044                            if ((_tokenSet_2.member(LA(1)))) {
1045                                    mSP(false);
1046                            }
1047                            else {
1048                                    break _loop451;
1049                            }
1050                            
1051                    } while (true);
1052                    }
1053                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1054                            _token = makeToken(_ttype);
1055                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1056                    }
1057                    _returnToken = _token;
1058            }
1059            
1060            protected final void mFILTER_VALUE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
1061                    int _ttype; Token _token=null; int _begin=text.length();
1062                    _ttype = FILTER_VALUE;
1063                    int _saveIndex;
1064                    
1065                    {
1066                    {
1067                    match(_tokenSet_5);
1068                    }
1069                    {
1070                    _loop457:
1071                    do {
1072                            if ((_tokenSet_6.member(LA(1)))) {
1073                                    {
1074                                    match(_tokenSet_6);
1075                                    }
1076                            }
1077                            else {
1078                                    break _loop457;
1079                            }
1080                            
1081                    } while (true);
1082                    }
1083                    }
1084                    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
1085                            _token = makeToken(_ttype);
1086                            _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
1087                    }
1088                    _returnToken = _token;
1089            }
1090            
1091            
1092            private static final long[] mk_tokenSet_0() {
1093                    long[] data = new long[1025];
1094                    data[0]=288019269919178752L;
1095                    return data;
1096            }
1097            public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
1098            private static final long[] mk_tokenSet_1() {
1099                    long[] data = new long[3988];
1100                    data[0]=-17179869186L;
1101                    data[1]=-1L;
1102                    data[3]=-36028797027352577L;
1103                    for (int i = 4; i<=127; i++) { data[i]=-1L; }
1104                    for (int i = 193; i<=197; i++) { data[i]=-1L; }
1105                    data[198]=65535L;
1106                    for (int i = 204; i<=205; i++) { data[i]=-1L; }
1107                    for (int i = 208; i<=243; i++) { data[i]=-1L; }
1108                    data[244]=70368744177663L;
1109                    for (int i = 312; i<=639; i++) { data[i]=-1L; }
1110                    for (int i = 996; i<=1003; i++) { data[i]=-1L; }
1111                    return data;
1112            }
1113            public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
1114            private static final long[] mk_tokenSet_2() {
1115                    long[] data = new long[1025];
1116                    data[0]=4294977024L;
1117                    return data;
1118            }
1119            public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
1120            private static final long[] mk_tokenSet_3() {
1121                    long[] data = new long[2048];
1122                    data[0]=-2L;
1123                    for (int i = 1; i<=127; i++) { data[i]=-1L; }
1124                    for (int i = 193; i<=197; i++) { data[i]=-1L; }
1125                    data[198]=65535L;
1126                    for (int i = 204; i<=205; i++) { data[i]=-1L; }
1127                    for (int i = 208; i<=243; i++) { data[i]=-1L; }
1128                    data[244]=70368744177663L;
1129                    for (int i = 312; i<=639; i++) { data[i]=-1L; }
1130                    for (int i = 996; i<=1003; i++) { data[i]=-1L; }
1131                    return data;
1132            }
1133            public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
1134            private static final long[] mk_tokenSet_4() {
1135                    long[] data = new long[1025];
1136                    data[1]=576460743847706622L;
1137                    return data;
1138            }
1139            public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
1140            private static final long[] mk_tokenSet_5() {
1141                    long[] data = new long[2048];
1142                    data[0]=-3582002724866L;
1143                    data[1]=-1152921504606846977L;
1144                    for (int i = 2; i<=127; i++) { data[i]=-1L; }
1145                    for (int i = 193; i<=197; i++) { data[i]=-1L; }
1146                    data[198]=65535L;
1147                    for (int i = 204; i<=205; i++) { data[i]=-1L; }
1148                    for (int i = 208; i<=243; i++) { data[i]=-1L; }
1149                    data[244]=70368744177663L;
1150                    for (int i = 312; i<=639; i++) { data[i]=-1L; }
1151                    for (int i = 996; i<=1003; i++) { data[i]=-1L; }
1152                    return data;
1153            }
1154            public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
1155            private static final long[] mk_tokenSet_6() {
1156                    long[] data = new long[2048];
1157                    data[0]=-2199023255554L;
1158                    for (int i = 1; i<=127; i++) { data[i]=-1L; }
1159                    for (int i = 193; i<=197; i++) { data[i]=-1L; }
1160                    data[198]=65535L;
1161                    for (int i = 204; i<=205; i++) { data[i]=-1L; }
1162                    for (int i = 208; i<=243; i++) { data[i]=-1L; }
1163                    data[244]=70368744177663L;
1164                    for (int i = 312; i<=639; i++) { data[i]=-1L; }
1165                    for (int i = 996; i<=1003; i++) { data[i]=-1L; }
1166                    return data;
1167            }
1168            public static final BitSet _tokenSet_6 = new BitSet(mk_tokenSet_6());
1169            
1170            }