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
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): ______________________________________.
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
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
)
112 #pragma warning(disable:4701)
118 %token BIT_IDENTIFIER
119 %token OID_IDENTIFIER
120 %token IMPORT_IDENTIFIER
121 %token MODULEREFERENCE
123 %token OBJECTCLASSREFERENCE
124 %token TYPEFIELDREFERENCE
125 %token VALUEFIELDREFERENCE
126 %token VALUESETFIELDREFERENCE
127 %token OBJECTFIELDREFERENCE
128 %token OBJECTSETFIELDREFERENCE
129 %token OBJECTREFERENCE
130 %token OBJECTSETREFERENCE
140 %token BITSTRING_BRACE
144 %token ABSTRACT_SYNTAX
176 %token TYPE_IDENTIFIER
188 %token MINUS_INFINITY
200 %token PrintableString
216 %token UniversalString
217 %token VideotexString
219 %token GeneralizedTime
236 %token not_accessible_t
248 %token ObjectDescriptor_t
252 %type
<ival
> TagDefault
253 %type
<ival
> SignedNumber
254 %type
<ival
> ObjectTypeAccess ObjectTypeStatus
255 %type
<ival
> Class ClassNumber
256 %type
<ival
> PresenceConstraint
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
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
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
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
412 NamedNumberList
* nlst
;
414 ConstraintElementList
* elst
;
415 ConstraintElementBase
* elmt
;
426 : MODULEREFERENCE DefinitiveIdentifier DEFINITIONS TagDefault ASSIGNMENT BEGIN_t
428 Module
= new ModuleDefinition
($1, $2, (Tag
::Mode
)$4);
429 ReferenceTokenContext
= TYPEREFERENCE
;
435 : '{' DefinitiveObjIdComponentList
'}'
441 $$
= new PStringList
;
445 DefinitiveObjIdComponentList
446 : DefinitiveObjIdComponent
448 $$
= new PStringList
;
451 | DefinitiveObjIdComponent DefinitiveObjIdComponentList
458 DefinitiveObjIdComponent
462 $$
= new PString
(PString
::Unsigned
, (int)$1);
464 | DefinitiveNameAndNumberForm
467 DefinitiveNameAndNumberForm
468 : IDENTIFIER
'(' INTEGER
')'
471 $$
= new PString
(PString
::Unsigned
, (int)$3);
495 /*************************************/
498 : Exports Imports AssignmentList
504 : EXPORTS SymbolsExported
';'
512 Module
->SetExports
($1);
516 Module
->SetExportAll
();
522 : IMPORTS SymbolsImported
';'
528 : SymbolsFromModuleList
532 SymbolsFromModuleList
534 | SymbolsFromModuleList SymbolsFromModule
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
561 ReferenceTokenContext
= TYPEREFERENCE
;
562 BraceTokenContext
= OID_BRACE
;
566 BraceTokenContext
= '{';
573 : DefinedValue_Import
574 | ObjectIdentifierValue
582 : ExternalValueReference
584 $$
= new DefinedValue
($1);
588 $$
= new DefinedValue
($1);
600 | Symbol
',' SymbolList
611 $$
= new ImportedType
($1, FALSE
);
613 | ParameterizedReference
/* only required for X.683 */
617 /*************************************/
619 AssignmentList: Assignment
620 | AssignmentList Assignment
627 | ValueSetTypeAssignment
628 | ObjectClassAssignment
630 | ObjectSetAssignment
631 | ParameterizedAssignment
632 /* We do not have "real" macros, so fake MIB ones */
634 | ObjectTypeDefinition
639 ValueSetTypeAssignment
644 IdentifierTokenContext
= $2->GetIdentifierTokenContext
();
645 BraceTokenContext
= $2->GetBraceTokenContext
();
649 IdentifierTokenContext
= IDENTIFIER
;
650 BraceTokenContext
= '{';
660 : TYPEREFERENCE ASSIGNMENT Type
678 | CharacterStringType
688 | ObjectClassFieldType
689 | ObjectIdentifierType
705 /*!!! syntactically identical to TypeFromObject
706 | ValueSetFromObjects
712 : ExternalTypeReference
714 $$
= new DefinedType
($1, FALSE
);
718 $$
= new DefinedType
($1,
719 DummyParameters
!= NULL
&&
720 DummyParameters
->GetValuesIndex
(*$1) != P_MAX_INDEX
);
723 /*| ParameterizedValueSetType synonym for ParameterizedType */
727 ExternalTypeReference
728 : MODULEREFERENCE
'.' TYPEREFERENCE
739 $$
= new BitStringType
;
741 | BIT STRING
'{' NamedBitList
'}'
743 $$
= new BitStringType
($4);
751 $$
= new NamedNumberList
;
754 | NamedBitList
',' NamedBit
761 : IDENTIFIER
'(' INTEGER
')'
763 $$
= new NamedNumber
($1, (int)$3);
765 | IDENTIFIER
'(' DefinedValue
')'
767 $$
= new NamedNumber
($1, ((DefinedValue
*)$3)->GetReference
());
776 $$
= new BooleanType
;
782 : RestrictedCharacterStringType
783 | UnrestrictedCharacterStringType
786 RestrictedCharacterStringType
789 $$
= new BMPStringType
;
793 $$
= new GeneralStringType
;
797 $$
= new GraphicStringType
;
801 $$
= new IA5StringType
;
805 $$
= new ISO646StringType
;
809 $$
= new NumericStringType
;
813 $$
= new PrintableStringType
;
817 $$
= new TeletexStringType
;
821 $$
= new T61StringType
;
825 $$
= new UniversalStringType
;
829 $$
= new VideotexStringType
;
833 $$
= new VisibleStringType
;
838 UnrestrictedCharacterStringType
841 $$
= new UnrestrictedCharacterStringType
;
847 : CHOICE
'{' 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);
874 | AlternativeTypeList
',' NamedType
881 ExtensionAndException
882 : '.' '.' '.' ExceptionSpec
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 */
904 $$
= new EmbeddedPDVType
;
910 : ENUMERATED
'{' Enumerations
'}'
919 $$
= new EnumeratedType
($1, FALSE
, NULL
);
921 | Enumeration
',' '.' '.' '.'
923 $$
= new EnumeratedType
($1, TRUE
, NULL
);
925 | Enumeration
',' '.' '.' '.' ',' Enumeration
927 $$
= new EnumeratedType
($1, TRUE
, $7);
934 $$
= new NamedNumberList
;
937 | Enumeration
',' EnumerationItem
940 PINDEX sz
= $1->GetSize
();
942 $3->SetAutoNumber
((*$1)[sz
-2]);
950 $$
= new NamedNumber
($1);
959 $$
= new ExternalType
;
967 $$
= new AnyType
(NULL
);
969 | ANY DEFINED BY IDENTIFIER
971 $$
= new AnyType
($4);
977 : INSTANCE OF_t DefinedObjectClass
984 $$
= new IntegerType
;
986 | INTEGER_t
'{' NamedNumberList
'}'
988 $$
= new IntegerType
($3);
1001 ObjectClassFieldType
1002 : DefinedObjectClass
'.' FieldName
1004 $$
= new ObjectClassFieldType
($1, $3);
1009 ObjectIdentifierType
1010 : OBJECT IDENTIFIER_t
1012 $$
= new ObjectIdentifierType
;
1019 $$
= new OctetStringType
;
1033 : SEQUENCE
'{' ComponentTypeLists
'}'
1039 $$
= new SequenceType
(NULL
, FALSE
, NULL
);
1041 | SEQUENCE
'{' ExtensionAndException
'}'
1043 $$
= new SequenceType
(NULL
, TRUE
, NULL
);
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);
1072 | ComponentTypeList
',' ComponentType
1080 | NamedType OPTIONAL_t
1086 IdentifierTokenContext
= $1->GetIdentifierTokenContext
();
1090 IdentifierTokenContext
= IDENTIFIER
;
1091 $1->SetDefaultValue
($4);
1093 | COMPONENTS OF_t Type
1101 : SEQUENCE OF_t Type
1103 $$
= new SequenceOfType
($3, NULL
);
1109 : SET
'{' ComponentTypeLists
'}'
1111 $$
= new SetType
((SequenceType
*)$3);
1123 $$
= new SetOfType
($3, NULL
);
1131 $2->SetTag
($1.tagClass
, $1.tagNumber
, Module
->GetDefaultTagMode
());
1136 $3->SetTag
($1.tagClass
, $1.tagNumber
, Tag
::Implicit
);
1141 $3->SetTag
($1.tagClass
, $1.tagNumber
, Tag
::Explicit
);
1147 : '[' Class ClassNumber
']'
1149 $$.tagClass
= (Tag
::Type
)$2;
1150 $$.tagNumber
= (int)$3;
1158 if
(PIsDescendant
($1, IntegerValue
))
1159 $$
= *(IntegerValue
*)$1;
1161 PError
<< StdError
(Fatal
) << "incorrect value type." << endl
;
1168 $$
= Tag
::Universal
;
1172 $$
= Tag
::Application
;
1180 $$
= Tag
::ContextSpecific
;
1186 : IDENTIFIER
'<' Type
1188 $$
= new SelectionType
($1, $3);
1196 $$
= new GeneralizedTimeType
;
1200 $$
= new UTCTimeType
;
1202 | ObjectDescriptor_t
1204 $$
= new ObjectDescriptorType
;
1210 : ReferencedObjects
'.' FieldName
1216 : ReferencedObjects '.' FieldName
1222 | ParameterizedObject
1225 | ParameterizedObjectSet
1230 : DefinedObject ActualParameterList
1240 $1->AddConstraint
($2);
1242 | 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));
1265 : '(' ConstraintSpec ExceptionSpec
')'
1278 : '!' ExceptionIdentification
1289 ExceptionIdentification
1292 $$
= new IntegerValue
($1);
1298 PError
<< StdError
(Warning
) << "Typed exception unsupported" << endl
;
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);
1328 $$
= new ConstraintElementList
;
1329 $$
->Append
(new ConstrainAllConstraintElement
($2));
1337 $$
= new ConstraintElementList
;
1338 $$
->Append
(new ElementListConstraintElement
($1));
1340 | Unions UnionMark Intersections
1342 $1->Append
(new ElementListConstraintElement
($3));
1347 : IntersectionElements
1349 $$
= new ConstraintElementList
;
1352 | Intersections IntersectionMark IntersectionElements
1358 IntersectionElements
1360 | Elements Exclusions
1362 $1->SetExclusions
($2);
1386 |
'(' ElementSetSpec
')'
1388 $$
= new ElementListConstraintElement
($2);
1396 $$
= new SingleValueConstraintElement
($1);
1400 $$
= new SubTypeConstraintElement
($1);
1405 /*| TypeConstraint This is really Type and causes ambiguity with ContainedSubtype */
1406 | InnerTypeConstraints
1410 : LowerEndpoint
'.' '.' UpperEndpoint
1412 $$
= new ValueRangeConstraintElement
($1, $4);
1448 $$
= new FromConstraintElement
($2);
1457 /*| Type Actual grammar has INCLUDES keyword optional but this is
1458 horribly ambiguous, so only support a few specific Type
1470 $$
= new SizeConstraintElement
($2);
1475 InnerTypeConstraints
1476 : WITH COMPONENT Constraint
1478 $$
= new WithComponentConstraintElement
(NULL
, $3, WithComponentConstraintElement
::Default
);
1480 | WITH COMPONENTS MultipleTypeConstraints
1486 MultipleTypeConstraints
1487 : '{' TypeConstraints
'}' /* FullSpecification */
1489 $$
= new InnerTypeConstraintElement
($2, FALSE
);
1491 |
'{' '.' '.' '.' ',' TypeConstraints
'}' /* PartialSpecification */
1493 $$
= new InnerTypeConstraintElement
($6, TRUE
);
1500 $$
= new ConstraintElementList
;
1503 | NamedConstraint
',' TypeConstraints
1511 : IDENTIFIER PresenceConstraint
1513 $$
= new WithComponentConstraintElement
($1, NULL
, (int)$2);
1515 | IDENTIFIER Constraint PresenceConstraint
1517 $$
= new WithComponentConstraintElement
($1, $2, (int)$3);
1524 $$
= WithComponentConstraintElement
::Present
;
1528 $$
= WithComponentConstraintElement
::Absent
;
1532 $$
= WithComponentConstraintElement
::Optional
;
1536 $$
= WithComponentConstraintElement
::Default
;
1542 : UserDefinedConstraint
1546 UserDefinedConstraint
1547 : CONSTRAINED BY
'{' UserDefinedConstraintParameterList
'}'
1549 $$
= new Constraint
($4);
1553 UserDefinedConstraintParameterList
1556 $$
= new UserDefinedConstraintElement
(NULL
);
1558 | UserDefinedConstraintParameters
1560 $$
= new UserDefinedConstraintElement
($1);
1564 UserDefinedConstraintParameters
1565 : UserDefinedConstraintParameter
',' UserDefinedConstraintParameters
1570 | UserDefinedConstraintParameter
1577 UserDefinedConstraintParameter
1578 : Governor
':' ActualParameter
1587 : ObjectSet
/* SimpleTableConstraint */
1588 | ComponentRelationConstraint
1591 ComponentRelationConstraint
1592 : '{' DefinedObjectSet
'}' '{' AtNotations
'}'
1597 : AtNotations
',' AtNotation
1602 : '@' ComponentIdList
1603 |
'@' '.' ComponentIdList
1607 : ComponentIdList
'.' IDENTIFIER
1614 ObjectClassAssignment
1615 : OBJECTCLASSREFERENCE ASSIGNMENT ObjectClass
1620 : OBJECTREFERENCE DefinedObjectClass ASSIGNMENT Object
1625 : OBJECTSETREFERENCE DefinedObjectClass ASSIGNMENT ObjectSet
1631 : DefinedObjectClass
1634 | ParameterizedObjectClass
1638 : ExternalObjectClassReference
1639 | OBJECTCLASSREFERENCE
1640 | UsefulObjectClassReference
1644 ExternalObjectClassReference
1645 : MODULEREFERENCE
'.' OBJECTCLASSREFERENCE
1647 $$
= ConcatNames
($1, '.', $3);
1651 UsefulObjectClassReference
1654 $$
= new PString
("TYPE-IDENTIFIER");
1658 $$
= new PString
("ABSTRACT-SYNTAX");
1664 : CLASS
'{' FieldSpecs
'}' WithSyntaxSpec
1668 : FieldSpecs
',' FieldSpec
1674 | FixedTypeValueFieldSpec
1675 | VariableTypeValueFieldSpec
1676 | FixedTypeValueSetFieldSpec
1677 | VariableTypeValueSetFieldSpec
1679 | ObjectSetFieldSpec
1683 : TYPEFIELDREFERENCE TypeOptionalitySpec
1693 FixedTypeValueFieldSpec
1694 : VALUEFIELDREFERENCE Type Unique ValueOptionalitySpec
1703 ValueOptionalitySpec
1709 VariableTypeValueFieldSpec
1710 : VALUEFIELDREFERENCE FieldName ValueOptionalitySpec
1714 FixedTypeValueSetFieldSpec
1715 : VALUESETFIELDREFERENCE Type ValueSetOptionalitySpec
1719 ValueSetOptionalitySpec
1725 VariableTypeValueSetFieldSpec
1726 : VALUESETFIELDREFERENCE FieldName ValueSetOptionalitySpec
1731 : OBJECTFIELDREFERENCE DefinedObjectClass ObjectOptionalitySpec
1735 ObjectOptionalitySpec
1742 : OBJECTSETFIELDREFERENCE DefinedObjectClass ObjectSetOptionalitySpec
1746 ObjectSetOptionalitySpec
1753 : WITH SYNTAX SyntaxList
1758 : '{' TokenOrGroupSpecs
'}'
1763 : TokenOrGroupSpecs TokenOrGroupSpec
1773 : '[' TokenOrGroupSpecs
']'
1778 | PrimitiveFieldName
1811 : ExternalObjectReference
1816 ExternalObjectReference
1817 : MODULEREFERENCE
'.' OBJECTREFERENCE
1822 ParameterizedObjectClass
1823 : DefinedObjectClass ActualParameterList
1829 : ExternalObjectSetReference
1831 | OBJECTSETREFERENCE
1835 ExternalObjectSetReference
1836 : MODULEREFERENCE
'.' OBJECTSETREFERENCE
1841 ParameterizedObjectSet
1842 : DefinedObjectSet ActualParameterList
1847 : FieldName
'.' PrimitiveFieldName
1849 $$
= ConcatNames
($1, '.', $3);
1851 | PrimitiveFieldName
1856 : TYPEFIELDREFERENCE
1857 | VALUEFIELDREFERENCE
1858 | VALUESETFIELDREFERENCE
1859 | OBJECTFIELDREFERENCE
1860 | OBJECTSETFIELDREFERENCE
1873 | ParameterizedObject
1885 : '{' FieldSettings '}
1890 : FieldSettings ',' FieldSetting
1895 : PrimitiveFieldName Setting
1899 : '{' DefinedSyntaxTokens '}'
1903 : DefinedSyntaxTokens DefinedSyntaxToken
1923 : '{' ElementSetSpec
'}'
1929 : ReferencedObjects
'.' FieldName
1939 | ObjectSetFromObjects
1941 | ParameterizedObjectSet
1946 ObjectSetFromObjects
1947 : ReferencedObjects '.' FieldName
1955 ParameterizedAssignment
1956 : ParameterizedTypeAssignment
1957 | ParameterizedValueAssignment
1958 | ParameterizedValueSetTypeAssignment
1959 | ParameterizedObjectClassAssignment
1960 | ParameterizedObjectAssignment
1961 | ParameterizedObjectSetAssignment
1964 ParameterizedTypeAssignment
1965 : TYPEREFERENCE ParameterList
1967 DummyParameters
= $2;
1971 DummyParameters
= NULL
;
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
2004 : '{' Parameters
'}'
2011 : Parameters
',' Parameter
2018 $$
= new PStringList
;
2024 : Governor
':' Reference
2034 | DefinedObjectClass
2040 : SimpleDefinedType ActualParameterList
2042 $$
= new ParameterizedType
($1, $2);
2047 : ExternalTypeReference
2053 : '{' ActualParameters
'}'
2060 : ActualParameters
',' ActualParameter
2078 | DefinedObjectClass
2094 IdentifierTokenContext
= $2->GetIdentifierTokenContext
();
2095 BraceTokenContext
= $2->GetBraceTokenContext
();
2096 NullTokenContext
= NULL_VALUE
;
2100 $5->SetValueName
($1);
2101 Module
->AddValue
($5);
2102 IdentifierTokenContext
= IDENTIFIER
;
2103 BraceTokenContext
= '{';
2104 NullTokenContext
= NULL_TYPE
;
2118 | CharacterStringValue
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);
2130 | ObjectClassFieldValue
2132 | ObjectIdentifierValue
2139 /*| SetValue synonym to SequenceValue */
2140 /*| SetOfValue synonym to SequenceOfValue */
2141 /*| TaggedValue synonym to Value */
2146 : ExternalValueReference
2148 $$
= new DefinedValue
($1);
2152 $$
= new DefinedValue
($1);
2154 | ParameterizedValue
2158 ExternalValueReference
2159 : MODULEREFERENCE
'.' IDENTIFIER
2167 ObjectIdentifierValue
2170 IdentifierTokenContext
= OID_IDENTIFIER
;
2172 ObjIdComponentList
'}'
2174 $$
= new ObjectIdentifierValue
($3);
2175 IdentifierTokenContext
= IDENTIFIER
;
2178 | '{' DefinedValue_OID ObjIdComponentList '}'
2180 $$ = new ObjectIdentifierValue($2);
2189 $$
= new PStringList
;
2192 | ObjIdComponent ObjIdComponentList
2194 $2->InsertAt
(0, $1);
2203 $$
= new PString
(PString
::Unsigned
, (int)$1);
2205 | OID_IDENTIFIER
'(' NumberForm
')'
2215 $$
= new PString
(PString
::Unsigned
, (int)$1);
2217 | ExternalValueReference
2225 $$
= new OctetStringValue
($1);
2229 $$
= new OctetStringValue
($1);
2236 $$
= new BitStringValue
($1);
2240 $$
= new BitStringValue
($1);
2242 | BITSTRING_BRACE BitIdentifierList
'}'
2244 $$
= new BitStringValue
($2);
2246 | BITSTRING_BRACE
'}'
2248 $$
= new BitStringValue
;
2256 $$
= new PStringList
;
2258 | BitIdentifierList
',' BIT_IDENTIFIER
2261 $1->SetAt
($1->GetSize
(), 0);
2269 $$
= new BooleanValue
(TRUE
);
2273 $$
= new BooleanValue
(FALSE
);
2278 CharacterStringValue
2279 : RestrictedCharacterStringValue
2281 | UnrestrictedCharacterStringValue
2285 RestrictedCharacterStringValue
2288 $$
= new CharacterStringValue
($1);
2290 | CharacterStringList
2296 : STRING_BRACE CharSyms
'}'
2298 $$
= new CharacterStringValue
($2);
2305 $$
= new PStringList
;
2308 | CharSyms
',' CharsDefn
2318 PError
<< StdError
(Warning
) << "DefinedValue in string unsupported" << endl
;
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);
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);
2342 : IDENTIFIER
':' Value
2344 $3->SetValueName
($1);
2366 $$
= new RealValue
(0);
2376 $$
= new RealValue
(0);
2380 $$
= new RealValue
(0);
2386 : '{' ComponentValueList
'}'
2388 $$
= new SequenceValue
($2);
2392 $$
= new SequenceValue
;
2399 $$
= new ValuesList
;
2402 | ComponentValueList
',' NamedValue
2411 $2->SetValueName
($1);
2432 | ValueList ',' Value
2439 ObjectClassFieldValue
2459 : ReferencedObjects '.' FieldName
2466 : SimpleDefinedValue ActualParameterList
2471 : ExternalValueReference
2480 : '{' ElementSetSpecs
'}'
2487 : TYPEREFERENCE MACRO ASSIGNMENT MacroSubstance
2489 PError
<< StdError
(Warning
) << "MACRO unsupported" << endl
;
2496 InMacroContext
= TRUE
;
2500 InMacroContext
= FALSE
;
2504 | TYPEREFERENCE
'.' TYPEREFERENCE
2509 : TypeProduction ValueProduction
/*SupportingProductions*/
2513 : TYPE_t NOTATION ASSIGNMENT MacroAlternativeList
2517 : VALUE NOTATION ASSIGNMENT MacroAlternativeList
2522 SupportingProductions
2529 | ProductionList Production
2533 : TYPEREFERENCE ASSIGNMENT MacroAlternativeList
2538 MacroAlternativeList
2540 | MacroAlternative
'|' MacroAlternativeList
2545 | SymbolElement MacroAlternative
2550 | EmbeddedDefinitions
2558 | TYPEREFERENCE ASSIGNMENT
2565 | type_t
'(' TYPE_t TYPEREFERENCE
')'
2566 | value_t
'(' Type
')'
2567 | value_t
'(' IDENTIFIER Type
')'
2568 | value_t
'(' VALUE Type
')'
2572 : '<' EmbeddedDefinitionList
'>'
2575 EmbeddedDefinitionList
2576 : EmbeddedDefinition
2577 | EmbeddedDefinitionList EmbeddedDefinition
2581 : LocalTypeAssignment
2582 | LocalValueAssignment
2586 : TYPEREFERENCE ASSIGNMENT Type
2590 LocalValueAssignment
2591 : IDENTIFIER Type ASSIGNMENT Value
2598 ObjectTypeDefinition
2599 : IDENTIFIER OBJECT_TYPE
2601 InMIBContext
= TRUE
;
2604 ACCESS ObjectTypeAccess
2605 STATUS ObjectTypeStatus
2611 IdentifierTokenContext
= OID_IDENTIFIER
;
2615 Module
->AddMIB
(new MibObject
($1, $5, (MibObject
::Access
)$7, (MibObject
::Status
)$9, $10, $11, $12, $13, $16));
2616 InMIBContext
= FALSE
;
2617 IdentifierTokenContext
= IDENTIFIER
;
2624 $$
= MibObject
::read_only
;
2628 $$
= MibObject
::read_write
;
2632 $$
= MibObject
::write_only
;
2636 $$
= MibObject
::not_accessible
;
2643 $$
= MibObject
::mandatory
;
2647 $$
= MibObject
::optional
;
2651 $$
= MibObject
::obsolete
;
2655 $$
= MibObject
::deprecated
;
2660 : DESCRIPTION_t CSTRING
2671 : REFERENCE_t CSTRING
2682 : INDEX_t
'{' MibIndexTypes
'}'
2695 $$
= new PStringList
;
2698 | MibIndexTypes
',' MibIndexType
2710 : DEFVAL_t
'{' Value
'}'
2721 : IDENTIFIER TRAP_TYPE
2723 InMIBContext
= TRUE
;
2724 IdentifierTokenContext
= OID_IDENTIFIER
;
2732 Module
->AddMIB
(new MibTrap
($1, $5, $6, $7, $8, $10));
2733 IdentifierTokenContext
= IDENTIFIER
;
2734 InMIBContext
= FALSE
;
2739 : VARIABLES
'{' MibVarTypes
'}'
2752 $$
= new ValuesList
;
2755 | MibVarTypes
',' Value
2765 /*!!! Not actually referenced by any other part of grammar
2767 : '@' GlobalModuleReference '.' ItemSpec
2772 | ItemId '.' ComponentId
2790 | OBJECTCLASSREFERENCE
2792 | OBJECTSETREFERENCE
2795 ParameterizedReference
2798 $$
= new ImportedType
($1, TRUE
);
2806 $$
= new NamedNumberList
;
2809 | NamedNumberList
',' NamedNumber
2816 : IDENTIFIER
'(' SignedNumber
')'
2818 $$
= new NamedNumber
($1, (int)$3);
2820 | IDENTIFIER
'(' DefinedValue
')'
2822 $$
= new NamedNumber
($1, ((DefinedValue
*)$3)->GetReference
());
2837 /** End of File ****/