001// $ANTLR 2.7.7 (20060906): "subtree-specification.g" -> "AntlrSubtreeSpecificationParser.java"$
002
003/*
004 *  Licensed to the Apache Software Foundation (ASF) under one
005 *  or more contributor license agreements.  See the NOTICE file
006 *  distributed with this work for additional information
007 *  regarding copyright ownership.  The ASF licenses this file
008 *  to you under the Apache License, Version 2.0 (the
009 *  "License"); you may not use this file except in compliance
010 *  with the License.  You may obtain a copy of the License at
011 *  
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *  
014 *  Unless required by applicable law or agreed to in writing,
015 *  software distributed under the License is distributed on an
016 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 *  KIND, either express or implied.  See the License for the
018 *  specific language governing permissions and limitations
019 *  under the License. 
020 *  
021 */
022
023
024package org.apache.directory.shared.ldap.model.subtree;
025
026import java.util.Set;
027import java.util.Map;
028import java.util.HashSet;
029import java.util.List;
030import java.util.ArrayList;
031
032import org.apache.directory.shared.ldap.model.name.Dn;
033import org.apache.directory.shared.ldap.model.filter.ExprNode;
034import org.apache.directory.shared.ldap.model.filter.LeafNode;
035import org.apache.directory.shared.ldap.model.filter.BranchNode;
036import org.apache.directory.shared.ldap.model.filter.AndNode;
037import org.apache.directory.shared.ldap.model.filter.OrNode;
038import org.apache.directory.shared.ldap.model.filter.NotNode;
039import org.apache.directory.shared.ldap.model.filter.EqualityNode;
040import org.apache.directory.shared.ldap.model.filter.FilterParser;
041import org.apache.directory.shared.ldap.model.schema.ObjectClass;
042import org.apache.directory.shared.ldap.model.schema.SchemaManager;
043import org.apache.directory.shared.ldap.model.subtree.SubtreeSpecification;
044import org.apache.directory.shared.ldap.model.subtree.SubtreeSpecificationModifier;
045import org.apache.directory.shared.ldap.model.schema.NormalizerMappingResolver;
046import org.apache.directory.shared.ldap.model.schema.normalizers.OidNormalizer;
047import org.apache.directory.shared.util.ComponentsMonitor;
048import org.apache.directory.shared.util.OptionalComponentsMonitor;
049import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
050import org.apache.directory.shared.ldap.model.entry.StringValue;
051import org.apache.directory.shared.ldap.model.exception.LdapException;
052import org.apache.directory.shared.ldap.model.schema.AttributeType;
053
054import org.slf4j.Logger;
055import org.slf4j.LoggerFactory;
056
057import antlr.TokenBuffer;
058import antlr.TokenStreamException;
059import antlr.TokenStreamIOException;
060import antlr.ANTLRException;
061import antlr.LLkParser;
062import antlr.Token;
063import antlr.TokenStream;
064import antlr.RecognitionException;
065import antlr.NoViableAltException;
066import antlr.MismatchedTokenException;
067import antlr.SemanticException;
068import antlr.ParserSharedInputState;
069import antlr.collections.impl.BitSet;
070
071/**
072 * The antlr generated subtree specification parser.
073 *
074 * @see <a href="http://www.faqs.org/rfcs/rfc3672.html">RFC 3672</a>
075 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
076 */
077public class AntlrSubtreeSpecificationParser extends antlr.LLkParser       implements AntlrSubtreeSpecificationParserTokenTypes
078 {
079
080    private static final Logger log = LoggerFactory.getLogger( AntlrSubtreeSpecificationParser.class );
081    
082    private NormalizerMappingResolver resolver;
083    
084    private Set<Dn> chopBeforeExclusions = null;
085    private Set<Dn> chopAfterExclusions = null;
086
087    private SubtreeSpecificationModifier ssModifier = null;
088    
089    /** The schemaManager */
090    private SchemaManager schemaManager;
091    
092    /** The ObjectClass AT */
093    AttributeType OBJECT_CLASS_AT;
094    
095    private ComponentsMonitor subtreeSpecificationComponentsMonitor = null;
096    
097    
098
099    /**
100     * Does nothing.
101     */
102    public void init( SchemaManager schemaManager )
103    {
104        this.schemaManager = schemaManager;
105        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
106        
107    }
108    
109    
110    public void setNormalizerMappingResolver( NormalizerMappingResolver resolver )
111    {
112        this.resolver = resolver;
113    }
114    
115    
116    public boolean isNormalizing()
117    {
118        return this.resolver != null;
119    }
120    
121
122    private int token2Integer( Token token ) throws RecognitionException
123    {
124        int i = 0;
125        
126        try
127        {
128            i = Integer.parseInt( token.getText());
129        }
130        catch ( NumberFormatException e )
131        {
132            throw new RecognitionException( "Value of INTEGER token " +
133                                            token.getText() +
134                                            " cannot be converted to an Integer" );
135        }
136        
137        return i;
138    }
139
140protected AntlrSubtreeSpecificationParser(TokenBuffer tokenBuf, int k) {
141  super(tokenBuf,k);
142  tokenNames = _tokenNames;
143}
144
145public AntlrSubtreeSpecificationParser(TokenBuffer tokenBuf) {
146  this(tokenBuf,1);
147}
148
149protected AntlrSubtreeSpecificationParser(TokenStream lexer, int k) {
150  super(lexer,k);
151  tokenNames = _tokenNames;
152}
153
154public AntlrSubtreeSpecificationParser(TokenStream lexer) {
155  this(lexer,1);
156}
157
158public AntlrSubtreeSpecificationParser(ParserSharedInputState state) {
159  super(state,1);
160  tokenNames = _tokenNames;
161}
162
163        public final SubtreeSpecification  wrapperEntryPoint() throws RecognitionException, TokenStreamException {
164                SubtreeSpecification ss;
165                
166                
167                log.debug( "entered wrapperEntryPoint()" );
168                ss = null;
169                SubtreeSpecification tempSs = null;
170                
171                
172                tempSs=subtreeSpecification();
173                match(LITERAL_end);
174                
175                ss = tempSs;
176                
177                return ss;
178        }
179        
180        public final SubtreeSpecification  subtreeSpecification() throws RecognitionException, TokenStreamException {
181                SubtreeSpecification ss;
182                
183                
184                log.debug( "entered subtreeSpecification()" );
185                // clear out ss, ssModifier, subtreeSpecificationComponentsMonitor,
186                // chopBeforeExclusions and chopAfterExclusions
187                // in case something is left from the last parse
188                ss = null;
189                ssModifier = new SubtreeSpecificationModifier();
190                subtreeSpecificationComponentsMonitor = new OptionalComponentsMonitor( 
191                new String [] { "base", "specificExclusions", "minimum", "maximum", "specificationFilter" } );
192                chopBeforeExclusions = new HashSet<Dn>();
193                chopAfterExclusions = new HashSet<Dn>();
194                // always create a new filter parser in case we may have some statefulness problems with it
195                
196                
197                match(OPEN_CURLY);
198                {
199                _loop4:
200                do {
201                        if ((LA(1)==SP)) {
202                                match(SP);
203                        }
204                        else {
205                                break _loop4;
206                        }
207                        
208                } while (true);
209                }
210                {
211                switch ( LA(1)) {
212                case ID_base:
213                case ID_specificExclusions:
214                case ID_minimum:
215                case ID_maximum:
216                case ID_specificationFilter:
217                {
218                        subtreeSpecificationComponent();
219                        {
220                        _loop7:
221                        do {
222                                if ((LA(1)==SP)) {
223                                        match(SP);
224                                }
225                                else {
226                                        break _loop7;
227                                }
228                                
229                        } while (true);
230                        }
231                        {
232                        _loop13:
233                        do {
234                                if ((LA(1)==SEP)) {
235                                        match(SEP);
236                                        {
237                                        _loop10:
238                                        do {
239                                                if ((LA(1)==SP)) {
240                                                        match(SP);
241                                                }
242                                                else {
243                                                        break _loop10;
244                                                }
245                                                
246                                        } while (true);
247                                        }
248                                        subtreeSpecificationComponent();
249                                        {
250                                        _loop12:
251                                        do {
252                                                if ((LA(1)==SP)) {
253                                                        match(SP);
254                                                }
255                                                else {
256                                                        break _loop12;
257                                                }
258                                                
259                                        } while (true);
260                                        }
261                                }
262                                else {
263                                        break _loop13;
264                                }
265                                
266                        } while (true);
267                        }
268                        break;
269                }
270                case CLOSE_CURLY:
271                {
272                        break;
273                }
274                default:
275                {
276                        throw new NoViableAltException(LT(1), getFilename());
277                }
278                }
279                }
280                match(CLOSE_CURLY);
281                
282                ss = ssModifier.getSubtreeSpecification();
283                
284                return ss;
285        }
286        
287        public final void subtreeSpecificationComponent() throws RecognitionException, TokenStreamException {
288                
289                
290                log.debug( "entered subtreeSpecification()" );
291                
292                
293                try {      // for error handling
294                        switch ( LA(1)) {
295                        case ID_base:
296                        {
297                                ss_base();
298                                
299                                subtreeSpecificationComponentsMonitor.useComponent( "base" );
300                                
301                                break;
302                        }
303                        case ID_specificExclusions:
304                        {
305                                ss_specificExclusions();
306                                
307                                subtreeSpecificationComponentsMonitor.useComponent( "specificExclusions" );
308                                
309                                break;
310                        }
311                        case ID_minimum:
312                        {
313                                ss_minimum();
314                                
315                                subtreeSpecificationComponentsMonitor.useComponent( "minimum" );
316                                
317                                break;
318                        }
319                        case ID_maximum:
320                        {
321                                ss_maximum();
322                                
323                                subtreeSpecificationComponentsMonitor.useComponent( "maximum" );
324                                
325                                break;
326                        }
327                        case ID_specificationFilter:
328                        {
329                                ss_specificationFilter();
330                                
331                                subtreeSpecificationComponentsMonitor.useComponent( "specificationFilter" );
332                                
333                                break;
334                        }
335                        default:
336                        {
337                                throw new NoViableAltException(LT(1), getFilename());
338                        }
339                        }
340                }
341                catch (IllegalArgumentException e) {
342                        
343                        throw new RecognitionException( e.getMessage() );
344                        
345                }
346        }
347        
348        public final void ss_base() throws RecognitionException, TokenStreamException {
349                
350                
351                log.debug( "entered ss_base()" );
352                Dn base = null;
353                
354                
355                match(ID_base);
356                {
357                int _cnt17=0;
358                _loop17:
359                do {
360                        if ((LA(1)==SP)) {
361                                match(SP);
362                        }
363                        else {
364                                if ( _cnt17>=1 ) { break _loop17; } else {throw new NoViableAltException(LT(1), getFilename());}
365                        }
366                        
367                        _cnt17++;
368                } while (true);
369                }
370                base=distinguishedName();
371                
372                ssModifier.setBase( base );
373                
374        }
375        
376        public final void ss_specificExclusions() throws RecognitionException, TokenStreamException {
377                
378                
379                log.debug( "entered ss_specificExclusions()" );
380                
381                
382                match(ID_specificExclusions);
383                {
384                int _cnt20=0;
385                _loop20:
386                do {
387                        if ((LA(1)==SP)) {
388                                match(SP);
389                        }
390                        else {
391                                if ( _cnt20>=1 ) { break _loop20; } else {throw new NoViableAltException(LT(1), getFilename());}
392                        }
393                        
394                        _cnt20++;
395                } while (true);
396                }
397                specificExclusions();
398                
399                ssModifier.setChopBeforeExclusions( chopBeforeExclusions );
400                ssModifier.setChopAfterExclusions( chopAfterExclusions );
401                
402        }
403        
404        public final void ss_minimum() throws RecognitionException, TokenStreamException {
405                
406                
407                log.debug( "entered ss_minimum()" );
408                int minimum = 0;
409                
410                
411                match(ID_minimum);
412                {
413                int _cnt46=0;
414                _loop46:
415                do {
416                        if ((LA(1)==SP)) {
417                                match(SP);
418                        }
419                        else {
420                                if ( _cnt46>=1 ) { break _loop46; } else {throw new NoViableAltException(LT(1), getFilename());}
421                        }
422                        
423                        _cnt46++;
424                } while (true);
425                }
426                minimum=baseDistance();
427                
428                ssModifier.setMinBaseDistance( minimum );
429                
430        }
431        
432        public final void ss_maximum() throws RecognitionException, TokenStreamException {
433                
434                
435                log.debug( "entered ss_maximum()" );
436                int maximum = 0;
437                
438                
439                match(ID_maximum);
440                {
441                int _cnt49=0;
442                _loop49:
443                do {
444                        if ((LA(1)==SP)) {
445                                match(SP);
446                        }
447                        else {
448                                if ( _cnt49>=1 ) { break _loop49; } else {throw new NoViableAltException(LT(1), getFilename());}
449                        }
450                        
451                        _cnt49++;
452                } while (true);
453                }
454                maximum=baseDistance();
455                
456                ssModifier.setMaxBaseDistance( maximum );
457                
458        }
459        
460        public final void ss_specificationFilter() throws RecognitionException, TokenStreamException {
461                
462                
463                log.debug( "entered ss_specificationFilter()" );
464                ExprNode filterExpr = null;
465                
466                
467                match(ID_specificationFilter);
468                {
469                int _cnt52=0;
470                _loop52:
471                do {
472                        if ((LA(1)==SP)) {
473                                match(SP);
474                        }
475                        else {
476                                if ( _cnt52>=1 ) { break _loop52; } else {throw new NoViableAltException(LT(1), getFilename());}
477                        }
478                        
479                        _cnt52++;
480                } while (true);
481                }
482                {
483                switch ( LA(1)) {
484                case ID_item:
485                case ID_and:
486                case ID_or:
487                case ID_not:
488                {
489                        {
490                        filterExpr=refinement();
491                        }
492                        break;
493                }
494                case FILTER:
495                {
496                        {
497                        filterExpr=filter();
498                        }
499                        break;
500                }
501                default:
502                {
503                        throw new NoViableAltException(LT(1), getFilename());
504                }
505                }
506                }
507                ssModifier.setRefinement( filterExpr );
508        }
509        
510        public final  Dn  distinguishedName() throws RecognitionException, TokenStreamException {
511                 Dn name ;
512                
513                Token  token = null;
514                
515                log.debug( "entered distinguishedName()" );
516                name = null;
517                
518                
519                try {      // for error handling
520                        token = LT(1);
521                        match(SAFEUTF8STRING);
522                        
523                        name = new Dn( token.getText() );
524                        name.apply( schemaManager );
525                        
526                        log.debug( "recognized a DistinguishedName: " + token.getText() );
527                        
528                }
529                catch (Exception e) {
530                        
531                        throw new RecognitionException( "dnParser failed for " + token.getText() + " " + e.getMessage() );
532                        
533                }
534                return name ;
535        }
536        
537        public final void specificExclusions() throws RecognitionException, TokenStreamException {
538                
539                
540                log.debug( "entered specificExclusions()" );
541                
542                
543                match(OPEN_CURLY);
544                {
545                _loop23:
546                do {
547                        if ((LA(1)==SP)) {
548                                match(SP);
549                        }
550                        else {
551                                break _loop23;
552                        }
553                        
554                } while (true);
555                }
556                {
557                switch ( LA(1)) {
558                case ID_chopBefore:
559                case ID_chopAfter:
560                {
561                        specificExclusion();
562                        {
563                        _loop26:
564                        do {
565                                if ((LA(1)==SP)) {
566                                        match(SP);
567                                }
568                                else {
569                                        break _loop26;
570                                }
571                                
572                        } while (true);
573                        }
574                        {
575                        _loop32:
576                        do {
577                                if ((LA(1)==SEP)) {
578                                        match(SEP);
579                                        {
580                                        _loop29:
581                                        do {
582                                                if ((LA(1)==SP)) {
583                                                        match(SP);
584                                                }
585                                                else {
586                                                        break _loop29;
587                                                }
588                                                
589                                        } while (true);
590                                        }
591                                        specificExclusion();
592                                        {
593                                        _loop31:
594                                        do {
595                                                if ((LA(1)==SP)) {
596                                                        match(SP);
597                                                }
598                                                else {
599                                                        break _loop31;
600                                                }
601                                                
602                                        } while (true);
603                                        }
604                                }
605                                else {
606                                        break _loop32;
607                                }
608                                
609                        } while (true);
610                        }
611                        break;
612                }
613                case CLOSE_CURLY:
614                {
615                        break;
616                }
617                default:
618                {
619                        throw new NoViableAltException(LT(1), getFilename());
620                }
621                }
622                }
623                match(CLOSE_CURLY);
624        }
625        
626        public final void specificExclusion() throws RecognitionException, TokenStreamException {
627                
628                
629                log.debug( "entered specificExclusion()" );
630                
631                
632                switch ( LA(1)) {
633                case ID_chopBefore:
634                {
635                        chopBefore();
636                        break;
637                }
638                case ID_chopAfter:
639                {
640                        chopAfter();
641                        break;
642                }
643                default:
644                {
645                        throw new NoViableAltException(LT(1), getFilename());
646                }
647                }
648        }
649        
650        public final void chopBefore() throws RecognitionException, TokenStreamException {
651                
652                
653                log.debug( "entered chopBefore()" );
654                Dn chopBeforeExclusion = null;
655                
656                
657                match(ID_chopBefore);
658                {
659                _loop36:
660                do {
661                        if ((LA(1)==SP)) {
662                                match(SP);
663                        }
664                        else {
665                                break _loop36;
666                        }
667                        
668                } while (true);
669                }
670                match(COLON);
671                {
672                _loop38:
673                do {
674                        if ((LA(1)==SP)) {
675                                match(SP);
676                        }
677                        else {
678                                break _loop38;
679                        }
680                        
681                } while (true);
682                }
683                chopBeforeExclusion=distinguishedName();
684                
685                chopBeforeExclusions.add( chopBeforeExclusion );
686                
687        }
688        
689        public final void chopAfter() throws RecognitionException, TokenStreamException {
690                
691                
692                log.debug( "entered chopAfter()" );
693                Dn chopAfterExclusion = null;
694                
695                
696                match(ID_chopAfter);
697                {
698                _loop41:
699                do {
700                        if ((LA(1)==SP)) {
701                                match(SP);
702                        }
703                        else {
704                                break _loop41;
705                        }
706                        
707                } while (true);
708                }
709                match(COLON);
710                {
711                _loop43:
712                do {
713                        if ((LA(1)==SP)) {
714                                match(SP);
715                        }
716                        else {
717                                break _loop43;
718                        }
719                        
720                } while (true);
721                }
722                chopAfterExclusion=distinguishedName();
723                
724                chopAfterExclusions.add( chopAfterExclusion );
725                
726        }
727        
728        public final  int  baseDistance() throws RecognitionException, TokenStreamException {
729                 int distance ;
730                
731                Token  token = null;
732                
733                log.debug( "entered baseDistance()" );
734                distance = 0;
735                
736                
737                token = LT(1);
738                match(INTEGER);
739                
740                distance = token2Integer( token );
741                
742                return distance ;
743        }
744        
745        public final  ExprNode  refinement() throws RecognitionException, TokenStreamException {
746                 ExprNode node ;
747                
748                
749                log.debug( "entered refinement()" );
750                node = null;
751                
752                
753                switch ( LA(1)) {
754                case ID_item:
755                {
756                        node=item();
757                        break;
758                }
759                case ID_and:
760                {
761                        node=and();
762                        break;
763                }
764                case ID_or:
765                {
766                        node=or();
767                        break;
768                }
769                case ID_not:
770                {
771                        node=not();
772                        break;
773                }
774                default:
775                {
776                        throw new NoViableAltException(LT(1), getFilename());
777                }
778                }
779                return node ;
780        }
781        
782        public final ExprNode  filter() throws RecognitionException, TokenStreamException {
783                 ExprNode filterExpr = null ;
784                
785                Token  filterToken = null;
786                
787                log.debug( "entered filter()" );
788                
789                
790                try {      // for error handling
791                        {
792                        filterToken = LT(1);
793                        match(FILTER);
794                        filterExpr=FilterParser.parse( schemaManager, filterToken.getText() );
795                        }
796                }
797                catch (Exception e) {
798                        
799                        throw new RecognitionException( "filterParser failed. " + e.getMessage() );
800                        
801                }
802                return filterExpr;
803        }
804        
805        public final  String  oid() throws RecognitionException, TokenStreamException {
806                 String result ;
807                
808                
809                log.debug( "entered oid()" );
810                result = null;
811                Token token = null;
812                
813                
814                token = LT( 1 );
815                {
816                switch ( LA(1)) {
817                case DESCR:
818                {
819                        match(DESCR);
820                        break;
821                }
822                case NUMERICOID:
823                {
824                        match(NUMERICOID);
825                        break;
826                }
827                default:
828                {
829                        throw new NoViableAltException(LT(1), getFilename());
830                }
831                }
832                }
833                
834                result = token.getText();
835                log.debug( "recognized an oid: " + result );
836                
837                return result ;
838        }
839        
840        public final  LeafNode  item() throws RecognitionException, TokenStreamException {
841                 LeafNode node ;
842                
843                
844                log.debug( "entered item()" );
845                node = null;
846                String oid = null;
847                ObjectClass objectClass;
848                
849                
850                match(ID_item);
851                {
852                _loop65:
853                do {
854                        if ((LA(1)==SP)) {
855                                match(SP);
856                        }
857                        else {
858                                break _loop65;
859                        }
860                        
861                } while (true);
862                }
863                match(COLON);
864                {
865                _loop67:
866                do {
867                        if ((LA(1)==SP)) {
868                                match(SP);
869                        }
870                        else {
871                                break _loop67;
872                        }
873                        
874                } while (true);
875                }
876                oid=oid();
877                
878                try
879                {
880                objectClass = schemaManager.lookupObjectClassRegistry( oid );
881                }
882                catch ( LdapException le )
883                {
884                // The oid does not exist
885                // TODO : deal with such an exception
886                }
887                
888                node = new EqualityNode( OBJECT_CLASS_AT, new StringValue( oid ) );
889                
890                return node ;
891        }
892        
893        public final  BranchNode  and() throws RecognitionException, TokenStreamException {
894                 BranchNode node ;
895                
896                
897                log.debug( "entered and()" );
898                node = null;
899                List<ExprNode> children = null; 
900                
901                
902                match(ID_and);
903                {
904                _loop70:
905                do {
906                        if ((LA(1)==SP)) {
907                                match(SP);
908                        }
909                        else {
910                                break _loop70;
911                        }
912                        
913                } while (true);
914                }
915                match(COLON);
916                {
917                _loop72:
918                do {
919                        if ((LA(1)==SP)) {
920                                match(SP);
921                        }
922                        else {
923                                break _loop72;
924                        }
925                        
926                } while (true);
927                }
928                children=refinements();
929                
930                node = new AndNode( children );
931                
932                return node ;
933        }
934        
935        public final  BranchNode  or() throws RecognitionException, TokenStreamException {
936                 BranchNode node ;
937                
938                
939                log.debug( "entered or()" );
940                node = null;
941                List<ExprNode> children = null; 
942                
943                
944                match(ID_or);
945                {
946                _loop75:
947                do {
948                        if ((LA(1)==SP)) {
949                                match(SP);
950                        }
951                        else {
952                                break _loop75;
953                        }
954                        
955                } while (true);
956                }
957                match(COLON);
958                {
959                _loop77:
960                do {
961                        if ((LA(1)==SP)) {
962                                match(SP);
963                        }
964                        else {
965                                break _loop77;
966                        }
967                        
968                } while (true);
969                }
970                children=refinements();
971                
972                node = new OrNode( children );
973                
974                return node ;
975        }
976        
977        public final  BranchNode  not() throws RecognitionException, TokenStreamException {
978                 BranchNode node ;
979                
980                
981                log.debug( "entered not()" );
982                node = null;
983                ExprNode child = null;
984                
985                
986                match(ID_not);
987                {
988                _loop80:
989                do {
990                        if ((LA(1)==SP)) {
991                                match(SP);
992                        }
993                        else {
994                                break _loop80;
995                        }
996                        
997                } while (true);
998                }
999                match(COLON);
1000                {
1001                _loop82:
1002                do {
1003                        if ((LA(1)==SP)) {
1004                                match(SP);
1005                        }
1006                        else {
1007                                break _loop82;
1008                        }
1009                        
1010                } while (true);
1011                }
1012                child=refinement();
1013                
1014                node = new NotNode( child );
1015                
1016                return node ;
1017        }
1018        
1019        public final  List<ExprNode>  refinements() throws RecognitionException, TokenStreamException {
1020                 List<ExprNode> children ;
1021                
1022                
1023                log.debug( "entered refinements()" );
1024                children = null;
1025                ExprNode child = null;
1026                List<ExprNode> tempChildren = new ArrayList<ExprNode>();
1027                
1028                
1029                match(OPEN_CURLY);
1030                {
1031                _loop85:
1032                do {
1033                        if ((LA(1)==SP)) {
1034                                match(SP);
1035                        }
1036                        else {
1037                                break _loop85;
1038                        }
1039                        
1040                } while (true);
1041                }
1042                {
1043                switch ( LA(1)) {
1044                case ID_item:
1045                case ID_and:
1046                case ID_or:
1047                case ID_not:
1048                {
1049                        child=refinement();
1050                        {
1051                        _loop88:
1052                        do {
1053                                if ((LA(1)==SP)) {
1054                                        match(SP);
1055                                }
1056                                else {
1057                                        break _loop88;
1058                                }
1059                                
1060                        } while (true);
1061                        }
1062                        
1063                        tempChildren.add( child );
1064                        
1065                        {
1066                        _loop94:
1067                        do {
1068                                if ((LA(1)==SEP)) {
1069                                        match(SEP);
1070                                        {
1071                                        _loop91:
1072                                        do {
1073                                                if ((LA(1)==SP)) {
1074                                                        match(SP);
1075                                                }
1076                                                else {
1077                                                        break _loop91;
1078                                                }
1079                                                
1080                                        } while (true);
1081                                        }
1082                                        child=refinement();
1083                                        {
1084                                        _loop93:
1085                                        do {
1086                                                if ((LA(1)==SP)) {
1087                                                        match(SP);
1088                                                }
1089                                                else {
1090                                                        break _loop93;
1091                                                }
1092                                                
1093                                        } while (true);
1094                                        }
1095                                        
1096                                        tempChildren.add( child );
1097                                        
1098                                }
1099                                else {
1100                                        break _loop94;
1101                                }
1102                                
1103                        } while (true);
1104                        }
1105                        break;
1106                }
1107                case CLOSE_CURLY:
1108                {
1109                        break;
1110                }
1111                default:
1112                {
1113                        throw new NoViableAltException(LT(1), getFilename());
1114                }
1115                }
1116                }
1117                match(CLOSE_CURLY);
1118                
1119                children = tempChildren;
1120                
1121                return children ;
1122        }
1123        
1124        
1125        public static final String[] _tokenNames = {
1126                "<0>",
1127                "EOF",
1128                "<2>",
1129                "NULL_TREE_LOOKAHEAD",
1130                "\"end\"",
1131                "OPEN_CURLY",
1132                "SP",
1133                "SEP",
1134                "CLOSE_CURLY",
1135                "\"base\"",
1136                "\"specificExclusions\"",
1137                "\"chopBefore\"",
1138                "COLON",
1139                "\"chopAfter\"",
1140                "\"minimum\"",
1141                "\"maximum\"",
1142                "\"specificationFilter\"",
1143                "FILTER",
1144                "SAFEUTF8STRING",
1145                "INTEGER",
1146                "DESCR",
1147                "NUMERICOID",
1148                "\"item\"",
1149                "\"and\"",
1150                "\"or\"",
1151                "\"not\"",
1152                "INTEGER_OR_NUMERICOID",
1153                "DOT",
1154                "DIGIT",
1155                "LDIGIT",
1156                "ALPHA",
1157                "SAFEUTF8CHAR",
1158                "FILTER_VALUE"
1159        };
1160        
1161        
1162        }