001 // $ANTLR 2.7.4: "schema.g" -> "antlrSchemaParser.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 * Keep the semicolon right next to the package name or else there will be a
024 * bug that comes into the foreground in the new antlr release.
025 */
026 package org.apache.directory.shared.converter.schema;
027 import java.util.List ;
028 import java.util.ArrayList ;
029 import java.util.Collections;
030 import java.io.IOException;
031
032 import org.apache.directory.shared.ldap.schema.UsageEnum;
033 import org.apache.directory.shared.converter.schema.SchemaElement;
034 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
035
036 import antlr.TokenBuffer;
037 import antlr.TokenStreamException;
038 import antlr.TokenStreamIOException;
039 import antlr.ANTLRException;
040 import antlr.LLkParser;
041 import antlr.Token;
042 import antlr.TokenStream;
043 import antlr.RecognitionException;
044 import antlr.NoViableAltException;
045 import antlr.MismatchedTokenException;
046 import antlr.SemanticException;
047 import antlr.ParserSharedInputState;
048 import antlr.collections.impl.BitSet;
049
050 public class antlrSchemaParser extends antlr.LLkParser implements antlrSchemaTokenTypes
051 {
052
053 private List<SchemaElement> schemaElements = new ArrayList<SchemaElement>();
054
055 // ------------------------------------------------------------------------
056 // Public Methods
057 // ------------------------------------------------------------------------
058 public void clear()
059 {
060 schemaElements.clear();
061 }
062
063
064 public List<SchemaElement> getSchemaElements()
065 {
066 return Collections.unmodifiableList( schemaElements );
067 }
068
069 protected antlrSchemaParser(TokenBuffer tokenBuf, int k) {
070 super(tokenBuf,k);
071 tokenNames = _tokenNames;
072 }
073
074 public antlrSchemaParser(TokenBuffer tokenBuf) {
075 this(tokenBuf,5);
076 }
077
078 protected antlrSchemaParser(TokenStream lexer, int k) {
079 super(lexer,k);
080 tokenNames = _tokenNames;
081 }
082
083 public antlrSchemaParser(TokenStream lexer) {
084 this(lexer,5);
085 }
086
087 public antlrSchemaParser(ParserSharedInputState state) {
088 super(state,5);
089 tokenNames = _tokenNames;
090 }
091
092 public final void parseSchema() throws RecognitionException, TokenStreamException {
093
094
095 {
096 _loop2007:
097 do {
098 switch ( LA(1)) {
099 case LITERAL_attributetype:
100 {
101 attributeType();
102 break;
103 }
104 case LITERAL_objectclass:
105 {
106 objectClass();
107 break;
108 }
109 default:
110 {
111 break _loop2007;
112 }
113 }
114 } while (true);
115 }
116 match(LITERAL_END);
117 }
118
119 public final void attributeType() throws RecognitionException, TokenStreamException {
120
121 Token oid = null;
122
123 AttributeTypeHolder type = null;
124
125
126 match(LITERAL_attributetype);
127 match(OPEN_PAREN);
128 oid = LT(1);
129 match(NUMERICOID);
130
131 type = new AttributeTypeHolder( oid.getText() );
132
133 {
134 switch ( LA(1)) {
135 case LITERAL_NAME:
136 {
137 names(type);
138 break;
139 }
140 case CLOSE_PAREN:
141 case DESC:
142 case SYNTAX:
143 case LITERAL_OBSOLETE:
144 case LITERAL_SUP:
145 case 28:
146 case LITERAL_COLLECTIVE:
147 case 30:
148 case LITERAL_EQUALITY:
149 case LITERAL_SUBSTR:
150 case LITERAL_ORDERING:
151 case LITERAL_USAGE:
152 {
153 break;
154 }
155 default:
156 {
157 throw new NoViableAltException(LT(1), getFilename());
158 }
159 }
160 }
161 {
162 switch ( LA(1)) {
163 case DESC:
164 {
165 desc(type);
166 break;
167 }
168 case CLOSE_PAREN:
169 case SYNTAX:
170 case LITERAL_OBSOLETE:
171 case LITERAL_SUP:
172 case 28:
173 case LITERAL_COLLECTIVE:
174 case 30:
175 case LITERAL_EQUALITY:
176 case LITERAL_SUBSTR:
177 case LITERAL_ORDERING:
178 case LITERAL_USAGE:
179 {
180 break;
181 }
182 default:
183 {
184 throw new NoViableAltException(LT(1), getFilename());
185 }
186 }
187 }
188 {
189 switch ( LA(1)) {
190 case LITERAL_OBSOLETE:
191 {
192 match(LITERAL_OBSOLETE);
193 type.setObsolete( true );
194 break;
195 }
196 case CLOSE_PAREN:
197 case SYNTAX:
198 case LITERAL_SUP:
199 case 28:
200 case LITERAL_COLLECTIVE:
201 case 30:
202 case LITERAL_EQUALITY:
203 case LITERAL_SUBSTR:
204 case LITERAL_ORDERING:
205 case LITERAL_USAGE:
206 {
207 break;
208 }
209 default:
210 {
211 throw new NoViableAltException(LT(1), getFilename());
212 }
213 }
214 }
215 {
216 switch ( LA(1)) {
217 case LITERAL_SUP:
218 {
219 superior(type);
220 break;
221 }
222 case CLOSE_PAREN:
223 case SYNTAX:
224 case 28:
225 case LITERAL_COLLECTIVE:
226 case 30:
227 case LITERAL_EQUALITY:
228 case LITERAL_SUBSTR:
229 case LITERAL_ORDERING:
230 case LITERAL_USAGE:
231 {
232 break;
233 }
234 default:
235 {
236 throw new NoViableAltException(LT(1), getFilename());
237 }
238 }
239 }
240 {
241 switch ( LA(1)) {
242 case LITERAL_EQUALITY:
243 {
244 equality(type);
245 break;
246 }
247 case CLOSE_PAREN:
248 case SYNTAX:
249 case 28:
250 case LITERAL_COLLECTIVE:
251 case 30:
252 case LITERAL_SUBSTR:
253 case LITERAL_ORDERING:
254 case LITERAL_USAGE:
255 {
256 break;
257 }
258 default:
259 {
260 throw new NoViableAltException(LT(1), getFilename());
261 }
262 }
263 }
264 {
265 switch ( LA(1)) {
266 case LITERAL_ORDERING:
267 {
268 ordering(type);
269 break;
270 }
271 case CLOSE_PAREN:
272 case SYNTAX:
273 case 28:
274 case LITERAL_COLLECTIVE:
275 case 30:
276 case LITERAL_SUBSTR:
277 case LITERAL_USAGE:
278 {
279 break;
280 }
281 default:
282 {
283 throw new NoViableAltException(LT(1), getFilename());
284 }
285 }
286 }
287 {
288 switch ( LA(1)) {
289 case LITERAL_SUBSTR:
290 {
291 substr(type);
292 break;
293 }
294 case CLOSE_PAREN:
295 case SYNTAX:
296 case 28:
297 case LITERAL_COLLECTIVE:
298 case 30:
299 case LITERAL_USAGE:
300 {
301 break;
302 }
303 default:
304 {
305 throw new NoViableAltException(LT(1), getFilename());
306 }
307 }
308 }
309 {
310 switch ( LA(1)) {
311 case SYNTAX:
312 {
313 syntax(type);
314 break;
315 }
316 case CLOSE_PAREN:
317 case 28:
318 case LITERAL_COLLECTIVE:
319 case 30:
320 case LITERAL_USAGE:
321 {
322 break;
323 }
324 default:
325 {
326 throw new NoViableAltException(LT(1), getFilename());
327 }
328 }
329 }
330 {
331 switch ( LA(1)) {
332 case 28:
333 {
334 match(28);
335 type.setSingleValue( true );
336 break;
337 }
338 case CLOSE_PAREN:
339 case LITERAL_COLLECTIVE:
340 case 30:
341 case LITERAL_USAGE:
342 {
343 break;
344 }
345 default:
346 {
347 throw new NoViableAltException(LT(1), getFilename());
348 }
349 }
350 }
351 {
352 switch ( LA(1)) {
353 case LITERAL_COLLECTIVE:
354 {
355 match(LITERAL_COLLECTIVE);
356 type.setCollective( true );
357 break;
358 }
359 case CLOSE_PAREN:
360 case 30:
361 case LITERAL_USAGE:
362 {
363 break;
364 }
365 default:
366 {
367 throw new NoViableAltException(LT(1), getFilename());
368 }
369 }
370 }
371 {
372 switch ( LA(1)) {
373 case 30:
374 {
375 match(30);
376 type.setNoUserModification( true );
377 break;
378 }
379 case CLOSE_PAREN:
380 case LITERAL_USAGE:
381 {
382 break;
383 }
384 default:
385 {
386 throw new NoViableAltException(LT(1), getFilename());
387 }
388 }
389 }
390 {
391 switch ( LA(1)) {
392 case LITERAL_USAGE:
393 {
394 usage(type);
395 break;
396 }
397 case CLOSE_PAREN:
398 {
399 break;
400 }
401 default:
402 {
403 throw new NoViableAltException(LT(1), getFilename());
404 }
405 }
406 }
407 match(CLOSE_PAREN);
408
409 schemaElements.add( type );
410
411 }
412
413 public final void objectClass() throws RecognitionException, TokenStreamException {
414
415 Token oid = null;
416
417 ObjectClassHolder objectClass = null;
418
419
420 match(LITERAL_objectclass);
421 match(OPEN_PAREN);
422 oid = LT(1);
423 match(NUMERICOID);
424
425 objectClass = new ObjectClassHolder( oid.getText() );
426
427 {
428 switch ( LA(1)) {
429 case LITERAL_NAME:
430 {
431 objectClassNames(objectClass);
432 break;
433 }
434 case CLOSE_PAREN:
435 case DESC:
436 case LITERAL_OBSOLETE:
437 case LITERAL_ABSTRACT:
438 case LITERAL_STRUCTURAL:
439 case LITERAL_AUXILIARY:
440 case LITERAL_MAY:
441 case LITERAL_MUST:
442 case LITERAL_SUP:
443 {
444 break;
445 }
446 default:
447 {
448 throw new NoViableAltException(LT(1), getFilename());
449 }
450 }
451 }
452 {
453 switch ( LA(1)) {
454 case DESC:
455 {
456 objectClassDesc(objectClass);
457 break;
458 }
459 case CLOSE_PAREN:
460 case LITERAL_OBSOLETE:
461 case LITERAL_ABSTRACT:
462 case LITERAL_STRUCTURAL:
463 case LITERAL_AUXILIARY:
464 case LITERAL_MAY:
465 case LITERAL_MUST:
466 case LITERAL_SUP:
467 {
468 break;
469 }
470 default:
471 {
472 throw new NoViableAltException(LT(1), getFilename());
473 }
474 }
475 }
476 {
477 switch ( LA(1)) {
478 case LITERAL_OBSOLETE:
479 {
480 match(LITERAL_OBSOLETE);
481 objectClass.setObsolete( true );
482 break;
483 }
484 case CLOSE_PAREN:
485 case LITERAL_ABSTRACT:
486 case LITERAL_STRUCTURAL:
487 case LITERAL_AUXILIARY:
488 case LITERAL_MAY:
489 case LITERAL_MUST:
490 case LITERAL_SUP:
491 {
492 break;
493 }
494 default:
495 {
496 throw new NoViableAltException(LT(1), getFilename());
497 }
498 }
499 }
500 {
501 switch ( LA(1)) {
502 case LITERAL_SUP:
503 {
504 objectClassSuperiors(objectClass);
505 break;
506 }
507 case CLOSE_PAREN:
508 case LITERAL_ABSTRACT:
509 case LITERAL_STRUCTURAL:
510 case LITERAL_AUXILIARY:
511 case LITERAL_MAY:
512 case LITERAL_MUST:
513 {
514 break;
515 }
516 default:
517 {
518 throw new NoViableAltException(LT(1), getFilename());
519 }
520 }
521 }
522 {
523 switch ( LA(1)) {
524 case LITERAL_ABSTRACT:
525 {
526 match(LITERAL_ABSTRACT);
527 objectClass.setClassType( ObjectClassTypeEnum.ABSTRACT );
528 break;
529 }
530 case LITERAL_STRUCTURAL:
531 {
532 match(LITERAL_STRUCTURAL);
533 objectClass.setClassType( ObjectClassTypeEnum.STRUCTURAL );
534 break;
535 }
536 case LITERAL_AUXILIARY:
537 {
538 match(LITERAL_AUXILIARY);
539 objectClass.setClassType( ObjectClassTypeEnum.AUXILIARY );
540 break;
541 }
542 case CLOSE_PAREN:
543 case LITERAL_MAY:
544 case LITERAL_MUST:
545 {
546 break;
547 }
548 default:
549 {
550 throw new NoViableAltException(LT(1), getFilename());
551 }
552 }
553 }
554 {
555 switch ( LA(1)) {
556 case LITERAL_MUST:
557 {
558 must(objectClass);
559 break;
560 }
561 case CLOSE_PAREN:
562 case LITERAL_MAY:
563 {
564 break;
565 }
566 default:
567 {
568 throw new NoViableAltException(LT(1), getFilename());
569 }
570 }
571 }
572 {
573 switch ( LA(1)) {
574 case LITERAL_MAY:
575 {
576 may(objectClass);
577 break;
578 }
579 case CLOSE_PAREN:
580 {
581 break;
582 }
583 default:
584 {
585 throw new NoViableAltException(LT(1), getFilename());
586 }
587 }
588 }
589 match(CLOSE_PAREN);
590
591 schemaElements.add( objectClass );
592
593 }
594
595 public final void objectClassNames(
596 ObjectClassHolder objectClass
597 ) throws RecognitionException, TokenStreamException {
598
599 Token id0 = null;
600 Token id1 = null;
601 Token id2 = null;
602
603 List<String> list = new ArrayList<String>();
604
605
606 {
607 match(LITERAL_NAME);
608 {
609 switch ( LA(1)) {
610 case QUOTE:
611 {
612 match(QUOTE);
613 id0 = LT(1);
614 match(IDENTIFIER);
615 match(QUOTE);
616
617 list.add( id0.getText() );
618
619 break;
620 }
621 case OPEN_PAREN:
622 {
623 {
624 match(OPEN_PAREN);
625 match(QUOTE);
626 id1 = LT(1);
627 match(IDENTIFIER);
628
629 list.add( id1.getText() );
630
631 match(QUOTE);
632 {
633 _loop2032:
634 do {
635 if ((LA(1)==QUOTE)) {
636 match(QUOTE);
637 id2 = LT(1);
638 match(IDENTIFIER);
639 match(QUOTE);
640
641 list.add( id2.getText() );
642
643 }
644 else {
645 break _loop2032;
646 }
647
648 } while (true);
649 }
650 match(CLOSE_PAREN);
651 }
652 break;
653 }
654 default:
655 {
656 throw new NoViableAltException(LT(1), getFilename());
657 }
658 }
659 }
660 }
661
662 objectClass.setNames( list );
663
664 }
665
666 public final void objectClassDesc(
667 ObjectClassHolder objectClass
668 ) throws RecognitionException, TokenStreamException {
669
670 Token d = null;
671
672 d = LT(1);
673 match(DESC);
674
675 String desc = d.getText().split( "'" )[1];
676 String[] quoted = desc.split( "\"" );
677
678 if ( quoted.length == 1 )
679 {
680 objectClass.setDescription( desc );
681 }
682 else
683 {
684 StringBuffer buf = new StringBuffer();
685 for ( int ii = 0; ii < quoted.length; ii++ )
686 {
687 if ( ii < quoted.length - 1 )
688 {
689 buf.append( quoted[ii] ).append( "\\" ).append( "\"" );
690 }
691 else
692 {
693 buf.append( quoted[ii] );
694 }
695 }
696
697 objectClass.setDescription( buf.toString() );
698 }
699
700 }
701
702 public final void objectClassSuperiors(
703 ObjectClassHolder objectClass
704 ) throws RecognitionException, TokenStreamException {
705
706
707 List<String> list = null;
708
709
710 match(LITERAL_SUP);
711 list=woidlist();
712
713 objectClass.setSuperiors( list );
714
715 }
716
717 public final void must(
718 ObjectClassHolder objectClass
719 ) throws RecognitionException, TokenStreamException {
720
721
722 List<String> list = null;
723
724
725 match(LITERAL_MUST);
726 list=woidlist();
727
728 objectClass.setMust( list );
729
730 }
731
732 public final void may(
733 ObjectClassHolder objectClass
734 ) throws RecognitionException, TokenStreamException {
735
736
737 List<String> list = null;
738
739
740 match(LITERAL_MAY);
741 list=woidlist();
742
743 objectClass.setMay( list );
744
745 }
746
747 public final List<String> woidlist() throws RecognitionException, TokenStreamException {
748 List<String> list;
749
750
751 list = new ArrayList<String>( 2 );
752 String oid = null;
753
754
755 {
756 switch ( LA(1)) {
757 case NUMERICOID:
758 case IDENTIFIER:
759 {
760 oid=woid();
761 list.add( oid );
762 break;
763 }
764 case OPEN_PAREN:
765 {
766 {
767 match(OPEN_PAREN);
768 oid=woid();
769 list.add( oid );
770 {
771 _loop2025:
772 do {
773 if ((LA(1)==DOLLAR)) {
774 match(DOLLAR);
775 oid=woid();
776 list.add( oid );
777 }
778 else {
779 break _loop2025;
780 }
781
782 } while (true);
783 }
784 match(CLOSE_PAREN);
785 }
786 break;
787 }
788 default:
789 {
790 throw new NoViableAltException(LT(1), getFilename());
791 }
792 }
793 }
794 return list;
795 }
796
797 public final String woid() throws RecognitionException, TokenStreamException {
798 String oid;
799
800 Token opt1 = null;
801 Token opt2 = null;
802
803 oid = null;
804
805
806 {
807 switch ( LA(1)) {
808 case NUMERICOID:
809 {
810 opt1 = LT(1);
811 match(NUMERICOID);
812
813 oid = opt1.getText();
814
815 break;
816 }
817 case IDENTIFIER:
818 {
819 opt2 = LT(1);
820 match(IDENTIFIER);
821
822 oid = opt2.getText();
823
824 break;
825 }
826 default:
827 {
828 throw new NoViableAltException(LT(1), getFilename());
829 }
830 }
831 }
832 return oid;
833 }
834
835 public final void names(
836 AttributeTypeHolder type
837 ) throws RecognitionException, TokenStreamException {
838
839 Token id0 = null;
840 Token id1 = null;
841
842 List<String> list = new ArrayList<String>();
843
844
845 match(LITERAL_NAME);
846 {
847 switch ( LA(1)) {
848 case QUOTE:
849 {
850 match(QUOTE);
851 id0 = LT(1);
852 match(IDENTIFIER);
853 match(QUOTE);
854
855 list.add( id0.getText() );
856
857 break;
858 }
859 case OPEN_PAREN:
860 {
861 {
862 match(OPEN_PAREN);
863 {
864 int _cnt2059=0;
865 _loop2059:
866 do {
867 if ((LA(1)==QUOTE)) {
868 match(QUOTE);
869 id1 = LT(1);
870 match(IDENTIFIER);
871
872 list.add( id1.getText() );
873
874 match(QUOTE);
875 }
876 else {
877 if ( _cnt2059>=1 ) { break _loop2059; } else {throw new NoViableAltException(LT(1), getFilename());}
878 }
879
880 _cnt2059++;
881 } while (true);
882 }
883 match(CLOSE_PAREN);
884 }
885 break;
886 }
887 default:
888 {
889 throw new NoViableAltException(LT(1), getFilename());
890 }
891 }
892 }
893
894 type.setNames( list );
895
896 }
897
898 public final void desc(
899 AttributeTypeHolder type
900 ) throws RecognitionException, TokenStreamException {
901
902 Token d = null;
903
904 d = LT(1);
905 match(DESC);
906
907 String desc = d.getText().split( "'" )[1];
908 String[] quoted = desc.split( "\"" );
909
910 if ( quoted.length == 1 )
911 {
912 type.setDescription( desc );
913 }
914 else
915 {
916 StringBuffer buf = new StringBuffer();
917 for ( int ii = 0; ii < quoted.length; ii++ )
918 {
919 if ( ii < quoted.length - 1 )
920 {
921 buf.append( quoted[ii] ).append( "\\" ).append( "\"" );
922 }
923 else
924 {
925 buf.append( quoted[ii] );
926 }
927 }
928
929 type.setDescription( buf.toString() );
930 }
931
932 }
933
934 public final void superior(
935 AttributeTypeHolder type
936 ) throws RecognitionException, TokenStreamException {
937
938 Token oid = null;
939 Token id = null;
940
941 match(LITERAL_SUP);
942 {
943 switch ( LA(1)) {
944 case NUMERICOID:
945 {
946 oid = LT(1);
947 match(NUMERICOID);
948
949 type.setSuperior( oid.getText() );
950
951 break;
952 }
953 case IDENTIFIER:
954 {
955 id = LT(1);
956 match(IDENTIFIER);
957
958 type.setSuperior( id.getText() );
959
960 break;
961 }
962 default:
963 {
964 throw new NoViableAltException(LT(1), getFilename());
965 }
966 }
967 }
968 }
969
970 public final void equality(
971 AttributeTypeHolder type
972 ) throws RecognitionException, TokenStreamException {
973
974 Token oid = null;
975 Token id = null;
976
977 match(LITERAL_EQUALITY);
978 {
979 switch ( LA(1)) {
980 case NUMERICOID:
981 {
982 oid = LT(1);
983 match(NUMERICOID);
984
985 type.setEquality( oid.getText() );
986
987 break;
988 }
989 case IDENTIFIER:
990 {
991 id = LT(1);
992 match(IDENTIFIER);
993
994 type.setEquality( id.getText() );
995
996 break;
997 }
998 default:
999 {
1000 throw new NoViableAltException(LT(1), getFilename());
1001 }
1002 }
1003 }
1004 }
1005
1006 public final void ordering(
1007 AttributeTypeHolder type
1008 ) throws RecognitionException, TokenStreamException {
1009
1010 Token oid = null;
1011 Token id = null;
1012
1013 match(LITERAL_ORDERING);
1014 {
1015 switch ( LA(1)) {
1016 case NUMERICOID:
1017 {
1018 oid = LT(1);
1019 match(NUMERICOID);
1020
1021 type.setOrdering( oid.getText() );
1022
1023 break;
1024 }
1025 case IDENTIFIER:
1026 {
1027 id = LT(1);
1028 match(IDENTIFIER);
1029
1030 type.setOrdering( id.getText() );
1031
1032 break;
1033 }
1034 default:
1035 {
1036 throw new NoViableAltException(LT(1), getFilename());
1037 }
1038 }
1039 }
1040 }
1041
1042 public final void substr(
1043 AttributeTypeHolder type
1044 ) throws RecognitionException, TokenStreamException {
1045
1046 Token oid = null;
1047 Token id = null;
1048
1049 match(LITERAL_SUBSTR);
1050 {
1051 switch ( LA(1)) {
1052 case NUMERICOID:
1053 {
1054 oid = LT(1);
1055 match(NUMERICOID);
1056
1057 type.setSubstr( oid.getText() );
1058
1059 break;
1060 }
1061 case IDENTIFIER:
1062 {
1063 id = LT(1);
1064 match(IDENTIFIER);
1065
1066 type.setSubstr( id.getText() );
1067
1068 break;
1069 }
1070 default:
1071 {
1072 throw new NoViableAltException(LT(1), getFilename());
1073 }
1074 }
1075 }
1076 }
1077
1078 public final void syntax(
1079 AttributeTypeHolder type
1080 ) throws RecognitionException, TokenStreamException {
1081
1082 Token token = null;
1083
1084 token = LT(1);
1085 match(SYNTAX);
1086
1087 String[] comps = token.getText().split( " " );
1088
1089 int index = comps[1].indexOf( "{" );
1090 if ( index == -1 )
1091 {
1092 type.setSyntax( comps[1] );
1093 return;
1094 }
1095
1096 String oid = comps[1].substring( 0, index );
1097 String length = comps[1].substring( index + 1, comps[1].length() - 1 );
1098
1099 type.setSyntax( oid );
1100 type.setOidLen( Integer.parseInt( length ) );
1101
1102 }
1103
1104 public final void usage(
1105 AttributeTypeHolder type
1106 ) throws RecognitionException, TokenStreamException {
1107
1108
1109 match(LITERAL_USAGE);
1110 {
1111 switch ( LA(1)) {
1112 case LITERAL_userApplications:
1113 {
1114 match(LITERAL_userApplications);
1115 type.setUsage( UsageEnum.USER_APPLICATIONS );
1116 break;
1117 }
1118 case LITERAL_directoryOperation:
1119 {
1120 match(LITERAL_directoryOperation);
1121 type.setUsage( UsageEnum.DIRECTORY_OPERATION );
1122 break;
1123 }
1124 case LITERAL_distributedOperation:
1125 {
1126 match(LITERAL_distributedOperation);
1127 type.setUsage( UsageEnum.DISTRIBUTED_OPERATION );
1128 break;
1129 }
1130 case LITERAL_dSAOperation:
1131 {
1132 match(LITERAL_dSAOperation);
1133 type.setUsage( UsageEnum.DSA_OPERATION );
1134 break;
1135 }
1136 default:
1137 {
1138 throw new NoViableAltException(LT(1), getFilename());
1139 }
1140 }
1141 }
1142 }
1143
1144
1145 public static final String[] _tokenNames = {
1146 "<0>",
1147 "EOF",
1148 "<2>",
1149 "NULL_TREE_LOOKAHEAD",
1150 "WS",
1151 "QUOTE",
1152 "DIGIT",
1153 "DOLLAR",
1154 "OPEN_PAREN",
1155 "CLOSE_PAREN",
1156 "OPEN_BRACKET",
1157 "CLOSE_BRACKET",
1158 "NUMERIC_STRING",
1159 "NUMERICOID",
1160 "IDENTIFIER",
1161 "DESC",
1162 "SYNTAX",
1163 "\"END\"",
1164 "\"objectclass\"",
1165 "\"OBSOLETE\"",
1166 "\"ABSTRACT\"",
1167 "\"STRUCTURAL\"",
1168 "\"AUXILIARY\"",
1169 "\"MAY\"",
1170 "\"MUST\"",
1171 "\"SUP\"",
1172 "\"NAME\"",
1173 "\"attributetype\"",
1174 "\"SINGLE-VALUE\"",
1175 "\"COLLECTIVE\"",
1176 "\"NO-USER-MODIFICATION\"",
1177 "\"EQUALITY\"",
1178 "\"SUBSTR\"",
1179 "\"ORDERING\"",
1180 "\"USAGE\"",
1181 "\"userApplications\"",
1182 "\"directoryOperation\"",
1183 "\"distributedOperation\"",
1184 "\"dSAOperation\""
1185 };
1186
1187
1188 }