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.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
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
)
109 #pragma warning(disable:4701)
115 %token BIT_IDENTIFIER
116 %token OID_IDENTIFIER
117 %token IMPORT_IDENTIFIER
118 %token MODULEREFERENCE
120 %token OBJECTCLASSREFERENCE
121 %token TYPEFIELDREFERENCE
122 %token VALUEFIELDREFERENCE
123 %token VALUESETFIELDREFERENCE
124 %token OBJECTFIELDREFERENCE
125 %token OBJECTSETFIELDREFERENCE
126 %token OBJECTREFERENCE
127 %token OBJECTSETREFERENCE
137 %token BITSTRING_BRACE
141 %token ABSTRACT_SYNTAX
173 %token TYPE_IDENTIFIER
185 %token MINUS_INFINITY
197 %token PrintableString
213 %token UniversalString
214 %token VideotexString
216 %token GeneralizedTime
233 %token not_accessible_t
245 %token ObjectDescriptor_t
249 %type
<ival
> TagDefault
250 %type
<ival
> SignedNumber
251 %type
<ival
> ObjectTypeAccess ObjectTypeStatus
252 %type
<ival
> Class ClassNumber
253 %type
<ival
> PresenceConstraint
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
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
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
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
409 NamedNumberList
* nlst
;
411 ConstraintElementList
* elst
;
412 ConstraintElementBase
* elmt
;
423 : MODULEREFERENCE DefinitiveIdentifier DEFINITIONS TagDefault ASSIGNMENT BEGIN_t
425 Module
= new ModuleDefinition
($1, $2, (Tag
::Mode
)$4);
426 ReferenceTokenContext
= TYPEREFERENCE
;
432 : '{' DefinitiveObjIdComponentList
'}'
438 $$
= new PStringList
;
442 DefinitiveObjIdComponentList
443 : DefinitiveObjIdComponent
445 $$
= new PStringList
;
448 | DefinitiveObjIdComponent DefinitiveObjIdComponentList
455 DefinitiveObjIdComponent
459 $$
= new PString
(PString
::Unsigned
, (int)$1);
461 | DefinitiveNameAndNumberForm
464 DefinitiveNameAndNumberForm
465 : IDENTIFIER
'(' INTEGER
')'
468 $$
= new PString
(PString
::Unsigned
, (int)$3);
492 /*************************************/
495 : Exports Imports AssignmentList
501 : EXPORTS SymbolsExported
';'
509 Module
->SetExports
($1);
513 Module
->SetExportAll
();
519 : IMPORTS SymbolsImported
';'
525 : SymbolsFromModuleList
529 SymbolsFromModuleList
531 | SymbolsFromModuleList SymbolsFromModule
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
558 ReferenceTokenContext
= TYPEREFERENCE
;
559 BraceTokenContext
= OID_BRACE
;
563 BraceTokenContext
= '{';
570 : DefinedValue_Import
571 | ObjectIdentifierValue
579 : ExternalValueReference
581 $$
= new DefinedValue
($1);
585 $$
= new DefinedValue
($1);
597 | Symbol
',' SymbolList
608 $$
= new ImportedType
($1, FALSE
);
610 | ParameterizedReference
/* only required for X.683 */
614 /*************************************/
616 AssignmentList: Assignment
617 | AssignmentList Assignment
624 | ValueSetTypeAssignment
625 | ObjectClassAssignment
627 | ObjectSetAssignment
628 | ParameterizedAssignment
629 /* We do not have "real" macros, so fake MIB ones */
631 | ObjectTypeDefinition
636 ValueSetTypeAssignment
641 IdentifierTokenContext
= $2->GetIdentifierTokenContext
();
642 BraceTokenContext
= $2->GetBraceTokenContext
();
646 IdentifierTokenContext
= IDENTIFIER
;
647 BraceTokenContext
= '{';
657 : TYPEREFERENCE ASSIGNMENT Type
675 | CharacterStringType
685 | ObjectClassFieldType
686 | ObjectIdentifierType
702 /*!!! syntactically identical to TypeFromObject
703 | ValueSetFromObjects
709 : ExternalTypeReference
711 $$
= new DefinedType
($1, FALSE
);
715 $$
= new DefinedType
($1,
716 DummyParameters
!= NULL
&&
717 DummyParameters
->GetValuesIndex
(*$1) != P_MAX_INDEX
);
720 /*| ParameterizedValueSetType synonym for ParameterizedType */
724 ExternalTypeReference
725 : MODULEREFERENCE
'.' TYPEREFERENCE
736 $$
= new BitStringType
;
738 | BIT STRING
'{' NamedBitList
'}'
740 $$
= new BitStringType
($4);
748 $$
= new NamedNumberList
;
751 | NamedBitList
',' NamedBit
758 : IDENTIFIER
'(' INTEGER
')'
760 $$
= new NamedNumber
($1, (int)$3);
762 | IDENTIFIER
'(' DefinedValue
')'
764 $$
= new NamedNumber
($1, ((DefinedValue
*)$3)->GetReference
());
773 $$
= new BooleanType
;
779 : RestrictedCharacterStringType
780 | UnrestrictedCharacterStringType
783 RestrictedCharacterStringType
786 $$
= new BMPStringType
;
790 $$
= new GeneralStringType
;
794 $$
= new GraphicStringType
;
798 $$
= new IA5StringType
;
802 $$
= new ISO646StringType
;
806 $$
= new NumericStringType
;
810 $$
= new PrintableStringType
;
814 $$
= new TeletexStringType
;
818 $$
= new T61StringType
;
822 $$
= new UniversalStringType
;
826 $$
= new VideotexStringType
;
830 $$
= new VisibleStringType
;
835 UnrestrictedCharacterStringType
838 $$
= new UnrestrictedCharacterStringType
;
844 : CHOICE
'{' 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);
871 | AlternativeTypeList
',' NamedType
878 ExtensionAndException
879 : '.' '.' '.' ExceptionSpec
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 */
901 $$
= new EmbeddedPDVType
;
907 : ENUMERATED
'{' Enumerations
'}'
916 $$
= new EnumeratedType
($1, FALSE
, NULL
);
918 | Enumeration
',' '.' '.' '.'
920 $$
= new EnumeratedType
($1, TRUE
, NULL
);
922 | Enumeration
',' '.' '.' '.' ',' Enumeration
924 $$
= new EnumeratedType
($1, TRUE
, $7);
931 $$
= new NamedNumberList
;
934 | Enumeration
',' EnumerationItem
937 PINDEX sz
= $1->GetSize
();
939 $3->SetAutoNumber
((*$1)[sz
-2]);
947 $$
= new NamedNumber
($1);
956 $$
= new ExternalType
;
964 $$
= new AnyType
(NULL
);
966 | ANY DEFINED BY IDENTIFIER
968 $$
= new AnyType
($4);
974 : INSTANCE OF_t DefinedObjectClass
981 $$
= new IntegerType
;
983 | INTEGER_t
'{' NamedNumberList
'}'
985 $$
= new IntegerType
($3);
999 : DefinedObjectClass
'.' FieldName
1001 $$
= new ObjectClassFieldType
($1, $3);
1006 ObjectIdentifierType
1007 : OBJECT IDENTIFIER_t
1009 $$
= new ObjectIdentifierType
;
1016 $$
= new OctetStringType
;
1030 : SEQUENCE
'{' ComponentTypeLists
'}'
1036 $$
= new SequenceType
(NULL
, FALSE
, NULL
);
1038 | SEQUENCE
'{' ExtensionAndException
'}'
1040 $$
= new SequenceType
(NULL
, TRUE
, NULL
);
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);
1069 | ComponentTypeList
',' ComponentType
1077 | NamedType OPTIONAL_t
1083 IdentifierTokenContext
= $1->GetIdentifierTokenContext
();
1087 IdentifierTokenContext
= IDENTIFIER
;
1088 $1->SetDefaultValue
($4);
1090 | COMPONENTS OF_t Type
1098 : SEQUENCE OF_t Type
1100 $$
= new SequenceOfType
($3, NULL
);
1106 : SET
'{' ComponentTypeLists
'}'
1108 $$
= new SetType
((SequenceType
*)$3);
1120 $$
= new SetOfType
($3, NULL
);
1128 $2->SetTag
($1.tagClass
, $1.tagNumber
, Module
->GetDefaultTagMode
());
1133 $3->SetTag
($1.tagClass
, $1.tagNumber
, Tag
::Implicit
);
1138 $3->SetTag
($1.tagClass
, $1.tagNumber
, Tag
::Explicit
);
1144 : '[' Class ClassNumber
']'
1146 $$.tagClass
= (Tag
::Type
)$2;
1147 $$.tagNumber
= (int)$3;
1155 if
($1->IsDescendant
(IntegerValue
::Class
()))
1156 $$
= *(IntegerValue
*)$1;
1158 PError
<< StdError
(Fatal
) << "incorrect value type." << endl
;
1165 $$
= Tag
::Universal
;
1169 $$
= Tag
::Application
;
1177 $$
= Tag
::ContextSpecific
;
1183 : IDENTIFIER
'<' Type
1185 $$
= new SelectionType
($1, $3);
1193 $$
= new GeneralizedTimeType
;
1197 $$
= new UTCTimeType
;
1199 | ObjectDescriptor_t
1201 $$
= new ObjectDescriptorType
;
1207 : ReferencedObjects
'.' FieldName
1213 : ReferencedObjects '.' FieldName
1219 | ParameterizedObject
1222 | ParameterizedObjectSet
1227 : DefinedObject ActualParameterList
1237 $1->AddConstraint
($2);
1239 | 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));
1262 : '(' ConstraintSpec ExceptionSpec
')'
1275 : '!' ExceptionIdentification
1286 ExceptionIdentification
1289 $$
= new IntegerValue
($1);
1295 PError
<< StdError
(Warning
) << "Typed exception unsupported" << endl
;
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);
1325 $$
= new ConstraintElementList
;
1326 $$
->Append
(new ConstrainAllConstraintElement
($2));
1334 $$
= new ConstraintElementList
;
1335 $$
->Append
(new ElementListConstraintElement
($1));
1337 | Unions UnionMark Intersections
1339 $1->Append
(new ElementListConstraintElement
($3));
1344 : IntersectionElements
1346 $$
= new ConstraintElementList
;
1349 | Intersections IntersectionMark IntersectionElements
1355 IntersectionElements
1357 | Elements Exclusions
1359 $1->SetExclusions
($2);
1383 |
'(' ElementSetSpec
')'
1385 $$
= new ElementListConstraintElement
($2);
1393 $$
= new SingleValueConstraintElement
($1);
1397 $$
= new SubTypeConstraintElement
($1);
1402 /*| TypeConstraint This is really Type and causes ambiguity with ContainedSubtype */
1403 | InnerTypeConstraints
1407 : LowerEndpoint
'.' '.' UpperEndpoint
1409 $$
= new ValueRangeConstraintElement
($1, $4);
1445 $$
= new FromConstraintElement
($2);
1454 /*| Type Actual grammar has INCLUDES keyword optional but this is
1455 horribly ambiguous, so only support a few specific Type
1467 $$
= new SizeConstraintElement
($2);
1472 InnerTypeConstraints
1473 : WITH COMPONENT Constraint
1475 $$
= new WithComponentConstraintElement
(NULL
, $3, WithComponentConstraintElement
::Default
);
1477 | WITH COMPONENTS MultipleTypeConstraints
1483 MultipleTypeConstraints
1484 : '{' TypeConstraints
'}' /* FullSpecification */
1486 $$
= new InnerTypeConstraintElement
($2, FALSE
);
1488 |
'{' '.' '.' '.' ',' TypeConstraints
'}' /* PartialSpecification */
1490 $$
= new InnerTypeConstraintElement
($6, TRUE
);
1497 $$
= new ConstraintElementList
;
1500 | NamedConstraint
',' TypeConstraints
1508 : IDENTIFIER PresenceConstraint
1510 $$
= new WithComponentConstraintElement
($1, NULL
, (int)$2);
1512 | IDENTIFIER Constraint PresenceConstraint
1514 $$
= new WithComponentConstraintElement
($1, $2, (int)$3);
1521 $$
= WithComponentConstraintElement
::Present
;
1525 $$
= WithComponentConstraintElement
::Absent
;
1529 $$
= WithComponentConstraintElement
::Optional
;
1533 $$
= WithComponentConstraintElement
::Default
;
1539 : UserDefinedConstraint
1543 UserDefinedConstraint
1544 : CONSTRAINED BY
'{' UserDefinedConstraintParameterList
'}'
1546 $$
= new Constraint
($4);
1550 UserDefinedConstraintParameterList
1553 $$
= new UserDefinedConstraintElement
(NULL
);
1555 | UserDefinedConstraintParameters
1557 $$
= new UserDefinedConstraintElement
($1);
1561 UserDefinedConstraintParameters
1562 : UserDefinedConstraintParameter
',' UserDefinedConstraintParameters
1567 | UserDefinedConstraintParameter
1574 UserDefinedConstraintParameter
1575 : Governor
':' ActualParameter
1584 : ObjectSet
/* SimpleTableConstraint */
1585 | ComponentRelationConstraint
1588 ComponentRelationConstraint
1589 : '{' DefinedObjectSet
'}' '{' AtNotations
'}'
1594 : AtNotations
',' AtNotation
1599 : '@' ComponentIdList
1600 |
'@' '.' ComponentIdList
1604 : ComponentIdList
'.' IDENTIFIER
1611 ObjectClassAssignment
1612 : OBJECTCLASSREFERENCE ASSIGNMENT ObjectClass
1617 : OBJECTREFERENCE DefinedObjectClass ASSIGNMENT Object
1622 : OBJECTSETREFERENCE DefinedObjectClass ASSIGNMENT ObjectSet
1628 : DefinedObjectClass
1631 | ParameterizedObjectClass
1635 : ExternalObjectClassReference
1636 | OBJECTCLASSREFERENCE
1637 | UsefulObjectClassReference
1641 ExternalObjectClassReference
1642 : MODULEREFERENCE
'.' OBJECTCLASSREFERENCE
1644 $$
= ConcatNames
($1, '.', $3);
1648 UsefulObjectClassReference
1651 $$
= new PString
("TYPE-IDENTIFIER");
1655 $$
= new PString
("ABSTRACT-SYNTAX");
1661 : CLASS
'{' FieldSpecs
'}' WithSyntaxSpec
1665 : FieldSpecs
',' FieldSpec
1671 | FixedTypeValueFieldSpec
1672 | VariableTypeValueFieldSpec
1673 | FixedTypeValueSetFieldSpec
1674 | VariableTypeValueSetFieldSpec
1676 | ObjectSetFieldSpec
1680 : TYPEFIELDREFERENCE TypeOptionalitySpec
1690 FixedTypeValueFieldSpec
1691 : VALUEFIELDREFERENCE Type Unique ValueOptionalitySpec
1700 ValueOptionalitySpec
1706 VariableTypeValueFieldSpec
1707 : VALUEFIELDREFERENCE FieldName ValueOptionalitySpec
1711 FixedTypeValueSetFieldSpec
1712 : VALUESETFIELDREFERENCE Type ValueSetOptionalitySpec
1716 ValueSetOptionalitySpec
1722 VariableTypeValueSetFieldSpec
1723 : VALUESETFIELDREFERENCE FieldName ValueSetOptionalitySpec
1728 : OBJECTFIELDREFERENCE DefinedObjectClass ObjectOptionalitySpec
1732 ObjectOptionalitySpec
1739 : OBJECTSETFIELDREFERENCE DefinedObjectClass ObjectSetOptionalitySpec
1743 ObjectSetOptionalitySpec
1750 : WITH SYNTAX SyntaxList
1755 : '{' TokenOrGroupSpecs
'}'
1760 : TokenOrGroupSpecs TokenOrGroupSpec
1770 : '[' TokenOrGroupSpecs
']'
1775 | PrimitiveFieldName
1808 : ExternalObjectReference
1813 ExternalObjectReference
1814 : MODULEREFERENCE
'.' OBJECTREFERENCE
1819 ParameterizedObjectClass
1820 : DefinedObjectClass ActualParameterList
1826 : ExternalObjectSetReference
1828 | OBJECTSETREFERENCE
1832 ExternalObjectSetReference
1833 : MODULEREFERENCE
'.' OBJECTSETREFERENCE
1838 ParameterizedObjectSet
1839 : DefinedObjectSet ActualParameterList
1844 : FieldName
'.' PrimitiveFieldName
1846 $$
= ConcatNames
($1, '.', $3);
1848 | PrimitiveFieldName
1853 : TYPEFIELDREFERENCE
1854 | VALUEFIELDREFERENCE
1855 | VALUESETFIELDREFERENCE
1856 | OBJECTFIELDREFERENCE
1857 | OBJECTSETFIELDREFERENCE
1870 | ParameterizedObject
1882 : '{' FieldSettings '}
1887 : FieldSettings ',' FieldSetting
1892 : PrimitiveFieldName Setting
1896 : '{' DefinedSyntaxTokens '}'
1900 : DefinedSyntaxTokens DefinedSyntaxToken
1920 : '{' ElementSetSpec
'}'
1926 : ReferencedObjects
'.' FieldName
1936 | ObjectSetFromObjects
1938 | ParameterizedObjectSet
1943 ObjectSetFromObjects
1944 : ReferencedObjects '.' FieldName
1952 ParameterizedAssignment
1953 : ParameterizedTypeAssignment
1954 | ParameterizedValueAssignment
1955 | ParameterizedValueSetTypeAssignment
1956 | ParameterizedObjectClassAssignment
1957 | ParameterizedObjectAssignment
1958 | ParameterizedObjectSetAssignment
1961 ParameterizedTypeAssignment
1962 : TYPEREFERENCE ParameterList
1964 DummyParameters
= $2;
1968 DummyParameters
= NULL
;
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
2001 : '{' Parameters
'}'
2008 : Parameters
',' Parameter
2015 $$
= new PStringList
;
2021 : Governor
':' Reference
2031 | DefinedObjectClass
2037 : SimpleDefinedType ActualParameterList
2039 $$
= new ParameterizedType
($1, $2);
2044 : ExternalTypeReference
2050 : '{' ActualParameters
'}'
2057 : ActualParameters
',' ActualParameter
2075 | DefinedObjectClass
2091 IdentifierTokenContext
= $2->GetIdentifierTokenContext
();
2092 BraceTokenContext
= $2->GetBraceTokenContext
();
2093 NullTokenContext
= NULL_VALUE
;
2097 $5->SetValueName
($1);
2098 Module
->AddValue
($5);
2099 IdentifierTokenContext
= IDENTIFIER
;
2100 BraceTokenContext
= '{';
2101 NullTokenContext
= NULL_TYPE
;
2115 | CharacterStringValue
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);
2127 | ObjectClassFieldValue
2129 | ObjectIdentifierValue
2136 /*| SetValue synonym to SequenceValue */
2137 /*| SetOfValue synonym to SequenceOfValue */
2138 /*| TaggedValue synonym to Value */
2143 : ExternalValueReference
2145 $$
= new DefinedValue
($1);
2149 $$
= new DefinedValue
($1);
2151 | ParameterizedValue
2155 ExternalValueReference
2156 : MODULEREFERENCE
'.' IDENTIFIER
2164 ObjectIdentifierValue
2167 IdentifierTokenContext
= OID_IDENTIFIER
;
2169 ObjIdComponentList
'}'
2171 $$
= new ObjectIdentifierValue
($3);
2172 IdentifierTokenContext
= IDENTIFIER
;
2175 | '{' DefinedValue_OID ObjIdComponentList '}'
2177 $$ = new ObjectIdentifierValue($2);
2186 $$
= new PStringList
;
2189 | ObjIdComponent ObjIdComponentList
2191 $2->InsertAt
(0, $1);
2200 $$
= new PString
(PString
::Unsigned
, (int)$1);
2202 | OID_IDENTIFIER
'(' NumberForm
')'
2212 $$
= new PString
(PString
::Unsigned
, (int)$1);
2214 | ExternalValueReference
2222 $$
= new OctetStringValue
($1);
2226 $$
= new OctetStringValue
($1);
2233 $$
= new BitStringValue
($1);
2237 $$
= new BitStringValue
($1);
2239 | BITSTRING_BRACE BitIdentifierList
'}'
2241 $$
= new BitStringValue
($2);
2243 | BITSTRING_BRACE
'}'
2245 $$
= new BitStringValue
;
2253 $$
= new PStringList
;
2255 | BitIdentifierList
',' BIT_IDENTIFIER
2258 $1->SetAt
($1->GetSize
(), 0);
2266 $$
= new BooleanValue
(TRUE
);
2270 $$
= new BooleanValue
(FALSE
);
2275 CharacterStringValue
2276 : RestrictedCharacterStringValue
2278 | UnrestrictedCharacterStringValue
2282 RestrictedCharacterStringValue
2285 $$
= new CharacterStringValue
($1);
2287 | CharacterStringList
2293 : STRING_BRACE CharSyms
'}'
2295 $$
= new CharacterStringValue
($2);
2302 $$
= new PStringList
;
2305 | CharSyms
',' CharsDefn
2315 PError
<< StdError
(Warning
) << "DefinedValue in string unsupported" << endl
;
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);
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);
2339 : IDENTIFIER
':' Value
2341 $3->SetValueName
($1);
2363 $$
= new RealValue
(0);
2373 $$
= new RealValue
(0);
2377 $$
= new RealValue
(0);
2383 : '{' ComponentValueList
'}'
2385 $$
= new SequenceValue
($2);
2389 $$
= new SequenceValue
;
2396 $$
= new ValuesList
;
2399 | ComponentValueList
',' NamedValue
2408 $2->SetValueName
($1);
2429 | ValueList ',' Value
2436 ObjectClassFieldValue
2456 : ReferencedObjects '.' FieldName
2463 : SimpleDefinedValue ActualParameterList
2468 : ExternalValueReference
2477 : '{' ElementSetSpecs
'}'
2484 : TYPEREFERENCE MACRO ASSIGNMENT MacroSubstance
2486 PError
<< StdError
(Warning
) << "MACRO unsupported" << endl
;
2493 InMacroContext
= TRUE
;
2497 InMacroContext
= FALSE
;
2501 | TYPEREFERENCE
'.' TYPEREFERENCE
2506 : TypeProduction ValueProduction
/*SupportingProductions*/
2510 : TYPE_t NOTATION ASSIGNMENT MacroAlternativeList
2514 : VALUE NOTATION ASSIGNMENT MacroAlternativeList
2519 SupportingProductions
2526 | ProductionList Production
2530 : TYPEREFERENCE ASSIGNMENT MacroAlternativeList
2535 MacroAlternativeList
2537 | MacroAlternative
'|' MacroAlternativeList
2542 | SymbolElement MacroAlternative
2547 | EmbeddedDefinitions
2555 | TYPEREFERENCE ASSIGNMENT
2562 | type_t
'(' TYPE_t TYPEREFERENCE
')'
2563 | value_t
'(' Type
')'
2564 | value_t
'(' IDENTIFIER Type
')'
2565 | value_t
'(' VALUE Type
')'
2569 : '<' EmbeddedDefinitionList
'>'
2572 EmbeddedDefinitionList
2573 : EmbeddedDefinition
2574 | EmbeddedDefinitionList EmbeddedDefinition
2578 : LocalTypeAssignment
2579 | LocalValueAssignment
2583 : TYPEREFERENCE ASSIGNMENT Type
2587 LocalValueAssignment
2588 : IDENTIFIER Type ASSIGNMENT Value
2595 ObjectTypeDefinition
2596 : IDENTIFIER OBJECT_TYPE
2598 InMIBContext
= TRUE
;
2601 ACCESS ObjectTypeAccess
2602 STATUS ObjectTypeStatus
2608 IdentifierTokenContext
= OID_IDENTIFIER
;
2612 Module
->AddMIB
(new MibObject
($1, $5, (MibObject
::Access
)$7, (MibObject
::Status
)$9, $10, $11, $12, $13, $16));
2613 InMIBContext
= FALSE
;
2614 IdentifierTokenContext
= IDENTIFIER
;
2621 $$
= MibObject
::read_only
;
2625 $$
= MibObject
::read_write
;
2629 $$
= MibObject
::write_only
;
2633 $$
= MibObject
::not_accessible
;
2640 $$
= MibObject
::mandatory
;
2644 $$
= MibObject
::optional
;
2648 $$
= MibObject
::obsolete
;
2652 $$
= MibObject
::deprecated
;
2657 : DESCRIPTION_t CSTRING
2668 : REFERENCE_t CSTRING
2679 : INDEX_t
'{' MibIndexTypes
'}'
2692 $$
= new PStringList
;
2695 | MibIndexTypes
',' MibIndexType
2707 : DEFVAL_t
'{' Value
'}'
2718 : IDENTIFIER TRAP_TYPE
2720 InMIBContext
= TRUE
;
2721 IdentifierTokenContext
= OID_IDENTIFIER
;
2729 Module
->AddMIB
(new MibTrap
($1, $5, $6, $7, $8, $10));
2730 IdentifierTokenContext
= IDENTIFIER
;
2731 InMIBContext
= FALSE
;
2736 : VARIABLES
'{' MibVarTypes
'}'
2749 $$
= new ValuesList
;
2752 | MibVarTypes
',' Value
2762 /*!!! Not actually referenced by any other part of grammar
2764 : '@' GlobalModuleReference '.' ItemSpec
2769 | ItemId '.' ComponentId
2787 | OBJECTCLASSREFERENCE
2789 | OBJECTSETREFERENCE
2792 ParameterizedReference
2795 $$
= new ImportedType
($1, TRUE
);
2803 $$
= new NamedNumberList
;
2806 | NamedNumberList
',' NamedNumber
2813 : IDENTIFIER
'(' SignedNumber
')'
2815 $$
= new NamedNumber
($1, (int)$3);
2817 | IDENTIFIER
'(' DefinedValue
')'
2819 $$
= new NamedNumber
($1, ((DefinedValue
*)$3)->GetReference
());
2834 /** End of File ****/