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