Added a parameter to semaphore constructor to avoid ambiguity
[pwlib.git] / tools / asnparser / asn_grammar.y
blob0c7c40c3b3f54cc9054492fc0b31b8097e67ae43
1 %expect 14
3 %{
5 /*
6 * asn_grammar.y
8 * ASN grammar file
10 * ASN.1 compiler to produce C++ classes.
12 * Copyright (c) 1997-1999 Equivalence Pty. Ltd.
14 * The contents of this file are subject to the Mozilla Public License
15 * Version 1.0 (the "License"); you may not use this file except in
16 * compliance with the License. You may obtain a copy of the License at
17 * http://www.mozilla.org/MPL/
19 * Software distributed under the License is distributed on an "AS IS"
20 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
21 * the License for the specific language governing rights and limitations
22 * under the License.
24 * The Original Code is ASN Parser.
26 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
28 * Portions of this code were written with the assisance of funding from
29 * Vovida Networks, Inc. http://www.vovida.com.
31 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
32 * All Rights Reserved.
34 * Contributor(s): ______________________________________.
36 * $Log$
37 * Revision 1.12 2001/10/02 00:56:04 robertj
38 * Fixed problem with autonumering enumerated types.
40 * Revision 1.11 2001/01/16 14:00:17 craigs
41 * Changed MIN and MAX tokens to avoid namespace conflicts under BeOS
43 * Revision 1.10 2000/05/08 08:55:44 robertj
44 * Fixed production error for ValueSet, thanks Huang-Ming Huang
46 * Revision 1.9 2000/01/19 12:33:07 robertj
47 * Fixed parsing of OID's in IMPORTS section.
49 * Revision 1.8 2000/01/19 03:38:12 robertj
50 * Fixed support for parsing multiple IMPORTS
52 * Revision 1.7 1999/07/22 06:48:54 robertj
53 * Added comparison operation to base ASN classes and compiled ASN code.
54 * Added support for ANY type in ASN parser.
56 * Revision 1.6 1999/06/09 06:58:08 robertj
57 * Adjusted heading comments.
59 * Revision 1.5 1999/06/07 01:56:25 robertj
60 * Added header comment on license.
62 * Revision 1.4 1999/06/06 05:30:28 robertj
63 * Support for parameterised types and type-dentifier types.
64 * Added ability to output multiple .cxx files.
66 * Revision 1.3 1998/12/14 06:47:55 robertj
67 * New memory check code support.
69 * Revision 1.2 1998/05/21 04:21:46 robertj
70 * Implementing more of the ASN spec.
72 * Revision 1.1 1997/12/13 09:17:47 robertj
73 * Initial revision
77 #include <ptlib.h>
79 #undef malloc
80 #undef calloc
81 #undef realloc
82 #undef free
84 #include "main.h"
86 extern int yylex();
88 extern int ReferenceTokenContext;
89 extern int IdentifierTokenContext;
90 extern int BraceTokenContext;
91 extern int NullTokenContext;
92 extern int InMacroContext;
93 extern int HasObjectTypeMacro;
94 extern int InMIBContext;
95 extern TypesList * CurrentImportList;
97 static int UnnamedFieldCount = 1;
98 static PStringList * DummyParameters;
100 static PString * ConcatNames(PString * s1, char c, PString * s2)
102 *s1 += c;
103 *s1 += *s2;
104 delete s2;
105 return s1;
108 #ifdef _MSC_VER
109 #pragma warning(disable:4701)
110 #endif
114 %token IDENTIFIER
115 %token BIT_IDENTIFIER
116 %token OID_IDENTIFIER
117 %token IMPORT_IDENTIFIER
118 %token MODULEREFERENCE
119 %token TYPEREFERENCE
120 %token OBJECTCLASSREFERENCE
121 %token TYPEFIELDREFERENCE
122 %token VALUEFIELDREFERENCE
123 %token VALUESETFIELDREFERENCE
124 %token OBJECTFIELDREFERENCE
125 %token OBJECTSETFIELDREFERENCE
126 %token OBJECTREFERENCE
127 %token OBJECTSETREFERENCE
128 %token INTEGER
130 %token CSTRING
131 %token OS_BSTRING
132 %token BS_BSTRING
133 %token OS_HSTRING
134 %token BS_HSTRING
136 %token STRING_BRACE
137 %token BITSTRING_BRACE
138 %token OID_BRACE
140 %token ABSENT
141 %token ABSTRACT_SYNTAX
142 %token ALL
143 %token ANY
144 %token APPLICATION
145 %token ASSIGNMENT
146 %token AUTOMATIC
147 %token BEGIN_t
148 %token BIT
149 %token BMPString
150 %token BOOLEAN_t
151 %token BY
152 %token CHARACTER
153 %token CHOICE
154 %token CLASS
155 %token COMPONENT
156 %token COMPONENTS
157 %token CONSTRAINED
158 %token DEFAULT
159 %token DEFINED
160 %token DEFINITIONS
161 %token EMBEDDED
162 %token END
163 %token ENUMERATED
164 %token EXCEPT
165 %token EXPLICIT
166 %token EXPORTS
167 %token EXTERNAL
168 %token FALSE_t
169 %token FROM
170 %token GeneralString
171 %token GraphicString
172 %token IA5String
173 %token TYPE_IDENTIFIER
174 %token IDENTIFIER_t
175 %token IMPLICIT
176 %token IMPORTS
177 %token INCLUDES
178 %token INSTANCE
179 %token INTEGER_t
180 %token INTERSECTION
181 %token ISO646String
182 %token MACRO
183 %token MAX_t
184 %token MIN_t
185 %token MINUS_INFINITY
186 %token NOTATION
187 %token NULL_VALUE
188 %token NULL_TYPE
189 %token NumericString
190 %token OBJECT
191 %token OCTET
192 %token OF_t
193 %token OPTIONAL_t
194 %token PDV
195 %token PLUS_INFINITY
196 %token PRESENT
197 %token PrintableString
198 %token PRIVATE
199 %token REAL
200 %token SEQUENCE
201 %token SET
202 %token SIZE_t
203 %token STRING
204 %token SYNTAX
205 %token T61String
206 %token TAGS
207 %token TeletexString
208 %token TRUE_t
209 %token TYPE_t
210 %token UNION
211 %token UNIQUE
212 %token UNIVERSAL
213 %token UniversalString
214 %token VideotexString
215 %token VisibleString
216 %token GeneralizedTime
217 %token UTCTime
218 %token VALUE
219 %token WITH
220 %token string_t
221 %token identifier_t
222 %token number_t
223 %token empty_t
224 %token type_t
225 %token value_t
226 %token OBJECT_TYPE
227 %token TRAP_TYPE
228 %token ACCESS
229 %token STATUS
230 %token read_only_t
231 %token read_write_t
232 %token write_only_t
233 %token not_accessible_t
234 %token mandatory_t
235 %token optional_t
236 %token obsolete_t
237 %token deprecated_t
238 %token DESCRIPTION_t
239 %token REFERENCE_t
240 %token INDEX_t
241 %token DEFVAL_t
242 %token ENTERPRISE
243 %token VARIABLES
245 %token ObjectDescriptor_t
248 %type <ival> INTEGER
249 %type <ival> TagDefault
250 %type <ival> SignedNumber
251 %type <ival> ObjectTypeAccess ObjectTypeStatus
252 %type <ival> Class ClassNumber
253 %type <ival> PresenceConstraint
255 %type <sval> CSTRING
256 %type <sval> BS_BSTRING
257 %type <sval> OS_BSTRING
258 %type <sval> BS_HSTRING
259 %type <sval> OS_HSTRING
260 %type <sval> IDENTIFIER
261 %type <sval> BIT_IDENTIFIER
262 %type <sval> OID_IDENTIFIER
263 %type <sval> IMPORT_IDENTIFIER
264 %type <sval> TYPEREFERENCE
265 %type <sval> MODULEREFERENCE
266 %type <sval> OBJECTCLASSREFERENCE
267 %type <sval> TYPEFIELDREFERENCE
268 %type <sval> VALUEFIELDREFERENCE
269 %type <sval> VALUESETFIELDREFERENCE
270 %type <sval> OBJECTFIELDREFERENCE
271 %type <sval> OBJECTSETFIELDREFERENCE
272 %type <sval> OBJECTREFERENCE
273 %type <sval> OBJECTSETREFERENCE
274 %type <sval> DefinitiveObjIdComponent
275 %type <sval> DefinitiveNameAndNumberForm
276 %type <sval> GlobalModuleReference
277 %type <sval> Reference
278 %type <sval> ExternalTypeReference ExternalValueReference
279 %type <sval> ObjIdComponent
280 %type <sval> NumberForm
281 %type <sval> SimpleDefinedType
282 %type <sval> ComponentIdList
283 %type <sval> CharsDefn
284 %type <sval> SimpleDefinedValue
285 %type <sval> FieldName PrimitiveFieldName
286 %type <sval> DefinedObjectClass
287 %type <sval> ExternalObjectClassReference
288 %type <sval> UsefulObjectClassReference
289 %type <sval> Parameter
290 %type <sval> MibIndexType MibDescrPart MibReferPart
292 %type <slst> DefinitiveIdentifier
293 %type <slst> DefinitiveObjIdComponentList
294 %type <slst> ObjIdComponentList
295 %type <slst> BitIdentifierList
296 %type <slst> CharSyms
297 %type <slst> ParameterList Parameters
298 %type <slst> MibIndexTypes MibIndexPart
300 %type <tval> Type BuiltinType ReferencedType NamedType
301 %type <tval> DefinedType
302 %type <tval> ConstrainedType
303 %type <tval> TypeWithConstraint
304 %type <tval> BitStringType
305 %type <tval> BooleanType
306 %type <tval> CharacterStringType
307 %type <tval> RestrictedCharacterStringType
308 %type <tval> UnrestrictedCharacterStringType
309 %type <tval> ChoiceType AlternativeTypeLists
310 %type <tval> EmbeddedPDVType
311 %type <tval> EnumeratedType Enumerations
312 %type <tval> ExternalType
313 %type <tval> AnyType
314 %type <tval> IntegerType
315 %type <tval> NullType
316 %type <tval> ObjectClassFieldType
317 %type <tval> ObjectIdentifierType
318 %type <tval> OctetStringType
319 %type <tval> RealType
320 %type <tval> SequenceType ComponentType ComponentTypeLists
321 %type <tval> SequenceOfType
322 %type <tval> SetType
323 %type <tval> SetOfType
324 %type <tval> TaggedType
325 %type <tval> ParameterizedType
326 %type <tval> SelectionType
327 %type <tval> UsefulType
328 %type <tval> TypeFromObject
329 %type <tval> ContainedSubtype
330 %type <tval> ActualParameter
331 %type <tval> UserDefinedConstraintParameter
332 %type <tval> Symbol
333 %type <tval> ParameterizedReference
335 %type <tlst> AlternativeTypeList
336 %type <tlst> ComponentTypeList
337 %type <tlst> ActualParameterList ActualParameters
338 %type <tlst> UserDefinedConstraintParameters
339 %type <tlst> SymbolList
341 %type <vval> Value BuiltinValue
342 %type <vval> AssignedIdentifier
343 %type <vval> DefinedValue DefinedValue_Import
344 %type <vval> ObjectIdentifierValue
345 %type <vval> OctetStringValue
346 %type <vval> BitStringValue
347 %type <vval> ExceptionSpec
348 %type <vval> ExceptionIdentification
349 %type <vval> MibDefValPart
350 %type <vval> LowerEndpoint LowerEndValue UpperEndpoint UpperEndValue
351 %type <vval> ReferencedValue
352 %type <vval> BooleanValue
353 %type <vval> CharacterStringValue RestrictedCharacterStringValue
354 %type <vval> CharacterStringList Quadruple Tuple
355 %type <vval> ChoiceValue
356 %type <vval> NullValue
357 %type <vval> RealValue NumericRealValue SpecialRealValue
358 %type <vval> SequenceValue NamedValue
359 /*!!!! %type <vval> SequenceOfValue */
360 %type <vval> ParameterizedValue
362 %type <vlst> ComponentValueList
363 %type <vlst> MibVarPart MibVarTypes
365 %type <nval> NamedBit
366 %type <nval> EnumerationItem
367 %type <nval> NamedNumber
369 %type <nlst> NamedBitList
370 %type <nlst> Enumeration
371 %type <nlst> NamedNumberList
373 %type <elmt> IntersectionElements
374 %type <elmt> Elements
375 %type <elmt> Exclusions
376 %type <elmt> SubtypeElements
377 %type <elmt> ObjectSetElements
378 %type <elmt> ValueRange
379 %type <elmt> PermittedAlphabet
380 %type <elmt> InnerTypeConstraints
381 %type <elmt> MultipleTypeConstraints
382 %type <elmt> SizeConstraint
383 %type <elmt> UserDefinedConstraintParameterList
384 %type <elmt> NamedConstraint
386 %type <elst> ElementSetSpec Unions Intersections TypeConstraints
388 %type <cons> Constraint
389 %type <cons> ConstraintSpec
390 %type <cons> ElementSetSpecs
391 %type <cons> GeneralConstraint
392 %type <cons> UserDefinedConstraint
393 %type <cons> TableConstraint
394 %type <cons> ComponentRelationConstraint
395 %type <cons> ObjectSet
397 %type <tagv> Tag
400 %union {
401 PInt64 ival;
402 PString * sval;
403 PStringList * slst;
404 TypeBase * tval;
405 TypesList * tlst;
406 ValueBase * vval;
407 ValuesList * vlst;
408 NamedNumber * nval;
409 NamedNumberList * nlst;
410 Constraint * cons;
411 ConstraintElementList * elst;
412 ConstraintElementBase * elmt;
413 struct {
414 Tag::Type tagClass;
415 unsigned tagNumber;
416 } tagv;
422 ModuleDefinition
423 : MODULEREFERENCE DefinitiveIdentifier DEFINITIONS TagDefault ASSIGNMENT BEGIN_t
425 Module = new ModuleDefinition($1, $2, (Tag::Mode)$4);
426 ReferenceTokenContext = TYPEREFERENCE;
428 ModuleBody END
431 DefinitiveIdentifier
432 : '{' DefinitiveObjIdComponentList '}'
434 $$ = $2;
436 | /* empty */
438 $$ = new PStringList;
442 DefinitiveObjIdComponentList
443 : DefinitiveObjIdComponent
445 $$ = new PStringList;
446 $$->Append($1);
448 | DefinitiveObjIdComponent DefinitiveObjIdComponentList
450 $2->InsertAt(0, $1);
451 $$ = $2;
455 DefinitiveObjIdComponent
456 : IDENTIFIER
457 | INTEGER
459 $$ = new PString(PString::Unsigned, (int)$1);
461 | DefinitiveNameAndNumberForm
464 DefinitiveNameAndNumberForm
465 : IDENTIFIER '(' INTEGER ')'
467 delete $1;
468 $$ = new PString(PString::Unsigned, (int)$3);
472 TagDefault
473 : EXPLICIT TAGS
475 $$ = Tag::Explicit;
477 | IMPLICIT TAGS
479 $$ = Tag::Implicit;
481 | AUTOMATIC TAGS
483 $$ = Tag::Automatic;
485 | /* empty */
487 $$ = Tag::Explicit;
492 /*************************************/
494 ModuleBody
495 : Exports Imports AssignmentList
496 | /* empty */
500 Exports
501 : EXPORTS SymbolsExported ';'
502 | /* empty */
506 SymbolsExported
507 : SymbolList
509 Module->SetExports($1);
511 | /* empty */
513 Module->SetExportAll();
518 Imports
519 : IMPORTS SymbolsImported ';'
520 | /* empty */
524 SymbolsImported
525 : SymbolsFromModuleList
526 | /* empty */
529 SymbolsFromModuleList
530 : SymbolsFromModule
531 | SymbolsFromModuleList SymbolsFromModule
535 SymbolsFromModule
536 : SymbolList FROM
538 CurrentImportList = $1;
539 ReferenceTokenContext = MODULEREFERENCE;
541 GlobalModuleReference
543 if (!HasObjectTypeMacro) {
544 HasObjectTypeMacro = $1->GetValuesIndex(SearchType("OBJECT-TYPE")) != P_MAX_INDEX;
545 if (HasObjectTypeMacro)
546 PError << "Info: including OBJECT-TYPE macro" << endl;
548 Module->AddImport(new ImportModule($4, $1));
549 ReferenceTokenContext = TYPEREFERENCE;
550 CurrentImportList = NULL;
555 GlobalModuleReference
556 : MODULEREFERENCE
558 ReferenceTokenContext = TYPEREFERENCE;
559 BraceTokenContext = OID_BRACE;
561 AssignedIdentifier
563 BraceTokenContext = '{';
564 delete $3;
569 AssignedIdentifier
570 : DefinedValue_Import
571 | ObjectIdentifierValue
572 | /* empty */
574 $$ = NULL;
578 DefinedValue_Import
579 : ExternalValueReference
581 $$ = new DefinedValue($1);
583 | IMPORT_IDENTIFIER
585 $$ = new DefinedValue($1);
591 SymbolList
592 : Symbol
594 $$ = new TypesList;
595 $$->Append($1);
597 | Symbol ',' SymbolList
599 $3->Append($1);
600 $$ = $3;
605 Symbol
606 : Reference
608 $$ = new ImportedType($1, FALSE);
610 | ParameterizedReference /* only required for X.683 */
614 /*************************************/
616 AssignmentList: Assignment
617 | AssignmentList Assignment
621 Assignment
622 : TypeAssignment
623 | ValueAssignment
624 | ValueSetTypeAssignment
625 | ObjectClassAssignment
626 | ObjectAssignment
627 | ObjectSetAssignment
628 | ParameterizedAssignment
629 /* We do not have "real" macros, so fake MIB ones */
630 | MacroDefinition
631 | ObjectTypeDefinition
632 | TrapTypeDefinition
636 ValueSetTypeAssignment
637 : TYPEREFERENCE Type
639 $2->SetName($1);
640 Module->AddType($2);
641 IdentifierTokenContext = $2->GetIdentifierTokenContext();
642 BraceTokenContext = $2->GetBraceTokenContext();
644 ASSIGNMENT ValueSet
646 IdentifierTokenContext = IDENTIFIER;
647 BraceTokenContext = '{';
654 /********/
656 TypeAssignment
657 : TYPEREFERENCE ASSIGNMENT Type
659 $3->SetName($1);
660 Module->AddType($3);
665 Type
666 : ConstrainedType
667 | ReferencedType
668 | BuiltinType
672 BuiltinType
673 : BitStringType
674 | BooleanType
675 | CharacterStringType
676 | ChoiceType
677 | EmbeddedPDVType
678 | EnumeratedType
679 | ExternalType
680 | AnyType
681 | InstanceOfType
683 | IntegerType
684 | NullType
685 | ObjectClassFieldType
686 | ObjectIdentifierType
687 | OctetStringType
688 | RealType
689 | SequenceType
690 | SequenceOfType
691 | SetType
692 | SetOfType
693 | TaggedType
697 ReferencedType
698 : DefinedType
699 | UsefulType
700 | SelectionType
701 | TypeFromObject
702 /*!!! syntactically identical to TypeFromObject
703 | ValueSetFromObjects
708 DefinedType
709 : ExternalTypeReference
711 $$ = new DefinedType($1, FALSE);
713 | TYPEREFERENCE
715 $$ = new DefinedType($1,
716 DummyParameters != NULL &&
717 DummyParameters->GetValuesIndex(*$1) != P_MAX_INDEX);
719 | ParameterizedType
720 /*| ParameterizedValueSetType synonym for ParameterizedType */
724 ExternalTypeReference
725 : MODULEREFERENCE '.' TYPEREFERENCE
727 *$1 += *$3;
728 delete $3;
733 BitStringType
734 : BIT STRING
736 $$ = new BitStringType;
738 | BIT STRING '{' NamedBitList '}'
740 $$ = new BitStringType($4);
745 NamedBitList
746 : NamedBit
748 $$ = new NamedNumberList;
749 $$->Append($1);
751 | NamedBitList ',' NamedBit
753 $1->InsertAt(0, $3);
757 NamedBit
758 : IDENTIFIER '(' INTEGER ')'
760 $$ = new NamedNumber($1, (int)$3);
762 | IDENTIFIER '(' DefinedValue ')'
764 $$ = new NamedNumber($1, ((DefinedValue*)$3)->GetReference());
765 delete $3;
770 BooleanType
771 : BOOLEAN_t
773 $$ = new BooleanType;
778 CharacterStringType
779 : RestrictedCharacterStringType
780 | UnrestrictedCharacterStringType
783 RestrictedCharacterStringType
784 : BMPString
786 $$ = new BMPStringType;
788 | GeneralString
790 $$ = new GeneralStringType;
792 | GraphicString
794 $$ = new GraphicStringType;
796 | IA5String
798 $$ = new IA5StringType;
800 | ISO646String
802 $$ = new ISO646StringType;
804 | NumericString
806 $$ = new NumericStringType;
808 | PrintableString
810 $$ = new PrintableStringType;
812 | TeletexString
814 $$ = new TeletexStringType;
816 | T61String
818 $$ = new T61StringType;
820 | UniversalString
822 $$ = new UniversalStringType;
824 | VideotexString
826 $$ = new VideotexStringType;
828 | VisibleString
830 $$ = new VisibleStringType;
835 UnrestrictedCharacterStringType
836 : CHARACTER STRING
838 $$ = new UnrestrictedCharacterStringType;
843 ChoiceType
844 : CHOICE '{' AlternativeTypeLists '}'
846 $$ = $3;
850 AlternativeTypeLists
851 : AlternativeTypeList
853 $$ = new ChoiceType($1);
855 | AlternativeTypeList ',' ExtensionAndException
857 $$ = new ChoiceType($1, TRUE);
859 | AlternativeTypeList ',' ExtensionAndException ',' AlternativeTypeList
861 $$ = new ChoiceType($1, TRUE, $5);
865 AlternativeTypeList
866 : NamedType
868 $$ = new TypesList;
869 $$->Append($1);
871 | AlternativeTypeList ',' NamedType
873 $1->Append($3);
878 ExtensionAndException
879 : '.' '.' '.' ExceptionSpec
883 NamedType
884 : IDENTIFIER Type
886 $2->SetName($1);
887 $$ = $2;
889 | Type /* ITU-T Rec. X.680 Appendix H.1 */
891 PError << StdError(Warning) << "unnamed field." << endl;
892 $1->SetName(new PString(PString::Printf, "_unnamed%u", UnnamedFieldCount++));
894 /*| SelectionType /* Unnecessary as have rule in Type for this */
898 EmbeddedPDVType
899 : EMBEDDED PDV
901 $$ = new EmbeddedPDVType;
906 EnumeratedType
907 : ENUMERATED '{' Enumerations '}'
909 $$ = $3;
913 Enumerations
914 : Enumeration
916 $$ = new EnumeratedType($1, FALSE, NULL);
918 | Enumeration ',' '.' '.' '.'
920 $$ = new EnumeratedType($1, TRUE, NULL);
922 | Enumeration ',' '.' '.' '.' ',' Enumeration
924 $$ = new EnumeratedType($1, TRUE, $7);
928 Enumeration
929 : EnumerationItem
931 $$ = new NamedNumberList;
932 $$->Append($1);
934 | Enumeration ',' EnumerationItem
936 $1->Append($3);
937 PINDEX sz = $1->GetSize();
938 if (sz > 1)
939 $3->SetAutoNumber((*$1)[sz-2]);
940 $$ = $1;
944 EnumerationItem
945 : IDENTIFIER
947 $$ = new NamedNumber($1);
949 | NamedNumber
953 ExternalType
954 : EXTERNAL
956 $$ = new ExternalType;
961 AnyType
962 : ANY
964 $$ = new AnyType(NULL);
966 | ANY DEFINED BY IDENTIFIER
968 $$ = new AnyType($4);
973 InstanceOfType
974 : INSTANCE OF_t DefinedObjectClass
978 IntegerType
979 : INTEGER_t
981 $$ = new IntegerType;
983 | INTEGER_t '{' NamedNumberList '}'
985 $$ = new IntegerType($3);
990 NullType
991 : NULL_TYPE
993 $$ = new NullType;
998 ObjectClassFieldType
999 : DefinedObjectClass '.' FieldName
1001 $$ = new ObjectClassFieldType($1, $3);
1006 ObjectIdentifierType
1007 : OBJECT IDENTIFIER_t
1009 $$ = new ObjectIdentifierType;
1013 OctetStringType
1014 : OCTET STRING
1016 $$ = new OctetStringType;
1021 RealType
1022 : REAL
1024 $$ = new RealType;
1029 SequenceType
1030 : SEQUENCE '{' ComponentTypeLists '}'
1032 $$ = $3;
1034 | SEQUENCE '{' '}'
1036 $$ = new SequenceType(NULL, FALSE, NULL);
1038 | SEQUENCE '{' ExtensionAndException '}'
1040 $$ = new SequenceType(NULL, TRUE, NULL);
1044 ComponentTypeLists
1045 : ComponentTypeList
1047 $$ = new SequenceType($1, FALSE, NULL);
1049 | ComponentTypeList ',' ExtensionAndException
1051 $$ = new SequenceType($1, TRUE, NULL);
1053 | ComponentTypeList ',' ExtensionAndException ',' ComponentTypeList
1055 $$ = new SequenceType($1, TRUE, $5);
1057 | ExtensionAndException ',' ComponentTypeList
1059 $$ = new SequenceType(NULL, TRUE, $3);
1063 ComponentTypeList
1064 : ComponentType
1066 $$ = new TypesList;
1067 $$->Append($1);
1069 | ComponentTypeList ',' ComponentType
1071 $1->Append($3);
1075 ComponentType
1076 : NamedType
1077 | NamedType OPTIONAL_t
1079 $1->SetOptional();
1081 | NamedType DEFAULT
1083 IdentifierTokenContext = $1->GetIdentifierTokenContext();
1085 Value
1087 IdentifierTokenContext = IDENTIFIER;
1088 $1->SetDefaultValue($4);
1090 | COMPONENTS OF_t Type
1092 $$ = $3;
1097 SequenceOfType
1098 : SEQUENCE OF_t Type
1100 $$ = new SequenceOfType($3, NULL);
1105 SetType
1106 : SET '{' ComponentTypeLists '}'
1108 $$ = new SetType((SequenceType*)$3);
1110 | SET '{' '}'
1112 $$ = new SetType;
1117 SetOfType
1118 : SET OF_t Type
1120 $$ = new SetOfType($3, NULL);
1125 TaggedType
1126 : Tag Type
1128 $2->SetTag($1.tagClass, $1.tagNumber, Module->GetDefaultTagMode());
1129 $$ = $2;
1131 | Tag IMPLICIT Type
1133 $3->SetTag($1.tagClass, $1.tagNumber, Tag::Implicit);
1134 $$ = $3;
1136 | Tag EXPLICIT Type
1138 $3->SetTag($1.tagClass, $1.tagNumber, Tag::Explicit);
1139 $$ = $3;
1144 : '[' Class ClassNumber ']'
1146 $$.tagClass = (Tag::Type)$2;
1147 $$.tagNumber = (int)$3;
1151 ClassNumber
1152 : INTEGER
1153 | DefinedValue
1155 if ($1->IsDescendant(IntegerValue::Class()))
1156 $$ = *(IntegerValue*)$1;
1157 else
1158 PError << StdError(Fatal) << "incorrect value type." << endl;
1162 Class
1163 : UNIVERSAL
1165 $$ = Tag::Universal;
1167 | APPLICATION
1169 $$ = Tag::Application;
1171 | PRIVATE
1173 $$ = Tag::Private;
1175 | /* empty */
1177 $$ = Tag::ContextSpecific;
1182 SelectionType
1183 : IDENTIFIER '<' Type
1185 $$ = new SelectionType($1, $3);
1190 UsefulType
1191 : GeneralizedTime
1193 $$ = new GeneralizedTimeType;
1195 | UTCTime
1197 $$ = new UTCTimeType;
1199 | ObjectDescriptor_t
1201 $$ = new ObjectDescriptorType;
1206 TypeFromObject
1207 : ReferencedObjects '.' FieldName
1211 /*!!!
1212 ValueSetFromObjects
1213 : ReferencedObjects '.' FieldName
1217 ReferencedObjects
1218 : DefinedObject
1219 | ParameterizedObject
1220 | DefinedObjectSet
1222 | ParameterizedObjectSet
1226 ParameterizedObject
1227 : DefinedObject ActualParameterList
1232 /********/
1234 ConstrainedType
1235 : Type Constraint
1237 $1->AddConstraint($2);
1239 | TypeWithConstraint
1242 TypeWithConstraint
1243 : SET Constraint OF_t Type
1245 $$ = new SetOfType($4, $2);
1247 | SET SizeConstraint OF_t Type
1249 $$ = new SetOfType($4, new Constraint($2));
1251 | SEQUENCE Constraint OF_t Type
1253 $$ = new SequenceOfType($4, $2);
1255 | SEQUENCE SizeConstraint OF_t Type
1257 $$ = new SequenceOfType($4, new Constraint($2));
1261 Constraint
1262 : '(' ConstraintSpec ExceptionSpec ')'
1264 $$ = $2;
1268 ConstraintSpec
1269 : ElementSetSpecs
1270 | GeneralConstraint
1274 ExceptionSpec
1275 : '!' ExceptionIdentification
1277 $$ = $2;
1279 | /* empty */
1281 $$ = NULL;
1286 ExceptionIdentification
1287 : SignedNumber
1289 $$ = new IntegerValue($1);
1291 | DefinedValue
1292 | Type ':' Value
1294 delete $1;
1295 PError << StdError(Warning) << "Typed exception unsupported" << endl;
1296 $$ = $3;
1301 ElementSetSpecs
1302 : ElementSetSpec
1304 $$ = new Constraint($1, FALSE, NULL);
1306 | ElementSetSpec ',' '.' '.' '.'
1308 $$ = new Constraint($1, TRUE, NULL);
1310 | '.' '.' '.' ',' ElementSetSpec
1312 $$ = new Constraint(NULL, TRUE, $5);
1314 | ElementSetSpec ',' '.' '.' '.' ElementSetSpec
1316 $$ = new Constraint($1, TRUE, $6);
1321 ElementSetSpec
1322 : Unions
1323 | ALL Exclusions
1325 $$ = new ConstraintElementList;
1326 $$->Append(new ConstrainAllConstraintElement($2));
1331 Unions
1332 : Intersections
1334 $$ = new ConstraintElementList;
1335 $$->Append(new ElementListConstraintElement($1));
1337 | Unions UnionMark Intersections
1339 $1->Append(new ElementListConstraintElement($3));
1343 Intersections
1344 : IntersectionElements
1346 $$ = new ConstraintElementList;
1347 $$->Append($1);
1349 | Intersections IntersectionMark IntersectionElements
1351 $1->Append($3);
1355 IntersectionElements
1356 : Elements
1357 | Elements Exclusions
1359 $1->SetExclusions($2);
1363 Exclusions
1364 : EXCEPT Elements
1366 $$ = $2;
1370 UnionMark
1371 : '|'
1372 | UNION
1375 IntersectionMark
1376 : '^'
1377 | INTERSECTION
1380 Elements
1381 : SubtypeElements
1382 | ObjectSetElements
1383 | '(' ElementSetSpec ')'
1385 $$ = new ElementListConstraintElement($2);
1390 SubtypeElements
1391 : Value
1393 $$ = new SingleValueConstraintElement($1);
1395 | ContainedSubtype
1397 $$ = new SubTypeConstraintElement($1);
1399 | ValueRange
1400 | PermittedAlphabet
1401 | SizeConstraint
1402 /*| TypeConstraint This is really Type and causes ambiguity with ContainedSubtype */
1403 | InnerTypeConstraints
1406 ValueRange
1407 : LowerEndpoint '.' '.' UpperEndpoint
1409 $$ = new ValueRangeConstraintElement($1, $4);
1413 LowerEndpoint
1414 : LowerEndValue
1415 | LowerEndValue '<'
1418 UpperEndpoint
1419 : UpperEndValue
1420 | '<' UpperEndValue
1422 $$ = $2;
1426 LowerEndValue
1427 : Value
1428 | MIN_t
1430 $$ = new MinValue;
1434 UpperEndValue
1435 : Value
1436 | MAX_t
1438 $$ = new MaxValue;
1442 PermittedAlphabet
1443 : FROM Constraint
1445 $$ = new FromConstraintElement($2);
1449 ContainedSubtype
1450 : INCLUDES Type
1452 $$ = $2;
1454 /*| Type Actual grammar has INCLUDES keyword optional but this is
1455 horribly ambiguous, so only support a few specific Type
1456 definitions */
1457 | ConstrainedType
1458 | BuiltinType
1459 | DefinedType
1460 | UsefulType
1464 SizeConstraint
1465 : SIZE_t Constraint
1467 $$ = new SizeConstraintElement($2);
1472 InnerTypeConstraints
1473 : WITH COMPONENT Constraint
1475 $$ = new WithComponentConstraintElement(NULL, $3, WithComponentConstraintElement::Default);
1477 | WITH COMPONENTS MultipleTypeConstraints
1479 $$ = $3;
1483 MultipleTypeConstraints
1484 : '{' TypeConstraints '}' /* FullSpecification */
1486 $$ = new InnerTypeConstraintElement($2, FALSE);
1488 | '{' '.' '.' '.' ',' TypeConstraints '}' /* PartialSpecification */
1490 $$ = new InnerTypeConstraintElement($6, TRUE);
1494 TypeConstraints
1495 : NamedConstraint
1497 $$ = new ConstraintElementList;
1498 $$->Append($1);
1500 | NamedConstraint ',' TypeConstraints
1502 $3->Append($1);
1503 $$ = $3;
1507 NamedConstraint
1508 : IDENTIFIER PresenceConstraint
1510 $$ = new WithComponentConstraintElement($1, NULL, (int)$2);
1512 | IDENTIFIER Constraint PresenceConstraint
1514 $$ = new WithComponentConstraintElement($1, $2, (int)$3);
1518 PresenceConstraint
1519 : PRESENT
1521 $$ = WithComponentConstraintElement::Present;
1523 | ABSENT
1525 $$ = WithComponentConstraintElement::Absent;
1527 | OPTIONAL_t
1529 $$ = WithComponentConstraintElement::Optional;
1531 | /* empty */
1533 $$ = WithComponentConstraintElement::Default;
1538 GeneralConstraint
1539 : UserDefinedConstraint
1540 | TableConstraint
1543 UserDefinedConstraint
1544 : CONSTRAINED BY '{' UserDefinedConstraintParameterList '}'
1546 $$ = new Constraint($4);
1550 UserDefinedConstraintParameterList
1551 : /* empty */
1553 $$ = new UserDefinedConstraintElement(NULL);
1555 | UserDefinedConstraintParameters
1557 $$ = new UserDefinedConstraintElement($1);
1561 UserDefinedConstraintParameters
1562 : UserDefinedConstraintParameter ',' UserDefinedConstraintParameters
1564 $3->Append($1);
1565 $$ = $3;
1567 | UserDefinedConstraintParameter
1569 $$ = new TypesList;
1570 $$->Append($1);
1574 UserDefinedConstraintParameter
1575 : Governor ':' ActualParameter
1577 $$ = $3;
1579 | ActualParameter
1583 TableConstraint
1584 : ObjectSet /* SimpleTableConstraint */
1585 | ComponentRelationConstraint
1588 ComponentRelationConstraint
1589 : '{' DefinedObjectSet '}' '{' AtNotations '}'
1590 { $$ = NULL; }
1593 AtNotations
1594 : AtNotations ',' AtNotation
1595 | AtNotation
1598 AtNotation
1599 : '@' ComponentIdList
1600 | '@' '.' ComponentIdList
1603 ComponentIdList
1604 : ComponentIdList '.' IDENTIFIER
1605 | IDENTIFIER
1609 /********/
1611 ObjectClassAssignment
1612 : OBJECTCLASSREFERENCE ASSIGNMENT ObjectClass
1616 ObjectAssignment
1617 : OBJECTREFERENCE DefinedObjectClass ASSIGNMENT Object
1621 ObjectSetAssignment
1622 : OBJECTSETREFERENCE DefinedObjectClass ASSIGNMENT ObjectSet
1627 ObjectClass
1628 : DefinedObjectClass
1630 | ObjectClassDefn
1631 | ParameterizedObjectClass
1634 DefinedObjectClass
1635 : ExternalObjectClassReference
1636 | OBJECTCLASSREFERENCE
1637 | UsefulObjectClassReference
1641 ExternalObjectClassReference
1642 : MODULEREFERENCE '.' OBJECTCLASSREFERENCE
1644 $$ = ConcatNames($1, '.', $3);
1648 UsefulObjectClassReference
1649 : TYPE_IDENTIFIER
1651 $$ = new PString("TYPE-IDENTIFIER");
1653 | ABSTRACT_SYNTAX
1655 $$ = new PString("ABSTRACT-SYNTAX");
1660 ObjectClassDefn
1661 : CLASS '{' FieldSpecs '}' WithSyntaxSpec
1664 FieldSpecs
1665 : FieldSpecs ',' FieldSpec
1666 | FieldSpec
1669 FieldSpec
1670 : TypeFieldSpec
1671 | FixedTypeValueFieldSpec
1672 | VariableTypeValueFieldSpec
1673 | FixedTypeValueSetFieldSpec
1674 | VariableTypeValueSetFieldSpec
1675 | ObjectFieldSpec
1676 | ObjectSetFieldSpec
1679 TypeFieldSpec
1680 : TYPEFIELDREFERENCE TypeOptionalitySpec
1684 TypeOptionalitySpec
1685 : OPTIONAL_t
1686 | DEFAULT Type
1687 | /* empty */
1690 FixedTypeValueFieldSpec
1691 : VALUEFIELDREFERENCE Type Unique ValueOptionalitySpec
1695 Unique
1696 : UNIQUE
1697 | /* empty */
1700 ValueOptionalitySpec
1701 : OPTIONAL_t
1702 | DEFAULT Value
1703 | /* empty */
1706 VariableTypeValueFieldSpec
1707 : VALUEFIELDREFERENCE FieldName ValueOptionalitySpec
1711 FixedTypeValueSetFieldSpec
1712 : VALUESETFIELDREFERENCE Type ValueSetOptionalitySpec
1716 ValueSetOptionalitySpec
1717 : OPTIONAL_t
1718 | DEFAULT ValueSet
1719 | /* empty */
1722 VariableTypeValueSetFieldSpec
1723 : VALUESETFIELDREFERENCE FieldName ValueSetOptionalitySpec
1727 ObjectFieldSpec
1728 : OBJECTFIELDREFERENCE DefinedObjectClass ObjectOptionalitySpec
1732 ObjectOptionalitySpec
1733 : OPTIONAL_t
1734 | DEFAULT Object
1735 | /* empty */
1738 ObjectSetFieldSpec
1739 : OBJECTSETFIELDREFERENCE DefinedObjectClass ObjectSetOptionalitySpec
1743 ObjectSetOptionalitySpec
1744 : OPTIONAL_t
1745 | DEFAULT ObjectSet
1746 | /* empty */
1749 WithSyntaxSpec
1750 : WITH SYNTAX SyntaxList
1751 | /* empty */
1754 SyntaxList
1755 : '{' TokenOrGroupSpecs '}'
1756 | '{' '}'
1759 TokenOrGroupSpecs
1760 : TokenOrGroupSpecs TokenOrGroupSpec
1761 | TokenOrGroupSpec
1764 TokenOrGroupSpec
1765 : RequiredToken
1766 | OptionalGroup
1769 OptionalGroup
1770 : '[' TokenOrGroupSpecs ']'
1773 RequiredToken
1774 : Literal
1775 | PrimitiveFieldName
1779 Literal
1780 : BIT
1781 | BOOLEAN_t
1782 | CHARACTER
1783 | CHOICE
1784 | EMBEDDED
1785 | END
1786 | ENUMERATED
1787 | EXTERNAL
1788 | FALSE_t
1789 | INSTANCE
1790 | INTEGER
1792 | INTERSECTION
1793 | MINUS_INFINITY
1794 | NULL_TYPE
1795 | OBJECT
1796 | OCTET
1797 | PLUS_INFINITY
1798 | REAL
1799 | SEQUENCE
1800 | SET
1801 | TRUE_t
1802 | UNION
1803 | ','
1807 DefinedObject
1808 : ExternalObjectReference
1809 | OBJECTREFERENCE
1813 ExternalObjectReference
1814 : MODULEREFERENCE '.' OBJECTREFERENCE
1819 ParameterizedObjectClass
1820 : DefinedObjectClass ActualParameterList
1825 DefinedObjectSet
1826 : ExternalObjectSetReference
1828 | OBJECTSETREFERENCE
1832 ExternalObjectSetReference
1833 : MODULEREFERENCE '.' OBJECTSETREFERENCE
1838 ParameterizedObjectSet
1839 : DefinedObjectSet ActualParameterList
1843 FieldName
1844 : FieldName '.' PrimitiveFieldName
1846 $$ = ConcatNames($1, '.', $3);
1848 | PrimitiveFieldName
1852 PrimitiveFieldName
1853 : TYPEFIELDREFERENCE
1854 | VALUEFIELDREFERENCE
1855 | VALUESETFIELDREFERENCE
1856 | OBJECTFIELDREFERENCE
1857 | OBJECTSETFIELDREFERENCE
1861 Object
1862 : DefinedObject
1864 /*!!!
1865 | ObjectDefn
1868 | ObjectFromObject
1870 | ParameterizedObject
1875 /*!!!!
1876 ObjectDefn
1877 : DefaultSyntax
1878 | DefinedSyntax
1881 DefaultSyntax
1882 : '{' FieldSettings '}
1883 : '{' '}
1886 FieldSettings
1887 : FieldSettings ',' FieldSetting
1888 | FieldSetting
1891 FieldSetting
1892 : PrimitiveFieldName Setting
1895 DefinedSyntax
1896 : '{' DefinedSyntaxTokens '}'
1899 DefinedSyntaxTokens
1900 : DefinedSyntaxTokens DefinedSyntaxToken
1901 | /* empty *//*
1904 DefinedSyntaxToken
1905 : Literal
1906 | Setting
1909 Setting
1910 : Type
1911 | Value
1912 | ValueSet
1913 | Object
1914 | ObjectSet
1919 ObjectSet
1920 : '{' ElementSetSpec '}'
1925 ObjectFromObject
1926 : ReferencedObjects '.' FieldName
1930 ObjectSetElements
1931 : Object
1933 | DefinedObjectSet
1935 /*!!!
1936 | ObjectSetFromObjects
1938 | ParameterizedObjectSet
1942 /*!!!
1943 ObjectSetFromObjects
1944 : ReferencedObjects '.' FieldName
1950 /********/
1952 ParameterizedAssignment
1953 : ParameterizedTypeAssignment
1954 | ParameterizedValueAssignment
1955 | ParameterizedValueSetTypeAssignment
1956 | ParameterizedObjectClassAssignment
1957 | ParameterizedObjectAssignment
1958 | ParameterizedObjectSetAssignment
1961 ParameterizedTypeAssignment
1962 : TYPEREFERENCE ParameterList
1964 DummyParameters = $2;
1966 ASSIGNMENT Type
1968 DummyParameters = NULL;
1969 $5->SetName($1);
1970 $5->SetParameters($2);
1971 Module->AddType($5);
1975 ParameterizedValueAssignment
1976 : IDENTIFIER ParameterList Type ASSIGNMENT Value
1980 ParameterizedValueSetTypeAssignment
1981 : TYPEREFERENCE ParameterList Type ASSIGNMENT ValueSet
1985 ParameterizedObjectClassAssignment
1986 : OBJECTCLASSREFERENCE ParameterList ASSIGNMENT ObjectClass
1990 ParameterizedObjectAssignment
1991 : OBJECTREFERENCE ParameterList DefinedObjectClass ASSIGNMENT Object
1995 ParameterizedObjectSetAssignment
1996 : OBJECTSETREFERENCE ParameterList DefinedObjectClass ASSIGNMENT ObjectSet
2000 ParameterList
2001 : '{' Parameters '}'
2003 $$ = $2;
2007 Parameters
2008 : Parameters ',' Parameter
2010 $$ = $1;
2011 $$->Append($3);
2013 | Parameter
2015 $$ = new PStringList;
2016 $$->Append($1);
2020 Parameter
2021 : Governor ':' Reference
2023 $$ = $3;
2025 | Reference
2028 Governor
2029 : Type
2031 | DefinedObjectClass
2036 ParameterizedType
2037 : SimpleDefinedType ActualParameterList
2039 $$ = new ParameterizedType($1, $2);
2043 SimpleDefinedType
2044 : ExternalTypeReference
2045 | TYPEREFERENCE
2049 ActualParameterList
2050 : '{' ActualParameters '}'
2052 $$ = $2;
2056 ActualParameters
2057 : ActualParameters ',' ActualParameter
2059 $1->Append($3);
2060 $$ = $1;
2062 | ActualParameter
2064 $$ = new TypesList;
2065 $$->Append($1);
2069 ActualParameter
2070 : Type
2071 | Value
2073 | ValueSet
2075 | DefinedObjectClass
2077 /*!!!
2078 | Object
2080 | ObjectSet
2086 /********/
2088 ValueAssignment
2089 : IDENTIFIER Type
2091 IdentifierTokenContext = $2->GetIdentifierTokenContext();
2092 BraceTokenContext = $2->GetBraceTokenContext();
2093 NullTokenContext = NULL_VALUE;
2095 ASSIGNMENT Value
2097 $5->SetValueName($1);
2098 Module->AddValue($5);
2099 IdentifierTokenContext = IDENTIFIER;
2100 BraceTokenContext = '{';
2101 NullTokenContext = NULL_TYPE;
2106 Value
2107 : BuiltinValue
2108 | ReferencedValue
2112 BuiltinValue
2113 : BitStringValue
2114 | BooleanValue
2115 | CharacterStringValue
2116 | ChoiceValue
2117 /*| EmbeddedPDVValue synonym to SequenceValue */
2118 /*| EnumeratedValue synonym to IDENTIFIER */
2119 /*| ExternalValue synonym to SequenceValue */
2120 /*| InstanceOfValue synonym to Value */
2121 | SignedNumber /* IntegerValue */
2123 $$ = new IntegerValue($1);
2125 | NullValue
2126 /*!!!
2127 | ObjectClassFieldValue
2129 | ObjectIdentifierValue
2130 | OctetStringValue
2131 | RealValue
2132 | SequenceValue
2133 /*!!!!
2134 | SequenceOfValue
2136 /*| SetValue synonym to SequenceValue */
2137 /*| SetOfValue synonym to SequenceOfValue */
2138 /*| TaggedValue synonym to Value */
2142 DefinedValue
2143 : ExternalValueReference
2145 $$ = new DefinedValue($1);
2147 | IDENTIFIER
2149 $$ = new DefinedValue($1);
2151 | ParameterizedValue
2155 ExternalValueReference
2156 : MODULEREFERENCE '.' IDENTIFIER
2158 *$1 += *$3;
2159 delete $3;
2164 ObjectIdentifierValue
2165 : OID_BRACE
2167 IdentifierTokenContext = OID_IDENTIFIER;
2169 ObjIdComponentList '}'
2171 $$ = new ObjectIdentifierValue($3);
2172 IdentifierTokenContext = IDENTIFIER;
2174 /*!!!
2175 | '{' DefinedValue_OID ObjIdComponentList '}'
2177 $$ = new ObjectIdentifierValue($2);
2183 ObjIdComponentList
2184 : ObjIdComponent
2186 $$ = new PStringList;
2187 $$->Append($1);
2189 | ObjIdComponent ObjIdComponentList
2191 $2->InsertAt(0, $1);
2192 $$ = $2;
2196 ObjIdComponent
2197 : OID_IDENTIFIER
2198 | INTEGER
2200 $$ = new PString(PString::Unsigned, (int)$1);
2202 | OID_IDENTIFIER '(' NumberForm ')'
2204 delete $1;
2205 $$ = $3;
2209 NumberForm
2210 : INTEGER
2212 $$ = new PString(PString::Unsigned, (int)$1);
2214 | ExternalValueReference
2215 | OID_IDENTIFIER
2219 OctetStringValue
2220 : OS_BSTRING
2222 $$ = new OctetStringValue($1);
2224 | OS_HSTRING
2226 $$ = new OctetStringValue($1);
2230 BitStringValue
2231 : BS_BSTRING
2233 $$ = new BitStringValue($1);
2235 | BS_HSTRING
2237 $$ = new BitStringValue($1);
2239 | BITSTRING_BRACE BitIdentifierList '}'
2241 $$ = new BitStringValue($2);
2243 | BITSTRING_BRACE '}'
2245 $$ = new BitStringValue;
2250 BitIdentifierList
2251 : BIT_IDENTIFIER
2253 $$ = new PStringList;
2255 | BitIdentifierList ',' BIT_IDENTIFIER
2257 // Look up $3
2258 $1->SetAt($1->GetSize(), 0);
2263 BooleanValue
2264 : TRUE_t
2266 $$ = new BooleanValue(TRUE);
2268 | FALSE_t
2270 $$ = new BooleanValue(FALSE);
2275 CharacterStringValue
2276 : RestrictedCharacterStringValue
2277 /*!!!
2278 | UnrestrictedCharacterStringValue
2282 RestrictedCharacterStringValue
2283 : CSTRING
2285 $$ = new CharacterStringValue($1);
2287 | CharacterStringList
2288 | Quadruple
2289 | Tuple
2292 CharacterStringList
2293 : STRING_BRACE CharSyms '}'
2295 $$ = new CharacterStringValue($2);
2299 CharSyms
2300 : CharsDefn
2302 $$ = new PStringList;
2303 $$->Append($1);
2305 | CharSyms ',' CharsDefn
2307 $1->Append($3);
2311 CharsDefn
2312 : CSTRING
2313 | DefinedValue
2315 PError << StdError(Warning) << "DefinedValue in string unsupported" << endl;
2319 Quadruple
2320 : STRING_BRACE INTEGER ',' INTEGER ',' INTEGER ',' INTEGER '}'
2322 if ($2 != 0 || $4 != 0 || $6 > 255 || $8 > 255)
2323 PError << StdError(Warning) << "Illegal value in Character Quadruple" << endl;
2324 $$ = new CharacterValue((BYTE)$2, (BYTE)$4, (BYTE)$6, (BYTE)$8);
2328 Tuple
2329 : STRING_BRACE INTEGER ',' INTEGER '}'
2331 if ($2 > 255 || $4 > 255)
2332 PError << StdError(Warning) << "Illegal value in Character Tuple" << endl;
2333 $$ = new CharacterValue((BYTE)$2, (BYTE)$4);
2338 ChoiceValue
2339 : IDENTIFIER ':' Value
2341 $3->SetValueName($1);
2342 $$ = $3;
2347 NullValue
2348 : NULL_VALUE
2350 $$ = new NullValue;
2355 RealValue
2356 : NumericRealValue
2357 | SpecialRealValue
2360 NumericRealValue
2361 : '0'
2363 $$ = new RealValue(0);
2365 /*!!!
2366 | SequenceValue
2370 SpecialRealValue
2371 : PLUS_INFINITY
2373 $$ = new RealValue(0);
2375 | MINUS_INFINITY
2377 $$ = new RealValue(0);
2382 SequenceValue
2383 : '{' ComponentValueList '}'
2385 $$ = new SequenceValue($2);
2387 | '{' '}'
2389 $$ = new SequenceValue;
2393 ComponentValueList
2394 : NamedValue
2396 $$ = new ValuesList;
2397 $$->Append($1);
2399 | ComponentValueList ',' NamedValue
2401 $1->Append($3);
2405 NamedValue
2406 : IDENTIFIER Value
2408 $2->SetValueName($1);
2409 $$ = $2;
2414 /*!!!!
2415 SequenceOfValue
2416 : '{' ValueList '}'
2418 $$ = NULL;
2420 | '{' '}'
2422 $$ = NULL;
2426 ValueList
2427 : Value
2429 | ValueList ',' Value
2435 /*!!!
2436 ObjectClassFieldValue
2437 : OpenTypeFieldVal
2438 | Value
2441 OpenTypeFieldVal
2442 : Type ':' Value
2447 ReferencedValue
2448 : DefinedValue
2449 /*!!!!
2450 | ValueFromObject
2454 /*!!!!
2455 ValueFromObject
2456 : ReferencedObjects '.' FieldName
2462 ParameterizedValue
2463 : SimpleDefinedValue ActualParameterList
2467 SimpleDefinedValue
2468 : ExternalValueReference
2469 | IDENTIFIER
2474 /********/
2476 ValueSet
2477 : '{' ElementSetSpecs '}'
2481 /********/
2483 MacroDefinition
2484 : TYPEREFERENCE MACRO ASSIGNMENT MacroSubstance
2486 PError << StdError(Warning) << "MACRO unsupported" << endl;
2490 MacroSubstance
2491 : BEGIN_t
2493 InMacroContext = TRUE;
2495 MacroBody END
2497 InMacroContext = FALSE;
2499 | TYPEREFERENCE
2501 | TYPEREFERENCE '.' TYPEREFERENCE
2505 MacroBody
2506 : TypeProduction ValueProduction /*SupportingProductions*/
2509 TypeProduction
2510 : TYPE_t NOTATION ASSIGNMENT MacroAlternativeList
2513 ValueProduction
2514 : VALUE NOTATION ASSIGNMENT MacroAlternativeList
2519 SupportingProductions
2520 : ProductionList
2521 | /* empty *//*
2524 ProductionList
2525 : Production
2526 | ProductionList Production
2529 Production
2530 : TYPEREFERENCE ASSIGNMENT MacroAlternativeList
2535 MacroAlternativeList
2536 : MacroAlternative
2537 | MacroAlternative '|' MacroAlternativeList
2540 MacroAlternative
2541 : SymbolElement
2542 | SymbolElement MacroAlternative
2545 SymbolElement
2546 : SymbolDefn
2547 | EmbeddedDefinitions
2550 SymbolDefn
2551 : CSTRING
2553 | TYPEREFERENCE
2555 | TYPEREFERENCE ASSIGNMENT
2557 | string_t
2558 | identifier_t
2559 | number_t
2560 | empty_t
2561 | type_t
2562 | type_t '(' TYPE_t TYPEREFERENCE ')'
2563 | value_t '(' Type ')'
2564 | value_t '(' IDENTIFIER Type ')'
2565 | value_t '(' VALUE Type ')'
2568 EmbeddedDefinitions
2569 : '<' EmbeddedDefinitionList '>'
2572 EmbeddedDefinitionList
2573 : EmbeddedDefinition
2574 | EmbeddedDefinitionList EmbeddedDefinition
2577 EmbeddedDefinition
2578 : LocalTypeAssignment
2579 | LocalValueAssignment
2582 LocalTypeAssignment
2583 : TYPEREFERENCE ASSIGNMENT Type
2587 LocalValueAssignment
2588 : IDENTIFIER Type ASSIGNMENT Value
2593 /********/
2595 ObjectTypeDefinition
2596 : IDENTIFIER OBJECT_TYPE
2598 InMIBContext = TRUE;
2600 SYNTAX Type
2601 ACCESS ObjectTypeAccess
2602 STATUS ObjectTypeStatus
2603 MibDescrPart
2604 MibReferPart
2605 MibIndexPart
2606 MibDefValPart
2608 IdentifierTokenContext = OID_IDENTIFIER;
2610 ASSIGNMENT Value
2612 Module->AddMIB(new MibObject($1, $5, (MibObject::Access)$7, (MibObject::Status)$9, $10, $11, $12, $13, $16));
2613 InMIBContext = FALSE;
2614 IdentifierTokenContext = IDENTIFIER;
2618 ObjectTypeAccess
2619 : read_only_t
2621 $$ = MibObject::read_only;
2623 | read_write_t
2625 $$ = MibObject::read_write;
2627 | write_only_t
2629 $$ = MibObject::write_only;
2631 | not_accessible_t
2633 $$ = MibObject::not_accessible;
2637 ObjectTypeStatus
2638 : mandatory_t
2640 $$ = MibObject::mandatory;
2642 | optional_t
2644 $$ = MibObject::optional;
2646 | obsolete_t
2648 $$ = MibObject::obsolete;
2650 | deprecated_t
2652 $$ = MibObject::deprecated;
2656 MibDescrPart
2657 : DESCRIPTION_t CSTRING
2659 $$ = $2;
2661 | /* empty */
2663 $$ = NULL;
2667 MibReferPart
2668 : REFERENCE_t CSTRING
2670 $$ = $2;
2672 | /* empty */
2674 $$ = NULL;
2678 MibIndexPart
2679 : INDEX_t '{' MibIndexTypes '}'
2681 $$ = $3;
2683 | /* empty */
2685 $$ = NULL;
2689 MibIndexTypes
2690 : MibIndexType
2692 $$ = new PStringList;
2693 $$->Append($1);
2695 | MibIndexTypes ',' MibIndexType
2697 $1->Append($3);
2701 MibIndexType
2702 : IDENTIFIER
2703 | TYPEREFERENCE
2706 MibDefValPart
2707 : DEFVAL_t '{' Value '}'
2709 $$ = $3;
2711 | /* empty */
2713 $$ = NULL;
2717 TrapTypeDefinition
2718 : IDENTIFIER TRAP_TYPE
2720 InMIBContext = TRUE;
2721 IdentifierTokenContext = OID_IDENTIFIER;
2723 ENTERPRISE Value
2724 MibVarPart
2725 MibDescrPart
2726 MibReferPart
2727 ASSIGNMENT Value
2729 Module->AddMIB(new MibTrap($1, $5, $6, $7, $8, $10));
2730 IdentifierTokenContext = IDENTIFIER;
2731 InMIBContext = FALSE;
2735 MibVarPart
2736 : VARIABLES '{' MibVarTypes '}'
2738 $$ = $3;
2740 | /* empty */
2742 $$ = NULL;
2746 MibVarTypes
2747 : Value
2749 $$ = new ValuesList;
2750 $$->Append($1);
2752 | MibVarTypes ',' Value
2754 $1->Append($3);
2760 /********/
2762 /*!!! Not actually referenced by any other part of grammar
2763 AbsoluteReference
2764 : '@' GlobalModuleReference '.' ItemSpec
2767 ItemSpec
2768 : TYPEREFERENCE
2769 | ItemId '.' ComponentId
2772 ItemId
2773 : ItemSpec
2776 ComponentId
2777 : IDENTIFIER
2778 | INTEGER
2779 | '*'
2784 Reference
2785 : TYPEREFERENCE
2786 | IDENTIFIER
2787 | OBJECTCLASSREFERENCE
2788 | OBJECTREFERENCE
2789 | OBJECTSETREFERENCE
2792 ParameterizedReference
2793 : Reference '{' '}'
2795 $$ = new ImportedType($1, TRUE);
2800 NamedNumberList
2801 : NamedNumber
2803 $$ = new NamedNumberList;
2804 $$->Append($1);
2806 | NamedNumberList ',' NamedNumber
2808 $1->Append($3);
2812 NamedNumber
2813 : IDENTIFIER '(' SignedNumber ')'
2815 $$ = new NamedNumber($1, (int)$3);
2817 | IDENTIFIER '(' DefinedValue ')'
2819 $$ = new NamedNumber($1, ((DefinedValue*)$3)->GetReference());
2820 delete $3;
2825 SignedNumber
2826 : INTEGER
2827 | '-' INTEGER
2829 $$ = -$2;
2834 /** End of File ****/