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