001// $ANTLR 2.7.7 (20060906): "ACIItem.g" -> "AntlrACIItemParser.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.shared.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.shared.ldap.model.filter.BranchNode;
035import org.apache.directory.shared.ldap.model.filter.AndNode;
036import org.apache.directory.shared.ldap.model.filter.OrNode;
037import org.apache.directory.shared.ldap.model.filter.NotNode;
038import org.apache.directory.shared.ldap.model.filter.ExprNode;
039import org.apache.directory.shared.ldap.model.filter.LeafNode;
040import org.apache.directory.shared.ldap.model.filter.EqualityNode;
041import org.apache.directory.shared.ldap.model.filter.FilterParser;
042import org.apache.directory.shared.ldap.model.schema.normalizers.NameComponentNormalizer;
043import org.apache.directory.shared.ldap.model.subtree.SubtreeSpecification;
044import org.apache.directory.shared.ldap.model.subtree.SubtreeSpecificationModifier;
045import org.apache.directory.shared.util.ComponentsMonitor;
046import org.apache.directory.shared.util.MandatoryAndOptionalComponentsMonitor;
047import org.apache.directory.shared.util.MandatoryComponentsMonitor;
048import org.apache.directory.shared.ldap.model.name.DnUtils;
049import org.apache.directory.shared.util.NoDuplicateKeysMap;
050import org.apache.directory.shared.util.OptionalComponentsMonitor;
051import org.apache.directory.shared.ldap.model.name.Dn;
052import org.apache.directory.shared.ldap.model.name.Rdn;
053import org.apache.directory.shared.ldap.model.schema.AttributeType;
054import org.apache.directory.shared.ldap.model.schema.SchemaManager;
055import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
056import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
057import org.apache.directory.shared.ldap.model.entry.StringValue;
058import org.apache.directory.shared.ldap.model.entry.Attribute;
059import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
060import org.apache.directory.shared.ldap.model.exception.LdapException;
061import org.apache.directory.shared.ldap.aci.protectedItem.AllAttributeValuesItem;
062import org.apache.directory.shared.ldap.aci.protectedItem.AttributeTypeItem;
063import org.apache.directory.shared.ldap.aci.protectedItem.AttributeValueItem;
064import org.apache.directory.shared.ldap.aci.protectedItem.SelfValueItem;
065import org.apache.directory.shared.ldap.aci.protectedItem.ClassesItem;
066import org.apache.directory.shared.ldap.aci.protectedItem.EntryItem;
067import org.apache.directory.shared.ldap.aci.protectedItem.RangeOfValuesItem;
068import org.apache.directory.shared.ldap.aci.protectedItem.MaxImmSubItem;
069import org.apache.directory.shared.ldap.aci.protectedItem.MaxValueCountElem;
070import org.apache.directory.shared.ldap.aci.protectedItem.MaxValueCountItem;
071import org.apache.directory.shared.ldap.aci.protectedItem.RestrictedByElem;
072import org.apache.directory.shared.ldap.aci.protectedItem.RestrictedByItem;
073import org.slf4j.Logger;
074import org.slf4j.LoggerFactory;
075
076
077import antlr.TokenBuffer;
078import antlr.TokenStreamException;
079import antlr.TokenStreamIOException;
080import antlr.ANTLRException;
081import antlr.LLkParser;
082import antlr.Token;
083import antlr.TokenStream;
084import antlr.RecognitionException;
085import antlr.NoViableAltException;
086import antlr.MismatchedTokenException;
087import antlr.SemanticException;
088import antlr.ParserSharedInputState;
089import antlr.collections.impl.BitSet;
090
091/**
092 * The antlr generated ACIItem parser.
093 *
094 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
095 */
096public class AntlrACIItemParser extends antlr.LLkParser       implements AntlrACIItemParserTokenTypes
097 {
098
099    private static final Logger log = LoggerFactory.getLogger( AntlrACIItemParser.class );
100    
101    NameComponentNormalizer normalizer;
102    
103    // nonshared global data needed to avoid extensive pass/return stuff
104    // these are only used by three first order components
105    private String identificationTag;
106    private AuthenticationLevel authenticationLevel;
107    private Integer aciPrecedence = null;
108    
109    private boolean isItemFirstACIItem;
110    
111    // shared global data needed to avoid extensive pass/return stuff
112    private Set<ProtectedItem> protectedItems;
113    private Map<String, ProtectedItem> protectedItemsMap;
114    private Set<UserClass> userClasses;
115    private Map<String, UserClass> userClassesMap;
116    private Set<ItemPermission> itemPermissions;
117    private Integer precedence = null;
118    private Set<GrantAndDenial> grantsAndDenials;
119    private Set<UserPermission> userPermissions;
120    
121    /** The SchemaManager */
122    private SchemaManager schemaManager;
123    
124    private Set<Dn> chopBeforeExclusions;
125    private Set<Dn> chopAfterExclusions;
126    private SubtreeSpecificationModifier ssModifier = null;
127    
128    private ComponentsMonitor mainACIItemComponentsMonitor;
129    private ComponentsMonitor itemPermissionComponentsMonitor;
130    private ComponentsMonitor userPermissionComponentsMonitor;
131    private ComponentsMonitor subtreeSpecificationComponentsMonitor;
132    
133    
134    /**
135     * Creates a (normalizing) subordinate DnParser for parsing Names.
136     * This method MUST be called for each instance while we cannot do
137     * constructor overloading for this class.
138     *
139     * @return the DnParser to be used for parsing Names
140     */
141    public void init( SchemaManager schemaManager )
142    {
143        this.schemaManager = schemaManager;
144    }
145
146    /**
147     * Sets the NameComponentNormalizer for this parser's dnParser.
148     */
149    public void setNormalizer(NameComponentNormalizer normalizer)
150    {
151        this.normalizer = normalizer;
152    }
153
154    private int token2Integer( Token token ) throws RecognitionException
155    {
156        int i = 0;
157        
158        try
159        {
160            i = Integer.parseInt( token.getText());
161        }
162        catch ( NumberFormatException e )
163        {
164            throw new RecognitionException( "Value of INTEGER token " +
165                                            token.getText() +
166                                            " cannot be converted to an Integer" );
167        }
168        
169        return i;
170    }
171
172protected AntlrACIItemParser(TokenBuffer tokenBuf, int k) {
173  super(tokenBuf,k);
174  tokenNames = _tokenNames;
175}
176
177public AntlrACIItemParser(TokenBuffer tokenBuf) {
178  this(tokenBuf,1);
179}
180
181protected AntlrACIItemParser(TokenStream lexer, int k) {
182  super(lexer,k);
183  tokenNames = _tokenNames;
184}
185
186public AntlrACIItemParser(TokenStream lexer) {
187  this(lexer,1);
188}
189
190public AntlrACIItemParser(ParserSharedInputState state) {
191  super(state,1);
192  tokenNames = _tokenNames;
193}
194
195        public final  ACIItem  wrapperEntryPoint() throws RecognitionException, TokenStreamException {
196                 ACIItem aciItem ;
197                
198                
199                log.debug( "entered wrapperEntryPoint()" );
200                aciItem = null;
201                
202                
203                {
204                _loop3:
205                do {
206                        if ((LA(1)==SP)) {
207                                match(SP);
208                        }
209                        else {
210                                break _loop3;
211                        }
212                        
213                } while (true);
214                }
215                aciItem=theACIItem();
216                {
217                _loop5:
218                do {
219                        if ((LA(1)==SP)) {
220                                match(SP);
221                        }
222                        else {
223                                break _loop5;
224                        }
225                        
226                } while (true);
227                }
228                match(Token.EOF_TYPE);
229                return aciItem ;
230        }
231        
232        public final  ACIItem  theACIItem() throws RecognitionException, TokenStreamException {
233                 ACIItem aciItem ;
234                
235                
236                log.debug( "entered theACIItem()" );
237                aciItem = null;
238                mainACIItemComponentsMonitor = new MandatoryComponentsMonitor( 
239                new String [] { "identificationTag", "precedence", "authenticationLevel", "itemOrUserFirst" } );
240                
241                
242                match(OPEN_CURLY);
243                {
244                _loop8:
245                do {
246                        if ((LA(1)==SP)) {
247                                match(SP);
248                        }
249                        else {
250                                break _loop8;
251                        }
252                        
253                } while (true);
254                }
255                mainACIItemComponent();
256                {
257                _loop10:
258                do {
259                        if ((LA(1)==SP)) {
260                                match(SP);
261                        }
262                        else {
263                                break _loop10;
264                        }
265                        
266                } while (true);
267                }
268                {
269                _loop16:
270                do {
271                        if ((LA(1)==SEP)) {
272                                match(SEP);
273                                {
274                                _loop13:
275                                do {
276                                        if ((LA(1)==SP)) {
277                                                match(SP);
278                                        }
279                                        else {
280                                                break _loop13;
281                                        }
282                                        
283                                } while (true);
284                                }
285                                mainACIItemComponent();
286                                {
287                                _loop15:
288                                do {
289                                        if ((LA(1)==SP)) {
290                                                match(SP);
291                                        }
292                                        else {
293                                                break _loop15;
294                                        }
295                                        
296                                } while (true);
297                                }
298                        }
299                        else {
300                                break _loop16;
301                        }
302                        
303                } while (true);
304                }
305                match(CLOSE_CURLY);
306                
307                if ( !mainACIItemComponentsMonitor.finalStateValid() )
308                {
309                throw new RecognitionException( "Missing mandatory ACIItem components: " 
310                + mainACIItemComponentsMonitor.getRemainingComponents() );
311                }
312                
313                if ( isItemFirstACIItem )
314                {
315                aciItem = new ItemFirstACIItem(
316                identificationTag,
317                aciPrecedence,
318                authenticationLevel,
319                protectedItems,
320                itemPermissions );
321                }
322                else
323                {
324                aciItem = new UserFirstACIItem(
325                identificationTag,
326                aciPrecedence,
327                authenticationLevel,
328                userClasses,
329                userPermissions );
330                }
331                
332                return aciItem ;
333        }
334        
335        public final void mainACIItemComponent() throws RecognitionException, TokenStreamException {
336                
337                
338                log.debug( "entered mainACIItemComponent()" );
339                
340                
341                try {      // for error handling
342                        switch ( LA(1)) {
343                        case ID_identificationTag:
344                        {
345                                aci_identificationTag();
346                                
347                                mainACIItemComponentsMonitor.useComponent( "identificationTag" );
348                                
349                                break;
350                        }
351                        case ID_precedence:
352                        {
353                                aci_precedence();
354                                
355                                mainACIItemComponentsMonitor.useComponent( "precedence" );
356                                
357                                break;
358                        }
359                        case ID_authenticationLevel:
360                        {
361                                aci_authenticationLevel();
362                                
363                                mainACIItemComponentsMonitor.useComponent( "authenticationLevel" );
364                                
365                                break;
366                        }
367                        case ID_itemOrUserFirst:
368                        {
369                                aci_itemOrUserFirst();
370                                
371                                mainACIItemComponentsMonitor.useComponent( "itemOrUserFirst" );
372                                
373                                break;
374                        }
375                        default:
376                        {
377                                throw new NoViableAltException(LT(1), getFilename());
378                        }
379                        }
380                }
381                catch (IllegalArgumentException e) {
382                        
383                        throw new RecognitionException( e.getMessage() );
384                        
385                }
386        }
387        
388        public final void aci_identificationTag() throws RecognitionException, TokenStreamException {
389                
390                Token  token = null;
391                
392                log.debug( "entered aci_identificationTag()" );
393                
394                
395                match(ID_identificationTag);
396                {
397                int _cnt20=0;
398                _loop20:
399                do {
400                        if ((LA(1)==SP)) {
401                                match(SP);
402                        }
403                        else {
404                                if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltException(LT(1), getFilename());}
405                        }
406                        
407                        _cnt20++;
408                } while (true);
409                }
410                token = LT(1);
411                match(SAFEUTF8STRING);
412                
413                identificationTag = token.getText();
414                
415        }
416        
417        public final void aci_precedence() throws RecognitionException, TokenStreamException {
418                
419                
420                log.debug( "entered aci_precedence()" );
421                
422                
423                precedence();
424                
425                aciPrecedence = Integer.valueOf( precedence );
426                precedence = null;
427                
428        }
429        
430        public final void aci_authenticationLevel() throws RecognitionException, TokenStreamException {
431                
432                
433                log.debug( "entered aci_authenticationLevel()" );
434                
435                
436                match(ID_authenticationLevel);
437                {
438                int _cnt27=0;
439                _loop27:
440                do {
441                        if ((LA(1)==SP)) {
442                                match(SP);
443                        }
444                        else {
445                                if ( _cnt27>=1 ) { break _loop27; } else {throw new NoViableAltException(LT(1), getFilename());}
446                        }
447                        
448                        _cnt27++;
449                } while (true);
450                }
451                authenticationLevel();
452        }
453        
454        public final void aci_itemOrUserFirst() throws RecognitionException, TokenStreamException {
455                
456                
457                log.debug( "entered aci_itemOrUserFirst()" );
458                
459                
460                match(ID_itemOrUserFirst);
461                {
462                int _cnt31=0;
463                _loop31:
464                do {
465                        if ((LA(1)==SP)) {
466                                match(SP);
467                        }
468                        else {
469                                if ( _cnt31>=1 ) { break _loop31; } else {throw new NoViableAltException(LT(1), getFilename());}
470                        }
471                        
472                        _cnt31++;
473                } while (true);
474                }
475                itemOrUserFirst();
476        }
477        
478        public final void precedence() throws RecognitionException, TokenStreamException {
479                
480                Token  token = null;
481                
482                log.debug( "entered precedence()" );
483                
484                
485                match(ID_precedence);
486                {
487                int _cnt24=0;
488                _loop24:
489                do {
490                        if ((LA(1)==SP)) {
491                                match(SP);
492                        }
493                        else {
494                                if ( _cnt24>=1 ) { break _loop24; } else {throw new NoViableAltException(LT(1), getFilename());}
495                        }
496                        
497                        _cnt24++;
498                } while (true);
499                }
500                token = LT(1);
501                match(INTEGER);
502                
503                precedence = Integer.valueOf( token2Integer( token ) );
504                
505                if ( ( precedence < 0 ) || ( precedence > 255 ) )
506                {
507                throw new RecognitionException( "Expecting INTEGER token having an Integer value between 0 and 255, found " + precedence );
508                }
509                
510        }
511        
512        public final void authenticationLevel() throws RecognitionException, TokenStreamException {
513                
514                
515                log.debug( "entered authenticationLevel()" );
516                
517                
518                switch ( LA(1)) {
519                case ID_none:
520                {
521                        match(ID_none);
522                        
523                        authenticationLevel = AuthenticationLevel.NONE;
524                        
525                        break;
526                }
527                case ID_simple:
528                {
529                        match(ID_simple);
530                        
531                        authenticationLevel = AuthenticationLevel.SIMPLE;
532                        
533                        break;
534                }
535                case ID_strong:
536                {
537                        match(ID_strong);
538                        
539                        authenticationLevel = AuthenticationLevel.STRONG;
540                        
541                        break;
542                }
543                default:
544                {
545                        throw new NoViableAltException(LT(1), getFilename());
546                }
547                }
548        }
549        
550        public final void itemOrUserFirst() throws RecognitionException, TokenStreamException {
551                
552                
553                log.debug( "entered itemOrUserFirst()" );
554                
555                
556                switch ( LA(1)) {
557                case ID_itemFirst:
558                {
559                        itemFirst();
560                        break;
561                }
562                case ID_userFirst:
563                {
564                        userFirst();
565                        break;
566                }
567                default:
568                {
569                        throw new NoViableAltException(LT(1), getFilename());
570                }
571                }
572        }
573        
574        public final void itemFirst() throws RecognitionException, TokenStreamException {
575                
576                
577                log.debug( "entered itemFirst()" );
578                
579                
580                match(ID_itemFirst);
581                {
582                _loop35:
583                do {
584                        if ((LA(1)==SP)) {
585                                match(SP);
586                        }
587                        else {
588                                break _loop35;
589                        }
590                        
591                } while (true);
592                }
593                match(COLON);
594                {
595                _loop37:
596                do {
597                        if ((LA(1)==SP)) {
598                                match(SP);
599                        }
600                        else {
601                                break _loop37;
602                        }
603                        
604                } while (true);
605                }
606                match(OPEN_CURLY);
607                {
608                _loop39:
609                do {
610                        if ((LA(1)==SP)) {
611                                match(SP);
612                        }
613                        else {
614                                break _loop39;
615                        }
616                        
617                } while (true);
618                }
619                protectedItems();
620                {
621                _loop41:
622                do {
623                        if ((LA(1)==SP)) {
624                                match(SP);
625                        }
626                        else {
627                                break _loop41;
628                        }
629                        
630                } while (true);
631                }
632                match(SEP);
633                {
634                _loop43:
635                do {
636                        if ((LA(1)==SP)) {
637                                match(SP);
638                        }
639                        else {
640                                break _loop43;
641                        }
642                        
643                } while (true);
644                }
645                itemPermissions();
646                {
647                _loop45:
648                do {
649                        if ((LA(1)==SP)) {
650                                match(SP);
651                        }
652                        else {
653                                break _loop45;
654                        }
655                        
656                } while (true);
657                }
658                match(CLOSE_CURLY);
659                
660                isItemFirstACIItem = true;
661                
662        }
663        
664        public final void userFirst() throws RecognitionException, TokenStreamException {
665                
666                
667                log.debug( "entered userFirst()" );
668                
669                
670                match(ID_userFirst);
671                {
672                _loop48:
673                do {
674                        if ((LA(1)==SP)) {
675                                match(SP);
676                        }
677                        else {
678                                break _loop48;
679                        }
680                        
681                } while (true);
682                }
683                match(COLON);
684                {
685                _loop50:
686                do {
687                        if ((LA(1)==SP)) {
688                                match(SP);
689                        }
690                        else {
691                                break _loop50;
692                        }
693                        
694                } while (true);
695                }
696                match(OPEN_CURLY);
697                {
698                _loop52:
699                do {
700                        if ((LA(1)==SP)) {
701                                match(SP);
702                        }
703                        else {
704                                break _loop52;
705                        }
706                        
707                } while (true);
708                }
709                userClasses();
710                {
711                _loop54:
712                do {
713                        if ((LA(1)==SP)) {
714                                match(SP);
715                        }
716                        else {
717                                break _loop54;
718                        }
719                        
720                } while (true);
721                }
722                match(SEP);
723                {
724                _loop56:
725                do {
726                        if ((LA(1)==SP)) {
727                                match(SP);
728                        }
729                        else {
730                                break _loop56;
731                        }
732                        
733                } while (true);
734                }
735                userPermissions();
736                {
737                _loop58:
738                do {
739                        if ((LA(1)==SP)) {
740                                match(SP);
741                        }
742                        else {
743                                break _loop58;
744                        }
745                        
746                } while (true);
747                }
748                match(CLOSE_CURLY);
749                
750                isItemFirstACIItem = false;
751                
752        }
753        
754        public final void protectedItems() throws RecognitionException, TokenStreamException {
755                
756                
757                log.debug( "entered protectedItems()" );
758                protectedItemsMap = new NoDuplicateKeysMap();
759                
760                
761                try {      // for error handling
762                        match(ID_protectedItems);
763                        {
764                        _loop61:
765                        do {
766                                if ((LA(1)==SP)) {
767                                        match(SP);
768                                }
769                                else {
770                                        break _loop61;
771                                }
772                                
773                        } while (true);
774                        }
775                        match(OPEN_CURLY);
776                        {
777                        _loop63:
778                        do {
779                                if ((LA(1)==SP)) {
780                                        match(SP);
781                                }
782                                else {
783                                        break _loop63;
784                                }
785                                
786                        } while (true);
787                        }
788                        {
789                        switch ( LA(1)) {
790                        case ATTRIBUTE_VALUE_CANDIDATE:
791                        case RANGE_OF_VALUES_CANDIDATE:
792                        case ID_entry:
793                        case ID_allUserAttributeTypes:
794                        case ID_attributeType:
795                        case ID_allAttributeValues:
796                        case ID_allUserAttributeTypesAndValues:
797                        case ID_selfValue:
798                        case ID_maxValueCount:
799                        case ID_maxImmSub:
800                        case ID_restrictedBy:
801                        case ID_classes:
802                        {
803                                protectedItem();
804                                {
805                                _loop66:
806                                do {
807                                        if ((LA(1)==SP)) {
808                                                match(SP);
809                                        }
810                                        else {
811                                                break _loop66;
812                                        }
813                                        
814                                } while (true);
815                                }
816                                {
817                                _loop72:
818                                do {
819                                        if ((LA(1)==SEP)) {
820                                                match(SEP);
821                                                {
822                                                _loop69:
823                                                do {
824                                                        if ((LA(1)==SP)) {
825                                                                match(SP);
826                                                        }
827                                                        else {
828                                                                break _loop69;
829                                                        }
830                                                        
831                                                } while (true);
832                                                }
833                                                protectedItem();
834                                                {
835                                                _loop71:
836                                                do {
837                                                        if ((LA(1)==SP)) {
838                                                                match(SP);
839                                                        }
840                                                        else {
841                                                                break _loop71;
842                                                        }
843                                                        
844                                                } while (true);
845                                                }
846                                        }
847                                        else {
848                                                break _loop72;
849                                        }
850                                        
851                                } while (true);
852                                }
853                                break;
854                        }
855                        case CLOSE_CURLY:
856                        {
857                                break;
858                        }
859                        default:
860                        {
861                                throw new NoViableAltException(LT(1), getFilename());
862                        }
863                        }
864                        }
865                        match(CLOSE_CURLY);
866                        
867                        protectedItems = new HashSet<ProtectedItem>( protectedItemsMap.values() );
868                        
869                }
870                catch (IllegalArgumentException e) {
871                        
872                        throw new RecognitionException( "Protected Items cannot be duplicated. " + e.getMessage() );
873                        
874                }
875        }
876        
877        public final void itemPermissions() throws RecognitionException, TokenStreamException {
878                
879                
880                log.debug( "entered itemPermissions()" );
881                itemPermissions = new HashSet<ItemPermission>();
882                ItemPermission itemPermission = null;
883                
884                
885                match(ID_itemPermissions);
886                {
887                int _cnt177=0;
888                _loop177:
889                do {
890                        if ((LA(1)==SP)) {
891                                match(SP);
892                        }
893                        else {
894                                if ( _cnt177>=1 ) { break _loop177; } else {throw new NoViableAltException(LT(1), getFilename());}
895                        }
896                        
897                        _cnt177++;
898                } while (true);
899                }
900                match(OPEN_CURLY);
901                {
902                _loop179:
903                do {
904                        if ((LA(1)==SP)) {
905                                match(SP);
906                        }
907                        else {
908                                break _loop179;
909                        }
910                        
911                } while (true);
912                }
913                {
914                switch ( LA(1)) {
915                case OPEN_CURLY:
916                {
917                        itemPermission=itemPermission();
918                        {
919                        _loop182:
920                        do {
921                                if ((LA(1)==SP)) {
922                                        match(SP);
923                                }
924                                else {
925                                        break _loop182;
926                                }
927                                
928                        } while (true);
929                        }
930                        
931                        itemPermissions.add( itemPermission );
932                        
933                        {
934                        _loop188:
935                        do {
936                                if ((LA(1)==SEP)) {
937                                        match(SEP);
938                                        {
939                                        _loop185:
940                                        do {
941                                                if ((LA(1)==SP)) {
942                                                        match(SP);
943                                                }
944                                                else {
945                                                        break _loop185;
946                                                }
947                                                
948                                        } while (true);
949                                        }
950                                        itemPermission=itemPermission();
951                                        {
952                                        _loop187:
953                                        do {
954                                                if ((LA(1)==SP)) {
955                                                        match(SP);
956                                                }
957                                                else {
958                                                        break _loop187;
959                                                }
960                                                
961                                        } while (true);
962                                        }
963                                        
964                                        itemPermissions.add( itemPermission );
965                                        
966                                }
967                                else {
968                                        break _loop188;
969                                }
970                                
971                        } while (true);
972                        }
973                        break;
974                }
975                case CLOSE_CURLY:
976                {
977                        break;
978                }
979                default:
980                {
981                        throw new NoViableAltException(LT(1), getFilename());
982                }
983                }
984                }
985                match(CLOSE_CURLY);
986        }
987        
988        public final void userClasses() throws RecognitionException, TokenStreamException {
989                
990                
991                log.debug( "entered userClasses()" );
992                userClassesMap = new NoDuplicateKeysMap();
993                
994                
995                try {      // for error handling
996                        match(ID_userClasses);
997                        {
998                        int _cnt218=0;
999                        _loop218:
1000                        do {
1001                                if ((LA(1)==SP)) {
1002                                        match(SP);
1003                                }
1004                                else {
1005                                        if ( _cnt218>=1 ) { break _loop218; } else {throw new NoViableAltException(LT(1), getFilename());}
1006                                }
1007                                
1008                                _cnt218++;
1009                        } while (true);
1010                        }
1011                        match(OPEN_CURLY);
1012                        {
1013                        _loop220:
1014                        do {
1015                                if ((LA(1)==SP)) {
1016                                        match(SP);
1017                                }
1018                                else {
1019                                        break _loop220;
1020                                }
1021                                
1022                        } while (true);
1023                        }
1024                        {
1025                        switch ( LA(1)) {
1026                        case ID_allUsers:
1027                        case ID_thisEntry:
1028                        case ID_parentOfEntry:
1029                        case ID_name:
1030                        case ID_userGroup:
1031                        case ID_subtree:
1032                        {
1033                                userClass();
1034                                {
1035                                _loop223:
1036                                do {
1037                                        if ((LA(1)==SP)) {
1038                                                match(SP);
1039                                        }
1040                                        else {
1041                                                break _loop223;
1042                                        }
1043                                        
1044                                } while (true);
1045                                }
1046                                {
1047                                _loop229:
1048                                do {
1049                                        if ((LA(1)==SEP)) {
1050                                                match(SEP);
1051                                                {
1052                                                _loop226:
1053                                                do {
1054                                                        if ((LA(1)==SP)) {
1055                                                                match(SP);
1056                                                        }
1057                                                        else {
1058                                                                break _loop226;
1059                                                        }
1060                                                        
1061                                                } while (true);
1062                                                }
1063                                                userClass();
1064                                                {
1065                                                _loop228:
1066                                                do {
1067                                                        if ((LA(1)==SP)) {
1068                                                                match(SP);
1069                                                        }
1070                                                        else {
1071                                                                break _loop228;
1072                                                        }
1073                                                        
1074                                                } while (true);
1075                                                }
1076                                        }
1077                                        else {
1078                                                break _loop229;
1079                                        }
1080                                        
1081                                } while (true);
1082                                }
1083                                break;
1084                        }
1085                        case CLOSE_CURLY:
1086                        {
1087                                break;
1088                        }
1089                        default:
1090                        {
1091                                throw new NoViableAltException(LT(1), getFilename());
1092                        }
1093                        }
1094                        }
1095                        match(CLOSE_CURLY);
1096                        
1097                        userClasses  = new HashSet<UserClass>( userClassesMap.values() );
1098                        
1099                }
1100                catch (IllegalArgumentException e) {
1101                        
1102                        throw new RecognitionException( "User Classes cannot be duplicated. " + e.getMessage() );
1103                        
1104                }
1105        }
1106        
1107        public final void userPermissions() throws RecognitionException, TokenStreamException {
1108                
1109                
1110                log.debug( "entered userPermissions()" );
1111                userPermissions = new HashSet<UserPermission>();
1112                UserPermission userPermission = null;
1113                
1114                
1115                match(ID_userPermissions);
1116                {
1117                int _cnt275=0;
1118                _loop275:
1119                do {
1120                        if ((LA(1)==SP)) {
1121                                match(SP);
1122                        }
1123                        else {
1124                                if ( _cnt275>=1 ) { break _loop275; } else {throw new NoViableAltException(LT(1), getFilename());}
1125                        }
1126                        
1127                        _cnt275++;
1128                } while (true);
1129                }
1130                match(OPEN_CURLY);
1131                {
1132                _loop277:
1133                do {
1134                        if ((LA(1)==SP)) {
1135                                match(SP);
1136                        }
1137                        else {
1138                                break _loop277;
1139                        }
1140                        
1141                } while (true);
1142                }
1143                {
1144                switch ( LA(1)) {
1145                case OPEN_CURLY:
1146                {
1147                        userPermission=userPermission();
1148                        {
1149                        _loop280:
1150                        do {
1151                                if ((LA(1)==SP)) {
1152                                        match(SP);
1153                                }
1154                                else {
1155                                        break _loop280;
1156                                }
1157                                
1158                        } while (true);
1159                        }
1160                        
1161                        userPermissions.add( userPermission );
1162                        
1163                        {
1164                        _loop286:
1165                        do {
1166                                if ((LA(1)==SEP)) {
1167                                        match(SEP);
1168                                        {
1169                                        _loop283:
1170                                        do {
1171                                                if ((LA(1)==SP)) {
1172                                                        match(SP);
1173                                                }
1174                                                else {
1175                                                        break _loop283;
1176                                                }
1177                                                
1178                                        } while (true);
1179                                        }
1180                                        userPermission=userPermission();
1181                                        {
1182                                        _loop285:
1183                                        do {
1184                                                if ((LA(1)==SP)) {
1185                                                        match(SP);
1186                                                }
1187                                                else {
1188                                                        break _loop285;
1189                                                }
1190                                                
1191                                        } while (true);
1192                                        }
1193                                        
1194                                        userPermissions.add( userPermission );
1195                                        
1196                                }
1197                                else {
1198                                        break _loop286;
1199                                }
1200                                
1201                        } while (true);
1202                        }
1203                        break;
1204                }
1205                case CLOSE_CURLY:
1206                {
1207                        break;
1208                }
1209                default:
1210                {
1211                        throw new NoViableAltException(LT(1), getFilename());
1212                }
1213                }
1214                }
1215                match(CLOSE_CURLY);
1216        }
1217        
1218        public final void protectedItem() throws RecognitionException, TokenStreamException {
1219                
1220                
1221                log.debug( "entered protectedItem()" );
1222                
1223                
1224                switch ( LA(1)) {
1225                case ID_entry:
1226                {
1227                        entry();
1228                        break;
1229                }
1230                case ID_allUserAttributeTypes:
1231                {
1232                        allUserAttributeTypes();
1233                        break;
1234                }
1235                case ID_attributeType:
1236                {
1237                        attributeType();
1238                        break;
1239                }
1240                case ID_allAttributeValues:
1241                {
1242                        allAttributeValues();
1243                        break;
1244                }
1245                case ID_allUserAttributeTypesAndValues:
1246                {
1247                        allUserAttributeTypesAndValues();
1248                        break;
1249                }
1250                case ATTRIBUTE_VALUE_CANDIDATE:
1251                {
1252                        attributeValue();
1253                        break;
1254                }
1255                case ID_selfValue:
1256                {
1257                        selfValue();
1258                        break;
1259                }
1260                case RANGE_OF_VALUES_CANDIDATE:
1261                {
1262                        rangeOfValues();
1263                        break;
1264                }
1265                case ID_maxValueCount:
1266                {
1267                        maxValueCount();
1268                        break;
1269                }
1270                case ID_maxImmSub:
1271                {
1272                        maxImmSub();
1273                        break;
1274                }
1275                case ID_restrictedBy:
1276                {
1277                        restrictedBy();
1278                        break;
1279                }
1280                case ID_classes:
1281                {
1282                        classes();
1283                        break;
1284                }
1285                default:
1286                {
1287                        throw new NoViableAltException(LT(1), getFilename());
1288                }
1289                }
1290        }
1291        
1292        public final void entry() throws RecognitionException, TokenStreamException {
1293                
1294                
1295                log.debug( "entered entry()" );  
1296                
1297                
1298                match(ID_entry);
1299                
1300                protectedItemsMap.put( "entry", ProtectedItem.ENTRY );
1301                
1302        }
1303        
1304        public final void allUserAttributeTypes() throws RecognitionException, TokenStreamException {
1305                
1306                
1307                log.debug( "entered allUserAttributeTypes()" );
1308                
1309                
1310                match(ID_allUserAttributeTypes);
1311                
1312                protectedItemsMap.put( "allUserAttributeTypes", ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
1313                
1314        }
1315        
1316        public final void attributeType() throws RecognitionException, TokenStreamException {
1317                
1318                
1319                log.debug( "entered attributeType()" );
1320                Set<AttributeType> attributeTypeSet = null;
1321                
1322                
1323                match(ID_attributeType);
1324                {
1325                int _cnt78=0;
1326                _loop78:
1327                do {
1328                        if ((LA(1)==SP)) {
1329                                match(SP);
1330                        }
1331                        else {
1332                                if ( _cnt78>=1 ) { break _loop78; } else {throw new NoViableAltException(LT(1), getFilename());}
1333                        }
1334                        
1335                        _cnt78++;
1336                } while (true);
1337                }
1338                attributeTypeSet=attributeTypeSet();
1339                
1340                protectedItemsMap.put( "attributeType", new AttributeTypeItem(attributeTypeSet ) );
1341                
1342        }
1343        
1344        public final void allAttributeValues() throws RecognitionException, TokenStreamException {
1345                
1346                
1347                log.debug( "entered allAttributeValues()" );
1348                Set<AttributeType> attributeTypeSet = null;
1349                
1350                
1351                match(ID_allAttributeValues);
1352                {
1353                int _cnt81=0;
1354                _loop81:
1355                do {
1356                        if ((LA(1)==SP)) {
1357                                match(SP);
1358                        }
1359                        else {
1360                                if ( _cnt81>=1 ) { break _loop81; } else {throw new NoViableAltException(LT(1), getFilename());}
1361                        }
1362                        
1363                        _cnt81++;
1364                } while (true);
1365                }
1366                attributeTypeSet=attributeTypeSet();
1367                
1368                protectedItemsMap.put( "allAttributeValues", new AllAttributeValuesItem( attributeTypeSet ) );
1369                
1370        }
1371        
1372        public final void allUserAttributeTypesAndValues() throws RecognitionException, TokenStreamException {
1373                
1374                
1375                log.debug( "entered allUserAttributeTypesAndValues()" );
1376                
1377                
1378                match(ID_allUserAttributeTypesAndValues);
1379                
1380                protectedItemsMap.put( "allUserAttributeTypesAndValues", ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
1381                
1382        }
1383        
1384        public final void attributeValue() throws RecognitionException, TokenStreamException {
1385                
1386                Token  token = null;
1387                
1388                log.debug( "entered attributeValue()" );
1389                String attributeTypeAndValue = null;
1390                String attributeType = null;
1391                String attributeValue = null;
1392                Set<Attribute> attributeSet = new HashSet<Attribute>();
1393                
1394                
1395                try {      // for error handling
1396                        token = LT(1);
1397                        match(ATTRIBUTE_VALUE_CANDIDATE);
1398                        
1399                        // A Dn can be considered as a set of attributeTypeAndValues
1400                        // So, parse the set as a Dn and extract each attributeTypeAndValue
1401                        Dn attributeTypeAndValueSetAsDn = new Dn( token.getText() );
1402                        
1403                        if ( schemaManager != null )
1404                        {        
1405                        attributeTypeAndValueSetAsDn.apply( schemaManager );
1406                        }
1407                        
1408                        for ( Rdn rdn : attributeTypeAndValueSetAsDn )
1409                        {
1410                        attributeTypeAndValue = rdn.getNormName();
1411                        attributeType = DnUtils.getRdnAttributeType( attributeTypeAndValue );
1412                        attributeValue = DnUtils.getRdnValue( attributeTypeAndValue );
1413                        
1414                        attributeSet.add( new DefaultAttribute( attributeType, attributeValue ) );
1415                        log.debug( "An attributeTypeAndValue from the set: " + attributeType + "=" +  attributeValue);
1416                        }
1417                        
1418                        protectedItemsMap.put( "attributeValue", new AttributeValueItem( attributeSet ) );
1419                        
1420                }
1421                catch (Exception e) {
1422                        
1423                        throw new RecognitionException( "dnParser failed for " + token.getText() + " , " + e.getMessage() );
1424                        
1425                }
1426        }
1427        
1428        public final void selfValue() throws RecognitionException, TokenStreamException {
1429                
1430                
1431                log.debug( "entered selfValue()" );
1432                Set<AttributeType> attributeTypeSet = null;
1433                
1434                
1435                match(ID_selfValue);
1436                {
1437                int _cnt86=0;
1438                _loop86:
1439                do {
1440                        if ((LA(1)==SP)) {
1441                                match(SP);
1442                        }
1443                        else {
1444                                if ( _cnt86>=1 ) { break _loop86; } else {throw new NoViableAltException(LT(1), getFilename());}
1445                        }
1446                        
1447                        _cnt86++;
1448                } while (true);
1449                }
1450                attributeTypeSet=attributeTypeSet();
1451                
1452                protectedItemsMap.put( "sefValue", new SelfValueItem( attributeTypeSet ) );
1453                
1454        }
1455        
1456        public final void rangeOfValues() throws RecognitionException, TokenStreamException {
1457                
1458                Token  token = null;
1459                
1460                log.debug( "entered rangeOfValues()" );
1461                
1462                
1463                try {      // for error handling
1464                        token = LT(1);
1465                        match(RANGE_OF_VALUES_CANDIDATE);
1466                        
1467                        protectedItemsMap.put( "rangeOfValues",
1468                        new RangeOfValuesItem(
1469                        FilterParser.parse( token.getText() ) ) );
1470                        log.debug( "filterParser parsed " + token.getText() );
1471                        
1472                }
1473                catch (Exception e) {
1474                        
1475                        throw new RecognitionException( "filterParser failed. " + e.getMessage() );
1476                        
1477                }
1478        }
1479        
1480        public final void maxValueCount() throws RecognitionException, TokenStreamException {
1481                
1482                
1483                log.debug( "entered maxValueCount()" );
1484                MaxValueCountElem maxValueCount = null;
1485                Set<MaxValueCountElem> maxValueCountSet = new HashSet<MaxValueCountElem>();
1486                
1487                
1488                match(ID_maxValueCount);
1489                {
1490                int _cnt90=0;
1491                _loop90:
1492                do {
1493                        if ((LA(1)==SP)) {
1494                                match(SP);
1495                        }
1496                        else {
1497                                if ( _cnt90>=1 ) { break _loop90; } else {throw new NoViableAltException(LT(1), getFilename());}
1498                        }
1499                        
1500                        _cnt90++;
1501                } while (true);
1502                }
1503                match(OPEN_CURLY);
1504                {
1505                _loop92:
1506                do {
1507                        if ((LA(1)==SP)) {
1508                                match(SP);
1509                        }
1510                        else {
1511                                break _loop92;
1512                        }
1513                        
1514                } while (true);
1515                }
1516                maxValueCount=aMaxValueCount();
1517                {
1518                _loop94:
1519                do {
1520                        if ((LA(1)==SP)) {
1521                                match(SP);
1522                        }
1523                        else {
1524                                break _loop94;
1525                        }
1526                        
1527                } while (true);
1528                }
1529                
1530                maxValueCountSet.add( maxValueCount );
1531                
1532                {
1533                _loop100:
1534                do {
1535                        if ((LA(1)==SEP)) {
1536                                match(SEP);
1537                                {
1538                                _loop97:
1539                                do {
1540                                        if ((LA(1)==SP)) {
1541                                                match(SP);
1542                                        }
1543                                        else {
1544                                                break _loop97;
1545                                        }
1546                                        
1547                                } while (true);
1548                                }
1549                                maxValueCount=aMaxValueCount();
1550                                {
1551                                _loop99:
1552                                do {
1553                                        if ((LA(1)==SP)) {
1554                                                match(SP);
1555                                        }
1556                                        else {
1557                                                break _loop99;
1558                                        }
1559                                        
1560                                } while (true);
1561                                }
1562                                
1563                                maxValueCountSet.add( maxValueCount );
1564                                
1565                        }
1566                        else {
1567                                break _loop100;
1568                        }
1569                        
1570                } while (true);
1571                }
1572                match(CLOSE_CURLY);
1573                
1574                protectedItemsMap.put( "maxValueCount", new MaxValueCountItem( maxValueCountSet ) );
1575                
1576        }
1577        
1578        public final void maxImmSub() throws RecognitionException, TokenStreamException {
1579                
1580                Token  token = null;
1581                
1582                log.debug( "entered maxImmSub()" );
1583                
1584                
1585                match(ID_maxImmSub);
1586                {
1587                int _cnt125=0;
1588                _loop125:
1589                do {
1590                        if ((LA(1)==SP)) {
1591                                match(SP);
1592                        }
1593                        else {
1594                                if ( _cnt125>=1 ) { break _loop125; } else {throw new NoViableAltException(LT(1), getFilename());}
1595                        }
1596                        
1597                        _cnt125++;
1598                } while (true);
1599                }
1600                token = LT(1);
1601                match(INTEGER);
1602                
1603                
1604                protectedItemsMap.put( "maxImmSub",
1605                new MaxImmSubItem(
1606                token2Integer( token ) ) );
1607                
1608        }
1609        
1610        public final void restrictedBy() throws RecognitionException, TokenStreamException {
1611                
1612                
1613                log.debug( "entered restrictedBy()" );
1614                RestrictedByElem restrictedValue = null;
1615                Set<RestrictedByElem> restrictedBy = new HashSet<RestrictedByElem>();
1616                
1617                
1618                match(ID_restrictedBy);
1619                {
1620                int _cnt128=0;
1621                _loop128:
1622                do {
1623                        if ((LA(1)==SP)) {
1624                                match(SP);
1625                        }
1626                        else {
1627                                if ( _cnt128>=1 ) { break _loop128; } else {throw new NoViableAltException(LT(1), getFilename());}
1628                        }
1629                        
1630                        _cnt128++;
1631                } while (true);
1632                }
1633                match(OPEN_CURLY);
1634                {
1635                _loop130:
1636                do {
1637                        if ((LA(1)==SP)) {
1638                                match(SP);
1639                        }
1640                        else {
1641                                break _loop130;
1642                        }
1643                        
1644                } while (true);
1645                }
1646                restrictedValue=restrictedValue();
1647                {
1648                _loop132:
1649                do {
1650                        if ((LA(1)==SP)) {
1651                                match(SP);
1652                        }
1653                        else {
1654                                break _loop132;
1655                        }
1656                        
1657                } while (true);
1658                }
1659                
1660                restrictedBy.add( restrictedValue );
1661                
1662                {
1663                _loop138:
1664                do {
1665                        if ((LA(1)==SEP)) {
1666                                match(SEP);
1667                                {
1668                                _loop135:
1669                                do {
1670                                        if ((LA(1)==SP)) {
1671                                                match(SP);
1672                                        }
1673                                        else {
1674                                                break _loop135;
1675                                        }
1676                                        
1677                                } while (true);
1678                                }
1679                                restrictedValue=restrictedValue();
1680                                {
1681                                _loop137:
1682                                do {
1683                                        if ((LA(1)==SP)) {
1684                                                match(SP);
1685                                        }
1686                                        else {
1687                                                break _loop137;
1688                                        }
1689                                        
1690                                } while (true);
1691                                }
1692                                
1693                                restrictedBy.add( restrictedValue );
1694                                
1695                        }
1696                        else {
1697                                break _loop138;
1698                        }
1699                        
1700                } while (true);
1701                }
1702                match(CLOSE_CURLY);
1703                
1704                protectedItemsMap.put( "restrictedBy", new RestrictedByItem( restrictedBy ) );
1705                
1706        }
1707        
1708        public final void classes() throws RecognitionException, TokenStreamException {
1709                
1710                
1711                log.debug( "entered classes()" );
1712                ExprNode classes = null;
1713                
1714                
1715                match(ID_classes);
1716                {
1717                int _cnt174=0;
1718                _loop174:
1719                do {
1720                        if ((LA(1)==SP)) {
1721                                match(SP);
1722                        }
1723                        else {
1724                                if ( _cnt174>=1 ) { break _loop174; } else {throw new NoViableAltException(LT(1), getFilename());}
1725                        }
1726                        
1727                        _cnt174++;
1728                } while (true);
1729                }
1730                classes=refinement();
1731                
1732                protectedItemsMap.put( "classes", new ClassesItem( classes ) );
1733                
1734        }
1735        
1736        public final  Set<AttributeType>  attributeTypeSet() throws RecognitionException, TokenStreamException {
1737                 Set<AttributeType> attributeTypeSet ;
1738                
1739                
1740                log.debug( "entered attributeTypeSet()" );
1741                String oid = null;
1742                attributeTypeSet = new HashSet<AttributeType>();
1743                AttributeType attributeType = null;
1744                
1745                
1746                match(OPEN_CURLY);
1747                {
1748                _loop163:
1749                do {
1750                        if ((LA(1)==SP)) {
1751                                match(SP);
1752                        }
1753                        else {
1754                                break _loop163;
1755                        }
1756                        
1757                } while (true);
1758                }
1759                oid=oid();
1760                {
1761                _loop165:
1762                do {
1763                        if ((LA(1)==SP)) {
1764                                match(SP);
1765                        }
1766                        else {
1767                                break _loop165;
1768                        }
1769                        
1770                } while (true);
1771                }
1772                
1773                try
1774                {
1775                attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
1776                attributeTypeSet.add( attributeType );
1777                }
1778                catch ( LdapException le )
1779                {
1780                // The oid does not exist
1781                // TODO : deal with such an exception
1782                }
1783                
1784                {
1785                _loop171:
1786                do {
1787                        if ((LA(1)==SEP)) {
1788                                match(SEP);
1789                                {
1790                                _loop168:
1791                                do {
1792                                        if ((LA(1)==SP)) {
1793                                                match(SP);
1794                                        }
1795                                        else {
1796                                                break _loop168;
1797                                        }
1798                                        
1799                                } while (true);
1800                                }
1801                                oid=oid();
1802                                {
1803                                _loop170:
1804                                do {
1805                                        if ((LA(1)==SP)) {
1806                                                match(SP);
1807                                        }
1808                                        else {
1809                                                break _loop170;
1810                                        }
1811                                        
1812                                } while (true);
1813                                }
1814                                
1815                                try
1816                                {
1817                                attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
1818                                attributeTypeSet.add( attributeType );
1819                                }
1820                                catch ( LdapException le )
1821                                {
1822                                // The oid does not exist
1823                                // TODO : deal with such an exception
1824                                }
1825                                
1826                        }
1827                        else {
1828                                break _loop171;
1829                        }
1830                        
1831                } while (true);
1832                }
1833                match(CLOSE_CURLY);
1834                return attributeTypeSet ;
1835        }
1836        
1837        public final  MaxValueCountElem  aMaxValueCount() throws RecognitionException, TokenStreamException {
1838                 MaxValueCountElem maxValueCount ;
1839                
1840                Token  token1 = null;
1841                Token  token2 = null;
1842                
1843                log.debug( "entered aMaxValueCount()" );
1844                maxValueCount = null;
1845                String oid = null;
1846                Token token = null;
1847                AttributeType attributeType = null;
1848                
1849                
1850                match(OPEN_CURLY);
1851                {
1852                _loop103:
1853                do {
1854                        if ((LA(1)==SP)) {
1855                                match(SP);
1856                        }
1857                        else {
1858                                break _loop103;
1859                        }
1860                        
1861                } while (true);
1862                }
1863                {
1864                switch ( LA(1)) {
1865                case ID_type:
1866                {
1867                        match(ID_type);
1868                        {
1869                        int _cnt106=0;
1870                        _loop106:
1871                        do {
1872                                if ((LA(1)==SP)) {
1873                                        match(SP);
1874                                }
1875                                else {
1876                                        if ( _cnt106>=1 ) { break _loop106; } else {throw new NoViableAltException(LT(1), getFilename());}
1877                                }
1878                                
1879                                _cnt106++;
1880                        } while (true);
1881                        }
1882                        oid=oid();
1883                        {
1884                        _loop108:
1885                        do {
1886                                if ((LA(1)==SP)) {
1887                                        match(SP);
1888                                }
1889                                else {
1890                                        break _loop108;
1891                                }
1892                                
1893                        } while (true);
1894                        }
1895                        match(SEP);
1896                        {
1897                        _loop110:
1898                        do {
1899                                if ((LA(1)==SP)) {
1900                                        match(SP);
1901                                }
1902                                else {
1903                                        break _loop110;
1904                                }
1905                                
1906                        } while (true);
1907                        }
1908                        match(ID_maxCount);
1909                        {
1910                        int _cnt112=0;
1911                        _loop112:
1912                        do {
1913                                if ((LA(1)==SP)) {
1914                                        match(SP);
1915                                }
1916                                else {
1917                                        if ( _cnt112>=1 ) { break _loop112; } else {throw new NoViableAltException(LT(1), getFilename());}
1918                                }
1919                                
1920                                _cnt112++;
1921                        } while (true);
1922                        }
1923                        token1 = LT(1);
1924                        match(INTEGER);
1925                        token = token1;
1926                        break;
1927                }
1928                case ID_maxCount:
1929                {
1930                        match(ID_maxCount);
1931                        {
1932                        int _cnt114=0;
1933                        _loop114:
1934                        do {
1935                                if ((LA(1)==SP)) {
1936                                        match(SP);
1937                                }
1938                                else {
1939                                        if ( _cnt114>=1 ) { break _loop114; } else {throw new NoViableAltException(LT(1), getFilename());}
1940                                }
1941                                
1942                                _cnt114++;
1943                        } while (true);
1944                        }
1945                        token2 = LT(1);
1946                        match(INTEGER);
1947                        {
1948                        _loop116:
1949                        do {
1950                                if ((LA(1)==SP)) {
1951                                        match(SP);
1952                                }
1953                                else {
1954                                        break _loop116;
1955                                }
1956                                
1957                        } while (true);
1958                        }
1959                        match(SEP);
1960                        {
1961                        _loop118:
1962                        do {
1963                                if ((LA(1)==SP)) {
1964                                        match(SP);
1965                                }
1966                                else {
1967                                        break _loop118;
1968                                }
1969                                
1970                        } while (true);
1971                        }
1972                        match(ID_type);
1973                        {
1974                        int _cnt120=0;
1975                        _loop120:
1976                        do {
1977                                if ((LA(1)==SP)) {
1978                                        match(SP);
1979                                }
1980                                else {
1981                                        if ( _cnt120>=1 ) { break _loop120; } else {throw new NoViableAltException(LT(1), getFilename());}
1982                                }
1983                                
1984                                _cnt120++;
1985                        } while (true);
1986                        }
1987                        oid=oid();
1988                        token = token2;
1989                        break;
1990                }
1991                default:
1992                {
1993                        throw new NoViableAltException(LT(1), getFilename());
1994                }
1995                }
1996                }
1997                {
1998                _loop122:
1999                do {
2000                        if ((LA(1)==SP)) {
2001                                match(SP);
2002                        }
2003                        else {
2004                                break _loop122;
2005                        }
2006                        
2007                } while (true);
2008                }
2009                match(CLOSE_CURLY);
2010                
2011                try
2012                {
2013                attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
2014                maxValueCount = new MaxValueCountElem( attributeType, token2Integer( token ) );
2015                }
2016                catch ( LdapException le )
2017                {
2018                // The oid does not exist
2019                // TODO : deal with such an exception
2020                }
2021                
2022                return maxValueCount ;
2023        }
2024        
2025        public final  String  oid() throws RecognitionException, TokenStreamException {
2026                 String result ;
2027                
2028                
2029                log.debug( "entered oid()" );
2030                result = null;
2031                Token token = null;
2032                
2033                
2034                token = LT( 1 );
2035                {
2036                switch ( LA(1)) {
2037                case DESCR:
2038                {
2039                        match(DESCR);
2040                        break;
2041                }
2042                case NUMERICOID:
2043                {
2044                        match(NUMERICOID);
2045                        break;
2046                }
2047                default:
2048                {
2049                        throw new NoViableAltException(LT(1), getFilename());
2050                }
2051                }
2052                }
2053                
2054                result = token.getText();
2055                log.debug( "recognized an oid: " + result );
2056                
2057                return result ;
2058        }
2059        
2060        public final  RestrictedByElem  restrictedValue() throws RecognitionException, TokenStreamException {
2061                 RestrictedByElem restrictedValue ;
2062                
2063                
2064                log.debug( "entered restrictedValue()" );
2065                String typeOid = null;
2066                String valuesInOid = null;
2067                restrictedValue = null;
2068                AttributeType attributeType = null;
2069                AttributeType valueInAttributeType = null;
2070                
2071                
2072                match(OPEN_CURLY);
2073                {
2074                _loop141:
2075                do {
2076                        if ((LA(1)==SP)) {
2077                                match(SP);
2078                        }
2079                        else {
2080                                break _loop141;
2081                        }
2082                        
2083                } while (true);
2084                }
2085                {
2086                switch ( LA(1)) {
2087                case ID_type:
2088                {
2089                        match(ID_type);
2090                        {
2091                        int _cnt144=0;
2092                        _loop144:
2093                        do {
2094                                if ((LA(1)==SP)) {
2095                                        match(SP);
2096                                }
2097                                else {
2098                                        if ( _cnt144>=1 ) { break _loop144; } else {throw new NoViableAltException(LT(1), getFilename());}
2099                                }
2100                                
2101                                _cnt144++;
2102                        } while (true);
2103                        }
2104                        typeOid=oid();
2105                        {
2106                        _loop146:
2107                        do {
2108                                if ((LA(1)==SP)) {
2109                                        match(SP);
2110                                }
2111                                else {
2112                                        break _loop146;
2113                                }
2114                                
2115                        } while (true);
2116                        }
2117                        match(SEP);
2118                        {
2119                        _loop148:
2120                        do {
2121                                if ((LA(1)==SP)) {
2122                                        match(SP);
2123                                }
2124                                else {
2125                                        break _loop148;
2126                                }
2127                                
2128                        } while (true);
2129                        }
2130                        match(ID_valuesIn);
2131                        {
2132                        int _cnt150=0;
2133                        _loop150:
2134                        do {
2135                                if ((LA(1)==SP)) {
2136                                        match(SP);
2137                                }
2138                                else {
2139                                        if ( _cnt150>=1 ) { break _loop150; } else {throw new NoViableAltException(LT(1), getFilename());}
2140                                }
2141                                
2142                                _cnt150++;
2143                        } while (true);
2144                        }
2145                        valuesInOid=oid();
2146                        break;
2147                }
2148                case ID_valuesIn:
2149                {
2150                        match(ID_valuesIn);
2151                        {
2152                        int _cnt152=0;
2153                        _loop152:
2154                        do {
2155                                if ((LA(1)==SP)) {
2156                                        match(SP);
2157                                }
2158                                else {
2159                                        if ( _cnt152>=1 ) { break _loop152; } else {throw new NoViableAltException(LT(1), getFilename());}
2160                                }
2161                                
2162                                _cnt152++;
2163                        } while (true);
2164                        }
2165                        valuesInOid=oid();
2166                        {
2167                        _loop154:
2168                        do {
2169                                if ((LA(1)==SP)) {
2170                                        match(SP);
2171                                }
2172                                else {
2173                                        break _loop154;
2174                                }
2175                                
2176                        } while (true);
2177                        }
2178                        match(SEP);
2179                        {
2180                        _loop156:
2181                        do {
2182                                if ((LA(1)==SP)) {
2183                                        match(SP);
2184                                }
2185                                else {
2186                                        break _loop156;
2187                                }
2188                                
2189                        } while (true);
2190                        }
2191                        match(ID_type);
2192                        {
2193                        int _cnt158=0;
2194                        _loop158:
2195                        do {
2196                                if ((LA(1)==SP)) {
2197                                        match(SP);
2198                                }
2199                                else {
2200                                        if ( _cnt158>=1 ) { break _loop158; } else {throw new NoViableAltException(LT(1), getFilename());}
2201                                }
2202                                
2203                                _cnt158++;
2204                        } while (true);
2205                        }
2206                        typeOid=oid();
2207                        break;
2208                }
2209                default:
2210                {
2211                        throw new NoViableAltException(LT(1), getFilename());
2212                }
2213                }
2214                }
2215                {
2216                _loop160:
2217                do {
2218                        if ((LA(1)==SP)) {
2219                                match(SP);
2220                        }
2221                        else {
2222                                break _loop160;
2223                        }
2224                        
2225                } while (true);
2226                }
2227                match(CLOSE_CURLY);
2228                
2229                try
2230                {
2231                attributeType = schemaManager.lookupAttributeTypeRegistry( typeOid );
2232                valueInAttributeType = schemaManager.lookupAttributeTypeRegistry( valuesInOid );
2233                restrictedValue = new RestrictedByElem( attributeType, valueInAttributeType );
2234                }
2235                catch ( LdapException le )
2236                {
2237                // The oid does not exist
2238                // TODO : deal with such an exception
2239                }
2240                
2241                return restrictedValue ;
2242        }
2243        
2244        public final  ExprNode  refinement() throws RecognitionException, TokenStreamException {
2245                 ExprNode node ;
2246                
2247                
2248                log.debug( "entered refinement()" );
2249                node = null;
2250                
2251                
2252                switch ( LA(1)) {
2253                case ID_item:
2254                {
2255                        node=item();
2256                        break;
2257                }
2258                case ID_and:
2259                {
2260                        node=and();
2261                        break;
2262                }
2263                case ID_or:
2264                {
2265                        node=or();
2266                        break;
2267                }
2268                case ID_not:
2269                {
2270                        node=not();
2271                        break;
2272                }
2273                default:
2274                {
2275                        throw new NoViableAltException(LT(1), getFilename());
2276                }
2277                }
2278                return node ;
2279        }
2280        
2281        public final  ItemPermission  itemPermission() throws RecognitionException, TokenStreamException {
2282                 ItemPermission itemPermission ;
2283                
2284                
2285                log.debug( "entered itemPermission()" );
2286                itemPermission = null;
2287                itemPermissionComponentsMonitor = new MandatoryAndOptionalComponentsMonitor( 
2288                new String [] { "userClasses", "grantsAndDenials" }, new String [] { "precedence" } );
2289                
2290                
2291                match(OPEN_CURLY);
2292                {
2293                _loop191:
2294                do {
2295                        if ((LA(1)==SP)) {
2296                                match(SP);
2297                        }
2298                        else {
2299                                break _loop191;
2300                        }
2301                        
2302                } while (true);
2303                }
2304                anyItemPermission();
2305                {
2306                _loop193:
2307                do {
2308                        if ((LA(1)==SP)) {
2309                                match(SP);
2310                        }
2311                        else {
2312                                break _loop193;
2313                        }
2314                        
2315                } while (true);
2316                }
2317                {
2318                _loop199:
2319                do {
2320                        if ((LA(1)==SEP)) {
2321                                match(SEP);
2322                                {
2323                                _loop196:
2324                                do {
2325                                        if ((LA(1)==SP)) {
2326                                                match(SP);
2327                                        }
2328                                        else {
2329                                                break _loop196;
2330                                        }
2331                                        
2332                                } while (true);
2333                                }
2334                                anyItemPermission();
2335                                {
2336                                _loop198:
2337                                do {
2338                                        if ((LA(1)==SP)) {
2339                                                match(SP);
2340                                        }
2341                                        else {
2342                                                break _loop198;
2343                                        }
2344                                        
2345                                } while (true);
2346                                }
2347                        }
2348                        else {
2349                                break _loop199;
2350                        }
2351                        
2352                } while (true);
2353                }
2354                match(CLOSE_CURLY);
2355                
2356                if ( !itemPermissionComponentsMonitor.finalStateValid() )
2357                {
2358                throw new RecognitionException( "Missing mandatory itemPermission components: " 
2359                + itemPermissionComponentsMonitor.getRemainingComponents() );
2360                }
2361                
2362                itemPermission = new ItemPermission( precedence, grantsAndDenials, userClasses );
2363                precedence = null;
2364                
2365                return itemPermission ;
2366        }
2367        
2368        public final void anyItemPermission() throws RecognitionException, TokenStreamException {
2369                
2370                
2371                try {      // for error handling
2372                        switch ( LA(1)) {
2373                        case ID_precedence:
2374                        {
2375                                precedence();
2376                                
2377                                itemPermissionComponentsMonitor.useComponent( "precedence" );
2378                                
2379                                break;
2380                        }
2381                        case ID_userClasses:
2382                        {
2383                                userClasses();
2384                                
2385                                itemPermissionComponentsMonitor.useComponent( "userClasses" );
2386                                
2387                                break;
2388                        }
2389                        case ID_grantsAndDenials:
2390                        {
2391                                grantsAndDenials();
2392                                
2393                                itemPermissionComponentsMonitor.useComponent( "grantsAndDenials" );
2394                                
2395                                break;
2396                        }
2397                        default:
2398                        {
2399                                throw new NoViableAltException(LT(1), getFilename());
2400                        }
2401                        }
2402                }
2403                catch (IllegalArgumentException e) {
2404                        
2405                        throw new RecognitionException( e.getMessage() );
2406                        
2407                }
2408        }
2409        
2410        public final void grantsAndDenials() throws RecognitionException, TokenStreamException {
2411                
2412                
2413                log.debug( "entered grantsAndDenials()" );
2414                grantsAndDenials = new HashSet<GrantAndDenial>();
2415                GrantAndDenial grantAndDenial = null;
2416                
2417                
2418                match(ID_grantsAndDenials);
2419                {
2420                int _cnt203=0;
2421                _loop203:
2422                do {
2423                        if ((LA(1)==SP)) {
2424                                match(SP);
2425                        }
2426                        else {
2427                                if ( _cnt203>=1 ) { break _loop203; } else {throw new NoViableAltException(LT(1), getFilename());}
2428                        }
2429                        
2430                        _cnt203++;
2431                } while (true);
2432                }
2433                match(OPEN_CURLY);
2434                {
2435                _loop205:
2436                do {
2437                        if ((LA(1)==SP)) {
2438                                match(SP);
2439                        }
2440                        else {
2441                                break _loop205;
2442                        }
2443                        
2444                } while (true);
2445                }
2446                {
2447                switch ( LA(1)) {
2448                case ID_grantAdd:
2449                case ID_denyAdd:
2450                case ID_grantDiscloseOnError:
2451                case ID_denyDiscloseOnError:
2452                case ID_grantRead:
2453                case ID_denyRead:
2454                case ID_grantRemove:
2455                case ID_denyRemove:
2456                case ID_grantBrowse:
2457                case ID_denyBrowse:
2458                case ID_grantExport:
2459                case ID_denyExport:
2460                case ID_grantImport:
2461                case ID_denyImport:
2462                case ID_grantModify:
2463                case ID_denyModify:
2464                case ID_grantRename:
2465                case ID_denyRename:
2466                case ID_grantReturnDN:
2467                case ID_denyReturnDN:
2468                case ID_grantCompare:
2469                case ID_denyCompare:
2470                case ID_grantFilterMatch:
2471                case ID_denyFilterMatch:
2472                case ID_grantInvoke:
2473                case ID_denyInvoke:
2474                {
2475                        grantAndDenial=grantAndDenial();
2476                        {
2477                        _loop208:
2478                        do {
2479                                if ((LA(1)==SP)) {
2480                                        match(SP);
2481                                }
2482                                else {
2483                                        break _loop208;
2484                                }
2485                                
2486                        } while (true);
2487                        }
2488                        
2489                        if ( !grantsAndDenials.add( grantAndDenial ))
2490                        {
2491                        throw new RecognitionException( "Duplicated GrantAndDenial bit: " + grantAndDenial );
2492                        }
2493                        
2494                        {
2495                        _loop214:
2496                        do {
2497                                if ((LA(1)==SEP)) {
2498                                        match(SEP);
2499                                        {
2500                                        _loop211:
2501                                        do {
2502                                                if ((LA(1)==SP)) {
2503                                                        match(SP);
2504                                                }
2505                                                else {
2506                                                        break _loop211;
2507                                                }
2508                                                
2509                                        } while (true);
2510                                        }
2511                                        grantAndDenial=grantAndDenial();
2512                                        {
2513                                        _loop213:
2514                                        do {
2515                                                if ((LA(1)==SP)) {
2516                                                        match(SP);
2517                                                }
2518                                                else {
2519                                                        break _loop213;
2520                                                }
2521                                                
2522                                        } while (true);
2523                                        }
2524                                        
2525                                        if ( !grantsAndDenials.add( grantAndDenial ))
2526                                        {
2527                                        throw new RecognitionException( "Duplicated GrantAndDenial bit: " + grantAndDenial );
2528                                        }
2529                                        
2530                                }
2531                                else {
2532                                        break _loop214;
2533                                }
2534                                
2535                        } while (true);
2536                        }
2537                        break;
2538                }
2539                case CLOSE_CURLY:
2540                {
2541                        break;
2542                }
2543                default:
2544                {
2545                        throw new NoViableAltException(LT(1), getFilename());
2546                }
2547                }
2548                }
2549                match(CLOSE_CURLY);
2550        }
2551        
2552        public final  GrantAndDenial  grantAndDenial() throws RecognitionException, TokenStreamException {
2553                 GrantAndDenial l_grantAndDenial ;
2554                
2555                
2556                log.debug( "entered grantAndDenialsBit()" );
2557                l_grantAndDenial = null;
2558                
2559                
2560                switch ( LA(1)) {
2561                case ID_grantAdd:
2562                {
2563                        match(ID_grantAdd);
2564                        l_grantAndDenial = GrantAndDenial.GRANT_ADD;
2565                        break;
2566                }
2567                case ID_denyAdd:
2568                {
2569                        match(ID_denyAdd);
2570                        l_grantAndDenial = GrantAndDenial.DENY_ADD;
2571                        break;
2572                }
2573                case ID_grantDiscloseOnError:
2574                {
2575                        match(ID_grantDiscloseOnError);
2576                        l_grantAndDenial = GrantAndDenial.GRANT_DISCLOSE_ON_ERROR;
2577                        break;
2578                }
2579                case ID_denyDiscloseOnError:
2580                {
2581                        match(ID_denyDiscloseOnError);
2582                        l_grantAndDenial = GrantAndDenial.DENY_DISCLOSE_ON_ERROR;
2583                        break;
2584                }
2585                case ID_grantRead:
2586                {
2587                        match(ID_grantRead);
2588                        l_grantAndDenial = GrantAndDenial.GRANT_READ;
2589                        break;
2590                }
2591                case ID_denyRead:
2592                {
2593                        match(ID_denyRead);
2594                        l_grantAndDenial = GrantAndDenial.DENY_READ;
2595                        break;
2596                }
2597                case ID_grantRemove:
2598                {
2599                        match(ID_grantRemove);
2600                        l_grantAndDenial = GrantAndDenial.GRANT_REMOVE;
2601                        break;
2602                }
2603                case ID_denyRemove:
2604                {
2605                        match(ID_denyRemove);
2606                        l_grantAndDenial = GrantAndDenial.DENY_REMOVE;
2607                        break;
2608                }
2609                case ID_grantBrowse:
2610                {
2611                        match(ID_grantBrowse);
2612                        l_grantAndDenial = GrantAndDenial.GRANT_BROWSE;
2613                        break;
2614                }
2615                case ID_denyBrowse:
2616                {
2617                        match(ID_denyBrowse);
2618                        l_grantAndDenial = GrantAndDenial.DENY_BROWSE;
2619                        break;
2620                }
2621                case ID_grantExport:
2622                {
2623                        match(ID_grantExport);
2624                        l_grantAndDenial = GrantAndDenial.GRANT_EXPORT;
2625                        break;
2626                }
2627                case ID_denyExport:
2628                {
2629                        match(ID_denyExport);
2630                        l_grantAndDenial = GrantAndDenial.DENY_EXPORT;
2631                        break;
2632                }
2633                case ID_grantImport:
2634                {
2635                        match(ID_grantImport);
2636                        l_grantAndDenial = GrantAndDenial.GRANT_IMPORT;
2637                        break;
2638                }
2639                case ID_denyImport:
2640                {
2641                        match(ID_denyImport);
2642                        l_grantAndDenial = GrantAndDenial.DENY_IMPORT;
2643                        break;
2644                }
2645                case ID_grantModify:
2646                {
2647                        match(ID_grantModify);
2648                        l_grantAndDenial = GrantAndDenial.GRANT_MODIFY;
2649                        break;
2650                }
2651                case ID_denyModify:
2652                {
2653                        match(ID_denyModify);
2654                        l_grantAndDenial = GrantAndDenial.DENY_MODIFY;
2655                        break;
2656                }
2657                case ID_grantRename:
2658                {
2659                        match(ID_grantRename);
2660                        l_grantAndDenial = GrantAndDenial.GRANT_RENAME;
2661                        break;
2662                }
2663                case ID_denyRename:
2664                {
2665                        match(ID_denyRename);
2666                        l_grantAndDenial = GrantAndDenial.DENY_RENAME;
2667                        break;
2668                }
2669                case ID_grantReturnDN:
2670                {
2671                        match(ID_grantReturnDN);
2672                        l_grantAndDenial = GrantAndDenial.GRANT_RETURN_DN;
2673                        break;
2674                }
2675                case ID_denyReturnDN:
2676                {
2677                        match(ID_denyReturnDN);
2678                        l_grantAndDenial = GrantAndDenial.DENY_RETURN_DN;
2679                        break;
2680                }
2681                case ID_grantCompare:
2682                {
2683                        match(ID_grantCompare);
2684                        l_grantAndDenial = GrantAndDenial.GRANT_COMPARE;
2685                        break;
2686                }
2687                case ID_denyCompare:
2688                {
2689                        match(ID_denyCompare);
2690                        l_grantAndDenial = GrantAndDenial.DENY_COMPARE;
2691                        break;
2692                }
2693                case ID_grantFilterMatch:
2694                {
2695                        match(ID_grantFilterMatch);
2696                        l_grantAndDenial = GrantAndDenial.GRANT_FILTER_MATCH;
2697                        break;
2698                }
2699                case ID_denyFilterMatch:
2700                {
2701                        match(ID_denyFilterMatch);
2702                        l_grantAndDenial = GrantAndDenial.DENY_FILTER_MATCH;
2703                        break;
2704                }
2705                case ID_grantInvoke:
2706                {
2707                        match(ID_grantInvoke);
2708                        l_grantAndDenial = GrantAndDenial.GRANT_INVOKE;
2709                        break;
2710                }
2711                case ID_denyInvoke:
2712                {
2713                        match(ID_denyInvoke);
2714                        l_grantAndDenial = GrantAndDenial.DENY_INVOKE;
2715                        break;
2716                }
2717                default:
2718                {
2719                        throw new NoViableAltException(LT(1), getFilename());
2720                }
2721                }
2722                return l_grantAndDenial ;
2723        }
2724        
2725        public final void userClass() throws RecognitionException, TokenStreamException {
2726                
2727                
2728                log.debug( "entered userClasses()" );
2729                
2730                
2731                switch ( LA(1)) {
2732                case ID_allUsers:
2733                {
2734                        allUsers();
2735                        break;
2736                }
2737                case ID_thisEntry:
2738                {
2739                        thisEntry();
2740                        break;
2741                }
2742                case ID_parentOfEntry:
2743                {
2744                        parentOfEntry();
2745                        break;
2746                }
2747                case ID_name:
2748                {
2749                        name();
2750                        break;
2751                }
2752                case ID_userGroup:
2753                {
2754                        userGroup();
2755                        break;
2756                }
2757                case ID_subtree:
2758                {
2759                        subtree();
2760                        break;
2761                }
2762                default:
2763                {
2764                        throw new NoViableAltException(LT(1), getFilename());
2765                }
2766                }
2767        }
2768        
2769        public final void allUsers() throws RecognitionException, TokenStreamException {
2770                
2771                
2772                log.debug( "entered allUsers()" );
2773                
2774                
2775                match(ID_allUsers);
2776                
2777                userClassesMap.put( "allUsers", UserClass.ALL_USERS );
2778                
2779        }
2780        
2781        public final void thisEntry() throws RecognitionException, TokenStreamException {
2782                
2783                
2784                log.debug( "entered thisEntry()" );
2785                
2786                
2787                match(ID_thisEntry);
2788                
2789                userClassesMap.put( "thisEntry", UserClass.THIS_ENTRY );
2790                
2791        }
2792        
2793        public final void parentOfEntry() throws RecognitionException, TokenStreamException {
2794                
2795                
2796                log.debug( "entered parentOfEntry()" );
2797                
2798                
2799                match(ID_parentOfEntry);
2800                
2801                userClassesMap.put( "parentOfEntry", UserClass.PARENT_OF_ENTRY );
2802                
2803        }
2804        
2805        public final void name() throws RecognitionException, TokenStreamException {
2806                
2807                
2808                log.debug( "entered name()" );
2809                Set<Dn> names = new HashSet<Dn>();
2810                Dn distinguishedName = null;
2811                
2812                
2813                match(ID_name);
2814                {
2815                int _cnt236=0;
2816                _loop236:
2817                do {
2818                        if ((LA(1)==SP)) {
2819                                match(SP);
2820                        }
2821                        else {
2822                                if ( _cnt236>=1 ) { break _loop236; } else {throw new NoViableAltException(LT(1), getFilename());}
2823                        }
2824                        
2825                        _cnt236++;
2826                } while (true);
2827                }
2828                match(OPEN_CURLY);
2829                {
2830                _loop238:
2831                do {
2832                        if ((LA(1)==SP)) {
2833                                match(SP);
2834                        }
2835                        else {
2836                                break _loop238;
2837                        }
2838                        
2839                } while (true);
2840                }
2841                distinguishedName=distinguishedName();
2842                {
2843                _loop240:
2844                do {
2845                        if ((LA(1)==SP)) {
2846                                match(SP);
2847                        }
2848                        else {
2849                                break _loop240;
2850                        }
2851                        
2852                } while (true);
2853                }
2854                
2855                names.add( distinguishedName );
2856                
2857                {
2858                _loop246:
2859                do {
2860                        if ((LA(1)==SEP)) {
2861                                match(SEP);
2862                                {
2863                                _loop243:
2864                                do {
2865                                        if ((LA(1)==SP)) {
2866                                                match(SP);
2867                                        }
2868                                        else {
2869                                                break _loop243;
2870                                        }
2871                                        
2872                                } while (true);
2873                                }
2874                                distinguishedName=distinguishedName();
2875                                {
2876                                _loop245:
2877                                do {
2878                                        if ((LA(1)==SP)) {
2879                                                match(SP);
2880                                        }
2881                                        else {
2882                                                break _loop245;
2883                                        }
2884                                        
2885                                } while (true);
2886                                }
2887                                
2888                                names.add( distinguishedName );
2889                                
2890                        }
2891                        else {
2892                                break _loop246;
2893                        }
2894                        
2895                } while (true);
2896                }
2897                match(CLOSE_CURLY);
2898                
2899                userClassesMap.put( "name", new UserClass.Name( names ) );
2900                
2901        }
2902        
2903        public final void userGroup() throws RecognitionException, TokenStreamException {
2904                
2905                
2906                log.debug( "entered userGroup()" );
2907                Set<Dn> userGroup = new HashSet<Dn>();
2908                Dn distinguishedName = null;
2909                
2910                
2911                match(ID_userGroup);
2912                {
2913                int _cnt249=0;
2914                _loop249:
2915                do {
2916                        if ((LA(1)==SP)) {
2917                                match(SP);
2918                        }
2919                        else {
2920                                if ( _cnt249>=1 ) { break _loop249; } else {throw new NoViableAltException(LT(1), getFilename());}
2921                        }
2922                        
2923                        _cnt249++;
2924                } while (true);
2925                }
2926                match(OPEN_CURLY);
2927                {
2928                _loop251:
2929                do {
2930                        if ((LA(1)==SP)) {
2931                                match(SP);
2932                        }
2933                        else {
2934                                break _loop251;
2935                        }
2936                        
2937                } while (true);
2938                }
2939                distinguishedName=distinguishedName();
2940                {
2941                _loop253:
2942                do {
2943                        if ((LA(1)==SP)) {
2944                                match(SP);
2945                        }
2946                        else {
2947                                break _loop253;
2948                        }
2949                        
2950                } while (true);
2951                }
2952                
2953                userGroup.add( distinguishedName );
2954                
2955                {
2956                _loop259:
2957                do {
2958                        if ((LA(1)==SEP)) {
2959                                match(SEP);
2960                                {
2961                                _loop256:
2962                                do {
2963                                        if ((LA(1)==SP)) {
2964                                                match(SP);
2965                                        }
2966                                        else {
2967                                                break _loop256;
2968                                        }
2969                                        
2970                                } while (true);
2971                                }
2972                                distinguishedName=distinguishedName();
2973                                {
2974                                _loop258:
2975                                do {
2976                                        if ((LA(1)==SP)) {
2977                                                match(SP);
2978                                        }
2979                                        else {
2980                                                break _loop258;
2981                                        }
2982                                        
2983                                } while (true);
2984                                }
2985                                
2986                                userGroup.add( distinguishedName );
2987                                
2988                        }
2989                        else {
2990                                break _loop259;
2991                        }
2992                        
2993                } while (true);
2994                }
2995                match(CLOSE_CURLY);
2996                
2997                userClassesMap.put( "userGroup", new UserClass.UserGroup( userGroup ) );
2998                
2999        }
3000        
3001        public final void subtree() throws RecognitionException, TokenStreamException {
3002                
3003                
3004                log.debug( "entered subtree()" );
3005                Set<SubtreeSpecification> subtrees = new HashSet<SubtreeSpecification>();
3006                SubtreeSpecification subtreeSpecification = null;    
3007                
3008                
3009                match(ID_subtree);
3010                {
3011                int _cnt262=0;
3012                _loop262:
3013                do {
3014                        if ((LA(1)==SP)) {
3015                                match(SP);
3016                        }
3017                        else {
3018                                if ( _cnt262>=1 ) { break _loop262; } else {throw new NoViableAltException(LT(1), getFilename());}
3019                        }
3020                        
3021                        _cnt262++;
3022                } while (true);
3023                }
3024                match(OPEN_CURLY);
3025                {
3026                _loop264:
3027                do {
3028                        if ((LA(1)==SP)) {
3029                                match(SP);
3030                        }
3031                        else {
3032                                break _loop264;
3033                        }
3034                        
3035                } while (true);
3036                }
3037                subtreeSpecification=subtreeSpecification();
3038                {
3039                _loop266:
3040                do {
3041                        if ((LA(1)==SP)) {
3042                                match(SP);
3043                        }
3044                        else {
3045                                break _loop266;
3046                        }
3047                        
3048                } while (true);
3049                }
3050                
3051                subtrees.add( subtreeSpecification );
3052                
3053                {
3054                _loop272:
3055                do {
3056                        if ((LA(1)==SEP)) {
3057                                match(SEP);
3058                                {
3059                                _loop269:
3060                                do {
3061                                        if ((LA(1)==SP)) {
3062                                                match(SP);
3063                                        }
3064                                        else {
3065                                                break _loop269;
3066                                        }
3067                                        
3068                                } while (true);
3069                                }
3070                                subtreeSpecification=subtreeSpecification();
3071                                {
3072                                _loop271:
3073                                do {
3074                                        if ((LA(1)==SP)) {
3075                                                match(SP);
3076                                        }
3077                                        else {
3078                                                break _loop271;
3079                                        }
3080                                        
3081                                } while (true);
3082                                }
3083                                
3084                                subtrees.add( subtreeSpecification );
3085                                
3086                        }
3087                        else {
3088                                break _loop272;
3089                        }
3090                        
3091                } while (true);
3092                }
3093                match(CLOSE_CURLY);
3094                
3095                userClassesMap.put( "subtree", new UserClass.Subtree( subtrees ) );
3096                
3097        }
3098        
3099        public final  Dn  distinguishedName() throws RecognitionException, TokenStreamException {
3100                 Dn name ;
3101                
3102                Token  token = null;
3103                
3104                log.debug( "entered distinguishedName()" );
3105                name = null;
3106                
3107                
3108                try {      // for error handling
3109                        token = LT(1);
3110                        match(SAFEUTF8STRING);
3111                        
3112                        name = new Dn( token.getText() );
3113                        if ( schemaManager != null )
3114                        {
3115                        name.apply( schemaManager );
3116                        }
3117                        log.debug( "recognized a DistinguishedName: " + token.getText() );
3118                        
3119                }
3120                catch (Exception e) {
3121                        
3122                        throw new RecognitionException( "dnParser failed for " + token.getText() + " " + e.getMessage() );
3123                        
3124                }
3125                return name ;
3126        }
3127        
3128        public final SubtreeSpecification  subtreeSpecification() throws RecognitionException, TokenStreamException {
3129                SubtreeSpecification ss;
3130                
3131                
3132                log.debug( "entered subtreeSpecification()" );
3133                // clear out ss, ssModifier, chopBeforeExclusions and chopAfterExclusions
3134                // in case something is left from the last parse
3135                ss = null;
3136                ssModifier = new SubtreeSpecificationModifier();
3137                chopBeforeExclusions = new HashSet<Dn>();
3138                chopAfterExclusions = new HashSet<Dn>();
3139                subtreeSpecificationComponentsMonitor = new OptionalComponentsMonitor( 
3140                new String [] { "base", "specificExclusions", "minimum", "maximum" } );
3141                
3142                
3143                match(OPEN_CURLY);
3144                {
3145                _loop301:
3146                do {
3147                        if ((LA(1)==SP)) {
3148                                match(SP);
3149                        }
3150                        else {
3151                                break _loop301;
3152                        }
3153                        
3154                } while (true);
3155                }
3156                {
3157                switch ( LA(1)) {
3158                case ID_base:
3159                case ID_specificExclusions:
3160                case ID_minimum:
3161                case ID_maximum:
3162                {
3163                        subtreeSpecificationComponent();
3164                        {
3165                        _loop304:
3166                        do {
3167                                if ((LA(1)==SP)) {
3168                                        match(SP);
3169                                }
3170                                else {
3171                                        break _loop304;
3172                                }
3173                                
3174                        } while (true);
3175                        }
3176                        {
3177                        _loop310:
3178                        do {
3179                                if ((LA(1)==SEP)) {
3180                                        match(SEP);
3181                                        {
3182                                        _loop307:
3183                                        do {
3184                                                if ((LA(1)==SP)) {
3185                                                        match(SP);
3186                                                }
3187                                                else {
3188                                                        break _loop307;
3189                                                }
3190                                                
3191                                        } while (true);
3192                                        }
3193                                        subtreeSpecificationComponent();
3194                                        {
3195                                        _loop309:
3196                                        do {
3197                                                if ((LA(1)==SP)) {
3198                                                        match(SP);
3199                                                }
3200                                                else {
3201                                                        break _loop309;
3202                                                }
3203                                                
3204                                        } while (true);
3205                                        }
3206                                }
3207                                else {
3208                                        break _loop310;
3209                                }
3210                                
3211                        } while (true);
3212                        }
3213                        break;
3214                }
3215                case CLOSE_CURLY:
3216                {
3217                        break;
3218                }
3219                default:
3220                {
3221                        throw new NoViableAltException(LT(1), getFilename());
3222                }
3223                }
3224                }
3225                match(CLOSE_CURLY);
3226                
3227                ss = ssModifier.getSubtreeSpecification();
3228                
3229                return ss;
3230        }
3231        
3232        public final  UserPermission  userPermission() throws RecognitionException, TokenStreamException {
3233                 UserPermission userPermission ;
3234                
3235                
3236                log.debug( "entered userPermission()" );
3237                userPermission = null;
3238                userPermissionComponentsMonitor = new MandatoryAndOptionalComponentsMonitor( 
3239                new String [] { "protectedItems", "grantsAndDenials" }, new String [] { "precedence" } );
3240                
3241                
3242                match(OPEN_CURLY);
3243                {
3244                _loop289:
3245                do {
3246                        if ((LA(1)==SP)) {
3247                                match(SP);
3248                        }
3249                        else {
3250                                break _loop289;
3251                        }
3252                        
3253                } while (true);
3254                }
3255                anyUserPermission();
3256                {
3257                _loop291:
3258                do {
3259                        if ((LA(1)==SP)) {
3260                                match(SP);
3261                        }
3262                        else {
3263                                break _loop291;
3264                        }
3265                        
3266                } while (true);
3267                }
3268                {
3269                _loop297:
3270                do {
3271                        if ((LA(1)==SEP)) {
3272                                match(SEP);
3273                                {
3274                                _loop294:
3275                                do {
3276                                        if ((LA(1)==SP)) {
3277                                                match(SP);
3278                                        }
3279                                        else {
3280                                                break _loop294;
3281                                        }
3282                                        
3283                                } while (true);
3284                                }
3285                                anyUserPermission();
3286                                {
3287                                _loop296:
3288                                do {
3289                                        if ((LA(1)==SP)) {
3290                                                match(SP);
3291                                        }
3292                                        else {
3293                                                break _loop296;
3294                                        }
3295                                        
3296                                } while (true);
3297                                }
3298                        }
3299                        else {
3300                                break _loop297;
3301                        }
3302                        
3303                } while (true);
3304                }
3305                match(CLOSE_CURLY);
3306                
3307                if ( !userPermissionComponentsMonitor.finalStateValid() )
3308                {
3309                throw new RecognitionException( "Missing mandatory userPermission components: " 
3310                + userPermissionComponentsMonitor.getRemainingComponents() );
3311                }
3312                
3313                userPermission = new UserPermission( precedence, grantsAndDenials, protectedItems );
3314                precedence = null;
3315                
3316                return userPermission ;
3317        }
3318        
3319        public final void anyUserPermission() throws RecognitionException, TokenStreamException {
3320                
3321                
3322                try {      // for error handling
3323                        switch ( LA(1)) {
3324                        case ID_precedence:
3325                        {
3326                                precedence();
3327                                
3328                                userPermissionComponentsMonitor.useComponent( "precedence" );
3329                                
3330                                break;
3331                        }
3332                        case ID_protectedItems:
3333                        {
3334                                protectedItems();
3335                                
3336                                userPermissionComponentsMonitor.useComponent( "protectedItems" );
3337                                
3338                                break;
3339                        }
3340                        case ID_grantsAndDenials:
3341                        {
3342                                grantsAndDenials();
3343                                
3344                                userPermissionComponentsMonitor.useComponent( "grantsAndDenials" );
3345                                
3346                                break;
3347                        }
3348                        default:
3349                        {
3350                                throw new NoViableAltException(LT(1), getFilename());
3351                        }
3352                        }
3353                }
3354                catch (IllegalArgumentException e) {
3355                        
3356                        throw new RecognitionException( e.getMessage() );
3357                        
3358                }
3359        }
3360        
3361        public final void subtreeSpecificationComponent() throws RecognitionException, TokenStreamException {
3362                
3363                
3364                log.debug( "entered subtreeSpecification()" );
3365                
3366                
3367                try {      // for error handling
3368                        switch ( LA(1)) {
3369                        case ID_base:
3370                        {
3371                                ss_base();
3372                                
3373                                subtreeSpecificationComponentsMonitor.useComponent( "base" );
3374                                
3375                                break;
3376                        }
3377                        case ID_specificExclusions:
3378                        {
3379                                ss_specificExclusions();
3380                                
3381                                subtreeSpecificationComponentsMonitor.useComponent( "specificExclusions" );
3382                                
3383                                break;
3384                        }
3385                        case ID_minimum:
3386                        {
3387                                ss_minimum();
3388                                
3389                                subtreeSpecificationComponentsMonitor.useComponent( "minimum" );
3390                                
3391                                break;
3392                        }
3393                        case ID_maximum:
3394                        {
3395                                ss_maximum();
3396                                
3397                                subtreeSpecificationComponentsMonitor.useComponent( "maximum" );
3398                                
3399                                break;
3400                        }
3401                        default:
3402                        {
3403                                throw new NoViableAltException(LT(1), getFilename());
3404                        }
3405                        }
3406                }
3407                catch (IllegalArgumentException e) {
3408                        
3409                        throw new RecognitionException( e.getMessage() );
3410                        
3411                }
3412        }
3413        
3414        public final void ss_base() throws RecognitionException, TokenStreamException {
3415                
3416                
3417                log.debug( "entered ss_base()" );
3418                Dn base = null;
3419                
3420                
3421                match(ID_base);
3422                {
3423                int _cnt314=0;
3424                _loop314:
3425                do {
3426                        if ((LA(1)==SP)) {
3427                                match(SP);
3428                        }
3429                        else {
3430                                if ( _cnt314>=1 ) { break _loop314; } else {throw new NoViableAltException(LT(1), getFilename());}
3431                        }
3432                        
3433                        _cnt314++;
3434                } while (true);
3435                }
3436                base=distinguishedName();
3437                
3438                ssModifier.setBase( base );
3439                
3440        }
3441        
3442        public final void ss_specificExclusions() throws RecognitionException, TokenStreamException {
3443                
3444                
3445                log.debug( "entered ss_specificExclusions()" );
3446                
3447                
3448                match(ID_specificExclusions);
3449                {
3450                int _cnt317=0;
3451                _loop317:
3452                do {
3453                        if ((LA(1)==SP)) {
3454                                match(SP);
3455                        }
3456                        else {
3457                                if ( _cnt317>=1 ) { break _loop317; } else {throw new NoViableAltException(LT(1), getFilename());}
3458                        }
3459                        
3460                        _cnt317++;
3461                } while (true);
3462                }
3463                specificExclusions();
3464                
3465                ssModifier.setChopBeforeExclusions( chopBeforeExclusions );
3466                ssModifier.setChopAfterExclusions( chopAfterExclusions );
3467                
3468        }
3469        
3470        public final void ss_minimum() throws RecognitionException, TokenStreamException {
3471                
3472                
3473                log.debug( "entered ss_minimum()" );
3474                int minimum = 0;
3475                
3476                
3477                match(ID_minimum);
3478                {
3479                int _cnt343=0;
3480                _loop343:
3481                do {
3482                        if ((LA(1)==SP)) {
3483                                match(SP);
3484                        }
3485                        else {
3486                                if ( _cnt343>=1 ) { break _loop343; } else {throw new NoViableAltException(LT(1), getFilename());}
3487                        }
3488                        
3489                        _cnt343++;
3490                } while (true);
3491                }
3492                minimum=baseDistance();
3493                
3494                ssModifier.setMinBaseDistance( minimum );
3495                
3496        }
3497        
3498        public final void ss_maximum() throws RecognitionException, TokenStreamException {
3499                
3500                
3501                log.debug( "entered ss_maximum()" );
3502                int maximum = 0;
3503                
3504                
3505                match(ID_maximum);
3506                {
3507                int _cnt346=0;
3508                _loop346:
3509                do {
3510                        if ((LA(1)==SP)) {
3511                                match(SP);
3512                        }
3513                        else {
3514                                if ( _cnt346>=1 ) { break _loop346; } else {throw new NoViableAltException(LT(1), getFilename());}
3515                        }
3516                        
3517                        _cnt346++;
3518                } while (true);
3519                }
3520                maximum=baseDistance();
3521                
3522                ssModifier.setMaxBaseDistance( maximum );
3523                
3524        }
3525        
3526        public final void specificExclusions() throws RecognitionException, TokenStreamException {
3527                
3528                
3529                log.debug( "entered specificExclusions()" );
3530                
3531                
3532                match(OPEN_CURLY);
3533                {
3534                _loop320:
3535                do {
3536                        if ((LA(1)==SP)) {
3537                                match(SP);
3538                        }
3539                        else {
3540                                break _loop320;
3541                        }
3542                        
3543                } while (true);
3544                }
3545                {
3546                switch ( LA(1)) {
3547                case ID_chopBefore:
3548                case ID_chopAfter:
3549                {
3550                        specificExclusion();
3551                        {
3552                        _loop323:
3553                        do {
3554                                if ((LA(1)==SP)) {
3555                                        match(SP);
3556                                }
3557                                else {
3558                                        break _loop323;
3559                                }
3560                                
3561                        } while (true);
3562                        }
3563                        {
3564                        _loop329:
3565                        do {
3566                                if ((LA(1)==SEP)) {
3567                                        match(SEP);
3568                                        {
3569                                        _loop326:
3570                                        do {
3571                                                if ((LA(1)==SP)) {
3572                                                        match(SP);
3573                                                }
3574                                                else {
3575                                                        break _loop326;
3576                                                }
3577                                                
3578                                        } while (true);
3579                                        }
3580                                        specificExclusion();
3581                                        {
3582                                        _loop328:
3583                                        do {
3584                                                if ((LA(1)==SP)) {
3585                                                        match(SP);
3586                                                }
3587                                                else {
3588                                                        break _loop328;
3589                                                }
3590                                                
3591                                        } while (true);
3592                                        }
3593                                }
3594                                else {
3595                                        break _loop329;
3596                                }
3597                                
3598                        } while (true);
3599                        }
3600                        break;
3601                }
3602                case CLOSE_CURLY:
3603                {
3604                        break;
3605                }
3606                default:
3607                {
3608                        throw new NoViableAltException(LT(1), getFilename());
3609                }
3610                }
3611                }
3612                match(CLOSE_CURLY);
3613        }
3614        
3615        public final void specificExclusion() throws RecognitionException, TokenStreamException {
3616                
3617                
3618                log.debug( "entered specificExclusion()" );
3619                
3620                
3621                switch ( LA(1)) {
3622                case ID_chopBefore:
3623                {
3624                        chopBefore();
3625                        break;
3626                }
3627                case ID_chopAfter:
3628                {
3629                        chopAfter();
3630                        break;
3631                }
3632                default:
3633                {
3634                        throw new NoViableAltException(LT(1), getFilename());
3635                }
3636                }
3637        }
3638        
3639        public final void chopBefore() throws RecognitionException, TokenStreamException {
3640                
3641                
3642                log.debug( "entered chopBefore()" );
3643                Dn chopBeforeExclusion = null;
3644                
3645                
3646                match(ID_chopBefore);
3647                {
3648                _loop333:
3649                do {
3650                        if ((LA(1)==SP)) {
3651                                match(SP);
3652                        }
3653                        else {
3654                                break _loop333;
3655                        }
3656                        
3657                } while (true);
3658                }
3659                match(COLON);
3660                {
3661                _loop335:
3662                do {
3663                        if ((LA(1)==SP)) {
3664                                match(SP);
3665                        }
3666                        else {
3667                                break _loop335;
3668                        }
3669                        
3670                } while (true);
3671                }
3672                chopBeforeExclusion=distinguishedName();
3673                
3674                chopBeforeExclusions.add( chopBeforeExclusion );
3675                
3676        }
3677        
3678        public final void chopAfter() throws RecognitionException, TokenStreamException {
3679                
3680                
3681                log.debug( "entered chopAfter()" );
3682                Dn chopAfterExclusion = null;
3683                
3684                
3685                match(ID_chopAfter);
3686                {
3687                _loop338:
3688                do {
3689                        if ((LA(1)==SP)) {
3690                                match(SP);
3691                        }
3692                        else {
3693                                break _loop338;
3694                        }
3695                        
3696                } while (true);
3697                }
3698                match(COLON);
3699                {
3700                _loop340:
3701                do {
3702                        if ((LA(1)==SP)) {
3703                                match(SP);
3704                        }
3705                        else {
3706                                break _loop340;
3707                        }
3708                        
3709                } while (true);
3710                }
3711                chopAfterExclusion=distinguishedName();
3712                
3713                chopAfterExclusions.add( chopAfterExclusion );
3714                
3715        }
3716        
3717        public final  int  baseDistance() throws RecognitionException, TokenStreamException {
3718                 int distance ;
3719                
3720                Token  token = null;
3721                
3722                log.debug( "entered baseDistance()" );
3723                distance = 0;
3724                
3725                
3726                token = LT(1);
3727                match(INTEGER);
3728                
3729                distance = token2Integer( token );
3730                
3731                return distance ;
3732        }
3733        
3734        public final  LeafNode  item() throws RecognitionException, TokenStreamException {
3735                 LeafNode node ;
3736                
3737                
3738                log.debug( "entered item()" );
3739                node = null;
3740                String oid = null;
3741                
3742                
3743                match(ID_item);
3744                {
3745                _loop354:
3746                do {
3747                        if ((LA(1)==SP)) {
3748                                match(SP);
3749                        }
3750                        else {
3751                                break _loop354;
3752                        }
3753                        
3754                } while (true);
3755                }
3756                match(COLON);
3757                {
3758                _loop356:
3759                do {
3760                        if ((LA(1)==SP)) {
3761                                match(SP);
3762                        }
3763                        else {
3764                                break _loop356;
3765                        }
3766                        
3767                } while (true);
3768                }
3769                oid=oid();
3770                
3771                node = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT , new StringValue( oid ) );
3772                
3773                return node ;
3774        }
3775        
3776        public final  BranchNode  and() throws RecognitionException, TokenStreamException {
3777                 BranchNode node ;
3778                
3779                
3780                log.debug( "entered and()" );
3781                node = null;
3782                List<ExprNode> children = null; 
3783                
3784                
3785                match(ID_and);
3786                {
3787                _loop359:
3788                do {
3789                        if ((LA(1)==SP)) {
3790                                match(SP);
3791                        }
3792                        else {
3793                                break _loop359;
3794                        }
3795                        
3796                } while (true);
3797                }
3798                match(COLON);
3799                {
3800                _loop361:
3801                do {
3802                        if ((LA(1)==SP)) {
3803                                match(SP);
3804                        }
3805                        else {
3806                                break _loop361;
3807                        }
3808                        
3809                } while (true);
3810                }
3811                children=refinements();
3812                
3813                node = new AndNode( children );
3814                
3815                return node ;
3816        }
3817        
3818        public final  BranchNode  or() throws RecognitionException, TokenStreamException {
3819                 BranchNode node ;
3820                
3821                
3822                log.debug( "entered or()" );
3823                node = null;
3824                List<ExprNode> children = null; 
3825                
3826                
3827                match(ID_or);
3828                {
3829                _loop364:
3830                do {
3831                        if ((LA(1)==SP)) {
3832                                match(SP);
3833                        }
3834                        else {
3835                                break _loop364;
3836                        }
3837                        
3838                } while (true);
3839                }
3840                match(COLON);
3841                {
3842                _loop366:
3843                do {
3844                        if ((LA(1)==SP)) {
3845                                match(SP);
3846                        }
3847                        else {
3848                                break _loop366;
3849                        }
3850                        
3851                } while (true);
3852                }
3853                children=refinements();
3854                
3855                node = new OrNode( children );
3856                
3857                return node ;
3858        }
3859        
3860        public final  BranchNode  not() throws RecognitionException, TokenStreamException {
3861                 BranchNode node ;
3862                
3863                
3864                log.debug( "entered not()" );
3865                node = null;
3866                List<ExprNode> children = null;
3867                
3868                
3869                match(ID_not);
3870                {
3871                _loop369:
3872                do {
3873                        if ((LA(1)==SP)) {
3874                                match(SP);
3875                        }
3876                        else {
3877                                break _loop369;
3878                        }
3879                        
3880                } while (true);
3881                }
3882                match(COLON);
3883                {
3884                _loop371:
3885                do {
3886                        if ((LA(1)==SP)) {
3887                                match(SP);
3888                        }
3889                        else {
3890                                break _loop371;
3891                        }
3892                        
3893                } while (true);
3894                }
3895                children=refinements();
3896                
3897                node = new NotNode( children );
3898                
3899                return node ;
3900        }
3901        
3902        public final  List<ExprNode>  refinements() throws RecognitionException, TokenStreamException {
3903                 List<ExprNode> children ;
3904                
3905                
3906                log.debug( "entered refinements()" );
3907                children = null;
3908                ExprNode child = null;
3909                List<ExprNode> tempChildren = new ArrayList<ExprNode>();
3910                
3911                
3912                match(OPEN_CURLY);
3913                {
3914                _loop374:
3915                do {
3916                        if ((LA(1)==SP)) {
3917                                match(SP);
3918                        }
3919                        else {
3920                                break _loop374;
3921                        }
3922                        
3923                } while (true);
3924                }
3925                {
3926                switch ( LA(1)) {
3927                case ID_item:
3928                case ID_and:
3929                case ID_or:
3930                case ID_not:
3931                {
3932                        child=refinement();
3933                        {
3934                        _loop377:
3935                        do {
3936                                if ((LA(1)==SP)) {
3937                                        match(SP);
3938                                }
3939                                else {
3940                                        break _loop377;
3941                                }
3942                                
3943                        } while (true);
3944                        }
3945                        
3946                        tempChildren.add( child );
3947                        
3948                        {
3949                        _loop383:
3950                        do {
3951                                if ((LA(1)==SEP)) {
3952                                        match(SEP);
3953                                        {
3954                                        _loop380:
3955                                        do {
3956                                                if ((LA(1)==SP)) {
3957                                                        match(SP);
3958                                                }
3959                                                else {
3960                                                        break _loop380;
3961                                                }
3962                                                
3963                                        } while (true);
3964                                        }
3965                                        child=refinement();
3966                                        {
3967                                        _loop382:
3968                                        do {
3969                                                if ((LA(1)==SP)) {
3970                                                        match(SP);
3971                                                }
3972                                                else {
3973                                                        break _loop382;
3974                                                }
3975                                                
3976                                        } while (true);
3977                                        }
3978                                        
3979                                        tempChildren.add( child );
3980                                        
3981                                }
3982                                else {
3983                                        break _loop383;
3984                                }
3985                                
3986                        } while (true);
3987                        }
3988                        break;
3989                }
3990                case CLOSE_CURLY:
3991                {
3992                        break;
3993                }
3994                default:
3995                {
3996                        throw new NoViableAltException(LT(1), getFilename());
3997                }
3998                }
3999                }
4000                match(CLOSE_CURLY);
4001                
4002                children = tempChildren;
4003                
4004                return children ;
4005        }
4006        
4007        
4008        public static final String[] _tokenNames = {
4009                "<0>",
4010                "EOF",
4011                "<2>",
4012                "NULL_TREE_LOOKAHEAD",
4013                "ATTRIBUTE_VALUE_CANDIDATE",
4014                "RANGE_OF_VALUES_CANDIDATE",
4015                "SP",
4016                "OPEN_CURLY",
4017                "SEP",
4018                "CLOSE_CURLY",
4019                "\"identificationTag\"",
4020                "SAFEUTF8STRING",
4021                "\"precedence\"",
4022                "INTEGER",
4023                "\"authenticationLevel\"",
4024                "\"none\"",
4025                "\"simple\"",
4026                "\"strong\"",
4027                "\"itemOrUserFirst\"",
4028                "\"itemFirst\"",
4029                "COLON",
4030                "\"userFirst\"",
4031                "\"protectedItems\"",
4032                "\"entry\"",
4033                "\"allUserAttributeTypes\"",
4034                "\"attributeType\"",
4035                "\"allAttributeValues\"",
4036                "\"allUserAttributeTypesAndValues\"",
4037                "\"selfValue\"",
4038                "\"maxValueCount\"",
4039                "\"type\"",
4040                "\"maxCount\"",
4041                "\"maxImmSub\"",
4042                "\"restrictedBy\"",
4043                "\"valuesIn\"",
4044                "\"classes\"",
4045                "\"itemPermissions\"",
4046                "\"grantsAndDenials\"",
4047                "\"grantAdd\"",
4048                "\"denyAdd\"",
4049                "\"grantDiscloseOnError\"",
4050                "\"denyDiscloseOnError\"",
4051                "\"grantRead\"",
4052                "\"denyRead\"",
4053                "\"grantRemove\"",
4054                "\"denyRemove\"",
4055                "\"grantBrowse\"",
4056                "\"denyBrowse\"",
4057                "\"grantExport\"",
4058                "\"denyExport\"",
4059                "\"grantImport\"",
4060                "\"denyImport\"",
4061                "\"grantModify\"",
4062                "\"denyModify\"",
4063                "\"grantRename\"",
4064                "\"denyRename\"",
4065                "\"grantReturnDN\"",
4066                "\"denyReturnDN\"",
4067                "\"grantCompare\"",
4068                "\"denyCompare\"",
4069                "\"grantFilterMatch\"",
4070                "\"denyFilterMatch\"",
4071                "\"grantInvoke\"",
4072                "\"denyInvoke\"",
4073                "\"userClasses\"",
4074                "\"allUsers\"",
4075                "\"thisEntry\"",
4076                "\"parentOfEntry\"",
4077                "\"name\"",
4078                "\"userGroup\"",
4079                "\"subtree\"",
4080                "\"userPermissions\"",
4081                "\"base\"",
4082                "\"specificExclusions\"",
4083                "\"chopBefore\"",
4084                "\"chopAfter\"",
4085                "\"minimum\"",
4086                "\"maximum\"",
4087                "DESCR",
4088                "NUMERICOID",
4089                "\"item\"",
4090                "\"and\"",
4091                "\"or\"",
4092                "\"not\"",
4093                "\"FALSE\"",
4094                "\"TRUE\"",
4095                "\"level\"",
4096                "\"basicLevels\"",
4097                "\"localQualifier\"",
4098                "\"signed\"",
4099                "\"rangeOfValues\"",
4100                "\"specificationFilter\"",
4101                "SAFEUTF8CHAR",
4102                "DIGIT",
4103                "LDIGIT",
4104                "ALPHA",
4105                "HYPHEN",
4106                "DOT",
4107                "INTEGER_OR_NUMERICOID",
4108                "FILTER",
4109                "FILTER_VALUE"
4110        };
4111        
4112        
4113        }