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