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