Added ifdef for Zeta build
[pwlib.git] / tools / asnparser / asn_grammar.y
blob8c94c8d02717e89331f89de58c866848e40d25ea
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.13 2004/04/03 08:22:23 csoutheren
38 * Remove pseudo-RTTI and replaced with real RTTI
40 * Revision 1.12 2001/10/02 00:56:04 robertj
41 * Fixed problem with autonumering enumerated types.
43 * Revision 1.11 2001/01/16 14:00:17 craigs
44 * Changed MIN and MAX tokens to avoid namespace conflicts under BeOS
46 * Revision 1.10 2000/05/08 08:55:44 robertj
47 * Fixed production error for ValueSet, thanks Huang-Ming Huang
49 * Revision 1.9 2000/01/19 12:33:07 robertj
50 * Fixed parsing of OID's in IMPORTS section.
52 * Revision 1.8 2000/01/19 03:38:12 robertj
53 * Fixed support for parsing multiple IMPORTS
55 * Revision 1.7 1999/07/22 06:48:54 robertj
56 * Added comparison operation to base ASN classes and compiled ASN code.
57 * Added support for ANY type in ASN parser.
59 * Revision 1.6 1999/06/09 06:58:08 robertj
60 * Adjusted heading comments.
62 * Revision 1.5 1999/06/07 01:56:25 robertj
63 * Added header comment on license.
65 * Revision 1.4 1999/06/06 05:30:28 robertj
66 * Support for parameterised types and type-dentifier types.
67 * Added ability to output multiple .cxx files.
69 * Revision 1.3 1998/12/14 06:47:55 robertj
70 * New memory check code support.
72 * Revision 1.2 1998/05/21 04:21:46 robertj
73 * Implementing more of the ASN spec.
75 * Revision 1.1 1997/12/13 09:17:47 robertj
76 * Initial revision
80 #include <ptlib.h>
82 #undef malloc
83 #undef calloc
84 #undef realloc
85 #undef free
87 #include "main.h"
89 extern int yylex();
91 extern int ReferenceTokenContext;
92 extern int IdentifierTokenContext;
93 extern int BraceTokenContext;
94 extern int NullTokenContext;
95 extern int InMacroContext;
96 extern int HasObjectTypeMacro;
97 extern int InMIBContext;
98 extern TypesList * CurrentImportList;
100 static int UnnamedFieldCount = 1;
101 static PStringList * DummyParameters;
103 static PString * ConcatNames(PString * s1, char c, PString * s2)
105 *s1 += c;
106 *s1 += *s2;
107 delete s2;
108 return s1;
111 #ifdef _MSC_VER
112 #pragma warning(disable:4701)
113 #endif
117 %token IDENTIFIER
118 %token BIT_IDENTIFIER
119 %token OID_IDENTIFIER
120 %token IMPORT_IDENTIFIER
121 %token MODULEREFERENCE
122 %token TYPEREFERENCE
123 %token OBJECTCLASSREFERENCE
124 %token TYPEFIELDREFERENCE
125 %token VALUEFIELDREFERENCE
126 %token VALUESETFIELDREFERENCE
127 %token OBJECTFIELDREFERENCE
128 %token OBJECTSETFIELDREFERENCE
129 %token OBJECTREFERENCE
130 %token OBJECTSETREFERENCE
131 %token INTEGER
133 %token CSTRING
134 %token OS_BSTRING
135 %token BS_BSTRING
136 %token OS_HSTRING
137 %token BS_HSTRING
139 %token STRING_BRACE
140 %token BITSTRING_BRACE
141 %token OID_BRACE
143 %token ABSENT
144 %token ABSTRACT_SYNTAX
145 %token ALL
146 %token ANY
147 %token APPLICATION
148 %token ASSIGNMENT
149 %token AUTOMATIC
150 %token BEGIN_t
151 %token BIT
152 %token BMPString
153 %token BOOLEAN_t
154 %token BY
155 %token CHARACTER
156 %token CHOICE
157 %token CLASS
158 %token COMPONENT
159 %token COMPONENTS
160 %token CONSTRAINED
161 %token DEFAULT
162 %token DEFINED
163 %token DEFINITIONS
164 %token EMBEDDED
165 %token END
166 %token ENUMERATED
167 %token EXCEPT
168 %token EXPLICIT
169 %token EXPORTS
170 %token EXTERNAL
171 %token FALSE_t
172 %token FROM
173 %token GeneralString
174 %token GraphicString
175 %token IA5String
176 %token TYPE_IDENTIFIER
177 %token IDENTIFIER_t
178 %token IMPLICIT
179 %token IMPORTS
180 %token INCLUDES
181 %token INSTANCE
182 %token INTEGER_t
183 %token INTERSECTION
184 %token ISO646String
185 %token MACRO
186 %token MAX_t
187 %token MIN_t
188 %token MINUS_INFINITY
189 %token NOTATION
190 %token NULL_VALUE
191 %token NULL_TYPE
192 %token NumericString
193 %token OBJECT
194 %token OCTET
195 %token OF_t
196 %token OPTIONAL_t
197 %token PDV
198 %token PLUS_INFINITY
199 %token PRESENT
200 %token PrintableString
201 %token PRIVATE
202 %token REAL
203 %token SEQUENCE
204 %token SET
205 %token SIZE_t
206 %token STRING
207 %token SYNTAX
208 %token T61String
209 %token TAGS
210 %token TeletexString
211 %token TRUE_t
212 %token TYPE_t
213 %token UNION
214 %token UNIQUE
215 %token UNIVERSAL
216 %token UniversalString
217 %token VideotexString
218 %token VisibleString
219 %token GeneralizedTime
220 %token UTCTime
221 %token VALUE
222 %token WITH
223 %token string_t
224 %token identifier_t
225 %token number_t
226 %token empty_t
227 %token type_t
228 %token value_t
229 %token OBJECT_TYPE
230 %token TRAP_TYPE
231 %token ACCESS
232 %token STATUS
233 %token read_only_t
234 %token read_write_t
235 %token write_only_t
236 %token not_accessible_t
237 %token mandatory_t
238 %token optional_t
239 %token obsolete_t
240 %token deprecated_t
241 %token DESCRIPTION_t
242 %token REFERENCE_t
243 %token INDEX_t
244 %token DEFVAL_t
245 %token ENTERPRISE
246 %token VARIABLES
248 %token ObjectDescriptor_t
251 %type <ival> INTEGER
252 %type <ival> TagDefault
253 %type <ival> SignedNumber
254 %type <ival> ObjectTypeAccess ObjectTypeStatus
255 %type <ival> Class ClassNumber
256 %type <ival> PresenceConstraint
258 %type <sval> CSTRING
259 %type <sval> BS_BSTRING
260 %type <sval> OS_BSTRING
261 %type <sval> BS_HSTRING
262 %type <sval> OS_HSTRING
263 %type <sval> IDENTIFIER
264 %type <sval> BIT_IDENTIFIER
265 %type <sval> OID_IDENTIFIER
266 %type <sval> IMPORT_IDENTIFIER
267 %type <sval> TYPEREFERENCE
268 %type <sval> MODULEREFERENCE
269 %type <sval> OBJECTCLASSREFERENCE
270 %type <sval> TYPEFIELDREFERENCE
271 %type <sval> VALUEFIELDREFERENCE
272 %type <sval> VALUESETFIELDREFERENCE
273 %type <sval> OBJECTFIELDREFERENCE
274 %type <sval> OBJECTSETFIELDREFERENCE
275 %type <sval> OBJECTREFERENCE
276 %type <sval> OBJECTSETREFERENCE
277 %type <sval> DefinitiveObjIdComponent
278 %type <sval> DefinitiveNameAndNumberForm
279 %type <sval> GlobalModuleReference
280 %type <sval> Reference
281 %type <sval> ExternalTypeReference ExternalValueReference
282 %type <sval> ObjIdComponent
283 %type <sval> NumberForm
284 %type <sval> SimpleDefinedType
285 %type <sval> ComponentIdList
286 %type <sval> CharsDefn
287 %type <sval> SimpleDefinedValue
288 %type <sval> FieldName PrimitiveFieldName
289 %type <sval> DefinedObjectClass
290 %type <sval> ExternalObjectClassReference
291 %type <sval> UsefulObjectClassReference
292 %type <sval> Parameter
293 %type <sval> MibIndexType MibDescrPart MibReferPart
295 %type <slst> DefinitiveIdentifier
296 %type <slst> DefinitiveObjIdComponentList
297 %type <slst> ObjIdComponentList
298 %type <slst> BitIdentifierList
299 %type <slst> CharSyms
300 %type <slst> ParameterList Parameters
301 %type <slst> MibIndexTypes MibIndexPart
303 %type <tval> Type BuiltinType ReferencedType NamedType
304 %type <tval> DefinedType
305 %type <tval> ConstrainedType
306 %type <tval> TypeWithConstraint
307 %type <tval> BitStringType
308 %type <tval> BooleanType
309 %type <tval> CharacterStringType
310 %type <tval> RestrictedCharacterStringType
311 %type <tval> UnrestrictedCharacterStringType
312 %type <tval> ChoiceType AlternativeTypeLists
313 %type <tval> EmbeddedPDVType
314 %type <tval> EnumeratedType Enumerations
315 %type <tval> ExternalType
316 %type <tval> AnyType
317 %type <tval> IntegerType
318 %type <tval> NullType
319 %type <tval> ObjectClassFieldType
320 %type <tval> ObjectIdentifierType
321 %type <tval> OctetStringType
322 %type <tval> RealType
323 %type <tval> SequenceType ComponentType ComponentTypeLists
324 %type <tval> SequenceOfType
325 %type <tval> SetType
326 %type <tval> SetOfType
327 %type <tval> TaggedType
328 %type <tval> ParameterizedType
329 %type <tval> SelectionType
330 %type <tval> UsefulType
331 %type <tval> TypeFromObject
332 %type <tval> ContainedSubtype
333 %type <tval> ActualParameter
334 %type <tval> UserDefinedConstraintParameter
335 %type <tval> Symbol
336 %type <tval> ParameterizedReference
338 %type <tlst> AlternativeTypeList
339 %type <tlst> ComponentTypeList
340 %type <tlst> ActualParameterList ActualParameters
341 %type <tlst> UserDefinedConstraintParameters
342 %type <tlst> SymbolList
344 %type <vval> Value BuiltinValue
345 %type <vval> AssignedIdentifier
346 %type <vval> DefinedValue DefinedValue_Import
347 %type <vval> ObjectIdentifierValue
348 %type <vval> OctetStringValue
349 %type <vval> BitStringValue
350 %type <vval> ExceptionSpec
351 %type <vval> ExceptionIdentification
352 %type <vval> MibDefValPart
353 %type <vval> LowerEndpoint LowerEndValue UpperEndpoint UpperEndValue
354 %type <vval> ReferencedValue
355 %type <vval> BooleanValue
356 %type <vval> CharacterStringValue RestrictedCharacterStringValue
357 %type <vval> CharacterStringList Quadruple Tuple
358 %type <vval> ChoiceValue
359 %type <vval> NullValue
360 %type <vval> RealValue NumericRealValue SpecialRealValue
361 %type <vval> SequenceValue NamedValue
362 /*!!!! %type <vval> SequenceOfValue */
363 %type <vval> ParameterizedValue
365 %type <vlst> ComponentValueList
366 %type <vlst> MibVarPart MibVarTypes
368 %type <nval> NamedBit
369 %type <nval> EnumerationItem
370 %type <nval> NamedNumber
372 %type <nlst> NamedBitList
373 %type <nlst> Enumeration
374 %type <nlst> NamedNumberList
376 %type <elmt> IntersectionElements
377 %type <elmt> Elements
378 %type <elmt> Exclusions
379 %type <elmt> SubtypeElements
380 %type <elmt> ObjectSetElements
381 %type <elmt> ValueRange
382 %type <elmt> PermittedAlphabet
383 %type <elmt> InnerTypeConstraints
384 %type <elmt> MultipleTypeConstraints
385 %type <elmt> SizeConstraint
386 %type <elmt> UserDefinedConstraintParameterList
387 %type <elmt> NamedConstraint
389 %type <elst> ElementSetSpec Unions Intersections TypeConstraints
391 %type <cons> Constraint
392 %type <cons> ConstraintSpec
393 %type <cons> ElementSetSpecs
394 %type <cons> GeneralConstraint
395 %type <cons> UserDefinedConstraint
396 %type <cons> TableConstraint
397 %type <cons> ComponentRelationConstraint
398 %type <cons> ObjectSet
400 %type <tagv> Tag
403 %union {
404 PInt64 ival;
405 PString * sval;
406 PStringList * slst;
407 TypeBase * tval;
408 TypesList * tlst;
409 ValueBase * vval;
410 ValuesList * vlst;
411 NamedNumber * nval;
412 NamedNumberList * nlst;
413 Constraint * cons;
414 ConstraintElementList * elst;
415 ConstraintElementBase * elmt;
416 struct {
417 Tag::Type tagClass;
418 unsigned tagNumber;
419 } tagv;
425 ModuleDefinition
426 : MODULEREFERENCE DefinitiveIdentifier DEFINITIONS TagDefault ASSIGNMENT BEGIN_t
428 Module = new ModuleDefinition($1, $2, (Tag::Mode)$4);
429 ReferenceTokenContext = TYPEREFERENCE;
431 ModuleBody END
434 DefinitiveIdentifier
435 : '{' DefinitiveObjIdComponentList '}'
437 $$ = $2;
439 | /* empty */
441 $$ = new PStringList;
445 DefinitiveObjIdComponentList
446 : DefinitiveObjIdComponent
448 $$ = new PStringList;
449 $$->Append($1);
451 | DefinitiveObjIdComponent DefinitiveObjIdComponentList
453 $2->InsertAt(0, $1);
454 $$ = $2;
458 DefinitiveObjIdComponent
459 : IDENTIFIER
460 | INTEGER
462 $$ = new PString(PString::Unsigned, (int)$1);
464 | DefinitiveNameAndNumberForm
467 DefinitiveNameAndNumberForm
468 : IDENTIFIER '(' INTEGER ')'
470 delete $1;
471 $$ = new PString(PString::Unsigned, (int)$3);
475 TagDefault
476 : EXPLICIT TAGS
478 $$ = Tag::Explicit;
480 | IMPLICIT TAGS
482 $$ = Tag::Implicit;
484 | AUTOMATIC TAGS
486 $$ = Tag::Automatic;
488 | /* empty */
490 $$ = Tag::Explicit;
495 /*************************************/
497 ModuleBody
498 : Exports Imports AssignmentList
499 | /* empty */
503 Exports
504 : EXPORTS SymbolsExported ';'
505 | /* empty */
509 SymbolsExported
510 : SymbolList
512 Module->SetExports($1);
514 | /* empty */
516 Module->SetExportAll();
521 Imports
522 : IMPORTS SymbolsImported ';'
523 | /* empty */
527 SymbolsImported
528 : SymbolsFromModuleList
529 | /* empty */
532 SymbolsFromModuleList
533 : SymbolsFromModule
534 | SymbolsFromModuleList SymbolsFromModule
538 SymbolsFromModule
539 : SymbolList FROM
541 CurrentImportList = $1;
542 ReferenceTokenContext = MODULEREFERENCE;
544 GlobalModuleReference
546 if (!HasObjectTypeMacro) {
547 HasObjectTypeMacro = $1->GetValuesIndex(SearchType("OBJECT-TYPE")) != P_MAX_INDEX;
548 if (HasObjectTypeMacro)
549 PError << "Info: including OBJECT-TYPE macro" << endl;
551 Module->AddImport(new ImportModule($4, $1));
552 ReferenceTokenContext = TYPEREFERENCE;
553 CurrentImportList = NULL;
558 GlobalModuleReference
559 : MODULEREFERENCE
561 ReferenceTokenContext = TYPEREFERENCE;
562 BraceTokenContext = OID_BRACE;
564 AssignedIdentifier
566 BraceTokenContext = '{';
567 delete $3;
572 AssignedIdentifier
573 : DefinedValue_Import
574 | ObjectIdentifierValue
575 | /* empty */
577 $$ = NULL;
581 DefinedValue_Import
582 : ExternalValueReference
584 $$ = new DefinedValue($1);
586 | IMPORT_IDENTIFIER
588 $$ = new DefinedValue($1);
594 SymbolList
595 : Symbol
597 $$ = new TypesList;
598 $$->Append($1);
600 | Symbol ',' SymbolList
602 $3->Append($1);
603 $$ = $3;
608 Symbol
609 : Reference
611 $$ = new ImportedType($1, FALSE);
613 | ParameterizedReference /* only required for X.683 */
617 /*************************************/
619 AssignmentList: Assignment
620 | AssignmentList Assignment
624 Assignment
625 : TypeAssignment
626 | ValueAssignment
627 | ValueSetTypeAssignment
628 | ObjectClassAssignment
629 | ObjectAssignment
630 | ObjectSetAssignment
631 | ParameterizedAssignment
632 /* We do not have "real" macros, so fake MIB ones */
633 | MacroDefinition
634 | ObjectTypeDefinition
635 | TrapTypeDefinition
639 ValueSetTypeAssignment
640 : TYPEREFERENCE Type
642 $2->SetName($1);
643 Module->AddType($2);
644 IdentifierTokenContext = $2->GetIdentifierTokenContext();
645 BraceTokenContext = $2->GetBraceTokenContext();
647 ASSIGNMENT ValueSet
649 IdentifierTokenContext = IDENTIFIER;
650 BraceTokenContext = '{';
657 /********/
659 TypeAssignment
660 : TYPEREFERENCE ASSIGNMENT Type
662 $3->SetName($1);
663 Module->AddType($3);
668 Type
669 : ConstrainedType
670 | ReferencedType
671 | BuiltinType
675 BuiltinType
676 : BitStringType
677 | BooleanType
678 | CharacterStringType
679 | ChoiceType
680 | EmbeddedPDVType
681 | EnumeratedType
682 | ExternalType
683 | AnyType
684 | InstanceOfType
686 | IntegerType
687 | NullType
688 | ObjectClassFieldType
689 | ObjectIdentifierType
690 | OctetStringType
691 | RealType
692 | SequenceType
693 | SequenceOfType
694 | SetType
695 | SetOfType
696 | TaggedType
700 ReferencedType
701 : DefinedType
702 | UsefulType
703 | SelectionType
704 | TypeFromObject
705 /*!!! syntactically identical to TypeFromObject
706 | ValueSetFromObjects
711 DefinedType
712 : ExternalTypeReference
714 $$ = new DefinedType($1, FALSE);
716 | TYPEREFERENCE
718 $$ = new DefinedType($1,
719 DummyParameters != NULL &&
720 DummyParameters->GetValuesIndex(*$1) != P_MAX_INDEX);
722 | ParameterizedType
723 /*| ParameterizedValueSetType synonym for ParameterizedType */
727 ExternalTypeReference
728 : MODULEREFERENCE '.' TYPEREFERENCE
730 *$1 += *$3;
731 delete $3;
736 BitStringType
737 : BIT STRING
739 $$ = new BitStringType;
741 | BIT STRING '{' NamedBitList '}'
743 $$ = new BitStringType($4);
748 NamedBitList
749 : NamedBit
751 $$ = new NamedNumberList;
752 $$->Append($1);
754 | NamedBitList ',' NamedBit
756 $1->InsertAt(0, $3);
760 NamedBit
761 : IDENTIFIER '(' INTEGER ')'
763 $$ = new NamedNumber($1, (int)$3);
765 | IDENTIFIER '(' DefinedValue ')'
767 $$ = new NamedNumber($1, ((DefinedValue*)$3)->GetReference());
768 delete $3;
773 BooleanType
774 : BOOLEAN_t
776 $$ = new BooleanType;
781 CharacterStringType
782 : RestrictedCharacterStringType
783 | UnrestrictedCharacterStringType
786 RestrictedCharacterStringType
787 : BMPString
789 $$ = new BMPStringType;
791 | GeneralString
793 $$ = new GeneralStringType;
795 | GraphicString
797 $$ = new GraphicStringType;
799 | IA5String
801 $$ = new IA5StringType;
803 | ISO646String
805 $$ = new ISO646StringType;
807 | NumericString
809 $$ = new NumericStringType;
811 | PrintableString
813 $$ = new PrintableStringType;
815 | TeletexString
817 $$ = new TeletexStringType;
819 | T61String
821 $$ = new T61StringType;
823 | UniversalString
825 $$ = new UniversalStringType;
827 | VideotexString
829 $$ = new VideotexStringType;
831 | VisibleString
833 $$ = new VisibleStringType;
838 UnrestrictedCharacterStringType
839 : CHARACTER STRING
841 $$ = new UnrestrictedCharacterStringType;
846 ChoiceType
847 : CHOICE '{' AlternativeTypeLists '}'
849 $$ = $3;
853 AlternativeTypeLists
854 : AlternativeTypeList
856 $$ = new ChoiceType($1);
858 | AlternativeTypeList ',' ExtensionAndException
860 $$ = new ChoiceType($1, TRUE);
862 | AlternativeTypeList ',' ExtensionAndException ',' AlternativeTypeList
864 $$ = new ChoiceType($1, TRUE, $5);
868 AlternativeTypeList
869 : NamedType
871 $$ = new TypesList;
872 $$->Append($1);
874 | AlternativeTypeList ',' NamedType
876 $1->Append($3);
881 ExtensionAndException
882 : '.' '.' '.' ExceptionSpec
886 NamedType
887 : IDENTIFIER Type
889 $2->SetName($1);
890 $$ = $2;
892 | Type /* ITU-T Rec. X.680 Appendix H.1 */
894 PError << StdError(Warning) << "unnamed field." << endl;
895 $1->SetName(new PString(PString::Printf, "_unnamed%u", UnnamedFieldCount++));
897 /*| SelectionType /* Unnecessary as have rule in Type for this */
901 EmbeddedPDVType
902 : EMBEDDED PDV
904 $$ = new EmbeddedPDVType;
909 EnumeratedType
910 : ENUMERATED '{' Enumerations '}'
912 $$ = $3;
916 Enumerations
917 : Enumeration
919 $$ = new EnumeratedType($1, FALSE, NULL);
921 | Enumeration ',' '.' '.' '.'
923 $$ = new EnumeratedType($1, TRUE, NULL);
925 | Enumeration ',' '.' '.' '.' ',' Enumeration
927 $$ = new EnumeratedType($1, TRUE, $7);
931 Enumeration
932 : EnumerationItem
934 $$ = new NamedNumberList;
935 $$->Append($1);
937 | Enumeration ',' EnumerationItem
939 $1->Append($3);
940 PINDEX sz = $1->GetSize();
941 if (sz > 1)
942 $3->SetAutoNumber((*$1)[sz-2]);
943 $$ = $1;
947 EnumerationItem
948 : IDENTIFIER
950 $$ = new NamedNumber($1);
952 | NamedNumber
956 ExternalType
957 : EXTERNAL
959 $$ = new ExternalType;
964 AnyType
965 : ANY
967 $$ = new AnyType(NULL);
969 | ANY DEFINED BY IDENTIFIER
971 $$ = new AnyType($4);
976 InstanceOfType
977 : INSTANCE OF_t DefinedObjectClass
981 IntegerType
982 : INTEGER_t
984 $$ = new IntegerType;
986 | INTEGER_t '{' NamedNumberList '}'
988 $$ = new IntegerType($3);
993 NullType
994 : NULL_TYPE
996 $$ = new NullType;
1001 ObjectClassFieldType
1002 : DefinedObjectClass '.' FieldName
1004 $$ = new ObjectClassFieldType($1, $3);
1009 ObjectIdentifierType
1010 : OBJECT IDENTIFIER_t
1012 $$ = new ObjectIdentifierType;
1016 OctetStringType
1017 : OCTET STRING
1019 $$ = new OctetStringType;
1024 RealType
1025 : REAL
1027 $$ = new RealType;
1032 SequenceType
1033 : SEQUENCE '{' ComponentTypeLists '}'
1035 $$ = $3;
1037 | SEQUENCE '{' '}'
1039 $$ = new SequenceType(NULL, FALSE, NULL);
1041 | SEQUENCE '{' ExtensionAndException '}'
1043 $$ = new SequenceType(NULL, TRUE, NULL);
1047 ComponentTypeLists
1048 : ComponentTypeList
1050 $$ = new SequenceType($1, FALSE, NULL);
1052 | ComponentTypeList ',' ExtensionAndException
1054 $$ = new SequenceType($1, TRUE, NULL);
1056 | ComponentTypeList ',' ExtensionAndException ',' ComponentTypeList
1058 $$ = new SequenceType($1, TRUE, $5);
1060 | ExtensionAndException ',' ComponentTypeList
1062 $$ = new SequenceType(NULL, TRUE, $3);
1066 ComponentTypeList
1067 : ComponentType
1069 $$ = new TypesList;
1070 $$->Append($1);
1072 | ComponentTypeList ',' ComponentType
1074 $1->Append($3);
1078 ComponentType
1079 : NamedType
1080 | NamedType OPTIONAL_t
1082 $1->SetOptional();
1084 | NamedType DEFAULT
1086 IdentifierTokenContext = $1->GetIdentifierTokenContext();
1088 Value
1090 IdentifierTokenContext = IDENTIFIER;
1091 $1->SetDefaultValue($4);
1093 | COMPONENTS OF_t Type
1095 $$ = $3;
1100 SequenceOfType
1101 : SEQUENCE OF_t Type
1103 $$ = new SequenceOfType($3, NULL);
1108 SetType
1109 : SET '{' ComponentTypeLists '}'
1111 $$ = new SetType((SequenceType*)$3);
1113 | SET '{' '}'
1115 $$ = new SetType;
1120 SetOfType
1121 : SET OF_t Type
1123 $$ = new SetOfType($3, NULL);
1128 TaggedType
1129 : Tag Type
1131 $2->SetTag($1.tagClass, $1.tagNumber, Module->GetDefaultTagMode());
1132 $$ = $2;
1134 | Tag IMPLICIT Type
1136 $3->SetTag($1.tagClass, $1.tagNumber, Tag::Implicit);
1137 $$ = $3;
1139 | Tag EXPLICIT Type
1141 $3->SetTag($1.tagClass, $1.tagNumber, Tag::Explicit);
1142 $$ = $3;
1147 : '[' Class ClassNumber ']'
1149 $$.tagClass = (Tag::Type)$2;
1150 $$.tagNumber = (int)$3;
1154 ClassNumber
1155 : INTEGER
1156 | DefinedValue
1158 if (PIsDescendant($1, IntegerValue))
1159 $$ = *(IntegerValue*)$1;
1160 else
1161 PError << StdError(Fatal) << "incorrect value type." << endl;
1165 Class
1166 : UNIVERSAL
1168 $$ = Tag::Universal;
1170 | APPLICATION
1172 $$ = Tag::Application;
1174 | PRIVATE
1176 $$ = Tag::Private;
1178 | /* empty */
1180 $$ = Tag::ContextSpecific;
1185 SelectionType
1186 : IDENTIFIER '<' Type
1188 $$ = new SelectionType($1, $3);
1193 UsefulType
1194 : GeneralizedTime
1196 $$ = new GeneralizedTimeType;
1198 | UTCTime
1200 $$ = new UTCTimeType;
1202 | ObjectDescriptor_t
1204 $$ = new ObjectDescriptorType;
1209 TypeFromObject
1210 : ReferencedObjects '.' FieldName
1214 /*!!!
1215 ValueSetFromObjects
1216 : ReferencedObjects '.' FieldName
1220 ReferencedObjects
1221 : DefinedObject
1222 | ParameterizedObject
1223 | DefinedObjectSet
1225 | ParameterizedObjectSet
1229 ParameterizedObject
1230 : DefinedObject ActualParameterList
1235 /********/
1237 ConstrainedType
1238 : Type Constraint
1240 $1->AddConstraint($2);
1242 | TypeWithConstraint
1245 TypeWithConstraint
1246 : SET Constraint OF_t Type
1248 $$ = new SetOfType($4, $2);
1250 | SET SizeConstraint OF_t Type
1252 $$ = new SetOfType($4, new Constraint($2));
1254 | SEQUENCE Constraint OF_t Type
1256 $$ = new SequenceOfType($4, $2);
1258 | SEQUENCE SizeConstraint OF_t Type
1260 $$ = new SequenceOfType($4, new Constraint($2));
1264 Constraint
1265 : '(' ConstraintSpec ExceptionSpec ')'
1267 $$ = $2;
1271 ConstraintSpec
1272 : ElementSetSpecs
1273 | GeneralConstraint
1277 ExceptionSpec
1278 : '!' ExceptionIdentification
1280 $$ = $2;
1282 | /* empty */
1284 $$ = NULL;
1289 ExceptionIdentification
1290 : SignedNumber
1292 $$ = new IntegerValue($1);
1294 | DefinedValue
1295 | Type ':' Value
1297 delete $1;
1298 PError << StdError(Warning) << "Typed exception unsupported" << endl;
1299 $$ = $3;
1304 ElementSetSpecs
1305 : ElementSetSpec
1307 $$ = new Constraint($1, FALSE, NULL);
1309 | ElementSetSpec ',' '.' '.' '.'
1311 $$ = new Constraint($1, TRUE, NULL);
1313 | '.' '.' '.' ',' ElementSetSpec
1315 $$ = new Constraint(NULL, TRUE, $5);
1317 | ElementSetSpec ',' '.' '.' '.' ElementSetSpec
1319 $$ = new Constraint($1, TRUE, $6);
1324 ElementSetSpec
1325 : Unions
1326 | ALL Exclusions
1328 $$ = new ConstraintElementList;
1329 $$->Append(new ConstrainAllConstraintElement($2));
1334 Unions
1335 : Intersections
1337 $$ = new ConstraintElementList;
1338 $$->Append(new ElementListConstraintElement($1));
1340 | Unions UnionMark Intersections
1342 $1->Append(new ElementListConstraintElement($3));
1346 Intersections
1347 : IntersectionElements
1349 $$ = new ConstraintElementList;
1350 $$->Append($1);
1352 | Intersections IntersectionMark IntersectionElements
1354 $1->Append($3);
1358 IntersectionElements
1359 : Elements
1360 | Elements Exclusions
1362 $1->SetExclusions($2);
1366 Exclusions
1367 : EXCEPT Elements
1369 $$ = $2;
1373 UnionMark
1374 : '|'
1375 | UNION
1378 IntersectionMark
1379 : '^'
1380 | INTERSECTION
1383 Elements
1384 : SubtypeElements
1385 | ObjectSetElements
1386 | '(' ElementSetSpec ')'
1388 $$ = new ElementListConstraintElement($2);
1393 SubtypeElements
1394 : Value
1396 $$ = new SingleValueConstraintElement($1);
1398 | ContainedSubtype
1400 $$ = new SubTypeConstraintElement($1);
1402 | ValueRange
1403 | PermittedAlphabet
1404 | SizeConstraint
1405 /*| TypeConstraint This is really Type and causes ambiguity with ContainedSubtype */
1406 | InnerTypeConstraints
1409 ValueRange
1410 : LowerEndpoint '.' '.' UpperEndpoint
1412 $$ = new ValueRangeConstraintElement($1, $4);
1416 LowerEndpoint
1417 : LowerEndValue
1418 | LowerEndValue '<'
1421 UpperEndpoint
1422 : UpperEndValue
1423 | '<' UpperEndValue
1425 $$ = $2;
1429 LowerEndValue
1430 : Value
1431 | MIN_t
1433 $$ = new MinValue;
1437 UpperEndValue
1438 : Value
1439 | MAX_t
1441 $$ = new MaxValue;
1445 PermittedAlphabet
1446 : FROM Constraint
1448 $$ = new FromConstraintElement($2);
1452 ContainedSubtype
1453 : INCLUDES Type
1455 $$ = $2;
1457 /*| Type Actual grammar has INCLUDES keyword optional but this is
1458 horribly ambiguous, so only support a few specific Type
1459 definitions */
1460 | ConstrainedType
1461 | BuiltinType
1462 | DefinedType
1463 | UsefulType
1467 SizeConstraint
1468 : SIZE_t Constraint
1470 $$ = new SizeConstraintElement($2);
1475 InnerTypeConstraints
1476 : WITH COMPONENT Constraint
1478 $$ = new WithComponentConstraintElement(NULL, $3, WithComponentConstraintElement::Default);
1480 | WITH COMPONENTS MultipleTypeConstraints
1482 $$ = $3;
1486 MultipleTypeConstraints
1487 : '{' TypeConstraints '}' /* FullSpecification */
1489 $$ = new InnerTypeConstraintElement($2, FALSE);
1491 | '{' '.' '.' '.' ',' TypeConstraints '}' /* PartialSpecification */
1493 $$ = new InnerTypeConstraintElement($6, TRUE);
1497 TypeConstraints
1498 : NamedConstraint
1500 $$ = new ConstraintElementList;
1501 $$->Append($1);
1503 | NamedConstraint ',' TypeConstraints
1505 $3->Append($1);
1506 $$ = $3;
1510 NamedConstraint
1511 : IDENTIFIER PresenceConstraint
1513 $$ = new WithComponentConstraintElement($1, NULL, (int)$2);
1515 | IDENTIFIER Constraint PresenceConstraint
1517 $$ = new WithComponentConstraintElement($1, $2, (int)$3);
1521 PresenceConstraint
1522 : PRESENT
1524 $$ = WithComponentConstraintElement::Present;
1526 | ABSENT
1528 $$ = WithComponentConstraintElement::Absent;
1530 | OPTIONAL_t
1532 $$ = WithComponentConstraintElement::Optional;
1534 | /* empty */
1536 $$ = WithComponentConstraintElement::Default;
1541 GeneralConstraint
1542 : UserDefinedConstraint
1543 | TableConstraint
1546 UserDefinedConstraint
1547 : CONSTRAINED BY '{' UserDefinedConstraintParameterList '}'
1549 $$ = new Constraint($4);
1553 UserDefinedConstraintParameterList
1554 : /* empty */
1556 $$ = new UserDefinedConstraintElement(NULL);
1558 | UserDefinedConstraintParameters
1560 $$ = new UserDefinedConstraintElement($1);
1564 UserDefinedConstraintParameters
1565 : UserDefinedConstraintParameter ',' UserDefinedConstraintParameters
1567 $3->Append($1);
1568 $$ = $3;
1570 | UserDefinedConstraintParameter
1572 $$ = new TypesList;
1573 $$->Append($1);
1577 UserDefinedConstraintParameter
1578 : Governor ':' ActualParameter
1580 $$ = $3;
1582 | ActualParameter
1586 TableConstraint
1587 : ObjectSet /* SimpleTableConstraint */
1588 | ComponentRelationConstraint
1591 ComponentRelationConstraint
1592 : '{' DefinedObjectSet '}' '{' AtNotations '}'
1593 { $$ = NULL; }
1596 AtNotations
1597 : AtNotations ',' AtNotation
1598 | AtNotation
1601 AtNotation
1602 : '@' ComponentIdList
1603 | '@' '.' ComponentIdList
1606 ComponentIdList
1607 : ComponentIdList '.' IDENTIFIER
1608 | IDENTIFIER
1612 /********/
1614 ObjectClassAssignment
1615 : OBJECTCLASSREFERENCE ASSIGNMENT ObjectClass
1619 ObjectAssignment
1620 : OBJECTREFERENCE DefinedObjectClass ASSIGNMENT Object
1624 ObjectSetAssignment
1625 : OBJECTSETREFERENCE DefinedObjectClass ASSIGNMENT ObjectSet
1630 ObjectClass
1631 : DefinedObjectClass
1633 | ObjectClassDefn
1634 | ParameterizedObjectClass
1637 DefinedObjectClass
1638 : ExternalObjectClassReference
1639 | OBJECTCLASSREFERENCE
1640 | UsefulObjectClassReference
1644 ExternalObjectClassReference
1645 : MODULEREFERENCE '.' OBJECTCLASSREFERENCE
1647 $$ = ConcatNames($1, '.', $3);
1651 UsefulObjectClassReference
1652 : TYPE_IDENTIFIER
1654 $$ = new PString("TYPE-IDENTIFIER");
1656 | ABSTRACT_SYNTAX
1658 $$ = new PString("ABSTRACT-SYNTAX");
1663 ObjectClassDefn
1664 : CLASS '{' FieldSpecs '}' WithSyntaxSpec
1667 FieldSpecs
1668 : FieldSpecs ',' FieldSpec
1669 | FieldSpec
1672 FieldSpec
1673 : TypeFieldSpec
1674 | FixedTypeValueFieldSpec
1675 | VariableTypeValueFieldSpec
1676 | FixedTypeValueSetFieldSpec
1677 | VariableTypeValueSetFieldSpec
1678 | ObjectFieldSpec
1679 | ObjectSetFieldSpec
1682 TypeFieldSpec
1683 : TYPEFIELDREFERENCE TypeOptionalitySpec
1687 TypeOptionalitySpec
1688 : OPTIONAL_t
1689 | DEFAULT Type
1690 | /* empty */
1693 FixedTypeValueFieldSpec
1694 : VALUEFIELDREFERENCE Type Unique ValueOptionalitySpec
1698 Unique
1699 : UNIQUE
1700 | /* empty */
1703 ValueOptionalitySpec
1704 : OPTIONAL_t
1705 | DEFAULT Value
1706 | /* empty */
1709 VariableTypeValueFieldSpec
1710 : VALUEFIELDREFERENCE FieldName ValueOptionalitySpec
1714 FixedTypeValueSetFieldSpec
1715 : VALUESETFIELDREFERENCE Type ValueSetOptionalitySpec
1719 ValueSetOptionalitySpec
1720 : OPTIONAL_t
1721 | DEFAULT ValueSet
1722 | /* empty */
1725 VariableTypeValueSetFieldSpec
1726 : VALUESETFIELDREFERENCE FieldName ValueSetOptionalitySpec
1730 ObjectFieldSpec
1731 : OBJECTFIELDREFERENCE DefinedObjectClass ObjectOptionalitySpec
1735 ObjectOptionalitySpec
1736 : OPTIONAL_t
1737 | DEFAULT Object
1738 | /* empty */
1741 ObjectSetFieldSpec
1742 : OBJECTSETFIELDREFERENCE DefinedObjectClass ObjectSetOptionalitySpec
1746 ObjectSetOptionalitySpec
1747 : OPTIONAL_t
1748 | DEFAULT ObjectSet
1749 | /* empty */
1752 WithSyntaxSpec
1753 : WITH SYNTAX SyntaxList
1754 | /* empty */
1757 SyntaxList
1758 : '{' TokenOrGroupSpecs '}'
1759 | '{' '}'
1762 TokenOrGroupSpecs
1763 : TokenOrGroupSpecs TokenOrGroupSpec
1764 | TokenOrGroupSpec
1767 TokenOrGroupSpec
1768 : RequiredToken
1769 | OptionalGroup
1772 OptionalGroup
1773 : '[' TokenOrGroupSpecs ']'
1776 RequiredToken
1777 : Literal
1778 | PrimitiveFieldName
1782 Literal
1783 : BIT
1784 | BOOLEAN_t
1785 | CHARACTER
1786 | CHOICE
1787 | EMBEDDED
1788 | END
1789 | ENUMERATED
1790 | EXTERNAL
1791 | FALSE_t
1792 | INSTANCE
1793 | INTEGER
1795 | INTERSECTION
1796 | MINUS_INFINITY
1797 | NULL_TYPE
1798 | OBJECT
1799 | OCTET
1800 | PLUS_INFINITY
1801 | REAL
1802 | SEQUENCE
1803 | SET
1804 | TRUE_t
1805 | UNION
1806 | ','
1810 DefinedObject
1811 : ExternalObjectReference
1812 | OBJECTREFERENCE
1816 ExternalObjectReference
1817 : MODULEREFERENCE '.' OBJECTREFERENCE
1822 ParameterizedObjectClass
1823 : DefinedObjectClass ActualParameterList
1828 DefinedObjectSet
1829 : ExternalObjectSetReference
1831 | OBJECTSETREFERENCE
1835 ExternalObjectSetReference
1836 : MODULEREFERENCE '.' OBJECTSETREFERENCE
1841 ParameterizedObjectSet
1842 : DefinedObjectSet ActualParameterList
1846 FieldName
1847 : FieldName '.' PrimitiveFieldName
1849 $$ = ConcatNames($1, '.', $3);
1851 | PrimitiveFieldName
1855 PrimitiveFieldName
1856 : TYPEFIELDREFERENCE
1857 | VALUEFIELDREFERENCE
1858 | VALUESETFIELDREFERENCE
1859 | OBJECTFIELDREFERENCE
1860 | OBJECTSETFIELDREFERENCE
1864 Object
1865 : DefinedObject
1867 /*!!!
1868 | ObjectDefn
1871 | ObjectFromObject
1873 | ParameterizedObject
1878 /*!!!!
1879 ObjectDefn
1880 : DefaultSyntax
1881 | DefinedSyntax
1884 DefaultSyntax
1885 : '{' FieldSettings '}
1886 : '{' '}
1889 FieldSettings
1890 : FieldSettings ',' FieldSetting
1891 | FieldSetting
1894 FieldSetting
1895 : PrimitiveFieldName Setting
1898 DefinedSyntax
1899 : '{' DefinedSyntaxTokens '}'
1902 DefinedSyntaxTokens
1903 : DefinedSyntaxTokens DefinedSyntaxToken
1904 | /* empty *//*
1907 DefinedSyntaxToken
1908 : Literal
1909 | Setting
1912 Setting
1913 : Type
1914 | Value
1915 | ValueSet
1916 | Object
1917 | ObjectSet
1922 ObjectSet
1923 : '{' ElementSetSpec '}'
1928 ObjectFromObject
1929 : ReferencedObjects '.' FieldName
1933 ObjectSetElements
1934 : Object
1936 | DefinedObjectSet
1938 /*!!!
1939 | ObjectSetFromObjects
1941 | ParameterizedObjectSet
1945 /*!!!
1946 ObjectSetFromObjects
1947 : ReferencedObjects '.' FieldName
1953 /********/
1955 ParameterizedAssignment
1956 : ParameterizedTypeAssignment
1957 | ParameterizedValueAssignment
1958 | ParameterizedValueSetTypeAssignment
1959 | ParameterizedObjectClassAssignment
1960 | ParameterizedObjectAssignment
1961 | ParameterizedObjectSetAssignment
1964 ParameterizedTypeAssignment
1965 : TYPEREFERENCE ParameterList
1967 DummyParameters = $2;
1969 ASSIGNMENT Type
1971 DummyParameters = NULL;
1972 $5->SetName($1);
1973 $5->SetParameters($2);
1974 Module->AddType($5);
1978 ParameterizedValueAssignment
1979 : IDENTIFIER ParameterList Type ASSIGNMENT Value
1983 ParameterizedValueSetTypeAssignment
1984 : TYPEREFERENCE ParameterList Type ASSIGNMENT ValueSet
1988 ParameterizedObjectClassAssignment
1989 : OBJECTCLASSREFERENCE ParameterList ASSIGNMENT ObjectClass
1993 ParameterizedObjectAssignment
1994 : OBJECTREFERENCE ParameterList DefinedObjectClass ASSIGNMENT Object
1998 ParameterizedObjectSetAssignment
1999 : OBJECTSETREFERENCE ParameterList DefinedObjectClass ASSIGNMENT ObjectSet
2003 ParameterList
2004 : '{' Parameters '}'
2006 $$ = $2;
2010 Parameters
2011 : Parameters ',' Parameter
2013 $$ = $1;
2014 $$->Append($3);
2016 | Parameter
2018 $$ = new PStringList;
2019 $$->Append($1);
2023 Parameter
2024 : Governor ':' Reference
2026 $$ = $3;
2028 | Reference
2031 Governor
2032 : Type
2034 | DefinedObjectClass
2039 ParameterizedType
2040 : SimpleDefinedType ActualParameterList
2042 $$ = new ParameterizedType($1, $2);
2046 SimpleDefinedType
2047 : ExternalTypeReference
2048 | TYPEREFERENCE
2052 ActualParameterList
2053 : '{' ActualParameters '}'
2055 $$ = $2;
2059 ActualParameters
2060 : ActualParameters ',' ActualParameter
2062 $1->Append($3);
2063 $$ = $1;
2065 | ActualParameter
2067 $$ = new TypesList;
2068 $$->Append($1);
2072 ActualParameter
2073 : Type
2074 | Value
2076 | ValueSet
2078 | DefinedObjectClass
2080 /*!!!
2081 | Object
2083 | ObjectSet
2089 /********/
2091 ValueAssignment
2092 : IDENTIFIER Type
2094 IdentifierTokenContext = $2->GetIdentifierTokenContext();
2095 BraceTokenContext = $2->GetBraceTokenContext();
2096 NullTokenContext = NULL_VALUE;
2098 ASSIGNMENT Value
2100 $5->SetValueName($1);
2101 Module->AddValue($5);
2102 IdentifierTokenContext = IDENTIFIER;
2103 BraceTokenContext = '{';
2104 NullTokenContext = NULL_TYPE;
2109 Value
2110 : BuiltinValue
2111 | ReferencedValue
2115 BuiltinValue
2116 : BitStringValue
2117 | BooleanValue
2118 | CharacterStringValue
2119 | ChoiceValue
2120 /*| EmbeddedPDVValue synonym to SequenceValue */
2121 /*| EnumeratedValue synonym to IDENTIFIER */
2122 /*| ExternalValue synonym to SequenceValue */
2123 /*| InstanceOfValue synonym to Value */
2124 | SignedNumber /* IntegerValue */
2126 $$ = new IntegerValue($1);
2128 | NullValue
2129 /*!!!
2130 | ObjectClassFieldValue
2132 | ObjectIdentifierValue
2133 | OctetStringValue
2134 | RealValue
2135 | SequenceValue
2136 /*!!!!
2137 | SequenceOfValue
2139 /*| SetValue synonym to SequenceValue */
2140 /*| SetOfValue synonym to SequenceOfValue */
2141 /*| TaggedValue synonym to Value */
2145 DefinedValue
2146 : ExternalValueReference
2148 $$ = new DefinedValue($1);
2150 | IDENTIFIER
2152 $$ = new DefinedValue($1);
2154 | ParameterizedValue
2158 ExternalValueReference
2159 : MODULEREFERENCE '.' IDENTIFIER
2161 *$1 += *$3;
2162 delete $3;
2167 ObjectIdentifierValue
2168 : OID_BRACE
2170 IdentifierTokenContext = OID_IDENTIFIER;
2172 ObjIdComponentList '}'
2174 $$ = new ObjectIdentifierValue($3);
2175 IdentifierTokenContext = IDENTIFIER;
2177 /*!!!
2178 | '{' DefinedValue_OID ObjIdComponentList '}'
2180 $$ = new ObjectIdentifierValue($2);
2186 ObjIdComponentList
2187 : ObjIdComponent
2189 $$ = new PStringList;
2190 $$->Append($1);
2192 | ObjIdComponent ObjIdComponentList
2194 $2->InsertAt(0, $1);
2195 $$ = $2;
2199 ObjIdComponent
2200 : OID_IDENTIFIER
2201 | INTEGER
2203 $$ = new PString(PString::Unsigned, (int)$1);
2205 | OID_IDENTIFIER '(' NumberForm ')'
2207 delete $1;
2208 $$ = $3;
2212 NumberForm
2213 : INTEGER
2215 $$ = new PString(PString::Unsigned, (int)$1);
2217 | ExternalValueReference
2218 | OID_IDENTIFIER
2222 OctetStringValue
2223 : OS_BSTRING
2225 $$ = new OctetStringValue($1);
2227 | OS_HSTRING
2229 $$ = new OctetStringValue($1);
2233 BitStringValue
2234 : BS_BSTRING
2236 $$ = new BitStringValue($1);
2238 | BS_HSTRING
2240 $$ = new BitStringValue($1);
2242 | BITSTRING_BRACE BitIdentifierList '}'
2244 $$ = new BitStringValue($2);
2246 | BITSTRING_BRACE '}'
2248 $$ = new BitStringValue;
2253 BitIdentifierList
2254 : BIT_IDENTIFIER
2256 $$ = new PStringList;
2258 | BitIdentifierList ',' BIT_IDENTIFIER
2260 // Look up $3
2261 $1->SetAt($1->GetSize(), 0);
2266 BooleanValue
2267 : TRUE_t
2269 $$ = new BooleanValue(TRUE);
2271 | FALSE_t
2273 $$ = new BooleanValue(FALSE);
2278 CharacterStringValue
2279 : RestrictedCharacterStringValue
2280 /*!!!
2281 | UnrestrictedCharacterStringValue
2285 RestrictedCharacterStringValue
2286 : CSTRING
2288 $$ = new CharacterStringValue($1);
2290 | CharacterStringList
2291 | Quadruple
2292 | Tuple
2295 CharacterStringList
2296 : STRING_BRACE CharSyms '}'
2298 $$ = new CharacterStringValue($2);
2302 CharSyms
2303 : CharsDefn
2305 $$ = new PStringList;
2306 $$->Append($1);
2308 | CharSyms ',' CharsDefn
2310 $1->Append($3);
2314 CharsDefn
2315 : CSTRING
2316 | DefinedValue
2318 PError << StdError(Warning) << "DefinedValue in string unsupported" << endl;
2322 Quadruple
2323 : STRING_BRACE INTEGER ',' INTEGER ',' INTEGER ',' INTEGER '}'
2325 if ($2 != 0 || $4 != 0 || $6 > 255 || $8 > 255)
2326 PError << StdError(Warning) << "Illegal value in Character Quadruple" << endl;
2327 $$ = new CharacterValue((BYTE)$2, (BYTE)$4, (BYTE)$6, (BYTE)$8);
2331 Tuple
2332 : STRING_BRACE INTEGER ',' INTEGER '}'
2334 if ($2 > 255 || $4 > 255)
2335 PError << StdError(Warning) << "Illegal value in Character Tuple" << endl;
2336 $$ = new CharacterValue((BYTE)$2, (BYTE)$4);
2341 ChoiceValue
2342 : IDENTIFIER ':' Value
2344 $3->SetValueName($1);
2345 $$ = $3;
2350 NullValue
2351 : NULL_VALUE
2353 $$ = new NullValue;
2358 RealValue
2359 : NumericRealValue
2360 | SpecialRealValue
2363 NumericRealValue
2364 : '0'
2366 $$ = new RealValue(0);
2368 /*!!!
2369 | SequenceValue
2373 SpecialRealValue
2374 : PLUS_INFINITY
2376 $$ = new RealValue(0);
2378 | MINUS_INFINITY
2380 $$ = new RealValue(0);
2385 SequenceValue
2386 : '{' ComponentValueList '}'
2388 $$ = new SequenceValue($2);
2390 | '{' '}'
2392 $$ = new SequenceValue;
2396 ComponentValueList
2397 : NamedValue
2399 $$ = new ValuesList;
2400 $$->Append($1);
2402 | ComponentValueList ',' NamedValue
2404 $1->Append($3);
2408 NamedValue
2409 : IDENTIFIER Value
2411 $2->SetValueName($1);
2412 $$ = $2;
2417 /*!!!!
2418 SequenceOfValue
2419 : '{' ValueList '}'
2421 $$ = NULL;
2423 | '{' '}'
2425 $$ = NULL;
2429 ValueList
2430 : Value
2432 | ValueList ',' Value
2438 /*!!!
2439 ObjectClassFieldValue
2440 : OpenTypeFieldVal
2441 | Value
2444 OpenTypeFieldVal
2445 : Type ':' Value
2450 ReferencedValue
2451 : DefinedValue
2452 /*!!!!
2453 | ValueFromObject
2457 /*!!!!
2458 ValueFromObject
2459 : ReferencedObjects '.' FieldName
2465 ParameterizedValue
2466 : SimpleDefinedValue ActualParameterList
2470 SimpleDefinedValue
2471 : ExternalValueReference
2472 | IDENTIFIER
2477 /********/
2479 ValueSet
2480 : '{' ElementSetSpecs '}'
2484 /********/
2486 MacroDefinition
2487 : TYPEREFERENCE MACRO ASSIGNMENT MacroSubstance
2489 PError << StdError(Warning) << "MACRO unsupported" << endl;
2493 MacroSubstance
2494 : BEGIN_t
2496 InMacroContext = TRUE;
2498 MacroBody END
2500 InMacroContext = FALSE;
2502 | TYPEREFERENCE
2504 | TYPEREFERENCE '.' TYPEREFERENCE
2508 MacroBody
2509 : TypeProduction ValueProduction /*SupportingProductions*/
2512 TypeProduction
2513 : TYPE_t NOTATION ASSIGNMENT MacroAlternativeList
2516 ValueProduction
2517 : VALUE NOTATION ASSIGNMENT MacroAlternativeList
2522 SupportingProductions
2523 : ProductionList
2524 | /* empty *//*
2527 ProductionList
2528 : Production
2529 | ProductionList Production
2532 Production
2533 : TYPEREFERENCE ASSIGNMENT MacroAlternativeList
2538 MacroAlternativeList
2539 : MacroAlternative
2540 | MacroAlternative '|' MacroAlternativeList
2543 MacroAlternative
2544 : SymbolElement
2545 | SymbolElement MacroAlternative
2548 SymbolElement
2549 : SymbolDefn
2550 | EmbeddedDefinitions
2553 SymbolDefn
2554 : CSTRING
2556 | TYPEREFERENCE
2558 | TYPEREFERENCE ASSIGNMENT
2560 | string_t
2561 | identifier_t
2562 | number_t
2563 | empty_t
2564 | type_t
2565 | type_t '(' TYPE_t TYPEREFERENCE ')'
2566 | value_t '(' Type ')'
2567 | value_t '(' IDENTIFIER Type ')'
2568 | value_t '(' VALUE Type ')'
2571 EmbeddedDefinitions
2572 : '<' EmbeddedDefinitionList '>'
2575 EmbeddedDefinitionList
2576 : EmbeddedDefinition
2577 | EmbeddedDefinitionList EmbeddedDefinition
2580 EmbeddedDefinition
2581 : LocalTypeAssignment
2582 | LocalValueAssignment
2585 LocalTypeAssignment
2586 : TYPEREFERENCE ASSIGNMENT Type
2590 LocalValueAssignment
2591 : IDENTIFIER Type ASSIGNMENT Value
2596 /********/
2598 ObjectTypeDefinition
2599 : IDENTIFIER OBJECT_TYPE
2601 InMIBContext = TRUE;
2603 SYNTAX Type
2604 ACCESS ObjectTypeAccess
2605 STATUS ObjectTypeStatus
2606 MibDescrPart
2607 MibReferPart
2608 MibIndexPart
2609 MibDefValPart
2611 IdentifierTokenContext = OID_IDENTIFIER;
2613 ASSIGNMENT Value
2615 Module->AddMIB(new MibObject($1, $5, (MibObject::Access)$7, (MibObject::Status)$9, $10, $11, $12, $13, $16));
2616 InMIBContext = FALSE;
2617 IdentifierTokenContext = IDENTIFIER;
2621 ObjectTypeAccess
2622 : read_only_t
2624 $$ = MibObject::read_only;
2626 | read_write_t
2628 $$ = MibObject::read_write;
2630 | write_only_t
2632 $$ = MibObject::write_only;
2634 | not_accessible_t
2636 $$ = MibObject::not_accessible;
2640 ObjectTypeStatus
2641 : mandatory_t
2643 $$ = MibObject::mandatory;
2645 | optional_t
2647 $$ = MibObject::optional;
2649 | obsolete_t
2651 $$ = MibObject::obsolete;
2653 | deprecated_t
2655 $$ = MibObject::deprecated;
2659 MibDescrPart
2660 : DESCRIPTION_t CSTRING
2662 $$ = $2;
2664 | /* empty */
2666 $$ = NULL;
2670 MibReferPart
2671 : REFERENCE_t CSTRING
2673 $$ = $2;
2675 | /* empty */
2677 $$ = NULL;
2681 MibIndexPart
2682 : INDEX_t '{' MibIndexTypes '}'
2684 $$ = $3;
2686 | /* empty */
2688 $$ = NULL;
2692 MibIndexTypes
2693 : MibIndexType
2695 $$ = new PStringList;
2696 $$->Append($1);
2698 | MibIndexTypes ',' MibIndexType
2700 $1->Append($3);
2704 MibIndexType
2705 : IDENTIFIER
2706 | TYPEREFERENCE
2709 MibDefValPart
2710 : DEFVAL_t '{' Value '}'
2712 $$ = $3;
2714 | /* empty */
2716 $$ = NULL;
2720 TrapTypeDefinition
2721 : IDENTIFIER TRAP_TYPE
2723 InMIBContext = TRUE;
2724 IdentifierTokenContext = OID_IDENTIFIER;
2726 ENTERPRISE Value
2727 MibVarPart
2728 MibDescrPart
2729 MibReferPart
2730 ASSIGNMENT Value
2732 Module->AddMIB(new MibTrap($1, $5, $6, $7, $8, $10));
2733 IdentifierTokenContext = IDENTIFIER;
2734 InMIBContext = FALSE;
2738 MibVarPart
2739 : VARIABLES '{' MibVarTypes '}'
2741 $$ = $3;
2743 | /* empty */
2745 $$ = NULL;
2749 MibVarTypes
2750 : Value
2752 $$ = new ValuesList;
2753 $$->Append($1);
2755 | MibVarTypes ',' Value
2757 $1->Append($3);
2763 /********/
2765 /*!!! Not actually referenced by any other part of grammar
2766 AbsoluteReference
2767 : '@' GlobalModuleReference '.' ItemSpec
2770 ItemSpec
2771 : TYPEREFERENCE
2772 | ItemId '.' ComponentId
2775 ItemId
2776 : ItemSpec
2779 ComponentId
2780 : IDENTIFIER
2781 | INTEGER
2782 | '*'
2787 Reference
2788 : TYPEREFERENCE
2789 | IDENTIFIER
2790 | OBJECTCLASSREFERENCE
2791 | OBJECTREFERENCE
2792 | OBJECTSETREFERENCE
2795 ParameterizedReference
2796 : Reference '{' '}'
2798 $$ = new ImportedType($1, TRUE);
2803 NamedNumberList
2804 : NamedNumber
2806 $$ = new NamedNumberList;
2807 $$->Append($1);
2809 | NamedNumberList ',' NamedNumber
2811 $1->Append($3);
2815 NamedNumber
2816 : IDENTIFIER '(' SignedNumber ')'
2818 $$ = new NamedNumber($1, (int)$3);
2820 | IDENTIFIER '(' DefinedValue ')'
2822 $$ = new NamedNumber($1, ((DefinedValue*)$3)->GetReference());
2823 delete $3;
2828 SignedNumber
2829 : INTEGER
2830 | '-' INTEGER
2832 $$ = -$2;
2837 /** End of File ****/