Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.8.2. */
2 :
3 : /* Bison implementation for Yacc-like parsers in C
4 :
5 : Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 : Inc.
7 :
8 : This program is free software: you can redistribute it and/or modify
9 : it under the terms of the GNU General Public License as published by
10 : the Free Software Foundation, either version 3 of the License, or
11 : (at your option) any later version.
12 :
13 : This program is distributed in the hope that it will be useful,
14 : but WITHOUT ANY WARRANTY; without even the implied warranty of
15 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 : GNU General Public License for more details.
17 :
18 : You should have received a copy of the GNU General Public License
19 : along with this program. If not, see <https://www.gnu.org/licenses/>. */
20 :
21 : /* As a special exception, you may create a larger work that contains
22 : part or all of the Bison parser skeleton and distribute that work
23 : under terms of your choice, so long as that work isn't itself a
24 : parser generator using the skeleton or a modified version thereof
25 : as a parser skeleton. Alternatively, if you modify or redistribute
26 : the parser skeleton itself, you may (at your option) remove this
27 : special exception, which will cause the skeleton and the resulting
28 : Bison output files to be licensed under the GNU General Public
29 : License without this special exception.
30 :
31 : This special exception was added by the Free Software Foundation in
32 : version 2.2 of Bison. */
33 :
34 : /* C LALR(1) parser skeleton written by Richard Stallman, by
35 : simplifying the original so-called "semantic" parser. */
36 :
37 : /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 : especially those whose name start with YY_ or yy_. They are
39 : private implementation details that can be changed or removed. */
40 :
41 : /* All symbols defined below should begin with yy or YY, to avoid
42 : infringing on user name space. This should be done even for local
43 : variables, as they might otherwise be expanded by user macros.
44 : There are some unavoidable exceptions within include files to
45 : define necessary library symbols; they are noted "INFRINGES ON
46 : USER NAME SPACE" below. */
47 :
48 : /* Identify Bison output, and Bison version. */
49 : #define YYBISON 30802
50 :
51 : /* Bison version string. */
52 : #define YYBISON_VERSION "3.8.2"
53 :
54 : /* Skeleton name. */
55 : #define YYSKELETON_NAME "yacc.c"
56 :
57 : /* Pure parsers. */
58 : #define YYPURE 0
59 :
60 : /* Push parsers. */
61 : #define YYPUSH 0
62 :
63 : /* Pull parsers. */
64 : #define YYPULL 1
65 :
66 :
67 :
68 :
69 : /* First part of user prologue. */
70 :
71 :
72 : #include <config.h>
73 :
74 : #include <stdio.h>
75 : #include <stdlib.h>
76 : #include <stdint.h>
77 : #include <string.h>
78 : #include "symbol.h"
79 : #include "lex.h"
80 : #include "gen_locl.h"
81 : #include "der.h"
82 :
83 : static Type *new_type (Typetype t);
84 : /*static IOSClass *new_class(struct fieldhead *);*/
85 : /*static IOSObject *new_object(struct objfieldhead *);*/
86 : /*IOSObjectSet *new_object_set(struct objectshead *);*/
87 : static struct objectshead *add_object_set_spec(struct objectshead *, IOSObject *);
88 : static ObjectField *new_field_setting(char *, Type *, struct value *);
89 : static struct objfieldhead *add_field_setting(struct objfieldhead *, ObjectField *);
90 : static struct fieldhead *add_field_spec(struct fieldhead *, Field *);
91 : static Field *new_type_field(char *, int, Type *);
92 : static Field *new_fixed_type_value_field(char *, Type *, int, int, struct value *);
93 : static Type *parametrize_type(Type *, IOSClass *);
94 : static Type *type_from_class_field(IOSClass *, const char *);
95 : static void validate_object_set(IOSObjectSet *);
96 : /*static Type *type_from_object(const char *, const char *);*/
97 : static struct constraint_spec *new_constraint_spec(enum ctype);
98 : static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
99 : void yyerror (const char *);
100 : #define yyerror yyerror
101 : static struct objid *new_objid(const char *label, int value);
102 : static void add_oid_to_tail(struct objid *, struct objid *);
103 : static void fix_labels(Symbol *s);
104 :
105 : struct string_list {
106 : char *string;
107 : struct string_list *next;
108 : };
109 :
110 : static int default_tag_env = TE_EXPLICIT;
111 : static unsigned long idcounter;
112 :
113 : /* Declarations for Bison */
114 : #define YYMALLOC malloc
115 : #define YYFREE free
116 :
117 :
118 :
119 : # ifndef YY_CAST
120 : # ifdef __cplusplus
121 : # define YY_CAST(Type, Val) static_cast<Type> (Val)
122 : # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
123 : # else
124 : # define YY_CAST(Type, Val) ((Type) (Val))
125 : # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
126 : # endif
127 : # endif
128 : # ifndef YY_NULLPTR
129 : # if defined __cplusplus
130 : # if 201103L <= __cplusplus
131 : # define YY_NULLPTR nullptr
132 : # else
133 : # define YY_NULLPTR 0
134 : # endif
135 : # else
136 : # define YY_NULLPTR ((void*)0)
137 : # endif
138 : # endif
139 :
140 : #include "asn1parse.tab.h"
141 : /* Symbol kind. */
142 : enum yysymbol_kind_t
143 : {
144 : YYSYMBOL_YYEMPTY = -2,
145 : YYSYMBOL_YYEOF = 0, /* "end of file" */
146 : YYSYMBOL_YYerror = 1, /* error */
147 : YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
148 : YYSYMBOL_kw_ABSENT = 3, /* kw_ABSENT */
149 : YYSYMBOL_kw_ABSTRACT_SYNTAX = 4, /* kw_ABSTRACT_SYNTAX */
150 : YYSYMBOL_kw_ALL = 5, /* kw_ALL */
151 : YYSYMBOL_kw_APPLICATION = 6, /* kw_APPLICATION */
152 : YYSYMBOL_kw_AUTOMATIC = 7, /* kw_AUTOMATIC */
153 : YYSYMBOL_kw_BEGIN = 8, /* kw_BEGIN */
154 : YYSYMBOL_kw_BIT = 9, /* kw_BIT */
155 : YYSYMBOL_kw_BMPString = 10, /* kw_BMPString */
156 : YYSYMBOL_kw_BOOLEAN = 11, /* kw_BOOLEAN */
157 : YYSYMBOL_kw_BY = 12, /* kw_BY */
158 : YYSYMBOL_kw_CHARACTER = 13, /* kw_CHARACTER */
159 : YYSYMBOL_kw_CHOICE = 14, /* kw_CHOICE */
160 : YYSYMBOL_kw_CLASS = 15, /* kw_CLASS */
161 : YYSYMBOL_kw_COMPONENT = 16, /* kw_COMPONENT */
162 : YYSYMBOL_kw_COMPONENTS = 17, /* kw_COMPONENTS */
163 : YYSYMBOL_kw_CONSTRAINED = 18, /* kw_CONSTRAINED */
164 : YYSYMBOL_kw_CONTAINING = 19, /* kw_CONTAINING */
165 : YYSYMBOL_kw_DEFAULT = 20, /* kw_DEFAULT */
166 : YYSYMBOL_kw_DEFINITIONS = 21, /* kw_DEFINITIONS */
167 : YYSYMBOL_kw_EMBEDDED = 22, /* kw_EMBEDDED */
168 : YYSYMBOL_kw_ENCODED = 23, /* kw_ENCODED */
169 : YYSYMBOL_kw_END = 24, /* kw_END */
170 : YYSYMBOL_kw_ENUMERATED = 25, /* kw_ENUMERATED */
171 : YYSYMBOL_kw_EXCEPT = 26, /* kw_EXCEPT */
172 : YYSYMBOL_kw_EXPLICIT = 27, /* kw_EXPLICIT */
173 : YYSYMBOL_kw_EXPORTS = 28, /* kw_EXPORTS */
174 : YYSYMBOL_kw_EXTENSIBILITY = 29, /* kw_EXTENSIBILITY */
175 : YYSYMBOL_kw_EXTERNAL = 30, /* kw_EXTERNAL */
176 : YYSYMBOL_kw_FALSE = 31, /* kw_FALSE */
177 : YYSYMBOL_kw_FROM = 32, /* kw_FROM */
178 : YYSYMBOL_kw_GeneralString = 33, /* kw_GeneralString */
179 : YYSYMBOL_kw_GeneralizedTime = 34, /* kw_GeneralizedTime */
180 : YYSYMBOL_kw_GraphicString = 35, /* kw_GraphicString */
181 : YYSYMBOL_kw_IA5String = 36, /* kw_IA5String */
182 : YYSYMBOL_kw_IDENTIFIER = 37, /* kw_IDENTIFIER */
183 : YYSYMBOL_kw_IMPLICIT = 38, /* kw_IMPLICIT */
184 : YYSYMBOL_kw_IMPLIED = 39, /* kw_IMPLIED */
185 : YYSYMBOL_kw_IMPORTS = 40, /* kw_IMPORTS */
186 : YYSYMBOL_kw_INCLUDES = 41, /* kw_INCLUDES */
187 : YYSYMBOL_kw_INSTANCE = 42, /* kw_INSTANCE */
188 : YYSYMBOL_kw_INTEGER = 43, /* kw_INTEGER */
189 : YYSYMBOL_kw_INTERSECTION = 44, /* kw_INTERSECTION */
190 : YYSYMBOL_kw_ISO646String = 45, /* kw_ISO646String */
191 : YYSYMBOL_kw_MAX = 46, /* kw_MAX */
192 : YYSYMBOL_kw_MIN = 47, /* kw_MIN */
193 : YYSYMBOL_kw_MINUS_INFINITY = 48, /* kw_MINUS_INFINITY */
194 : YYSYMBOL_kw_NULL = 49, /* kw_NULL */
195 : YYSYMBOL_kw_NumericString = 50, /* kw_NumericString */
196 : YYSYMBOL_kw_OBJECT = 51, /* kw_OBJECT */
197 : YYSYMBOL_kw_OCTET = 52, /* kw_OCTET */
198 : YYSYMBOL_kw_OF = 53, /* kw_OF */
199 : YYSYMBOL_kw_OPTIONAL = 54, /* kw_OPTIONAL */
200 : YYSYMBOL_kw_ObjectDescriptor = 55, /* kw_ObjectDescriptor */
201 : YYSYMBOL_kw_PATTERN = 56, /* kw_PATTERN */
202 : YYSYMBOL_kw_PDV = 57, /* kw_PDV */
203 : YYSYMBOL_kw_PLUS_INFINITY = 58, /* kw_PLUS_INFINITY */
204 : YYSYMBOL_kw_PRESENT = 59, /* kw_PRESENT */
205 : YYSYMBOL_kw_PRIVATE = 60, /* kw_PRIVATE */
206 : YYSYMBOL_kw_PrintableString = 61, /* kw_PrintableString */
207 : YYSYMBOL_kw_REAL = 62, /* kw_REAL */
208 : YYSYMBOL_kw_RELATIVE_OID = 63, /* kw_RELATIVE_OID */
209 : YYSYMBOL_kw_SEQUENCE = 64, /* kw_SEQUENCE */
210 : YYSYMBOL_kw_SET = 65, /* kw_SET */
211 : YYSYMBOL_kw_SIZE = 66, /* kw_SIZE */
212 : YYSYMBOL_kw_STRING = 67, /* kw_STRING */
213 : YYSYMBOL_kw_SYNTAX = 68, /* kw_SYNTAX */
214 : YYSYMBOL_kw_T61String = 69, /* kw_T61String */
215 : YYSYMBOL_kw_TAGS = 70, /* kw_TAGS */
216 : YYSYMBOL_kw_TRUE = 71, /* kw_TRUE */
217 : YYSYMBOL_kw_TYPE_IDENTIFIER = 72, /* kw_TYPE_IDENTIFIER */
218 : YYSYMBOL_kw_TeletexString = 73, /* kw_TeletexString */
219 : YYSYMBOL_kw_UNION = 74, /* kw_UNION */
220 : YYSYMBOL_kw_UNIQUE = 75, /* kw_UNIQUE */
221 : YYSYMBOL_kw_UNIVERSAL = 76, /* kw_UNIVERSAL */
222 : YYSYMBOL_kw_UTCTime = 77, /* kw_UTCTime */
223 : YYSYMBOL_kw_UTF8String = 78, /* kw_UTF8String */
224 : YYSYMBOL_kw_UniversalString = 79, /* kw_UniversalString */
225 : YYSYMBOL_kw_VideotexString = 80, /* kw_VideotexString */
226 : YYSYMBOL_kw_VisibleString = 81, /* kw_VisibleString */
227 : YYSYMBOL_kw_WITH = 82, /* kw_WITH */
228 : YYSYMBOL_RANGE = 83, /* RANGE */
229 : YYSYMBOL_EEQUAL = 84, /* EEQUAL */
230 : YYSYMBOL_ELLIPSIS = 85, /* ELLIPSIS */
231 : YYSYMBOL_TYPE_IDENTIFIER = 86, /* TYPE_IDENTIFIER */
232 : YYSYMBOL_referencename = 87, /* referencename */
233 : YYSYMBOL_CLASS_IDENTIFIER = 88, /* CLASS_IDENTIFIER */
234 : YYSYMBOL_VALUE_IDENTIFIER = 89, /* VALUE_IDENTIFIER */
235 : YYSYMBOL_STRING = 90, /* STRING */
236 : YYSYMBOL_NUMBER = 91, /* NUMBER */
237 : YYSYMBOL_92_ = 92, /* ';' */
238 : YYSYMBOL_93_ = 93, /* ',' */
239 : YYSYMBOL_94_ = 94, /* '{' */
240 : YYSYMBOL_95_ = 95, /* '}' */
241 : YYSYMBOL_96_ = 96, /* '|' */
242 : YYSYMBOL_97_ = 97, /* '&' */
243 : YYSYMBOL_98_ = 98, /* ':' */
244 : YYSYMBOL_99_ = 99, /* '.' */
245 : YYSYMBOL_100_ = 100, /* '(' */
246 : YYSYMBOL_101_ = 101, /* ')' */
247 : YYSYMBOL_102_ = 102, /* '@' */
248 : YYSYMBOL_103_ = 103, /* '[' */
249 : YYSYMBOL_104_ = 104, /* ']' */
250 : YYSYMBOL_YYACCEPT = 105, /* $accept */
251 : YYSYMBOL_Identifier = 106, /* Identifier */
252 : YYSYMBOL_ModuleDefinition = 107, /* ModuleDefinition */
253 : YYSYMBOL_TagDefault = 108, /* TagDefault */
254 : YYSYMBOL_ExtensionDefault = 109, /* ExtensionDefault */
255 : YYSYMBOL_ModuleBody = 110, /* ModuleBody */
256 : YYSYMBOL_Imports = 111, /* Imports */
257 : YYSYMBOL_SymbolsImported = 112, /* SymbolsImported */
258 : YYSYMBOL_SymbolsFromModuleList = 113, /* SymbolsFromModuleList */
259 : YYSYMBOL_SymbolsFromModule = 114, /* SymbolsFromModule */
260 : YYSYMBOL_Exports = 115, /* Exports */
261 : YYSYMBOL_AssignmentList = 116, /* AssignmentList */
262 : YYSYMBOL_Assignment = 117, /* Assignment */
263 : YYSYMBOL_referencenames = 118, /* referencenames */
264 : YYSYMBOL_DefinedObjectClass = 119, /* DefinedObjectClass */
265 : YYSYMBOL_ObjectClassAssignment = 120, /* ObjectClassAssignment */
266 : YYSYMBOL_ObjectClassDefn = 121, /* ObjectClassDefn */
267 : YYSYMBOL_ObjectAssignment = 122, /* ObjectAssignment */
268 : YYSYMBOL_ObjectSetAssignment = 123, /* ObjectSetAssignment */
269 : YYSYMBOL_ObjectSet = 124, /* ObjectSet */
270 : YYSYMBOL_ObjectSetSpec = 125, /* ObjectSetSpec */
271 : YYSYMBOL_Object = 126, /* Object */
272 : YYSYMBOL_DefinedObject = 127, /* DefinedObject */
273 : YYSYMBOL_DefinedObjectSet = 128, /* DefinedObjectSet */
274 : YYSYMBOL_ObjectDefn = 129, /* ObjectDefn */
275 : YYSYMBOL_FieldSettings = 130, /* FieldSettings */
276 : YYSYMBOL_FieldSetting = 131, /* FieldSetting */
277 : YYSYMBOL_FieldSpecList = 132, /* FieldSpecList */
278 : YYSYMBOL_FieldSpec = 133, /* FieldSpec */
279 : YYSYMBOL_TypeFieldSpec = 134, /* TypeFieldSpec */
280 : YYSYMBOL_FixedTypeValueFieldSpec = 135, /* FixedTypeValueFieldSpec */
281 : YYSYMBOL_TypeAssignment = 136, /* TypeAssignment */
282 : YYSYMBOL_ParameterizedTypeAssignment = 137, /* ParameterizedTypeAssignment */
283 : YYSYMBOL_Parameter = 138, /* Parameter */
284 : YYSYMBOL_DummyReference = 139, /* DummyReference */
285 : YYSYMBOL_ParamGovernor = 140, /* ParamGovernor */
286 : YYSYMBOL_UnconstrainedType = 141, /* UnconstrainedType */
287 : YYSYMBOL_Type = 142, /* Type */
288 : YYSYMBOL_BuiltinType = 143, /* BuiltinType */
289 : YYSYMBOL_ObjectClassFieldType = 144, /* ObjectClassFieldType */
290 : YYSYMBOL_BooleanType = 145, /* BooleanType */
291 : YYSYMBOL_range = 146, /* range */
292 : YYSYMBOL_IntegerType = 147, /* IntegerType */
293 : YYSYMBOL_NamedNumberList = 148, /* NamedNumberList */
294 : YYSYMBOL_NamedNumber = 149, /* NamedNumber */
295 : YYSYMBOL_EnumeratedType = 150, /* EnumeratedType */
296 : YYSYMBOL_Enumerations = 151, /* Enumerations */
297 : YYSYMBOL_BitStringType = 152, /* BitStringType */
298 : YYSYMBOL_ObjectIdentifierType = 153, /* ObjectIdentifierType */
299 : YYSYMBOL_OctetStringType = 154, /* OctetStringType */
300 : YYSYMBOL_NullType = 155, /* NullType */
301 : YYSYMBOL_size = 156, /* size */
302 : YYSYMBOL_SequenceType = 157, /* SequenceType */
303 : YYSYMBOL_SequenceOfType = 158, /* SequenceOfType */
304 : YYSYMBOL_SetType = 159, /* SetType */
305 : YYSYMBOL_SetOfType = 160, /* SetOfType */
306 : YYSYMBOL_ChoiceType = 161, /* ChoiceType */
307 : YYSYMBOL_ReferencedType = 162, /* ReferencedType */
308 : YYSYMBOL_DefinedType = 163, /* DefinedType */
309 : YYSYMBOL_ParameterizedType = 164, /* ParameterizedType */
310 : YYSYMBOL_ActualParameter = 165, /* ActualParameter */
311 : YYSYMBOL_UsefulType = 166, /* UsefulType */
312 : YYSYMBOL_ConstrainedType = 167, /* ConstrainedType */
313 : YYSYMBOL_Constraint = 168, /* Constraint */
314 : YYSYMBOL_ConstraintSpec = 169, /* ConstraintSpec */
315 : YYSYMBOL_SubtypeConstraint = 170, /* SubtypeConstraint */
316 : YYSYMBOL_GeneralConstraint = 171, /* GeneralConstraint */
317 : YYSYMBOL_ContentsConstraint = 172, /* ContentsConstraint */
318 : YYSYMBOL_UserDefinedConstraint = 173, /* UserDefinedConstraint */
319 : YYSYMBOL_TableConstraint = 174, /* TableConstraint */
320 : YYSYMBOL_SimpleTableConstraint = 175, /* SimpleTableConstraint */
321 : YYSYMBOL_ComponentRelationConstraint = 176, /* ComponentRelationConstraint */
322 : YYSYMBOL_TaggedType = 177, /* TaggedType */
323 : YYSYMBOL_Tag = 178, /* Tag */
324 : YYSYMBOL_Class = 179, /* Class */
325 : YYSYMBOL_tagenv = 180, /* tagenv */
326 : YYSYMBOL_ValueAssignment = 181, /* ValueAssignment */
327 : YYSYMBOL_CharacterStringType = 182, /* CharacterStringType */
328 : YYSYMBOL_RestrictedCharactedStringType = 183, /* RestrictedCharactedStringType */
329 : YYSYMBOL_ComponentTypeList = 184, /* ComponentTypeList */
330 : YYSYMBOL_NamedType = 185, /* NamedType */
331 : YYSYMBOL_ComponentType = 186, /* ComponentType */
332 : YYSYMBOL_NamedBitList = 187, /* NamedBitList */
333 : YYSYMBOL_NamedBit = 188, /* NamedBit */
334 : YYSYMBOL_objid_opt = 189, /* objid_opt */
335 : YYSYMBOL_objid = 190, /* objid */
336 : YYSYMBOL_objid_list = 191, /* objid_list */
337 : YYSYMBOL_objid_element = 192, /* objid_element */
338 : YYSYMBOL_Value = 193, /* Value */
339 : YYSYMBOL_ValueExNull = 194, /* ValueExNull */
340 : YYSYMBOL_BuiltinValue = 195, /* BuiltinValue */
341 : YYSYMBOL_BuiltinValueExNull = 196, /* BuiltinValueExNull */
342 : YYSYMBOL_ReferencedValue = 197, /* ReferencedValue */
343 : YYSYMBOL_DefinedValue = 198, /* DefinedValue */
344 : YYSYMBOL_Valuereference = 199, /* Valuereference */
345 : YYSYMBOL_CharacterStringValue = 200, /* CharacterStringValue */
346 : YYSYMBOL_BooleanValue = 201, /* BooleanValue */
347 : YYSYMBOL_IntegerValue = 202, /* IntegerValue */
348 : YYSYMBOL_SignedNumber = 203, /* SignedNumber */
349 : YYSYMBOL_NullValue = 204, /* NullValue */
350 : YYSYMBOL_ObjectIdentifierValue = 205 /* ObjectIdentifierValue */
351 : };
352 : typedef enum yysymbol_kind_t yysymbol_kind_t;
353 :
354 :
355 :
356 :
357 : #ifdef short
358 : # undef short
359 : #endif
360 :
361 : /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
362 : <limits.h> and (if available) <stdint.h> are included
363 : so that the code can choose integer types of a good width. */
364 :
365 : #ifndef __PTRDIFF_MAX__
366 : # include <limits.h> /* INFRINGES ON USER NAME SPACE */
367 : # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
368 : # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
369 : # define YY_STDINT_H
370 : # endif
371 : #endif
372 :
373 : /* Narrow types that promote to a signed type and that can represent a
374 : signed or unsigned integer of at least N bits. In tables they can
375 : save space and decrease cache pressure. Promoting to a signed type
376 : helps avoid bugs in integer arithmetic. */
377 :
378 : #ifdef __INT_LEAST8_MAX__
379 : typedef __INT_LEAST8_TYPE__ yytype_int8;
380 : #elif defined YY_STDINT_H
381 : typedef int_least8_t yytype_int8;
382 : #else
383 : typedef signed char yytype_int8;
384 : #endif
385 :
386 : #ifdef __INT_LEAST16_MAX__
387 : typedef __INT_LEAST16_TYPE__ yytype_int16;
388 : #elif defined YY_STDINT_H
389 : typedef int_least16_t yytype_int16;
390 : #else
391 : typedef short yytype_int16;
392 : #endif
393 :
394 : /* Work around bug in HP-UX 11.23, which defines these macros
395 : incorrectly for preprocessor constants. This workaround can likely
396 : be removed in 2023, as HPE has promised support for HP-UX 11.23
397 : (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
398 : <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
399 : #ifdef __hpux
400 : # undef UINT_LEAST8_MAX
401 : # undef UINT_LEAST16_MAX
402 : # define UINT_LEAST8_MAX 255
403 : # define UINT_LEAST16_MAX 65535
404 : #endif
405 :
406 : #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
407 : typedef __UINT_LEAST8_TYPE__ yytype_uint8;
408 : #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
409 : && UINT_LEAST8_MAX <= INT_MAX)
410 : typedef uint_least8_t yytype_uint8;
411 : #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
412 : typedef unsigned char yytype_uint8;
413 : #else
414 : typedef short yytype_uint8;
415 : #endif
416 :
417 : #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
418 : typedef __UINT_LEAST16_TYPE__ yytype_uint16;
419 : #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
420 : && UINT_LEAST16_MAX <= INT_MAX)
421 : typedef uint_least16_t yytype_uint16;
422 : #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
423 : typedef unsigned short yytype_uint16;
424 : #else
425 : typedef int yytype_uint16;
426 : #endif
427 :
428 : #ifndef YYPTRDIFF_T
429 : # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
430 : # define YYPTRDIFF_T __PTRDIFF_TYPE__
431 : # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
432 : # elif defined PTRDIFF_MAX
433 : # ifndef ptrdiff_t
434 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
435 : # endif
436 : # define YYPTRDIFF_T ptrdiff_t
437 : # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
438 : # else
439 : # define YYPTRDIFF_T long
440 : # define YYPTRDIFF_MAXIMUM LONG_MAX
441 : # endif
442 : #endif
443 :
444 : #ifndef YYSIZE_T
445 : # ifdef __SIZE_TYPE__
446 : # define YYSIZE_T __SIZE_TYPE__
447 : # elif defined size_t
448 : # define YYSIZE_T size_t
449 : # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
450 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
451 : # define YYSIZE_T size_t
452 : # else
453 : # define YYSIZE_T unsigned
454 : # endif
455 : #endif
456 :
457 : #define YYSIZE_MAXIMUM \
458 : YY_CAST (YYPTRDIFF_T, \
459 : (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
460 : ? YYPTRDIFF_MAXIMUM \
461 : : YY_CAST (YYSIZE_T, -1)))
462 :
463 : #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
464 :
465 :
466 : /* Stored state numbers (used for stacks). */
467 : typedef yytype_int16 yy_state_t;
468 :
469 : /* State numbers in computations. */
470 : typedef int yy_state_fast_t;
471 :
472 : #ifndef YY_
473 : # if defined YYENABLE_NLS && YYENABLE_NLS
474 : # if ENABLE_NLS
475 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
476 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
477 : # endif
478 : # endif
479 : # ifndef YY_
480 : # define YY_(Msgid) Msgid
481 : # endif
482 : #endif
483 :
484 :
485 : #ifndef YY_ATTRIBUTE_PURE
486 : # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
487 : # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
488 : # else
489 : # define YY_ATTRIBUTE_PURE
490 : # endif
491 : #endif
492 :
493 : #ifndef YY_ATTRIBUTE_UNUSED
494 : # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
495 : # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
496 : # else
497 : # define YY_ATTRIBUTE_UNUSED
498 : # endif
499 : #endif
500 :
501 : /* Suppress unused-variable warnings by "using" E. */
502 : #if ! defined lint || defined __GNUC__
503 : # define YY_USE(E) ((void) (E))
504 : #else
505 : # define YY_USE(E) /* empty */
506 : #endif
507 :
508 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
509 : #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
510 : # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
511 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
512 : _Pragma ("GCC diagnostic push") \
513 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
514 : # else
515 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
516 : _Pragma ("GCC diagnostic push") \
517 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
518 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
519 : # endif
520 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
521 : _Pragma ("GCC diagnostic pop")
522 : #else
523 : # define YY_INITIAL_VALUE(Value) Value
524 : #endif
525 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
526 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
527 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
528 : #endif
529 : #ifndef YY_INITIAL_VALUE
530 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
531 : #endif
532 :
533 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
534 : # define YY_IGNORE_USELESS_CAST_BEGIN \
535 : _Pragma ("GCC diagnostic push") \
536 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
537 : # define YY_IGNORE_USELESS_CAST_END \
538 : _Pragma ("GCC diagnostic pop")
539 : #endif
540 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
541 : # define YY_IGNORE_USELESS_CAST_BEGIN
542 : # define YY_IGNORE_USELESS_CAST_END
543 : #endif
544 :
545 :
546 : #define YY_ASSERT(E) ((void) (0 && (E)))
547 :
548 : #if !defined yyoverflow
549 :
550 : /* The parser invokes alloca or malloc; define the necessary symbols. */
551 :
552 : # ifdef YYSTACK_USE_ALLOCA
553 : # if YYSTACK_USE_ALLOCA
554 : # ifdef __GNUC__
555 : # define YYSTACK_ALLOC __builtin_alloca
556 : # elif defined __BUILTIN_VA_ARG_INCR
557 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
558 : # elif defined _AIX
559 : # define YYSTACK_ALLOC __alloca
560 : # elif defined _MSC_VER
561 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
562 : # define alloca _alloca
563 : # else
564 : # define YYSTACK_ALLOC alloca
565 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
566 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
567 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
568 : # ifndef EXIT_SUCCESS
569 : # define EXIT_SUCCESS 0
570 : # endif
571 : # endif
572 : # endif
573 : # endif
574 : # endif
575 :
576 : # ifdef YYSTACK_ALLOC
577 : /* Pacify GCC's 'empty if-body' warning. */
578 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
579 : # ifndef YYSTACK_ALLOC_MAXIMUM
580 : /* The OS might guarantee only one guard page at the bottom of the stack,
581 : and a page size can be as small as 4096 bytes. So we cannot safely
582 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
583 : to allow for a few compiler-allocated temporary stack slots. */
584 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
585 : # endif
586 : # else
587 : # define YYSTACK_ALLOC YYMALLOC
588 : # define YYSTACK_FREE YYFREE
589 : # ifndef YYSTACK_ALLOC_MAXIMUM
590 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
591 : # endif
592 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
593 : && ! ((defined YYMALLOC || defined malloc) \
594 : && (defined YYFREE || defined free)))
595 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
596 : # ifndef EXIT_SUCCESS
597 : # define EXIT_SUCCESS 0
598 : # endif
599 : # endif
600 : # ifndef YYMALLOC
601 : # define YYMALLOC malloc
602 : # if ! defined malloc && ! defined EXIT_SUCCESS
603 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
604 : # endif
605 : # endif
606 : # ifndef YYFREE
607 : # define YYFREE free
608 : # if ! defined free && ! defined EXIT_SUCCESS
609 : void free (void *); /* INFRINGES ON USER NAME SPACE */
610 : # endif
611 : # endif
612 : # endif
613 : #endif /* !defined yyoverflow */
614 :
615 : #if (! defined yyoverflow \
616 : && (! defined __cplusplus \
617 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
618 :
619 : /* A type that is properly aligned for any stack member. */
620 : union yyalloc
621 : {
622 : yy_state_t yyss_alloc;
623 : YYSTYPE yyvs_alloc;
624 : };
625 :
626 : /* The size of the maximum gap between one aligned stack and the next. */
627 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
628 :
629 : /* The size of an array large to enough to hold all stacks, each with
630 : N elements. */
631 : # define YYSTACK_BYTES(N) \
632 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
633 : + YYSTACK_GAP_MAXIMUM)
634 :
635 : # define YYCOPY_NEEDED 1
636 :
637 : /* Relocate STACK from its old location to the new one. The
638 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
639 : elements in the stack, and YYPTR gives the new location of the
640 : stack. Advance YYPTR to a properly aligned location for the next
641 : stack. */
642 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
643 : do \
644 : { \
645 : YYPTRDIFF_T yynewbytes; \
646 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
647 : Stack = &yyptr->Stack_alloc; \
648 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
649 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
650 : } \
651 : while (0)
652 :
653 : #endif
654 :
655 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
656 : /* Copy COUNT objects from SRC to DST. The source and destination do
657 : not overlap. */
658 : # ifndef YYCOPY
659 : # if defined __GNUC__ && 1 < __GNUC__
660 : # define YYCOPY(Dst, Src, Count) \
661 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
662 : # else
663 : # define YYCOPY(Dst, Src, Count) \
664 : do \
665 : { \
666 : YYPTRDIFF_T yyi; \
667 : for (yyi = 0; yyi < (Count); yyi++) \
668 : (Dst)[yyi] = (Src)[yyi]; \
669 : } \
670 : while (0)
671 : # endif
672 : # endif
673 : #endif /* !YYCOPY_NEEDED */
674 :
675 : /* YYFINAL -- State number of the termination state. */
676 : #define YYFINAL 8
677 : /* YYLAST -- Last index in YYTABLE. */
678 : #define YYLAST 415
679 :
680 : /* YYNTOKENS -- Number of terminals. */
681 : #define YYNTOKENS 105
682 : /* YYNNTS -- Number of nonterminals. */
683 : #define YYNNTS 101
684 : /* YYNRULES -- Number of rules. */
685 : #define YYNRULES 211
686 : /* YYNSTATES -- Number of states. */
687 : #define YYNSTATES 320
688 :
689 : /* YYMAXUTOK -- Last valid token kind. */
690 : #define YYMAXUTOK 346
691 :
692 :
693 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
694 : as returned by yylex, with out-of-bounds checking. */
695 : #define YYTRANSLATE(YYX) \
696 : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
697 : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
698 : : YYSYMBOL_YYUNDEF)
699 :
700 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
701 : as returned by yylex. */
702 : static const yytype_int8 yytranslate[] =
703 : {
704 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
705 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
706 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
707 : 2, 2, 2, 2, 2, 2, 2, 2, 97, 2,
708 : 100, 101, 2, 2, 93, 2, 99, 2, 2, 2,
709 : 2, 2, 2, 2, 2, 2, 2, 2, 98, 92,
710 : 2, 2, 2, 2, 102, 2, 2, 2, 2, 2,
711 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
712 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
713 : 2, 103, 2, 104, 2, 2, 2, 2, 2, 2,
714 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
715 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
716 : 2, 2, 2, 94, 96, 95, 2, 2, 2, 2,
717 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
718 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
719 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
720 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
721 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
722 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
723 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
724 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
725 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
726 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
727 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
728 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
729 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
730 : 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
731 : 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
732 : 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
733 : 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
734 : 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
735 : 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
736 : 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
737 : 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
738 : 85, 86, 87, 88, 89, 90, 91
739 : };
740 :
741 : #if YYDEBUG
742 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
743 : static const yytype_int16 yyrline[] =
744 : {
745 : 0, 355, 355, 356, 358, 379, 381, 383, 385, 388,
746 : 390, 393, 394, 397, 398, 401, 402, 405, 406, 409,
747 : 435, 441, 442, 445, 446, 449, 450, 451, 452, 453,
748 : 454, 458, 464, 473, 482, 490, 499, 506, 519, 532,
749 : 540, 542, 546, 547, 552, 561, 571, 580, 584, 591,
750 : 593, 601, 603, 623, 624, 631, 633, 635, 640, 642,
751 : 644, 646, 648, 650, 861, 887, 912, 917, 919, 925,
752 : 926, 927, 928, 929, 930, 931, 932, 933, 934, 935,
753 : 936, 938, 938, 938, 940, 941, 942, 943, 944, 945,
754 : 946, 947, 948, 949, 950, 951, 952, 953, 954, 959,
755 : 962, 979, 989, 997, 1005, 1016, 1021, 1029, 1035, 1040,
756 : 1044, 1055, 1071, 1079, 1082, 1089, 1097, 1103, 1117, 1125,
757 : 1126, 1131, 1137, 1145, 1160, 1166, 1174, 1182, 1189, 1190,
758 : 1200, 1209, 1218, 1260, 1263, 1268, 1275, 1300, 1306, 1306,
759 : 1309, 1315, 1316, 1317, 1320, 1326, 1334, 1344, 1350, 1352,
760 : 1356, 1401, 1409, 1451, 1460, 1463, 1467, 1471, 1478, 1481,
761 : 1485, 1492, 1512, 1515, 1520, 1525, 1530, 1535, 1540, 1545,
762 : 1550, 1558, 1564, 1569, 1580, 1591, 1597, 1603, 1611, 1617,
763 : 1624, 1637, 1638, 1641, 1648, 1651, 1662, 1666, 1677, 1683,
764 : 1684, 1687, 1688, 1691, 1692, 1693, 1694, 1695, 1699, 1700,
765 : 1701, 1702, 1705, 1708, 1711, 1722, 1730, 1736, 1744, 1752,
766 : 1755, 1760
767 : };
768 : #endif
769 :
770 : /** Accessing symbol of state STATE. */
771 : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
772 :
773 : #if YYDEBUG || 0
774 : /* The user-facing name of the symbol whose (internal) number is
775 : YYSYMBOL. No bounds checking. */
776 : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
777 :
778 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
779 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
780 : static const char *const yytname[] =
781 : {
782 : "\"end of file\"", "error", "\"invalid token\"", "kw_ABSENT",
783 : "kw_ABSTRACT_SYNTAX", "kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC",
784 : "kw_BEGIN", "kw_BIT", "kw_BMPString", "kw_BOOLEAN", "kw_BY",
785 : "kw_CHARACTER", "kw_CHOICE", "kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS",
786 : "kw_CONSTRAINED", "kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS",
787 : "kw_EMBEDDED", "kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT",
788 : "kw_EXPLICIT", "kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL",
789 : "kw_FALSE", "kw_FROM", "kw_GeneralString", "kw_GeneralizedTime",
790 : "kw_GraphicString", "kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT",
791 : "kw_IMPLIED", "kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",
792 : "kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",
793 : "kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",
794 : "kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",
795 : "kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",
796 : "kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",
797 : "kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",
798 : "kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",
799 : "kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",
800 : "kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",
801 : "RANGE", "EEQUAL", "ELLIPSIS", "TYPE_IDENTIFIER", "referencename",
802 : "CLASS_IDENTIFIER", "VALUE_IDENTIFIER", "STRING", "NUMBER", "';'", "','",
803 : "'{'", "'}'", "'|'", "'&'", "':'", "'.'", "'('", "')'", "'@'", "'['",
804 : "']'", "$accept", "Identifier", "ModuleDefinition", "TagDefault",
805 : "ExtensionDefault", "ModuleBody", "Imports", "SymbolsImported",
806 : "SymbolsFromModuleList", "SymbolsFromModule", "Exports",
807 : "AssignmentList", "Assignment", "referencenames", "DefinedObjectClass",
808 : "ObjectClassAssignment", "ObjectClassDefn", "ObjectAssignment",
809 : "ObjectSetAssignment", "ObjectSet", "ObjectSetSpec", "Object",
810 : "DefinedObject", "DefinedObjectSet", "ObjectDefn", "FieldSettings",
811 : "FieldSetting", "FieldSpecList", "FieldSpec", "TypeFieldSpec",
812 : "FixedTypeValueFieldSpec", "TypeAssignment",
813 : "ParameterizedTypeAssignment", "Parameter", "DummyReference",
814 : "ParamGovernor", "UnconstrainedType", "Type", "BuiltinType",
815 : "ObjectClassFieldType", "BooleanType", "range", "IntegerType",
816 : "NamedNumberList", "NamedNumber", "EnumeratedType", "Enumerations",
817 : "BitStringType", "ObjectIdentifierType", "OctetStringType", "NullType",
818 : "size", "SequenceType", "SequenceOfType", "SetType", "SetOfType",
819 : "ChoiceType", "ReferencedType", "DefinedType", "ParameterizedType",
820 : "ActualParameter", "UsefulType", "ConstrainedType", "Constraint",
821 : "ConstraintSpec", "SubtypeConstraint", "GeneralConstraint",
822 : "ContentsConstraint", "UserDefinedConstraint", "TableConstraint",
823 : "SimpleTableConstraint", "ComponentRelationConstraint", "TaggedType",
824 : "Tag", "Class", "tagenv", "ValueAssignment", "CharacterStringType",
825 : "RestrictedCharactedStringType", "ComponentTypeList", "NamedType",
826 : "ComponentType", "NamedBitList", "NamedBit", "objid_opt", "objid",
827 : "objid_list", "objid_element", "Value", "ValueExNull", "BuiltinValue",
828 : "BuiltinValueExNull", "ReferencedValue", "DefinedValue",
829 : "Valuereference", "CharacterStringValue", "BooleanValue", "IntegerValue",
830 : "SignedNumber", "NullValue", "ObjectIdentifierValue", YY_NULLPTR
831 : };
832 :
833 : static const char *
834 : yysymbol_name (yysymbol_kind_t yysymbol)
835 : {
836 : return yytname[yysymbol];
837 : }
838 : #endif
839 :
840 : #define YYPACT_NINF (-227)
841 :
842 : #define yypact_value_is_default(Yyn) \
843 : ((Yyn) == YYPACT_NINF)
844 :
845 : #define YYTABLE_NINF (-81)
846 :
847 : #define yytable_value_is_error(Yyn) \
848 : 0
849 :
850 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
851 : STATE-NUM. */
852 : static const yytype_int16 yypact[] =
853 : {
854 : 25, -227, -227, -65, 55, -18, 42, -227, -227, -227,
855 : -23, -17, -18, 15, 4, -227, -227, 26, 35, 51,
856 : 98, 29, -227, -227, -227, 102, 58, -227, -227, 136,
857 : 62, 2, 121, 106, -227, 54, 57, -227, 25, 20,
858 : 25, -227, 59, 25, -227, 118, 64, 69, 312, -59,
859 : -227, 20, -227, -227, -227, -227, -227, -227, -227, -227,
860 : -227, 25, -227, 70, -5, 89, -227, -227, 63, 65,
861 : -227, -227, -227, 66, -227, 124, 91, -227, -45, -36,
862 : -227, -227, -227, -227, -227, 71, 9, 72, -58, 67,
863 : 79, -227, 68, 73, 75, 76, 77, 78, 80, 81,
864 : 83, -227, 84, -227, 85, -227, -227, -227, -227, -227,
865 : -227, 27, 90, -227, 312, 64, -227, -65, 95, 99,
866 : -227, -227, 100, 25, 25, 25, -227, 103, 92, -39,
867 : 111, 312, -19, -227, -227, -227, 88, 86, -14, 74,
868 : -10, -227, 3, -227, -227, 312, 96, -227, -227, 101,
869 : 105, -227, 108, -227, 104, 25, 312, -47, 8, -227,
870 : 107, 112, -227, 109, 24, -227, -31, -227, 33, 312,
871 : -227, -227, 38, 94, -227, -227, 114, -227, 115, -227,
872 : -227, -227, 25, 158, 312, 187, 117, -227, 120, -227,
873 : 113, -227, -227, -227, -227, -227, -227, -227, 132, -227,
874 : -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,
875 : -227, -227, -227, -227, -227, -227, -227, 133, 130, 5,
876 : -227, 25, 41, -227, -227, -227, 119, 44, -227, -227,
877 : 13, -227, 3, -227, 31, 18, -227, -227, 122, -227,
878 : -227, -227, -227, -227, 25, 45, -227, -227, 128, 195,
879 : 3, 134, 129, -227, -32, 312, -227, -227, -227, 108,
880 : 263, 104, -227, 140, 25, -227, -227, -227, -227, 126,
881 : 131, -227, -227, -227, 177, 115, -227, 138, 222, -227,
882 : -227, 142, -227, -227, -227, -227, 312, -227, -9, -227,
883 : 139, -227, -227, -227, 143, -227, -227, -227, -227, -227,
884 : -227, -227, -227, -227, -227, 3, 137, -227, 3, -227,
885 : 10, -227, -227, 25, -227, 3, -227, 148, -227, -227
886 : };
887 :
888 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
889 : Performed when YYTABLE does not specify something else to do. Zero
890 : means the default is an error. */
891 : static const yytype_uint8 yydefact[] =
892 : {
893 : 0, 2, 3, 182, 0, 184, 0, 181, 1, 188,
894 : 187, 0, 184, 8, 0, 183, 185, 0, 0, 0,
895 : 10, 0, 7, 5, 6, 0, 0, 186, 9, 0,
896 : 22, 0, 0, 14, 21, 32, 0, 4, 16, 0,
897 : 0, 20, 0, 15, 17, 0, 2, 0, 3, 0,
898 : 11, 23, 28, 29, 30, 25, 27, 26, 31, 13,
899 : 18, 0, 33, 0, 0, 0, 169, 100, 0, 0,
900 : 163, 134, 168, 105, 118, 0, 0, 166, 119, 0,
901 : 164, 135, 165, 170, 167, 130, 154, 0, 0, 0,
902 : 0, 81, 98, 85, 89, 88, 84, 91, 92, 90,
903 : 93, 94, 95, 96, 87, 82, 128, 131, 129, 83,
904 : 97, 158, 86, 162, 0, 0, 24, 182, 0, 0,
905 : 35, 34, 114, 0, 0, 0, 116, 119, 0, 0,
906 : 0, 0, 0, 156, 157, 155, 0, 0, 0, 0,
907 : 0, 136, 0, 159, 160, 0, 0, 64, 68, 0,
908 : 0, 19, 0, 38, 0, 0, 0, 0, 175, 171,
909 : 0, 113, 107, 0, 0, 117, 0, 122, 0, 0,
910 : 126, 125, 0, 0, 45, 133, 0, 44, 0, 37,
911 : 42, 43, 0, 0, 0, 0, 0, 209, 0, 140,
912 : 0, 138, 139, 141, 142, 143, 148, 149, 104, 208,
913 : 207, 210, 206, 204, 205, 211, 161, 189, 190, 202,
914 : 203, 194, 193, 195, 197, 196, 152, 0, 0, 0,
915 : 40, 0, 0, 51, 53, 54, 0, 0, 178, 174,
916 : 0, 127, 0, 176, 0, 0, 112, 106, 0, 121,
917 : 123, 124, 153, 132, 0, 0, 47, 99, 0, 144,
918 : 0, 0, 0, 137, 0, 0, 67, 66, 39, 0,
919 : 55, 0, 36, 0, 0, 115, 173, 172, 177, 0,
920 : 0, 109, 108, 120, 0, 0, 46, 0, 0, 145,
921 : 103, 150, 102, 101, 65, 41, 0, 56, 58, 52,
922 : 0, 179, 111, 110, 204, 49, 50, 191, 192, 199,
923 : 198, 200, 201, 48, 147, 0, 0, 57, 0, 62,
924 : 59, 180, 146, 0, 63, 0, 60, 0, 61, 151
925 : };
926 :
927 : /* YYPGOTO[NTERM-NUM]. */
928 : static const yytype_int16 yypgoto[] =
929 : {
930 : -227, 0, -227, -227, -227, -227, -227, -227, -227, 202,
931 : -227, 196, -227, -8, -28, -227, -227, -227, -227, -227,
932 : -227, -227, -149, -227, -227, -227, -29, -227, -12, -227,
933 : -227, -227, -227, -227, -227, -227, -227, -112, -227, -227,
934 : -227, 87, -227, 127, 16, -227, -227, -227, -227, -227,
935 : -227, 135, -227, -227, -227, -227, -227, -227, -227, -227,
936 : -227, -227, -227, -227, -227, -227, -227, -227, -227, -227,
937 : -227, -227, -227, -227, -227, -227, -227, -227, -227, -16,
938 : -227, 30, -227, -7, 144, 1, 247, -227, -226, -227,
939 : -227, -227, -4, 47, -227, 11, 12, -139, 48, -227,
940 : 17
941 : };
942 :
943 : /* YYDEFGOTO[NTERM-NUM]. */
944 : static const yytype_int16 yydefgoto[] =
945 : {
946 : 0, 87, 4, 20, 26, 32, 39, 42, 43, 44,
947 : 33, 50, 51, 45, 146, 52, 121, 53, 54, 153,
948 : 219, 179, 180, 175, 181, 245, 246, 222, 223, 224,
949 : 225, 55, 56, 149, 257, 150, 89, 90, 91, 92,
950 : 93, 189, 94, 161, 162, 95, 163, 96, 97, 98,
951 : 99, 130, 100, 101, 102, 103, 104, 105, 106, 107,
952 : 176, 108, 109, 141, 190, 191, 192, 193, 194, 195,
953 : 196, 197, 110, 111, 136, 145, 57, 112, 113, 157,
954 : 158, 159, 227, 228, 6, 205, 11, 12, 206, 296,
955 : 207, 297, 208, 209, 210, 211, 212, 213, 199, 214,
956 : 215
957 : };
958 :
959 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
960 : positive, shift that token. If negative, reduce the rule whose
961 : number is the opposite. If YYTABLE_NINF, syntax error. */
962 : static const yytype_int16 yytable[] =
963 : {
964 : 3, 198, 147, 220, 7, 10, 268, 34, 183, 184,
965 : 119, 308, 10, 185, 282, 133, 186, 131, 63, 170,
966 : 88, 128, 17, 36, 279, 114, 138, 198, 232, 5,
967 : 315, 35, 58, 216, 200, 115, 120, 186, 35, 49,
968 : 35, 139, 18, 35, 229, 309, 230, 1, 231, 129,
969 : 2, 49, 201, 19, 143, 8, 167, 240, 132, 187,
970 : 187, 117, 233, 13, 316, 144, 310, 1, 1, 134,
971 : 2, 2, 249, 9, 202, 177, 171, 14, 15, 312,
972 : 178, 187, 314, 62, 188, 135, -12, 148, 1, 318,
973 : 31, 2, 203, 204, 187, 21, 22, 5, 266, 1,
974 : 258, 259, 2, 271, 1, 23, 46, 2, 47, 48,
975 : 285, 1, 280, 168, 2, 283, 172, 235, 7, 237,
976 : 203, 24, 187, 156, 160, 160, 230, 25, 239, 156,
977 : 27, 230, 156, 241, 261, 301, 262, 264, 275, 265,
978 : 276, 28, 29, 284, 30, 37, 38, 40, 288, 41,
979 : 61, 59, 62, 64, 118, 226, 122, 123, 127, 124,
980 : 125, 126, 295, 142, 169, -2, 137, 140, -80, 128,
981 : 248, 182, 174, -70, 307, -74, -73, -69, -76, 173,
982 : -77, -75, 247, -78, -79, -72, 65, 66, 67, 152,
983 : -71, 68, 166, 154, 155, 139, 217, 177, 242, 250,
984 : 251, 221, 69, 218, 236, 235, 252, 234, 200, 243,
985 : 70, 71, 244, 72, 253, 254, 256, 255, 278, 263,
986 : 73, 260, 277, 273, 281, 187, 74, 292, 75, 76,
987 : 156, 290, 293, 304, 305, 160, 306, -3, 77, 313,
988 : 311, 78, 79, 319, 274, 60, 303, 116, 202, 289,
989 : 80, 272, 164, 238, 81, 82, 83, 291, 84, 16,
990 : 267, 151, 165, 85, 226, 62, 294, 204, 187, 0,
991 : 298, 5, 65, 66, 67, 0, 0, 68, 0, 0,
992 : 86, 269, 270, 286, 0, 299, 300, 0, 69, 0,
993 : 0, 302, 0, 0, 0, 0, 70, 71, 0, 72,
994 : 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
995 : 0, 0, 74, 317, 75, 76, 0, 287, 0, 0,
996 : 0, 65, 66, 67, 77, 0, 68, 78, 79, 0,
997 : 0, 0, 0, 0, 0, 0, 80, 69, 0, 0,
998 : 81, 82, 83, 0, 84, 70, 71, 0, 72, 85,
999 : 0, 62, 2, 0, 0, 73, 0, 0, 0, 0,
1000 : 0, 74, 0, 75, 76, 0, 86, 0, 0, 0,
1001 : 0, 0, 0, 77, 0, 0, 78, 79, 0, 0,
1002 : 0, 0, 0, 0, 0, 80, 0, 0, 0, 81,
1003 : 82, 83, 0, 84, 0, 0, 0, 0, 85, 0,
1004 : 62, 2, 0, 0, 0, 0, 0, 0, 0, 0,
1005 : 0, 0, 0, 0, 0, 86
1006 : };
1007 :
1008 : static const yytype_int16 yycheck[] =
1009 : {
1010 : 0, 140, 114, 152, 3, 5, 232, 5, 18, 19,
1011 : 15, 20, 12, 23, 46, 6, 47, 53, 46, 131,
1012 : 48, 66, 7, 31, 250, 84, 84, 166, 20, 94,
1013 : 20, 31, 40, 145, 31, 94, 64, 47, 38, 39,
1014 : 40, 99, 27, 43, 156, 54, 93, 86, 95, 94,
1015 : 89, 51, 49, 38, 27, 0, 95, 169, 94, 91,
1016 : 91, 61, 54, 21, 54, 38, 75, 86, 86, 60,
1017 : 89, 89, 184, 91, 71, 89, 95, 100, 95, 305,
1018 : 94, 91, 308, 88, 94, 76, 24, 115, 86, 315,
1019 : 28, 89, 89, 90, 91, 91, 70, 94, 85, 86,
1020 : 95, 96, 89, 85, 86, 70, 86, 89, 88, 89,
1021 : 259, 86, 251, 129, 89, 254, 132, 93, 117, 95,
1022 : 89, 70, 91, 123, 124, 125, 93, 29, 95, 129,
1023 : 101, 93, 132, 95, 93, 274, 95, 93, 93, 95,
1024 : 95, 39, 84, 255, 8, 24, 40, 93, 260, 92,
1025 : 32, 92, 88, 84, 84, 155, 67, 94, 67, 94,
1026 : 94, 37, 274, 84, 53, 94, 94, 100, 100, 66,
1027 : 12, 97, 86, 100, 286, 100, 100, 100, 100, 91,
1028 : 100, 100, 182, 100, 100, 100, 9, 10, 11, 94,
1029 : 100, 14, 100, 94, 94, 99, 95, 89, 104, 12,
1030 : 83, 97, 25, 98, 95, 93, 86, 100, 31, 95,
1031 : 33, 34, 97, 36, 101, 83, 86, 84, 23, 100,
1032 : 43, 221, 94, 101, 95, 91, 49, 101, 51, 52,
1033 : 230, 91, 101, 95, 12, 235, 94, 94, 61, 102,
1034 : 101, 64, 65, 95, 244, 43, 275, 51, 71, 261,
1035 : 73, 235, 125, 166, 77, 78, 79, 264, 81, 12,
1036 : 230, 117, 127, 86, 264, 88, 89, 90, 91, -1,
1037 : 274, 94, 9, 10, 11, -1, -1, 14, -1, -1,
1038 : 103, 234, 234, 20, -1, 274, 274, -1, 25, -1,
1039 : -1, 274, -1, -1, -1, -1, 33, 34, -1, 36,
1040 : -1, -1, -1, -1, -1, -1, 43, -1, -1, -1,
1041 : -1, -1, 49, 313, 51, 52, -1, 54, -1, -1,
1042 : -1, 9, 10, 11, 61, -1, 14, 64, 65, -1,
1043 : -1, -1, -1, -1, -1, -1, 73, 25, -1, -1,
1044 : 77, 78, 79, -1, 81, 33, 34, -1, 36, 86,
1045 : -1, 88, 89, -1, -1, 43, -1, -1, -1, -1,
1046 : -1, 49, -1, 51, 52, -1, 103, -1, -1, -1,
1047 : -1, -1, -1, 61, -1, -1, 64, 65, -1, -1,
1048 : -1, -1, -1, -1, -1, 73, -1, -1, -1, 77,
1049 : 78, 79, -1, 81, -1, -1, -1, -1, 86, -1,
1050 : 88, 89, -1, -1, -1, -1, -1, -1, -1, -1,
1051 : -1, -1, -1, -1, -1, 103
1052 : };
1053 :
1054 : /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1055 : state STATE-NUM. */
1056 : static const yytype_uint8 yystos[] =
1057 : {
1058 : 0, 86, 89, 106, 107, 94, 189, 190, 0, 91,
1059 : 106, 191, 192, 21, 100, 95, 191, 7, 27, 38,
1060 : 108, 91, 70, 70, 70, 29, 109, 101, 39, 84,
1061 : 8, 28, 110, 115, 5, 106, 118, 24, 40, 111,
1062 : 93, 92, 112, 113, 114, 118, 86, 88, 89, 106,
1063 : 116, 117, 120, 122, 123, 136, 137, 181, 118, 92,
1064 : 114, 32, 88, 119, 84, 9, 10, 11, 14, 25,
1065 : 33, 34, 36, 43, 49, 51, 52, 61, 64, 65,
1066 : 73, 77, 78, 79, 81, 86, 103, 106, 119, 141,
1067 : 142, 143, 144, 145, 147, 150, 152, 153, 154, 155,
1068 : 157, 158, 159, 160, 161, 162, 163, 164, 166, 167,
1069 : 177, 178, 182, 183, 84, 94, 116, 106, 84, 15,
1070 : 119, 121, 67, 94, 94, 94, 37, 67, 66, 94,
1071 : 156, 53, 94, 6, 60, 76, 179, 94, 84, 99,
1072 : 100, 168, 84, 27, 38, 180, 119, 142, 119, 138,
1073 : 140, 189, 94, 124, 94, 94, 106, 184, 185, 186,
1074 : 106, 148, 149, 151, 148, 156, 100, 95, 184, 53,
1075 : 142, 95, 184, 91, 86, 128, 165, 89, 94, 126,
1076 : 127, 129, 97, 18, 19, 23, 47, 91, 94, 146,
1077 : 169, 170, 171, 172, 173, 174, 175, 176, 202, 203,
1078 : 31, 49, 71, 89, 90, 190, 193, 195, 197, 198,
1079 : 199, 200, 201, 202, 204, 205, 142, 95, 98, 125,
1080 : 127, 97, 132, 133, 134, 135, 106, 187, 188, 142,
1081 : 93, 95, 20, 54, 100, 93, 95, 95, 146, 95,
1082 : 142, 95, 104, 95, 97, 130, 131, 106, 12, 142,
1083 : 12, 83, 86, 101, 83, 84, 86, 139, 95, 96,
1084 : 106, 93, 95, 100, 93, 95, 85, 186, 193, 198,
1085 : 203, 85, 149, 101, 106, 93, 95, 94, 23, 193,
1086 : 202, 95, 46, 202, 142, 127, 20, 54, 142, 133,
1087 : 91, 188, 101, 101, 89, 142, 194, 196, 197, 200,
1088 : 201, 202, 205, 131, 95, 12, 94, 142, 20, 54,
1089 : 75, 101, 193, 102, 193, 20, 54, 106, 193, 95
1090 : };
1091 :
1092 : /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
1093 : static const yytype_uint8 yyr1[] =
1094 : {
1095 : 0, 105, 106, 106, 107, 108, 108, 108, 108, 109,
1096 : 109, 110, 110, 111, 111, 112, 112, 113, 113, 114,
1097 : 115, 115, 115, 116, 116, 117, 117, 117, 117, 117,
1098 : 117, 118, 118, 119, 120, 120, 121, 122, 123, 124,
1099 : 125, 125, 126, 126, 127, 128, 129, 130, 130, 131,
1100 : 131, 132, 132, 133, 133, 134, 134, 134, 135, 135,
1101 : 135, 135, 135, 135, 136, 137, 138, 139, 140, 141,
1102 : 141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
1103 : 141, 142, 142, 142, 143, 143, 143, 143, 143, 143,
1104 : 143, 143, 143, 143, 143, 143, 143, 143, 143, 144,
1105 : 145, 146, 146, 146, 146, 147, 147, 148, 148, 148,
1106 : 149, 149, 150, 151, 152, 152, 153, 154, 155, 156,
1107 : 156, 157, 157, 158, 159, 159, 160, 161, 162, 162,
1108 : 163, 163, 164, 165, 166, 166, 167, 168, 169, 169,
1109 : 170, 171, 171, 171, 172, 172, 172, 173, 174, 174,
1110 : 175, 176, 177, 178, 179, 179, 179, 179, 180, 180,
1111 : 180, 181, 182, 183, 183, 183, 183, 183, 183, 183,
1112 : 183, 184, 184, 184, 185, 186, 186, 186, 187, 187,
1113 : 188, 189, 189, 190, 191, 191, 192, 192, 192, 193,
1114 : 193, 194, 194, 195, 195, 195, 195, 195, 196, 196,
1115 : 196, 196, 197, 198, 199, 200, 201, 201, 202, 203,
1116 : 204, 205
1117 : };
1118 :
1119 : /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
1120 : static const yytype_int8 yyr2[] =
1121 : {
1122 : 0, 2, 1, 1, 9, 2, 2, 2, 0, 2,
1123 : 0, 3, 0, 3, 0, 1, 0, 1, 2, 4,
1124 : 3, 2, 0, 1, 2, 1, 1, 1, 1, 1,
1125 : 1, 3, 1, 1, 3, 3, 4, 4, 4, 3,
1126 : 1, 3, 1, 1, 1, 1, 3, 1, 3, 3,
1127 : 3, 1, 3, 1, 1, 2, 3, 4, 3, 4,
1128 : 5, 6, 4, 5, 3, 6, 3, 1, 1, 1,
1129 : 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1130 : 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1131 : 1, 1, 1, 1, 1, 1, 1, 1, 1, 4,
1132 : 1, 3, 3, 3, 1, 1, 4, 1, 3, 3,
1133 : 4, 4, 4, 1, 2, 5, 2, 3, 1, 0,
1134 : 4, 4, 3, 4, 4, 3, 3, 4, 1, 1,
1135 : 1, 1, 4, 1, 1, 1, 2, 3, 1, 1,
1136 : 1, 1, 1, 1, 2, 3, 5, 4, 1, 1,
1137 : 3, 7, 3, 4, 0, 1, 1, 1, 0, 1,
1138 : 1, 4, 1, 1, 1, 1, 1, 1, 1, 1,
1139 : 1, 1, 3, 3, 2, 1, 2, 3, 1, 3,
1140 : 4, 1, 0, 3, 0, 2, 4, 1, 1, 1,
1141 : 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1142 : 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1143 : 1, 1
1144 : };
1145 :
1146 :
1147 : enum { YYENOMEM = -2 };
1148 :
1149 : #define yyerrok (yyerrstatus = 0)
1150 : #define yyclearin (yychar = YYEMPTY)
1151 :
1152 : #define YYACCEPT goto yyacceptlab
1153 : #define YYABORT goto yyabortlab
1154 : #define YYERROR goto yyerrorlab
1155 : #define YYNOMEM goto yyexhaustedlab
1156 :
1157 :
1158 : #define YYRECOVERING() (!!yyerrstatus)
1159 :
1160 : #define YYBACKUP(Token, Value) \
1161 : do \
1162 : if (yychar == YYEMPTY) \
1163 : { \
1164 : yychar = (Token); \
1165 : yylval = (Value); \
1166 : YYPOPSTACK (yylen); \
1167 : yystate = *yyssp; \
1168 : goto yybackup; \
1169 : } \
1170 : else \
1171 : { \
1172 : yyerror (YY_("syntax error: cannot back up")); \
1173 : YYERROR; \
1174 : } \
1175 : while (0)
1176 :
1177 : /* Backward compatibility with an undocumented macro.
1178 : Use YYerror or YYUNDEF. */
1179 : #define YYERRCODE YYUNDEF
1180 :
1181 :
1182 : /* Enable debugging if requested. */
1183 : #if YYDEBUG
1184 :
1185 : # ifndef YYFPRINTF
1186 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1187 : # define YYFPRINTF fprintf
1188 : # endif
1189 :
1190 : # define YYDPRINTF(Args) \
1191 : do { \
1192 : if (yydebug) \
1193 : YYFPRINTF Args; \
1194 : } while (0)
1195 :
1196 :
1197 :
1198 :
1199 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1200 : do { \
1201 : if (yydebug) \
1202 : { \
1203 : YYFPRINTF (stderr, "%s ", Title); \
1204 : yy_symbol_print (stderr, \
1205 : Kind, Value); \
1206 : YYFPRINTF (stderr, "\n"); \
1207 : } \
1208 : } while (0)
1209 :
1210 :
1211 : /*-----------------------------------.
1212 : | Print this symbol's value on YYO. |
1213 : `-----------------------------------*/
1214 :
1215 : static void
1216 : yy_symbol_value_print (FILE *yyo,
1217 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1218 : {
1219 : FILE *yyoutput = yyo;
1220 : YY_USE (yyoutput);
1221 : if (!yyvaluep)
1222 : return;
1223 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1224 : YY_USE (yykind);
1225 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1226 : }
1227 :
1228 :
1229 : /*---------------------------.
1230 : | Print this symbol on YYO. |
1231 : `---------------------------*/
1232 :
1233 : static void
1234 : yy_symbol_print (FILE *yyo,
1235 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1236 : {
1237 : YYFPRINTF (yyo, "%s %s (",
1238 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1239 :
1240 : yy_symbol_value_print (yyo, yykind, yyvaluep);
1241 : YYFPRINTF (yyo, ")");
1242 : }
1243 :
1244 : /*------------------------------------------------------------------.
1245 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1246 : | TOP (included). |
1247 : `------------------------------------------------------------------*/
1248 :
1249 : static void
1250 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1251 : {
1252 : YYFPRINTF (stderr, "Stack now");
1253 : for (; yybottom <= yytop; yybottom++)
1254 : {
1255 : int yybot = *yybottom;
1256 : YYFPRINTF (stderr, " %d", yybot);
1257 : }
1258 : YYFPRINTF (stderr, "\n");
1259 : }
1260 :
1261 : # define YY_STACK_PRINT(Bottom, Top) \
1262 : do { \
1263 : if (yydebug) \
1264 : yy_stack_print ((Bottom), (Top)); \
1265 : } while (0)
1266 :
1267 :
1268 : /*------------------------------------------------.
1269 : | Report that the YYRULE is going to be reduced. |
1270 : `------------------------------------------------*/
1271 :
1272 : static void
1273 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1274 : int yyrule)
1275 : {
1276 : int yylno = yyrline[yyrule];
1277 : int yynrhs = yyr2[yyrule];
1278 : int yyi;
1279 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1280 : yyrule - 1, yylno);
1281 : /* The symbols being reduced. */
1282 : for (yyi = 0; yyi < yynrhs; yyi++)
1283 : {
1284 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
1285 : yy_symbol_print (stderr,
1286 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1287 : &yyvsp[(yyi + 1) - (yynrhs)]);
1288 : YYFPRINTF (stderr, "\n");
1289 : }
1290 : }
1291 :
1292 : # define YY_REDUCE_PRINT(Rule) \
1293 : do { \
1294 : if (yydebug) \
1295 : yy_reduce_print (yyssp, yyvsp, Rule); \
1296 : } while (0)
1297 :
1298 : /* Nonzero means print parse trace. It is left uninitialized so that
1299 : multiple parsers can coexist. */
1300 : int yydebug;
1301 : #else /* !YYDEBUG */
1302 : # define YYDPRINTF(Args) ((void) 0)
1303 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1304 : # define YY_STACK_PRINT(Bottom, Top)
1305 : # define YY_REDUCE_PRINT(Rule)
1306 : #endif /* !YYDEBUG */
1307 :
1308 :
1309 : /* YYINITDEPTH -- initial size of the parser's stacks. */
1310 : #ifndef YYINITDEPTH
1311 : # define YYINITDEPTH 200
1312 : #endif
1313 :
1314 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1315 : if the built-in stack extension method is used).
1316 :
1317 : Do not make this value too large; the results are undefined if
1318 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1319 : evaluated with infinite-precision integer arithmetic. */
1320 :
1321 : #ifndef YYMAXDEPTH
1322 : # define YYMAXDEPTH 10000
1323 : #endif
1324 :
1325 :
1326 :
1327 :
1328 :
1329 :
1330 : /*-----------------------------------------------.
1331 : | Release the memory associated to this symbol. |
1332 : `-----------------------------------------------*/
1333 :
1334 : static void
1335 576 : yydestruct (const char *yymsg,
1336 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1337 : {
1338 : YY_USE (yyvaluep);
1339 576 : if (!yymsg)
1340 0 : yymsg = "Deleting";
1341 : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1342 :
1343 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1344 : YY_USE (yykind);
1345 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1346 576 : }
1347 :
1348 :
1349 : /* Lookahead token kind. */
1350 : int yychar;
1351 :
1352 : /* The semantic value of the lookahead symbol. */
1353 : YYSTYPE yylval;
1354 : /* Number of syntax errors so far. */
1355 : int yynerrs;
1356 :
1357 :
1358 :
1359 :
1360 : /*----------.
1361 : | yyparse. |
1362 : `----------*/
1363 :
1364 : int
1365 304 : yyparse (void)
1366 : {
1367 304 : yy_state_fast_t yystate = 0;
1368 : /* Number of tokens to shift before error messages enabled. */
1369 304 : int yyerrstatus = 0;
1370 :
1371 : /* Refer to the stacks through separate pointers, to allow yyoverflow
1372 : to reallocate them elsewhere. */
1373 :
1374 : /* Their size. */
1375 304 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
1376 :
1377 : /* The state stack: array, bottom, top. */
1378 16 : yy_state_t yyssa[YYINITDEPTH];
1379 304 : yy_state_t *yyss = yyssa;
1380 304 : yy_state_t *yyssp = yyss;
1381 :
1382 : /* The semantic value stack: array, bottom, top. */
1383 16 : YYSTYPE yyvsa[YYINITDEPTH];
1384 304 : YYSTYPE *yyvs = yyvsa;
1385 304 : YYSTYPE *yyvsp = yyvs;
1386 :
1387 16 : int yyn;
1388 : /* The return value of yyparse. */
1389 16 : int yyresult;
1390 : /* Lookahead symbol kind. */
1391 304 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1392 : /* The variables used to return semantic value and location from the
1393 : action routines. */
1394 16 : YYSTYPE yyval;
1395 :
1396 :
1397 :
1398 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1399 :
1400 : /* The number of symbols on the RHS of the reduced rule.
1401 : Keep to zero when no symbol should be popped. */
1402 304 : int yylen = 0;
1403 :
1404 16 : YYDPRINTF ((stderr, "Starting parse\n"));
1405 :
1406 304 : yychar = YYEMPTY; /* Cause a token to be read. */
1407 :
1408 304 : goto yysetstate;
1409 :
1410 :
1411 : /*------------------------------------------------------------.
1412 : | yynewstate -- push a new state, which is found in yystate. |
1413 : `------------------------------------------------------------*/
1414 702449 : yynewstate:
1415 : /* In all cases, when you get here, the value and location stacks
1416 : have just been pushed. So pushing a state here evens the stacks. */
1417 702449 : yyssp++;
1418 :
1419 :
1420 : /*--------------------------------------------------------------------.
1421 : | yysetstate -- set current state (the top of the stack) to yystate. |
1422 : `--------------------------------------------------------------------*/
1423 702753 : yysetstate:
1424 36987 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1425 36987 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1426 : YY_IGNORE_USELESS_CAST_BEGIN
1427 702753 : *yyssp = YY_CAST (yy_state_t, yystate);
1428 : YY_IGNORE_USELESS_CAST_END
1429 36987 : YY_STACK_PRINT (yyss, yyssp);
1430 :
1431 702753 : if (yyss + yystacksize - 1 <= yyssp)
1432 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1433 : YYNOMEM;
1434 : #else
1435 : {
1436 : /* Get the current used size of the three stacks, in elements. */
1437 38 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
1438 :
1439 : # if defined yyoverflow
1440 : {
1441 : /* Give user a chance to reallocate the stack. Use copies of
1442 : these so that the &'s don't force the real ones into
1443 : memory. */
1444 : yy_state_t *yyss1 = yyss;
1445 : YYSTYPE *yyvs1 = yyvs;
1446 :
1447 : /* Each stack pointer address is followed by the size of the
1448 : data in use in that stack, in bytes. This used to be a
1449 : conditional around just the two extra args, but that might
1450 : be undefined if yyoverflow is a macro. */
1451 : yyoverflow (YY_("memory exhausted"),
1452 : &yyss1, yysize * YYSIZEOF (*yyssp),
1453 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
1454 : &yystacksize);
1455 : yyss = yyss1;
1456 : yyvs = yyvs1;
1457 : }
1458 : # else /* defined YYSTACK_RELOCATE */
1459 : /* Extend the stack our own way. */
1460 38 : if (YYMAXDEPTH <= yystacksize)
1461 0 : YYNOMEM;
1462 38 : yystacksize *= 2;
1463 38 : if (YYMAXDEPTH < yystacksize)
1464 0 : yystacksize = YYMAXDEPTH;
1465 :
1466 : {
1467 38 : yy_state_t *yyss1 = yyss;
1468 2 : union yyalloc *yyptr =
1469 38 : YY_CAST (union yyalloc *,
1470 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1471 38 : if (! yyptr)
1472 0 : YYNOMEM;
1473 38 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1474 38 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1475 : # undef YYSTACK_RELOCATE
1476 38 : if (yyss1 != yyssa)
1477 19 : YYSTACK_FREE (yyss1);
1478 : }
1479 : # endif
1480 :
1481 38 : yyssp = yyss + yysize - 1;
1482 38 : yyvsp = yyvs + yysize - 1;
1483 :
1484 : YY_IGNORE_USELESS_CAST_BEGIN
1485 2 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1486 : YY_CAST (long, yystacksize)));
1487 : YY_IGNORE_USELESS_CAST_END
1488 :
1489 38 : if (yyss + yystacksize - 1 <= yyssp)
1490 0 : YYABORT;
1491 : }
1492 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1493 :
1494 :
1495 702753 : if (yystate == YYFINAL)
1496 304 : YYACCEPT;
1497 :
1498 702449 : goto yybackup;
1499 :
1500 :
1501 : /*-----------.
1502 : | yybackup. |
1503 : `-----------*/
1504 702449 : yybackup:
1505 : /* Do appropriate processing given the current state. Read a
1506 : lookahead token if we need one and don't already have one. */
1507 :
1508 : /* First try to decide what to do without reference to lookahead token. */
1509 702449 : yyn = yypact[yystate];
1510 702449 : if (yypact_value_is_default (yyn))
1511 341582 : goto yydefault;
1512 :
1513 : /* Not known => get a lookahead token if don't already have one. */
1514 :
1515 : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1516 360867 : if (yychar == YYEMPTY)
1517 : {
1518 14289 : YYDPRINTF ((stderr, "Reading a token\n"));
1519 271491 : yychar = yylex ();
1520 : }
1521 :
1522 360867 : if (yychar <= YYEOF)
1523 : {
1524 304 : yychar = YYEOF;
1525 304 : yytoken = YYSYMBOL_YYEOF;
1526 16 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1527 : }
1528 360563 : else if (yychar == YYerror)
1529 : {
1530 : /* The scanner already issued an error message, process directly
1531 : to error recovery. But do not keep the error token as
1532 : lookahead, it is too special and may lead us to an endless
1533 : loop in error recovery. */
1534 0 : yychar = YYUNDEF;
1535 0 : yytoken = YYSYMBOL_YYerror;
1536 0 : goto yyerrlab1;
1537 : }
1538 : else
1539 : {
1540 360563 : yytoken = YYTRANSLATE (yychar);
1541 18993 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1542 : }
1543 :
1544 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1545 : detect an error, take that action. */
1546 360867 : yyn += yytoken;
1547 360867 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1548 88160 : goto yydefault;
1549 272707 : yyn = yytable[yyn];
1550 272707 : if (yyn <= 0)
1551 : {
1552 64 : if (yytable_value_is_error (yyn))
1553 : goto yyerrlab;
1554 1216 : yyn = -yyn;
1555 1216 : goto yyreduce;
1556 : }
1557 :
1558 : /* Count tokens shifted since error; after three, turn off error
1559 : status. */
1560 271491 : if (yyerrstatus)
1561 0 : yyerrstatus--;
1562 :
1563 : /* Shift the lookahead token. */
1564 14289 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1565 271491 : yystate = yyn;
1566 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1567 271491 : *++yyvsp = yylval;
1568 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1569 :
1570 : /* Discard the shifted token. */
1571 271491 : yychar = YYEMPTY;
1572 271491 : goto yynewstate;
1573 :
1574 :
1575 : /*-----------------------------------------------------------.
1576 : | yydefault -- do the default action for the current state. |
1577 : `-----------------------------------------------------------*/
1578 429742 : yydefault:
1579 429742 : yyn = yydefact[yystate];
1580 429742 : if (yyn == 0)
1581 0 : goto yyerrlab;
1582 429742 : goto yyreduce;
1583 :
1584 :
1585 : /*-----------------------------.
1586 : | yyreduce -- do a reduction. |
1587 : `-----------------------------*/
1588 430958 : yyreduce:
1589 : /* yyn is the number of a rule to reduce with. */
1590 430958 : yylen = yyr2[yyn];
1591 :
1592 : /* If YYLEN is nonzero, implement the default value of the action:
1593 : '$$ = $1'.
1594 :
1595 : Otherwise, the following line sets YYVAL to garbage.
1596 : This behavior is undocumented and Bison
1597 : users should not rely upon it. Assigning to YYVAL
1598 : unconditionally makes the parser a bit smaller, and it avoids a
1599 : GCC warning that YYVAL may be used uninitialized. */
1600 430958 : yyval = yyvsp[1-yylen];
1601 :
1602 :
1603 22682 : YY_REDUCE_PRINT (yyn);
1604 430958 : switch (yyn)
1605 : {
1606 16169 : case 2: /* Identifier: TYPE_IDENTIFIER */
1607 16169 : { (yyval.name) = (yyvsp[0].name); }
1608 16169 : break;
1609 :
1610 32566 : case 3: /* Identifier: VALUE_IDENTIFIER */
1611 32566 : { (yyval.name) = (yyvsp[0].name); }
1612 32566 : break;
1613 :
1614 304 : case 4: /* ModuleDefinition: Identifier objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END */
1615 : {
1616 304 : struct objid **o = objid2list((yyvsp[-7].objid));
1617 16 : size_t i;
1618 :
1619 304 : fprintf(jsonfile,
1620 288 : "{\"module\":\"%s\",\"tagging\":\"%s\",\"objid\":[", (yyvsp[-8].name),
1621 304 : default_tag_env == TE_EXPLICIT ? "explicit" : "implicit");
1622 :
1623 491 : for (i = 0; o && o[i]; i++) {
1624 172 : fprintf(jsonfile, "%s{\"value\":%d", i ? "," : "", o[i]->value);
1625 171 : if (o[i]->label)
1626 171 : fprintf(jsonfile, ",\"label\":\"%s\"", o[i]->label);
1627 171 : fprintf(jsonfile, "}");
1628 : }
1629 304 : fprintf(jsonfile, "]}\n");
1630 304 : free(o);
1631 : }
1632 304 : break;
1633 :
1634 19 : case 5: /* TagDefault: kw_EXPLICIT kw_TAGS */
1635 19 : { default_tag_env = TE_EXPLICIT; }
1636 19 : break;
1637 :
1638 19 : case 6: /* TagDefault: kw_IMPLICIT kw_TAGS */
1639 19 : { default_tag_env = TE_IMPLICIT; }
1640 19 : break;
1641 :
1642 0 : case 7: /* TagDefault: kw_AUTOMATIC kw_TAGS */
1643 0 : { lex_error_message("automatic tagging is not supported"); }
1644 0 : break;
1645 :
1646 0 : case 9: /* ExtensionDefault: kw_EXTENSIBILITY kw_IMPLIED */
1647 0 : { lex_error_message("no extensibility options supported"); }
1648 0 : break;
1649 :
1650 437 : case 19: /* SymbolsFromModule: referencenames kw_FROM Identifier objid_opt */
1651 : {
1652 : /*
1653 : * FIXME We really could use knowing what kind of thing the
1654 : * identifier identifies -- a type, a value, what?
1655 : *
1656 : * Our sin of allowing type names to start with lower-case
1657 : * and values with upper-case means we can't tell. So we
1658 : * assume it's types only, but that means we can't import
1659 : * OID values, but we really want to!
1660 : *
1661 : * One thing we could do is not force `s->stype = Stype'
1662 : * here, instead set it to a new `Sunknown' value so that
1663 : * the first place that refers to this symbol with enough
1664 : * context to imply a symbol type can set it.
1665 : */
1666 23 : struct string_list *sl;
1667 1501 : for(sl = (yyvsp[-3].sl); sl != NULL; sl = sl->next) {
1668 1064 : Symbol *s = addsym(sl->string);
1669 1064 : s->stype = Stype;
1670 1064 : gen_template_import(s);
1671 : }
1672 437 : add_import((yyvsp[-1].name));
1673 : }
1674 437 : break;
1675 :
1676 19 : case 20: /* Exports: kw_EXPORTS referencenames ';' */
1677 : {
1678 1 : struct string_list *sl;
1679 1710 : for(sl = (yyvsp[-1].sl); sl != NULL; sl = sl->next)
1680 1691 : add_export(sl->string);
1681 : }
1682 18 : break;
1683 :
1684 2299 : case 31: /* referencenames: Identifier ',' referencenames */
1685 : {
1686 2299 : (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1687 2299 : (yyval.sl)->string = (yyvsp[-2].name);
1688 2299 : (yyval.sl)->next = (yyvsp[0].sl);
1689 : }
1690 2299 : break;
1691 :
1692 456 : case 32: /* referencenames: Identifier */
1693 : {
1694 456 : (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1695 456 : (yyval.sl)->string = (yyvsp[0].name);
1696 456 : (yyval.sl)->next = NULL;
1697 : }
1698 456 : break;
1699 :
1700 1406 : case 33: /* DefinedObjectClass: CLASS_IDENTIFIER */
1701 : {
1702 1406 : Symbol *s = addsym((yyvsp[0].name));
1703 1406 : if(s->stype != Sclass)
1704 0 : lex_error_message ("%s is not a class\n", (yyvsp[0].name));
1705 1406 : (yyval.class) = s->iosclass;
1706 : }
1707 1406 : break;
1708 :
1709 95 : case 34: /* ObjectClassAssignment: CLASS_IDENTIFIER EEQUAL ObjectClassDefn */
1710 : {
1711 95 : Symbol *s = addsym((yyvsp[-2].name));
1712 95 : s->stype = Sclass;
1713 95 : s->iosclass = (yyvsp[0].class);
1714 95 : s->iosclass->symbol = s;
1715 95 : fix_labels(s);
1716 : }
1717 95 : break;
1718 :
1719 0 : case 35: /* ObjectClassAssignment: CLASS_IDENTIFIER EEQUAL DefinedObjectClass */
1720 : {
1721 0 : Symbol *s = addsym((yyvsp[-2].name));
1722 0 : s->stype = Sclass;
1723 0 : s->iosclass = (yyvsp[0].class);
1724 : }
1725 0 : break;
1726 :
1727 95 : case 36: /* ObjectClassDefn: kw_CLASS '{' FieldSpecList '}' */
1728 : {
1729 95 : (yyval.class) = ecalloc(1, sizeof(*(yyval.class)));
1730 95 : (yyval.class)->fields = (yyvsp[-1].fields);
1731 95 : (yyval.class)->id = idcounter++;
1732 : }
1733 95 : break;
1734 :
1735 969 : case 37: /* ObjectAssignment: VALUE_IDENTIFIER DefinedObjectClass EEQUAL Object */
1736 : {
1737 969 : Symbol *s = addsym((yyvsp[-3].name));
1738 969 : s->stype = Sobj;
1739 969 : s->object = (yyvsp[0].object);
1740 969 : s->object->iosclass = (yyvsp[-2].class);
1741 969 : if (!s->object->symbol)
1742 969 : s->object->symbol = s;
1743 969 : fix_labels(s);
1744 : }
1745 969 : break;
1746 :
1747 95 : case 38: /* ObjectSetAssignment: TYPE_IDENTIFIER DefinedObjectClass EEQUAL ObjectSet */
1748 : {
1749 95 : Symbol *s = addsym((yyvsp[-3].name));
1750 95 : s->stype = Sobjset;
1751 95 : s->iosclass = (yyvsp[-2].class);
1752 95 : s->objectset = (yyvsp[0].objectset);
1753 95 : s->objectset->symbol = s->objectset->symbol ? s->objectset->symbol : s;
1754 95 : s->objectset->iosclass = (yyvsp[-2].class);
1755 95 : validate_object_set((yyvsp[0].objectset));
1756 95 : generate_template_objectset_forwards(s);
1757 : }
1758 95 : break;
1759 :
1760 95 : case 39: /* ObjectSet: '{' ObjectSetSpec '}' */
1761 : {
1762 95 : (yyval.objectset) = ecalloc(1, sizeof(*(yyval.objectset)));
1763 95 : (yyval.objectset)->objects = (yyvsp[-1].objects);
1764 95 : (yyval.objectset)->id = idcounter++;
1765 : }
1766 95 : break;
1767 :
1768 95 : case 40: /* ObjectSetSpec: DefinedObject */
1769 100 : { (yyval.objects) = add_object_set_spec(NULL, (yyvsp[0].object)); }
1770 95 : break;
1771 :
1772 874 : case 41: /* ObjectSetSpec: ObjectSetSpec '|' DefinedObject */
1773 920 : { (yyval.objects) = add_object_set_spec((yyvsp[-2].objects), (yyvsp[0].object)); }
1774 874 : break;
1775 :
1776 969 : case 44: /* DefinedObject: VALUE_IDENTIFIER */
1777 : {
1778 969 : Symbol *s = addsym((yyvsp[0].name));
1779 969 : if(s->stype != Sobj)
1780 0 : lex_error_message ("%s is not an object\n", (yyvsp[0].name));
1781 969 : (yyval.object) = s->object;
1782 : }
1783 969 : break;
1784 :
1785 114 : case 45: /* DefinedObjectSet: TYPE_IDENTIFIER */
1786 : {
1787 114 : Symbol *s = addsym((yyvsp[0].name));
1788 114 : if(s->stype != Sobjset && s->stype != SUndefined)
1789 0 : lex_error_message ("%s is not an object set\n", (yyvsp[0].name));
1790 114 : (yyval.objectset) = s->objectset;
1791 : }
1792 114 : break;
1793 :
1794 969 : case 46: /* ObjectDefn: '{' FieldSettings '}' */
1795 : {
1796 969 : (yyval.object) = ecalloc(1, sizeof(*(yyval.object)));
1797 969 : (yyval.object)->objfields = (yyvsp[-1].objfields);
1798 969 : (yyval.object)->id = idcounter++;
1799 : }
1800 969 : break;
1801 :
1802 969 : case 47: /* FieldSettings: FieldSetting */
1803 : {
1804 1020 : (yyval.objfields) = add_field_setting(NULL, (yyvsp[0].objfield));
1805 : }
1806 969 : break;
1807 :
1808 1349 : case 48: /* FieldSettings: FieldSettings ',' FieldSetting */
1809 : {
1810 1420 : (yyval.objfields) = add_field_setting((yyvsp[-2].objfields), (yyvsp[0].objfield));
1811 : }
1812 1349 : break;
1813 :
1814 969 : case 49: /* FieldSetting: '&' Identifier Type */
1815 1020 : { (yyval.objfield) = new_field_setting((yyvsp[-1].name), (yyvsp[0].type), NULL); }
1816 969 : break;
1817 :
1818 1349 : case 50: /* FieldSetting: '&' Identifier ValueExNull */
1819 1420 : { (yyval.objfield) = new_field_setting((yyvsp[-1].name), NULL, (yyvsp[0].value)); }
1820 1349 : break;
1821 :
1822 95 : case 51: /* FieldSpecList: FieldSpec */
1823 100 : { (yyval.fields) = add_field_spec(NULL, (yyvsp[0].field)); }
1824 95 : break;
1825 :
1826 190 : case 52: /* FieldSpecList: FieldSpecList ',' FieldSpec */
1827 200 : { (yyval.fields) = add_field_spec((yyvsp[-2].fields), (yyvsp[0].field)); }
1828 190 : break;
1829 :
1830 57 : case 55: /* TypeFieldSpec: '&' Identifier */
1831 60 : { (yyval.field) = new_type_field((yyvsp[0].name), 0, NULL); }
1832 57 : break;
1833 :
1834 38 : case 56: /* TypeFieldSpec: '&' Identifier kw_OPTIONAL */
1835 40 : { (yyval.field) = new_type_field((yyvsp[-1].name), 1, NULL); }
1836 38 : break;
1837 :
1838 0 : case 57: /* TypeFieldSpec: '&' Identifier kw_DEFAULT Type */
1839 0 : { (yyval.field) = new_type_field((yyvsp[-2].name), 1, (yyvsp[0].type)); }
1840 0 : break;
1841 :
1842 0 : case 58: /* FixedTypeValueFieldSpec: '&' Identifier Type */
1843 0 : { (yyval.field) = new_fixed_type_value_field((yyvsp[-1].name), (yyvsp[0].type), 0, 0, NULL); }
1844 0 : break;
1845 :
1846 95 : case 59: /* FixedTypeValueFieldSpec: '&' Identifier Type kw_UNIQUE */
1847 100 : { (yyval.field) = new_fixed_type_value_field((yyvsp[-2].name), (yyvsp[-1].type), 1, 0, NULL); }
1848 95 : break;
1849 :
1850 0 : case 60: /* FixedTypeValueFieldSpec: '&' Identifier Type kw_UNIQUE kw_OPTIONAL */
1851 0 : { (yyval.field) = new_fixed_type_value_field((yyvsp[-3].name), (yyvsp[-2].type), 1, 1, NULL); }
1852 0 : break;
1853 :
1854 0 : case 61: /* FixedTypeValueFieldSpec: '&' Identifier Type kw_UNIQUE kw_DEFAULT Value */
1855 0 : { (yyval.field) = new_fixed_type_value_field((yyvsp[-4].name), (yyvsp[-3].type), 1, 0, (yyvsp[0].value)); }
1856 0 : break;
1857 :
1858 38 : case 62: /* FixedTypeValueFieldSpec: '&' Identifier Type kw_OPTIONAL */
1859 40 : { (yyval.field) = new_fixed_type_value_field((yyvsp[-2].name), (yyvsp[-1].type), 0, 1, NULL); }
1860 38 : break;
1861 :
1862 57 : case 63: /* FixedTypeValueFieldSpec: '&' Identifier Type kw_DEFAULT Value */
1863 60 : { (yyval.field) = new_fixed_type_value_field((yyvsp[-3].name), (yyvsp[-2].type), 0, 0, (yyvsp[0].value)); }
1864 57 : break;
1865 :
1866 7771 : case 64: /* TypeAssignment: Identifier EEQUAL Type */
1867 : {
1868 7771 : Symbol *s = addsym((yyvsp[-2].name));
1869 7771 : s->stype = Stype;
1870 7771 : s->type = (yyvsp[0].type);
1871 7771 : fix_labels(s);
1872 :
1873 : /*
1874 : * Hack: make sure that non-anonymous enumeration types get
1875 : * a symbol tacked on so we can generate a template for
1876 : * their members for value printing.
1877 : */
1878 7771 : if (s->type->type == TTag && (yyvsp[0].type)->symbol == NULL &&
1879 6631 : (yyvsp[0].type)->subtype != NULL && (yyvsp[0].type)->subtype->type == TInteger &&
1880 703 : (yyvsp[0].type)->subtype->symbol == NULL) {
1881 703 : (yyvsp[0].type)->subtype->symbol = s;
1882 : }
1883 7771 : if (original_order)
1884 0 : generate_type(s);
1885 : else
1886 7771 : generate_type_header_forwards(s);
1887 : }
1888 7362 : break;
1889 :
1890 114 : case 65: /* ParameterizedTypeAssignment: Identifier '{' Parameter '}' EEQUAL Type */
1891 : {
1892 114 : char *pname = NULL;
1893 6 : Symbol *s;
1894 :
1895 114 : if (asprintf(&pname, "%s{%s:x}", (yyvsp[-5].name), (yyvsp[-3].class)->symbol->name) == -1 ||
1896 114 : pname == NULL)
1897 0 : err(1, "Out of memory");
1898 114 : s = addsym(pname);
1899 114 : free((yyvsp[-5].name));
1900 114 : s->stype = Sparamtype;
1901 114 : s->type = parametrize_type((yyvsp[0].type), (yyvsp[-3].class));
1902 114 : s->type->symbol = s;
1903 114 : fix_labels(s);
1904 : }
1905 114 : break;
1906 :
1907 114 : case 66: /* Parameter: ParamGovernor ':' DummyReference */
1908 114 : { (yyval.class) = (yyvsp[-2].class); }
1909 114 : break;
1910 :
1911 114 : case 67: /* DummyReference: TYPE_IDENTIFIER */
1912 114 : { (yyval.constant) = idcounter++; }
1913 114 : break;
1914 :
1915 114 : case 68: /* ParamGovernor: DefinedObjectClass */
1916 114 : { (yyval.class) = (yyvsp[0].class); }
1917 114 : break;
1918 :
1919 228 : case 99: /* ObjectClassFieldType: DefinedObjectClass '.' '&' Identifier */
1920 228 : { (yyval.type) = type_from_class_field((yyvsp[-3].class), (yyvsp[0].name)); }
1921 228 : break;
1922 :
1923 288 : case 100: /* BooleanType: kw_BOOLEAN */
1924 : {
1925 336 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
1926 : TE_EXPLICIT, new_type(TBoolean));
1927 : }
1928 304 : break;
1929 :
1930 836 : case 101: /* range: IntegerValue RANGE IntegerValue */
1931 : {
1932 836 : if((yyvsp[-2].value)->type != integervalue)
1933 0 : lex_error_message("Non-integer used in first part of range");
1934 836 : if((yyvsp[-2].value)->type != integervalue)
1935 0 : lex_error_message("Non-integer in second part of range");
1936 836 : (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1937 836 : (yyval.range)->min = (yyvsp[-2].value)->u.integervalue;
1938 836 : (yyval.range)->max = (yyvsp[0].value)->u.integervalue;
1939 : }
1940 836 : break;
1941 :
1942 266 : case 102: /* range: IntegerValue RANGE kw_MAX */
1943 : {
1944 266 : if((yyvsp[-2].value)->type != integervalue)
1945 0 : lex_error_message("Non-integer in first part of range");
1946 266 : (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1947 266 : (yyval.range)->min = (yyvsp[-2].value)->u.integervalue;
1948 266 : (yyval.range)->max = INT_MAX;
1949 : }
1950 266 : break;
1951 :
1952 0 : case 103: /* range: kw_MIN RANGE IntegerValue */
1953 : {
1954 0 : if((yyvsp[0].value)->type != integervalue)
1955 0 : lex_error_message("Non-integer in second part of range");
1956 0 : (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1957 0 : (yyval.range)->min = INT_MIN;
1958 0 : (yyval.range)->max = (yyvsp[0].value)->u.integervalue;
1959 : }
1960 0 : break;
1961 :
1962 76 : case 104: /* range: IntegerValue */
1963 : {
1964 76 : if((yyvsp[0].value)->type != integervalue)
1965 0 : lex_error_message("Non-integer used in limit");
1966 76 : (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1967 76 : (yyval.range)->min = (yyvsp[0].value)->u.integervalue;
1968 76 : (yyval.range)->max = (yyvsp[0].value)->u.integervalue;
1969 : }
1970 76 : break;
1971 :
1972 2484 : case 105: /* IntegerType: kw_INTEGER */
1973 : {
1974 2898 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
1975 : TE_EXPLICIT, new_type(TInteger));
1976 : }
1977 2622 : break;
1978 :
1979 306 : case 106: /* IntegerType: kw_INTEGER '{' NamedNumberList '}' */
1980 : {
1981 340 : (yyval.type) = new_type(TInteger);
1982 323 : (yyval.type)->members = (yyvsp[-1].members);
1983 340 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1984 : }
1985 323 : break;
1986 :
1987 513 : case 107: /* NamedNumberList: NamedNumber */
1988 : {
1989 513 : (yyval.members) = emalloc(sizeof(*(yyval.members)));
1990 513 : HEIM_TAILQ_INIT((yyval.members));
1991 513 : HEIM_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1992 : }
1993 513 : break;
1994 :
1995 5054 : case 108: /* NamedNumberList: NamedNumberList ',' NamedNumber */
1996 : {
1997 5054 : HEIM_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1998 5054 : (yyval.members) = (yyvsp[-2].members);
1999 : }
2000 5054 : break;
2001 :
2002 0 : case 109: /* NamedNumberList: NamedNumberList ',' ELLIPSIS */
2003 0 : { (yyval.members) = (yyvsp[-2].members); }
2004 0 : break;
2005 :
2006 5567 : case 110: /* NamedNumber: Identifier '(' SignedNumber ')' */
2007 : {
2008 5567 : (yyval.member) = emalloc(sizeof(*(yyval.member)));
2009 5567 : (yyval.member)->name = (yyvsp[-3].name);
2010 5567 : (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
2011 5567 : output_name ((yyval.member)->gen_name);
2012 5567 : (yyval.member)->val = (yyvsp[-1].constant);
2013 5567 : (yyval.member)->optional = 0;
2014 5567 : (yyval.member)->ellipsis = 0;
2015 5567 : (yyval.member)->type = NULL;
2016 : }
2017 5567 : break;
2018 :
2019 0 : case 111: /* NamedNumber: Identifier '(' DefinedValue ')' */
2020 : {
2021 0 : if ((yyvsp[-1].value)->type != integervalue)
2022 0 : lex_error_message("Named number %s not a numeric value",
2023 0 : (yyvsp[-1].value)->s->name);
2024 0 : (yyval.member) = emalloc(sizeof(*(yyval.member)));
2025 0 : (yyval.member)->name = (yyvsp[-3].name);
2026 0 : (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
2027 0 : output_name ((yyval.member)->gen_name);
2028 0 : (yyval.member)->val = (yyvsp[-1].value)->u.integervalue;
2029 0 : (yyval.member)->optional = 0;
2030 0 : (yyval.member)->ellipsis = 0;
2031 0 : (yyval.member)->type = NULL;
2032 : }
2033 0 : break;
2034 :
2035 180 : case 112: /* EnumeratedType: kw_ENUMERATED '{' Enumerations '}' */
2036 : {
2037 200 : (yyval.type) = new_type(TInteger);
2038 190 : (yyval.type)->members = (yyvsp[-1].members);
2039 200 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));
2040 : }
2041 190 : break;
2042 :
2043 396 : case 114: /* BitStringType: kw_BIT kw_STRING */
2044 : {
2045 440 : (yyval.type) = new_type(TBitString);
2046 440 : (yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));
2047 418 : HEIM_TAILQ_INIT((yyval.type)->members);
2048 418 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
2049 : }
2050 418 : break;
2051 :
2052 234 : case 115: /* BitStringType: kw_BIT kw_STRING '{' NamedBitList '}' */
2053 : {
2054 260 : (yyval.type) = new_type(TBitString);
2055 247 : (yyval.type)->members = (yyvsp[-1].members);
2056 260 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
2057 : }
2058 247 : break;
2059 :
2060 5004 : case 116: /* ObjectIdentifierType: kw_OBJECT kw_IDENTIFIER */
2061 : {
2062 5838 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
2063 : TE_EXPLICIT, new_type(TOID));
2064 : }
2065 5282 : break;
2066 :
2067 2196 : case 117: /* OctetStringType: kw_OCTET kw_STRING size */
2068 : {
2069 2440 : Type *t = new_type(TOctetString);
2070 2318 : t->range = (yyvsp[0].range);
2071 2318 : if (t->range) {
2072 76 : if (t->range->min < 0)
2073 0 : lex_error_message("can't use a negative SIZE range "
2074 : "length for OCTET STRING");
2075 : }
2076 2318 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,
2077 : TE_EXPLICIT, t);
2078 : }
2079 2318 : break;
2080 :
2081 90 : case 118: /* NullType: kw_NULL */
2082 : {
2083 105 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
2084 : TE_EXPLICIT, new_type(TNull));
2085 : }
2086 95 : break;
2087 :
2088 3401 : case 119: /* size: %empty */
2089 3401 : { (yyval.range) = NULL; }
2090 3401 : break;
2091 :
2092 323 : case 120: /* size: kw_SIZE '(' range ')' */
2093 323 : { (yyval.range) = (yyvsp[-1].range); }
2094 323 : break;
2095 :
2096 3960 : case 121: /* SequenceType: kw_SEQUENCE '{' ComponentTypeList '}' */
2097 : {
2098 4400 : (yyval.type) = new_type(TSequence);
2099 4180 : (yyval.type)->members = (yyvsp[-1].members);
2100 4400 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, default_tag_env, (yyval.type));
2101 : }
2102 4180 : break;
2103 :
2104 0 : case 122: /* SequenceType: kw_SEQUENCE '{' '}' */
2105 : {
2106 0 : (yyval.type) = new_type(TSequence);
2107 0 : (yyval.type)->members = NULL;
2108 0 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, default_tag_env, (yyval.type));
2109 : }
2110 0 : break;
2111 :
2112 1332 : case 123: /* SequenceOfType: kw_SEQUENCE size kw_OF Type */
2113 : {
2114 1480 : (yyval.type) = new_type(TSequenceOf);
2115 1406 : (yyval.type)->range = (yyvsp[-2].range);
2116 1406 : if ((yyval.type)->range) {
2117 247 : if ((yyval.type)->range->min < 0)
2118 0 : lex_error_message("can't use a negative SIZE range "
2119 : "length for SEQUENCE OF");
2120 : }
2121 :
2122 1406 : (yyval.type)->subtype = (yyvsp[0].type);
2123 1406 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, default_tag_env, (yyval.type));
2124 : }
2125 1406 : break;
2126 :
2127 0 : case 124: /* SetType: kw_SET '{' ComponentTypeList '}' */
2128 : {
2129 0 : (yyval.type) = new_type(TSet);
2130 0 : (yyval.type)->members = (yyvsp[-1].members);
2131 0 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, default_tag_env, (yyval.type));
2132 : }
2133 0 : break;
2134 :
2135 0 : case 125: /* SetType: kw_SET '{' '}' */
2136 : {
2137 0 : (yyval.type) = new_type(TSet);
2138 0 : (yyval.type)->members = NULL;
2139 0 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, default_tag_env, (yyval.type));
2140 : }
2141 0 : break;
2142 :
2143 306 : case 126: /* SetOfType: kw_SET kw_OF Type */
2144 : {
2145 340 : (yyval.type) = new_type(TSetOf);
2146 323 : (yyval.type)->subtype = (yyvsp[0].type);
2147 340 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, default_tag_env, (yyval.type));
2148 : }
2149 323 : break;
2150 :
2151 558 : case 127: /* ChoiceType: kw_CHOICE '{' ComponentTypeList '}' */
2152 : {
2153 620 : (yyval.type) = new_type(TChoice);
2154 589 : (yyval.type)->members = (yyvsp[-1].members);
2155 : }
2156 589 : break;
2157 :
2158 12559 : case 130: /* DefinedType: TYPE_IDENTIFIER */
2159 : {
2160 12559 : Symbol *s = addsym((yyvsp[0].name));
2161 13220 : (yyval.type) = new_type(TType);
2162 12559 : if(s->stype != Stype && s->stype != SUndefined)
2163 0 : lex_error_message ("%s is not a type\n", (yyvsp[0].name));
2164 : else
2165 12559 : (yyval.type)->symbol = s;
2166 : }
2167 11898 : break;
2168 :
2169 114 : case 131: /* DefinedType: ParameterizedType */
2170 114 : { (yyval.type) = (yyvsp[0].type); }
2171 114 : break;
2172 :
2173 114 : case 132: /* ParameterizedType: Identifier '{' ActualParameter '}' */
2174 : {
2175 6 : Symbol *s, *ps;
2176 114 : char *pname = NULL;
2177 :
2178 114 : if ((yyvsp[-1].objectset) == NULL) {
2179 0 : lex_error_message("Unknown ActualParameter object set parametrizing %s\n", (yyvsp[-3].name));
2180 0 : exit(1);
2181 : }
2182 :
2183 : /* Lookup the type from a ParameterizedTypeAssignment */
2184 114 : if (asprintf(&pname, "%s{%s:x}", (yyvsp[-3].name),
2185 114 : (yyvsp[-1].objectset)->iosclass->symbol->name) == -1 ||
2186 114 : pname == NULL)
2187 0 : err(1, "Out of memory");
2188 114 : ps = addsym(pname);
2189 114 : if (ps->stype != Sparamtype)
2190 0 : lex_error_message ("%s is not a parameterized type\n", (yyvsp[-3].name));
2191 :
2192 114 : s = addsym((yyvsp[-3].name));
2193 114 : (yyval.type) = ps->type; /* XXX copy, probably */
2194 114 : if (!ps->type)
2195 0 : errx(1, "Wrong class (%s) parameter for parameterized "
2196 0 : "type %s", (yyvsp[-1].objectset)->iosclass->symbol->name, (yyvsp[-3].name));
2197 114 : s->stype = Stype;
2198 114 : if(s->stype != Stype && s->stype != SUndefined)
2199 0 : lex_error_message ("%s is not a type\n", (yyvsp[-3].name));
2200 : else
2201 114 : (yyval.type)->symbol = s;
2202 114 : (yyval.type)->actual_parameter = (yyvsp[-1].objectset);
2203 114 : if ((yyval.type)->type == TTag)
2204 114 : (yyval.type)->subtype->actual_parameter = (yyvsp[-1].objectset);
2205 : }
2206 114 : break;
2207 :
2208 114 : case 133: /* ActualParameter: DefinedObjectSet */
2209 114 : { (yyval.objectset) = (yyvsp[0].objectset); }
2210 114 : break;
2211 :
2212 162 : case 134: /* UsefulType: kw_GeneralizedTime */
2213 : {
2214 189 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
2215 : TE_EXPLICIT, new_type(TGeneralizedTime));
2216 : }
2217 171 : break;
2218 :
2219 18 : case 135: /* UsefulType: kw_UTCTime */
2220 : {
2221 21 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
2222 : TE_EXPLICIT, new_type(TUTCTime));
2223 : }
2224 19 : break;
2225 :
2226 1102 : case 136: /* ConstrainedType: UnconstrainedType Constraint */
2227 : {
2228 1102 : (yyval.type) = (yyvsp[-1].type);
2229 1102 : if ((yyvsp[0].constraint_spec)->ctype == CT_RANGE) {
2230 855 : if ((yyvsp[-1].type)->type != TTag || (yyvsp[-1].type)->subtype->type != TInteger)
2231 0 : lex_error_message("RANGE constraints apply only to INTEGER types");
2232 855 : (yyval.type)->subtype->range = (yyvsp[0].constraint_spec)->u.range;
2233 855 : free((yyvsp[0].constraint_spec));
2234 : } else {
2235 247 : (yyval.type)->constraint = (yyvsp[0].constraint_spec);
2236 : }
2237 : /* if (Constraint.type == contentConstraint) {
2238 : assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
2239 : if (Constraint.u.constraint.type) {
2240 : assert((Constraint.u.constraint.type.length % 8) == 0);
2241 : }
2242 : }
2243 : if (Constraint.u.constraint.encoding) {
2244 : type == der-oid|ber-oid
2245 : }
2246 : */
2247 : }
2248 1044 : break;
2249 :
2250 1102 : case 137: /* Constraint: '(' ConstraintSpec ')' */
2251 : {
2252 1102 : (yyval.constraint_spec) = (yyvsp[-1].constraint_spec);
2253 : }
2254 1102 : break;
2255 :
2256 810 : case 140: /* SubtypeConstraint: range */
2257 : {
2258 900 : (yyval.constraint_spec) = new_constraint_spec(CT_RANGE);
2259 855 : (yyval.constraint_spec)->u.range = (yyvsp[0].range);
2260 : }
2261 855 : break;
2262 :
2263 18 : case 144: /* ContentsConstraint: kw_CONTAINING Type */
2264 : {
2265 20 : (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2266 19 : (yyval.constraint_spec)->u.content.type = (yyvsp[0].type);
2267 19 : (yyval.constraint_spec)->u.content.encoding = NULL;
2268 : }
2269 19 : break;
2270 :
2271 0 : case 145: /* ContentsConstraint: kw_ENCODED kw_BY Value */
2272 : {
2273 0 : if ((yyvsp[0].value)->type != objectidentifiervalue)
2274 0 : lex_error_message("Non-OID used in ENCODED BY constraint");
2275 0 : (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2276 0 : (yyval.constraint_spec)->u.content.type = NULL;
2277 0 : (yyval.constraint_spec)->u.content.encoding = (yyvsp[0].value);
2278 : }
2279 0 : break;
2280 :
2281 0 : case 146: /* ContentsConstraint: kw_CONTAINING Type kw_ENCODED kw_BY Value */
2282 : {
2283 0 : if ((yyvsp[0].value)->type != objectidentifiervalue)
2284 0 : lex_error_message("Non-OID used in ENCODED BY constraint");
2285 0 : (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2286 0 : (yyval.constraint_spec)->u.content.type = (yyvsp[-3].type);
2287 0 : (yyval.constraint_spec)->u.content.encoding = (yyvsp[0].value);
2288 : }
2289 0 : break;
2290 :
2291 0 : case 147: /* UserDefinedConstraint: kw_CONSTRAINED kw_BY '{' '}' */
2292 : {
2293 0 : (yyval.constraint_spec) = new_constraint_spec(CT_USER);
2294 : }
2295 0 : break;
2296 :
2297 114 : case 148: /* TableConstraint: SimpleTableConstraint */
2298 114 : { (yyval.constraint_spec) = (yyvsp[0].constraint_spec); }
2299 114 : break;
2300 :
2301 114 : case 149: /* TableConstraint: ComponentRelationConstraint */
2302 114 : { (yyval.constraint_spec) = (yyvsp[0].constraint_spec); }
2303 114 : break;
2304 :
2305 114 : case 150: /* SimpleTableConstraint: '{' TYPE_IDENTIFIER '}' */
2306 : {
2307 114 : (yyval.constraint_spec) = ecalloc(1, sizeof(*(yyval.constraint_spec)));
2308 114 : (yyval.constraint_spec)->ctype = CT_TABLE_CONSTRAINT;
2309 114 : (yyval.constraint_spec)->u.content.crel.objectname = (yyvsp[-1].name);
2310 114 : (yyval.constraint_spec)->u.content.crel.membername = 0;
2311 : }
2312 114 : break;
2313 :
2314 114 : case 151: /* ComponentRelationConstraint: '{' TYPE_IDENTIFIER '}' '{' '@' Identifier '}' */
2315 : {
2316 114 : (yyval.constraint_spec) = ecalloc(1, sizeof(*(yyval.constraint_spec)));
2317 114 : (yyval.constraint_spec)->ctype = CT_TABLE_CONSTRAINT;
2318 114 : (yyval.constraint_spec)->u.content.crel.objectname = (yyvsp[-5].name);
2319 114 : (yyval.constraint_spec)->u.content.crel.membername = (yyvsp[-1].name);
2320 : }
2321 114 : break;
2322 :
2323 11016 : case 152: /* TaggedType: Tag tagenv Type */
2324 : {
2325 12240 : (yyval.type) = new_type(TTag);
2326 11628 : (yyval.type)->tag = (yyvsp[-2].tag);
2327 11628 : (yyval.type)->tag.tagenv = (yyvsp[-1].constant);
2328 11628 : if (template_flag) {
2329 9671 : (yyval.type)->subtype = (yyvsp[0].type);
2330 1957 : } else if ((yyvsp[-1].constant) == TE_IMPLICIT) {
2331 209 : Type *t = (yyvsp[0].type);
2332 :
2333 : /*
2334 : * FIXME We shouldn't do this... The logic for
2335 : * dealing with IMPLICIT tags belongs elsewhere.
2336 : */
2337 277 : while (t->type == TType) {
2338 76 : if (t->subtype)
2339 0 : t = t->subtype;
2340 76 : else if (t->symbol && t->symbol->type)
2341 54 : t = t->symbol->type;
2342 : else
2343 : break;
2344 : }
2345 : /*
2346 : * IMPLICIT tags of CHOICE types are EXPLICIT
2347 : * instead.
2348 : */
2349 209 : if (t->type == TChoice) {
2350 38 : (yyval.type)->implicit_choice = 1;
2351 38 : (yyval.type)->tag.tagenv = TE_EXPLICIT;
2352 : }
2353 209 : if((yyvsp[0].type)->type == TTag && (yyvsp[-1].constant) == TE_IMPLICIT) {
2354 95 : (yyval.type)->subtype = (yyvsp[0].type)->subtype;
2355 95 : free((yyvsp[0].type));
2356 : } else {
2357 114 : (yyval.type)->subtype = (yyvsp[0].type);
2358 : }
2359 : } else {
2360 1748 : (yyval.type)->subtype = (yyvsp[0].type);
2361 : }
2362 : }
2363 11016 : break;
2364 :
2365 11628 : case 153: /* Tag: '[' Class NUMBER ']' */
2366 : {
2367 11628 : (yyval.tag).tagclass = (yyvsp[-2].constant);
2368 11628 : (yyval.tag).tagvalue = (yyvsp[-1].constant);
2369 11628 : (yyval.tag).tagenv = default_tag_env;
2370 : }
2371 11628 : break;
2372 :
2373 11153 : case 154: /* Class: %empty */
2374 : {
2375 11153 : (yyval.constant) = ASN1_C_CONTEXT;
2376 : }
2377 11153 : break;
2378 :
2379 19 : case 155: /* Class: kw_UNIVERSAL */
2380 : {
2381 19 : (yyval.constant) = ASN1_C_UNIV;
2382 : }
2383 19 : break;
2384 :
2385 456 : case 156: /* Class: kw_APPLICATION */
2386 : {
2387 456 : (yyval.constant) = ASN1_C_APPL;
2388 : }
2389 456 : break;
2390 :
2391 0 : case 157: /* Class: kw_PRIVATE */
2392 : {
2393 0 : (yyval.constant) = ASN1_C_PRIVATE;
2394 : }
2395 0 : break;
2396 :
2397 9880 : case 158: /* tagenv: %empty */
2398 : {
2399 9880 : (yyval.constant) = default_tag_env;
2400 : }
2401 9880 : break;
2402 :
2403 437 : case 159: /* tagenv: kw_EXPLICIT */
2404 : {
2405 437 : (yyval.constant) = default_tag_env;
2406 : }
2407 437 : break;
2408 :
2409 1311 : case 160: /* tagenv: kw_IMPLICIT */
2410 : {
2411 1311 : (yyval.constant) = TE_IMPLICIT;
2412 : }
2413 1311 : break;
2414 :
2415 5529 : case 161: /* ValueAssignment: VALUE_IDENTIFIER Type EEQUAL Value */
2416 : {
2417 291 : Symbol *s;
2418 5529 : s = addsym ((yyvsp[-3].name));
2419 :
2420 5529 : s->stype = SValue;
2421 5529 : s->value = (yyvsp[0].value);
2422 5529 : generate_constant (s);
2423 : /*
2424 : * Save this value's name so we can know some name for
2425 : * this value wherever _a_ name may be needed for it.
2426 : *
2427 : * This is useful for OIDs used as type IDs in objects
2428 : * sets of classes with open types. We'll generate
2429 : * enum labels from those OIDs' names.
2430 : */
2431 5529 : s->value->s = s;
2432 : }
2433 5529 : break;
2434 :
2435 252 : case 163: /* RestrictedCharactedStringType: kw_GeneralString */
2436 : {
2437 294 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
2438 : TE_EXPLICIT, new_type(TGeneralString));
2439 : }
2440 266 : break;
2441 :
2442 18 : case 164: /* RestrictedCharactedStringType: kw_TeletexString */
2443 : {
2444 21 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_TeletexString,
2445 : TE_EXPLICIT, new_type(TTeletexString));
2446 : }
2447 19 : break;
2448 :
2449 828 : case 165: /* RestrictedCharactedStringType: kw_UTF8String */
2450 : {
2451 966 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
2452 : TE_EXPLICIT, new_type(TUTF8String));
2453 : }
2454 874 : break;
2455 :
2456 36 : case 166: /* RestrictedCharactedStringType: kw_PrintableString */
2457 : {
2458 42 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
2459 : TE_EXPLICIT, new_type(TPrintableString));
2460 : }
2461 38 : break;
2462 :
2463 36 : case 167: /* RestrictedCharactedStringType: kw_VisibleString */
2464 : {
2465 42 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_VisibleString,
2466 : TE_EXPLICIT, new_type(TVisibleString));
2467 : }
2468 38 : break;
2469 :
2470 198 : case 168: /* RestrictedCharactedStringType: kw_IA5String */
2471 : {
2472 231 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
2473 : TE_EXPLICIT, new_type(TIA5String));
2474 : }
2475 209 : break;
2476 :
2477 54 : case 169: /* RestrictedCharactedStringType: kw_BMPString */
2478 : {
2479 63 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
2480 : TE_EXPLICIT, new_type(TBMPString));
2481 : }
2482 57 : break;
2483 :
2484 18 : case 170: /* RestrictedCharactedStringType: kw_UniversalString */
2485 : {
2486 21 : (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
2487 : TE_EXPLICIT, new_type(TUniversalString));
2488 : }
2489 19 : break;
2490 :
2491 4769 : case 171: /* ComponentTypeList: ComponentType */
2492 : {
2493 4769 : (yyval.members) = emalloc(sizeof(*(yyval.members)));
2494 4769 : HEIM_TAILQ_INIT((yyval.members));
2495 4769 : HEIM_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
2496 : }
2497 4769 : break;
2498 :
2499 11818 : case 172: /* ComponentTypeList: ComponentTypeList ',' ComponentType */
2500 : {
2501 11818 : HEIM_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
2502 11818 : (yyval.members) = (yyvsp[-2].members);
2503 : }
2504 11818 : break;
2505 :
2506 741 : case 173: /* ComponentTypeList: ComponentTypeList ',' ELLIPSIS */
2507 : {
2508 741 : struct member *m = ecalloc(1, sizeof(*m));
2509 741 : m->name = estrdup("...");
2510 741 : m->gen_name = estrdup("asn1_ellipsis");
2511 741 : m->ellipsis = 1;
2512 741 : HEIM_TAILQ_INSERT_TAIL((yyvsp[-2].members), m, members);
2513 741 : (yyval.members) = (yyvsp[-2].members);
2514 : }
2515 741 : break;
2516 :
2517 16587 : case 174: /* NamedType: Identifier Type */
2518 : {
2519 16587 : (yyval.member) = emalloc(sizeof(*(yyval.member)));
2520 16587 : (yyval.member)->name = (yyvsp[-1].name);
2521 16587 : (yyval.member)->gen_name = estrdup((yyvsp[-1].name));
2522 16587 : output_name ((yyval.member)->gen_name);
2523 16587 : (yyval.member)->type = (yyvsp[0].type);
2524 16587 : (yyval.member)->ellipsis = 0;
2525 : }
2526 16587 : break;
2527 :
2528 10811 : case 175: /* ComponentType: NamedType */
2529 : {
2530 10811 : (yyval.member) = (yyvsp[0].member);
2531 10811 : (yyval.member)->optional = 0;
2532 10811 : (yyval.member)->defval = NULL;
2533 : }
2534 10811 : break;
2535 :
2536 5567 : case 176: /* ComponentType: NamedType kw_OPTIONAL */
2537 : {
2538 5567 : (yyval.member) = (yyvsp[-1].member);
2539 5567 : (yyval.member)->optional = 1;
2540 5567 : (yyval.member)->defval = NULL;
2541 : }
2542 5567 : break;
2543 :
2544 209 : case 177: /* ComponentType: NamedType kw_DEFAULT Value */
2545 : {
2546 209 : (yyval.member) = (yyvsp[-2].member);
2547 209 : (yyval.member)->optional = 0;
2548 209 : (yyval.member)->defval = (yyvsp[0].value);
2549 : }
2550 209 : break;
2551 :
2552 247 : case 178: /* NamedBitList: NamedBit */
2553 : {
2554 247 : (yyval.members) = emalloc(sizeof(*(yyval.members)));
2555 247 : HEIM_TAILQ_INIT((yyval.members));
2556 247 : HEIM_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
2557 : }
2558 247 : break;
2559 :
2560 2109 : case 179: /* NamedBitList: NamedBitList ',' NamedBit */
2561 : {
2562 2109 : HEIM_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
2563 2109 : (yyval.members) = (yyvsp[-2].members);
2564 : }
2565 2109 : break;
2566 :
2567 2356 : case 180: /* NamedBit: Identifier '(' NUMBER ')' */
2568 : {
2569 2356 : (yyval.member) = emalloc(sizeof(*(yyval.member)));
2570 2356 : (yyval.member)->name = (yyvsp[-3].name);
2571 2356 : (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
2572 2356 : output_name ((yyval.member)->gen_name);
2573 2356 : (yyval.member)->val = (yyvsp[-1].constant);
2574 2356 : (yyval.member)->optional = 0;
2575 2356 : (yyval.member)->ellipsis = 0;
2576 2356 : (yyval.member)->type = NULL;
2577 : }
2578 2356 : break;
2579 :
2580 703 : case 182: /* objid_opt: %empty */
2581 703 : { (yyval.objid) = NULL; }
2582 703 : break;
2583 :
2584 4655 : case 183: /* objid: '{' objid_list '}' */
2585 : {
2586 4655 : (yyval.objid) = (yyvsp[-1].objid);
2587 : }
2588 4655 : break;
2589 :
2590 4655 : case 184: /* objid_list: %empty */
2591 : {
2592 4655 : (yyval.objid) = NULL;
2593 : }
2594 4655 : break;
2595 :
2596 15865 : case 185: /* objid_list: objid_element objid_list */
2597 : {
2598 15865 : if ((yyvsp[0].objid)) {
2599 11210 : (yyval.objid) = (yyvsp[0].objid);
2600 33892 : add_oid_to_tail((yyvsp[0].objid), (yyvsp[-1].objid));
2601 : } else {
2602 4655 : (yyval.objid) = (yyvsp[-1].objid);
2603 : }
2604 : }
2605 15030 : break;
2606 :
2607 6365 : case 186: /* objid_element: Identifier '(' NUMBER ')' */
2608 : {
2609 6700 : (yyval.objid) = new_objid((yyvsp[-3].name), (yyvsp[-1].constant));
2610 : }
2611 6365 : break;
2612 :
2613 3420 : case 187: /* objid_element: Identifier */
2614 : {
2615 3420 : Symbol *s = addsym((yyvsp[0].name));
2616 3420 : if(s->stype != SValue ||
2617 3420 : s->value->type != objectidentifiervalue) {
2618 0 : lex_error_message("%s is not an object identifier\n",
2619 : s->name);
2620 0 : exit(1);
2621 : }
2622 3420 : (yyval.objid) = s->value->u.objectidentifiervalue;
2623 : }
2624 3420 : break;
2625 :
2626 6080 : case 188: /* objid_element: NUMBER */
2627 : {
2628 6400 : (yyval.objid) = new_objid(NULL, (yyvsp[0].constant));
2629 : }
2630 6080 : break;
2631 :
2632 969 : case 204: /* Valuereference: VALUE_IDENTIFIER */
2633 : {
2634 969 : Symbol *s = addsym((yyvsp[0].name));
2635 969 : if(s->stype != SValue)
2636 0 : lex_error_message ("%s is not a value\n",
2637 : s->name);
2638 : else
2639 969 : (yyval.value) = s->value;
2640 : }
2641 918 : break;
2642 :
2643 0 : case 205: /* CharacterStringValue: STRING */
2644 : {
2645 0 : (yyval.value) = emalloc(sizeof(*(yyval.value)));
2646 0 : (yyval.value)->type = stringvalue;
2647 0 : (yyval.value)->u.stringvalue = (yyvsp[0].name);
2648 : }
2649 0 : break;
2650 :
2651 0 : case 206: /* BooleanValue: kw_TRUE */
2652 : {
2653 0 : (yyval.value) = emalloc(sizeof(*(yyval.value)));
2654 0 : (yyval.value)->type = booleanvalue;
2655 0 : (yyval.value)->u.booleanvalue = 1;
2656 : }
2657 0 : break;
2658 :
2659 513 : case 207: /* BooleanValue: kw_FALSE */
2660 : {
2661 513 : (yyval.value) = emalloc(sizeof(*(yyval.value)));
2662 513 : (yyval.value)->type = booleanvalue;
2663 513 : (yyval.value)->u.booleanvalue = 0;
2664 : }
2665 513 : break;
2666 :
2667 3059 : case 208: /* IntegerValue: SignedNumber */
2668 : {
2669 3059 : (yyval.value) = emalloc(sizeof(*(yyval.value)));
2670 3059 : (yyval.value)->type = integervalue;
2671 3059 : (yyval.value)->u.integervalue = (yyvsp[0].constant);
2672 : }
2673 3059 : break;
2674 :
2675 0 : case 210: /* NullValue: kw_NULL */
2676 : {
2677 : }
2678 0 : break;
2679 :
2680 4617 : case 211: /* ObjectIdentifierValue: objid */
2681 : {
2682 4617 : (yyval.value) = emalloc(sizeof(*(yyval.value)));
2683 4617 : (yyval.value)->type = objectidentifiervalue;
2684 4617 : (yyval.value)->u.objectidentifiervalue = (yyvsp[0].objid);
2685 : }
2686 4617 : break;
2687 :
2688 :
2689 :
2690 140778 : default: break;
2691 : }
2692 : /* User semantic actions sometimes alter yychar, and that requires
2693 : that yytoken be updated with the new translation. We take the
2694 : approach of translating immediately before every use of yytoken.
2695 : One alternative is translating here after every semantic action,
2696 : but that translation would be missed if the semantic action invokes
2697 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2698 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2699 : incorrect destructor might then be invoked immediately. In the
2700 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
2701 : to an incorrect destructor call or verbose syntax error message
2702 : before the lookahead is translated. */
2703 22682 : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2704 :
2705 430958 : YYPOPSTACK (yylen);
2706 430958 : yylen = 0;
2707 :
2708 430958 : *++yyvsp = yyval;
2709 :
2710 : /* Now 'shift' the result of the reduction. Determine what state
2711 : that goes to, based on the state we popped back to and the rule
2712 : number reduced by. */
2713 : {
2714 430958 : const int yylhs = yyr1[yyn] - YYNTOKENS;
2715 430958 : const int yyi = yypgoto[yylhs] + *yyssp;
2716 225245 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2717 174743 : ? yytable[yyi]
2718 656203 : : yydefgoto[yylhs]);
2719 : }
2720 :
2721 430958 : goto yynewstate;
2722 :
2723 :
2724 : /*--------------------------------------.
2725 : | yyerrlab -- here on detecting error. |
2726 : `--------------------------------------*/
2727 0 : yyerrlab:
2728 : /* Make sure we have latest lookahead translation. See comments at
2729 : user semantic actions for why this is necessary. */
2730 0 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2731 : /* If not already recovering from an error, report this error. */
2732 0 : if (!yyerrstatus)
2733 : {
2734 0 : ++yynerrs;
2735 0 : yyerror (YY_("syntax error"));
2736 : }
2737 :
2738 0 : if (yyerrstatus == 3)
2739 : {
2740 : /* If just tried and failed to reuse lookahead token after an
2741 : error, discard it. */
2742 :
2743 0 : if (yychar <= YYEOF)
2744 : {
2745 : /* Return failure if at end of input. */
2746 0 : if (yychar == YYEOF)
2747 0 : YYABORT;
2748 : }
2749 : else
2750 : {
2751 0 : yydestruct ("Error: discarding",
2752 : yytoken, &yylval);
2753 0 : yychar = YYEMPTY;
2754 : }
2755 : }
2756 :
2757 : /* Else will try to reuse lookahead token after shifting the error
2758 : token. */
2759 0 : goto yyerrlab1;
2760 :
2761 :
2762 : /*---------------------------------------------------.
2763 : | yyerrorlab -- error raised explicitly by YYERROR. |
2764 : `---------------------------------------------------*/
2765 : yyerrorlab:
2766 : /* Pacify compilers when the user code never invokes YYERROR and the
2767 : label yyerrorlab therefore never appears in user code. */
2768 : if (0)
2769 : YYERROR;
2770 : ++yynerrs;
2771 :
2772 : /* Do not reclaim the symbols of the rule whose action triggered
2773 : this YYERROR. */
2774 : YYPOPSTACK (yylen);
2775 : yylen = 0;
2776 : YY_STACK_PRINT (yyss, yyssp);
2777 : yystate = *yyssp;
2778 : goto yyerrlab1;
2779 :
2780 :
2781 : /*-------------------------------------------------------------.
2782 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
2783 : `-------------------------------------------------------------*/
2784 0 : yyerrlab1:
2785 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
2786 :
2787 : /* Pop stack until we find a state that shifts the error token. */
2788 0 : for (;;)
2789 : {
2790 0 : yyn = yypact[yystate];
2791 0 : if (!yypact_value_is_default (yyn))
2792 : {
2793 0 : yyn += YYSYMBOL_YYerror;
2794 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2795 : {
2796 0 : yyn = yytable[yyn];
2797 0 : if (0 < yyn)
2798 0 : break;
2799 : }
2800 : }
2801 :
2802 : /* Pop the current state because it cannot handle the error token. */
2803 0 : if (yyssp == yyss)
2804 0 : YYABORT;
2805 :
2806 :
2807 0 : yydestruct ("Error: popping",
2808 0 : YY_ACCESSING_SYMBOL (yystate), yyvsp);
2809 0 : YYPOPSTACK (1);
2810 0 : yystate = *yyssp;
2811 0 : YY_STACK_PRINT (yyss, yyssp);
2812 : }
2813 :
2814 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2815 0 : *++yyvsp = yylval;
2816 : YY_IGNORE_MAYBE_UNINITIALIZED_END
2817 :
2818 :
2819 : /* Shift the error token. */
2820 0 : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2821 :
2822 0 : yystate = yyn;
2823 0 : goto yynewstate;
2824 :
2825 :
2826 : /*-------------------------------------.
2827 : | yyacceptlab -- YYACCEPT comes here. |
2828 : `-------------------------------------*/
2829 304 : yyacceptlab:
2830 304 : yyresult = 0;
2831 304 : goto yyreturnlab;
2832 :
2833 :
2834 : /*-----------------------------------.
2835 : | yyabortlab -- YYABORT comes here. |
2836 : `-----------------------------------*/
2837 0 : yyabortlab:
2838 0 : yyresult = 1;
2839 0 : goto yyreturnlab;
2840 :
2841 :
2842 : /*-----------------------------------------------------------.
2843 : | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2844 : `-----------------------------------------------------------*/
2845 0 : yyexhaustedlab:
2846 0 : yyerror (YY_("memory exhausted"));
2847 0 : yyresult = 2;
2848 0 : goto yyreturnlab;
2849 :
2850 :
2851 : /*----------------------------------------------------------.
2852 : | yyreturnlab -- parsing is finished, clean up and return. |
2853 : `----------------------------------------------------------*/
2854 304 : yyreturnlab:
2855 304 : if (yychar != YYEMPTY)
2856 : {
2857 : /* Make sure we have latest lookahead translation. See comments at
2858 : user semantic actions for why this is necessary. */
2859 16 : yytoken = YYTRANSLATE (yychar);
2860 0 : yydestruct ("Cleanup: discarding lookahead",
2861 : yytoken, &yylval);
2862 : }
2863 : /* Do not reclaim the symbols of the rule whose action triggered
2864 : this YYABORT or YYACCEPT. */
2865 288 : YYPOPSTACK (yylen);
2866 : YY_STACK_PRINT (yyss, yyssp);
2867 880 : while (yyssp != yyss)
2868 : {
2869 576 : yydestruct ("Cleanup: popping",
2870 576 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
2871 576 : YYPOPSTACK (1);
2872 : }
2873 : #ifndef yyoverflow
2874 304 : if (yyss != yyssa)
2875 19 : YYSTACK_FREE (yyss);
2876 : #endif
2877 :
2878 304 : return yyresult;
2879 : }
2880 :
2881 :
2882 :
2883 : void
2884 0 : yyerror (const char *s)
2885 : {
2886 0 : lex_error_message ("%s\n", s);
2887 0 : }
2888 :
2889 : static Type *
2890 19418 : new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
2891 : {
2892 1022 : Type *t;
2893 19418 : if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
2894 0 : t = oldtype;
2895 0 : oldtype = oldtype->subtype; /* XXX */
2896 : } else
2897 20440 : t = new_type (TTag);
2898 :
2899 19418 : t->tag.tagclass = tagclass;
2900 19418 : t->tag.tagvalue = tagvalue;
2901 19418 : t->tag.tagenv = tagenv;
2902 19418 : t->subtype = oldtype;
2903 19418 : return t;
2904 : }
2905 :
2906 : static struct objid *
2907 12445 : new_objid(const char *label, int value)
2908 : {
2909 655 : struct objid *s;
2910 12445 : s = emalloc(sizeof(*s));
2911 12445 : s->label = label;
2912 12445 : s->value = value;
2913 12445 : s->next = NULL;
2914 12445 : return s;
2915 : }
2916 :
2917 : static void
2918 11210 : add_oid_to_tail(struct objid *head, struct objid *tail)
2919 : {
2920 590 : struct objid *o;
2921 11210 : o = head;
2922 31882 : while (o->next)
2923 19584 : o = o->next;
2924 11210 : o->next = tail;
2925 11210 : }
2926 :
2927 : static Type *
2928 63954 : new_type (Typetype tt)
2929 : {
2930 63936 : Type *t = ecalloc(1, sizeof(*t));
2931 63954 : t->type = tt;
2932 63954 : t->id = idcounter++;
2933 63936 : return t;
2934 : }
2935 :
2936 : static struct constraint_spec *
2937 874 : new_constraint_spec(enum ctype ct)
2938 : {
2939 874 : struct constraint_spec *c = ecalloc(1, sizeof(*c));
2940 874 : c->ctype = ct;
2941 874 : return c;
2942 : }
2943 :
2944 : static void fix_labels2(Type *t, const char *prefix);
2945 52212 : static void fix_labels1(struct memhead *members, const char *prefix)
2946 : {
2947 2748 : Member *m;
2948 :
2949 52212 : if(members == NULL)
2950 43722 : return;
2951 31559 : HEIM_TAILQ_FOREACH(m, members, members) {
2952 25498 : if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
2953 0 : errx(1, "malloc");
2954 25498 : if (m->label == NULL)
2955 0 : errx(1, "malloc");
2956 25498 : if(m->type != NULL)
2957 16834 : fix_labels2(m->type, m->label);
2958 : }
2959 : }
2960 :
2961 24304 : static void fix_labels2(Type *t, const char *prefix)
2962 : {
2963 76931 : for(; t; t = t->subtype)
2964 52212 : fix_labels1(t->members, prefix);
2965 24304 : }
2966 :
2967 : static void
2968 8949 : fix_labels(Symbol *s)
2969 : {
2970 8949 : char *p = NULL;
2971 8949 : if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
2972 0 : errx(1, "malloc");
2973 8949 : if (s->type)
2974 7941 : fix_labels2(s->type, p);
2975 8949 : free(p);
2976 8949 : }
2977 :
2978 : static struct objectshead *
2979 969 : add_object_set_spec(struct objectshead *lst, IOSObject *o)
2980 : {
2981 964 : if (lst == NULL) {
2982 95 : lst = emalloc(sizeof(*lst));
2983 95 : HEIM_TAILQ_INIT(lst);
2984 90 : HEIM_TAILQ_INSERT_HEAD(lst, o, objects);
2985 : } else {
2986 874 : HEIM_TAILQ_INSERT_TAIL(lst, o, objects);
2987 : }
2988 969 : return lst;
2989 : }
2990 :
2991 : static struct objfieldhead *
2992 2318 : add_field_setting(struct objfieldhead *lst, ObjectField *f)
2993 : {
2994 2267 : if (lst == NULL) {
2995 969 : lst = emalloc(sizeof(*lst));
2996 969 : HEIM_TAILQ_INIT(lst);
2997 918 : HEIM_TAILQ_INSERT_HEAD(lst, f, objfields);
2998 : } else {
2999 1349 : HEIM_TAILQ_INSERT_TAIL(lst, f, objfields);
3000 : }
3001 2318 : return lst;
3002 : }
3003 :
3004 : static struct fieldhead *
3005 285 : add_field_spec(struct fieldhead *lst, Field *f)
3006 : {
3007 280 : if (lst == NULL) {
3008 95 : lst = emalloc(sizeof(*lst));
3009 95 : HEIM_TAILQ_INIT(lst);
3010 90 : HEIM_TAILQ_INSERT_HEAD(lst, f, fields);
3011 : } else {
3012 190 : HEIM_TAILQ_INSERT_TAIL(lst, f, fields);
3013 : }
3014 285 : return lst;
3015 : }
3016 :
3017 : static ObjectField *
3018 2318 : new_field_setting(char *n, Type *t, struct value *v)
3019 : {
3020 122 : ObjectField *of;
3021 :
3022 2318 : of = ecalloc(1, sizeof(*of));
3023 2318 : of->value = v;
3024 2318 : of->type = t;
3025 2318 : of->name = n;
3026 2318 : return of;
3027 : }
3028 :
3029 : static Field *
3030 95 : new_type_field(char *n, int optional, Type *t)
3031 : {
3032 5 : Field *f;
3033 :
3034 95 : f = ecalloc(1, sizeof(*f));
3035 95 : f->optional = optional;
3036 95 : f->unique = 0;
3037 95 : f->defval = 0;
3038 95 : f->type = t;
3039 95 : f->name = n;
3040 95 : return f;
3041 : }
3042 :
3043 : static Field *
3044 190 : new_fixed_type_value_field(char *n, Type *t, int unique, int optional, struct value *defval)
3045 : {
3046 10 : Field *f;
3047 :
3048 190 : f = ecalloc(1, sizeof(*f));
3049 190 : f->optional = optional;
3050 190 : f->unique = unique;
3051 190 : f->defval = defval;
3052 190 : f->type = t;
3053 190 : f->name = n;
3054 190 : return f;
3055 : }
3056 :
3057 : static Type *
3058 114 : parametrize_type(Type *t, IOSClass *c)
3059 : {
3060 6 : Type *type;
3061 :
3062 114 : type = new_type(TType);
3063 114 : *type = *t; /* XXX Copy, or use subtype; this only works as long as we don't cleanup! */
3064 114 : type->formal_parameter = c;
3065 114 : return type;
3066 : }
3067 :
3068 : static Type *
3069 228 : type_from_class_field(IOSClass *c, const char *n)
3070 : {
3071 12 : Field *f;
3072 12 : Type *t;
3073 :
3074 342 : HEIM_TAILQ_FOREACH(f, c->fields, fields) {
3075 342 : if (strcmp(f->name, n) == 0) {
3076 228 : t = new_type(TType);
3077 228 : if (f->type) {
3078 114 : *t = *f->type;
3079 : } else {
3080 114 : Symbol *s = addsym("HEIM_ANY");
3081 114 : if(s->stype != Stype && s->stype != SUndefined)
3082 0 : errx(1, "Do not define HEIM_ANY, only import it\n");
3083 114 : s->stype = Stype;
3084 114 : t->symbol = s;
3085 : }
3086 228 : t->typeref.iosclass = c;
3087 228 : t->typeref.field = f;
3088 228 : return t;
3089 : }
3090 : }
3091 0 : return NULL;
3092 : }
3093 :
3094 : static void
3095 95 : validate_object_set(IOSObjectSet *os)
3096 : {
3097 5 : IOSObject **objects;
3098 5 : ObjectField *of;
3099 5 : IOSObject *o;
3100 5 : Field *cf;
3101 5 : size_t nobjs, i;
3102 :
3103 : /* Check unique fields */
3104 380 : HEIM_TAILQ_FOREACH(cf, os->iosclass->fields, fields) {
3105 285 : if (!cf->unique)
3106 190 : continue;
3107 95 : if (!cf->type)
3108 0 : errx(1, "Type fields of classes can't be UNIQUE (%s)",
3109 0 : os->iosclass->symbol->name);
3110 95 : sort_object_set(os, cf, &objects, &nobjs);
3111 1069 : for (i = 0; i < nobjs; i++) {
3112 1406 : HEIM_TAILQ_FOREACH(of, objects[i]->objfields, objfields) {
3113 1406 : if (strcmp(cf->name, of->name) != 0)
3114 437 : continue;
3115 969 : if (!of->value)
3116 0 : errx(1, "Value not specified for required UNIQUE field %s of object %s",
3117 0 : cf->name, objects[i]->symbol->name);
3118 918 : break;
3119 : }
3120 969 : if (i == 0)
3121 95 : continue;
3122 874 : if (object_cmp(&objects[i - 1], &objects[i]) == 0)
3123 0 : errx(1, "Duplicate values of UNIQUE field %s of objects %s and %s",
3124 0 : cf->name, objects[i - 1]->symbol->name,
3125 0 : objects[i]->symbol->name);
3126 : }
3127 95 : free(objects);
3128 : }
3129 :
3130 : /* Check required fields */
3131 380 : HEIM_TAILQ_FOREACH(cf, os->iosclass->fields, fields) {
3132 285 : if (cf->optional || cf->defval || !cf->type)
3133 190 : continue;
3134 1064 : HEIM_TAILQ_FOREACH(o, os->objects, objects) {
3135 969 : int specified = 0;
3136 :
3137 1406 : HEIM_TAILQ_FOREACH(of, o->objfields, objfields) {
3138 1406 : if (strcmp(of->name, cf->name) != 0)
3139 437 : continue;
3140 969 : if (of->value)
3141 969 : specified = 1;
3142 918 : break;
3143 : }
3144 969 : if (!specified)
3145 0 : errx(1, "Value not specified for required non-UNIQUE field %s of object %s",
3146 0 : cf->name, o->symbol->name);
3147 : }
3148 : }
3149 95 : }
|