1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
70 kw_ABSTRACT_SYNTAX = 259,
95 kw_EXTENSIBILITY = 284,
99 kw_GeneralString = 288,
100 kw_GeneralizedTime = 289,
101 kw_GraphicString = 290,
110 kw_INTERSECTION = 299,
111 kw_ISO646String = 300,
114 kw_MINUS_INFINITY = 303,
116 kw_NumericString = 305,
121 kw_ObjectDescriptor = 310,
124 kw_PLUS_INFINITY = 313,
127 kw_PrintableString = 316,
129 kw_RELATIVE_OID = 318,
138 kw_TYPE_IDENTIFIER = 327,
139 kw_TeletexString = 328,
145 kw_UniversalString = 334,
146 kw_VideotexString = 335,
147 kw_VisibleString = 336,
159 #define kw_ABSENT 258
160 #define kw_ABSTRACT_SYNTAX 259
162 #define kw_APPLICATION 261
163 #define kw_AUTOMATIC 262
166 #define kw_BMPString 265
167 #define kw_BOOLEAN 266
169 #define kw_CHARACTER 268
170 #define kw_CHOICE 269
172 #define kw_COMPONENT 271
173 #define kw_COMPONENTS 272
174 #define kw_CONSTRAINED 273
175 #define kw_CONTAINING 274
176 #define kw_DEFAULT 275
177 #define kw_DEFINITIONS 276
178 #define kw_EMBEDDED 277
179 #define kw_ENCODED 278
181 #define kw_ENUMERATED 280
182 #define kw_EXCEPT 281
183 #define kw_EXPLICIT 282
184 #define kw_EXPORTS 283
185 #define kw_EXTENSIBILITY 284
186 #define kw_EXTERNAL 285
189 #define kw_GeneralString 288
190 #define kw_GeneralizedTime 289
191 #define kw_GraphicString 290
192 #define kw_IA5String 291
193 #define kw_IDENTIFIER 292
194 #define kw_IMPLICIT 293
195 #define kw_IMPLIED 294
196 #define kw_IMPORTS 295
197 #define kw_INCLUDES 296
198 #define kw_INSTANCE 297
199 #define kw_INTEGER 298
200 #define kw_INTERSECTION 299
201 #define kw_ISO646String 300
204 #define kw_MINUS_INFINITY 303
206 #define kw_NumericString 305
207 #define kw_OBJECT 306
210 #define kw_OPTIONAL 309
211 #define kw_ObjectDescriptor 310
212 #define kw_PATTERN 311
214 #define kw_PLUS_INFINITY 313
215 #define kw_PRESENT 314
216 #define kw_PRIVATE 315
217 #define kw_PrintableString 316
219 #define kw_RELATIVE_OID 318
220 #define kw_SEQUENCE 319
223 #define kw_STRING 322
224 #define kw_SYNTAX 323
225 #define kw_T61String 324
228 #define kw_TYPE_IDENTIFIER 327
229 #define kw_TeletexString 328
231 #define kw_UNIQUE 330
232 #define kw_UNIVERSAL 331
233 #define kw_UTCTime 332
234 #define kw_UTF8String 333
235 #define kw_UniversalString 334
236 #define kw_VideotexString 335
237 #define kw_VisibleString 336
242 #define IDENTIFIER 341
243 #define referencename 342
250 /* Copy the first part of user declarations. */
251 #line 38 "asn1parse.y"
261 #include "gen_locl.h"
266 static Type *new_type (Typetype t);
267 static struct constraint_spec *new_constraint_spec(enum ctype);
268 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
269 void yyerror (const char *);
270 static struct objid *new_objid(const char *label, int value);
271 static void add_oid_to_tail(struct objid *, struct objid *);
272 static void fix_labels(Symbol *s);
276 struct string_list *next;
279 /* Declarations for Bison */
280 #define YYMALLOC malloc
285 /* Enabling traces. */
290 /* Enabling verbose error messages. */
291 #ifdef YYERROR_VERBOSE
292 # undef YYERROR_VERBOSE
293 # define YYERROR_VERBOSE 1
295 # define YYERROR_VERBOSE 0
298 /* Enabling the token table. */
299 #ifndef YYTOKEN_TABLE
300 # define YYTOKEN_TABLE 0
303 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
304 typedef union YYSTYPE
305 #line 71 "asn1parse.y"
315 struct string_list *sl;
317 struct memhead *members;
318 struct constraint_spec *constraint_spec;
320 /* Line 193 of yacc.c. */
321 #line 322 "asn1parse.c"
323 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
324 # define YYSTYPE_IS_DECLARED 1
325 # define YYSTYPE_IS_TRIVIAL 1
330 /* Copy the second part of user declarations. */
333 /* Line 216 of yacc.c. */
334 #line 335 "asn1parse.c"
341 typedef YYTYPE_UINT8 yytype_uint8;
343 typedef unsigned char yytype_uint8;
347 typedef YYTYPE_INT8 yytype_int8;
348 #elif (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
350 typedef signed char yytype_int8;
352 typedef short int yytype_int8;
356 typedef YYTYPE_UINT16 yytype_uint16;
358 typedef unsigned short int yytype_uint16;
362 typedef YYTYPE_INT16 yytype_int16;
364 typedef short int yytype_int16;
368 # ifdef __SIZE_TYPE__
369 # define YYSIZE_T __SIZE_TYPE__
370 # elif defined size_t
371 # define YYSIZE_T size_t
372 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
373 || defined __cplusplus || defined _MSC_VER)
374 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
375 # define YYSIZE_T size_t
377 # define YYSIZE_T unsigned int
381 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
384 # if defined YYENABLE_NLS && YYENABLE_NLS
386 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
387 # define YY_(msgid) dgettext ("bison-runtime", msgid)
391 # define YY_(msgid) msgid
395 /* Suppress unused-variable warnings by "using" E. */
396 #if ! defined lint || defined __GNUC__
397 # define YYUSE(e) ((void) (e))
399 # define YYUSE(e) /* empty */
402 /* Identity function, used to suppress warnings about constant conditions. */
406 #if (defined __STDC__ || defined __C99__FUNC__ \
407 || defined __cplusplus || defined _MSC_VER)
420 #if ! defined yyoverflow || YYERROR_VERBOSE
422 /* The parser invokes alloca or malloc; define the necessary symbols. */
424 # ifdef YYSTACK_USE_ALLOCA
425 # if YYSTACK_USE_ALLOCA
427 # define YYSTACK_ALLOC __builtin_alloca
428 # elif defined __BUILTIN_VA_ARG_INCR
429 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
431 # define YYSTACK_ALLOC __alloca
432 # elif defined _MSC_VER
433 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
434 # define alloca _alloca
436 # define YYSTACK_ALLOC alloca
437 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
438 || defined __cplusplus || defined _MSC_VER)
439 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
448 # ifdef YYSTACK_ALLOC
449 /* Pacify GCC's `empty if-body' warning. */
450 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
451 # ifndef YYSTACK_ALLOC_MAXIMUM
452 /* The OS might guarantee only one guard page at the bottom of the stack,
453 and a page size can be as small as 4096 bytes. So we cannot safely
454 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
455 to allow for a few compiler-allocated temporary stack slots. */
456 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
459 # define YYSTACK_ALLOC YYMALLOC
460 # define YYSTACK_FREE YYFREE
461 # ifndef YYSTACK_ALLOC_MAXIMUM
462 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
464 # if (defined __cplusplus && ! defined _STDLIB_H \
465 && ! ((defined YYMALLOC || defined malloc) \
466 && (defined YYFREE || defined free)))
467 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
473 # define YYMALLOC malloc
474 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
475 || defined __cplusplus || defined _MSC_VER)
476 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
481 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
482 || defined __cplusplus || defined _MSC_VER)
483 void free (void *); /* INFRINGES ON USER NAME SPACE */
487 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
490 #if (! defined yyoverflow \
491 && (! defined __cplusplus \
492 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
494 /* A type that is properly aligned for any stack member. */
501 /* The size of the maximum gap between one aligned stack and the next. */
502 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
504 /* The size of an array large to enough to hold all stacks, each with
506 # define YYSTACK_BYTES(N) \
507 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
508 + YYSTACK_GAP_MAXIMUM)
510 /* Copy COUNT objects from FROM to TO. The source and destination do
513 # if defined __GNUC__ && 1 < __GNUC__
514 # define YYCOPY(To, From, Count) \
515 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
517 # define YYCOPY(To, From, Count) \
521 for (yyi = 0; yyi < (Count); yyi++) \
522 (To)[yyi] = (From)[yyi]; \
528 /* Relocate STACK from its old location to the new one. The
529 local variables YYSIZE and YYSTACKSIZE give the old and new number of
530 elements in the stack, and YYPTR gives the new location of the
531 stack. Advance YYPTR to a properly aligned location for the next
533 # define YYSTACK_RELOCATE(Stack) \
536 YYSIZE_T yynewbytes; \
537 YYCOPY (&yyptr->Stack, Stack, yysize); \
538 Stack = &yyptr->Stack; \
539 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
540 yyptr += yynewbytes / sizeof (*yyptr); \
546 /* YYFINAL -- State number of the termination state. */
548 /* YYLAST -- Last index in YYTABLE. */
551 /* YYNTOKENS -- Number of terminals. */
553 /* YYNNTS -- Number of nonterminals. */
555 /* YYNRULES -- Number of rules. */
557 /* YYNRULES -- Number of states. */
558 #define YYNSTATES 220
560 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
562 #define YYMAXUTOK 344
564 #define YYTRANSLATE(YYX) \
565 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
567 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
568 static const yytype_uint8 yytranslate[] =
570 0, 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 92, 93, 2, 2, 91, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 90,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 96, 2, 97, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 94, 2, 95, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
596 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
597 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
598 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
599 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
600 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
601 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
602 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
603 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
608 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
610 static const yytype_uint16 yyprhs[] =
612 0, 0, 3, 13, 16, 19, 22, 23, 26, 27,
613 31, 32, 36, 37, 39, 40, 42, 45, 50, 54,
614 57, 58, 60, 63, 65, 67, 71, 73, 77, 79,
615 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,
616 101, 103, 105, 107, 109, 111, 113, 119, 125, 131,
617 135, 137, 140, 145, 147, 151, 155, 160, 165, 167,
618 170, 176, 179, 183, 185, 186, 189, 194, 198, 203,
619 208, 212, 216, 221, 223, 225, 227, 229, 231, 234,
620 238, 240, 242, 244, 247, 251, 257, 262, 266, 271,
621 272, 274, 276, 278, 279, 281, 283, 288, 290, 292,
622 294, 296, 298, 300, 302, 304, 306, 308, 312, 316,
623 319, 321, 324, 328, 330, 334, 339, 341, 342, 346,
624 347, 350, 355, 357, 359, 361, 363, 365, 367, 369,
625 371, 373, 375, 377, 379, 381, 383, 385, 387, 389,
629 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
630 static const yytype_int16 yyrhs[] =
632 99, 0, -1, 86, 152, 21, 100, 101, 84, 8,
633 102, 24, -1, 27, 70, -1, 38, 70, -1, 7,
634 70, -1, -1, 29, 39, -1, -1, 107, 103, 108,
635 -1, -1, 40, 104, 90, -1, -1, 105, -1, -1,
636 106, -1, 105, 106, -1, 110, 32, 86, 152, -1,
637 28, 110, 90, -1, 28, 5, -1, -1, 109, -1,
638 109, 108, -1, 111, -1, 144, -1, 86, 91, 110,
639 -1, 86, -1, 86, 84, 112, -1, 113, -1, 131,
640 -1, 134, -1, 121, -1, 114, -1, 145, -1, 130,
641 -1, 119, -1, 116, -1, 124, -1, 122, -1, 123,
642 -1, 126, -1, 127, -1, 128, -1, 129, -1, 140,
643 -1, 11, -1, 92, 156, 83, 156, 93, -1, 92,
644 156, 83, 46, 93, -1, 92, 47, 83, 156, 93,
645 -1, 92, 156, 93, -1, 43, -1, 43, 115, -1,
646 43, 94, 117, 95, -1, 118, -1, 117, 91, 118,
647 -1, 117, 91, 85, -1, 86, 92, 164, 93, -1,
648 25, 94, 120, 95, -1, 117, -1, 9, 67, -1,
649 9, 67, 94, 150, 95, -1, 51, 37, -1, 52,
650 67, 125, -1, 49, -1, -1, 66, 115, -1, 64,
651 94, 147, 95, -1, 64, 94, 95, -1, 64, 125,
652 53, 112, -1, 65, 94, 147, 95, -1, 65, 94,
653 95, -1, 65, 53, 112, -1, 14, 94, 147, 95,
654 -1, 132, -1, 133, -1, 86, -1, 34, -1, 77,
655 -1, 112, 135, -1, 92, 136, 93, -1, 137, -1,
656 138, -1, 139, -1, 19, 112, -1, 23, 12, 156,
657 -1, 19, 112, 23, 12, 156, -1, 18, 12, 94,
658 95, -1, 141, 143, 112, -1, 96, 142, 89, 97,
659 -1, -1, 76, -1, 6, -1, 60, -1, -1, 27,
660 -1, 38, -1, 86, 112, 84, 156, -1, 146, -1,
661 33, -1, 73, -1, 78, -1, 61, -1, 81, -1,
662 36, -1, 10, -1, 79, -1, 149, -1, 147, 91,
663 149, -1, 147, 91, 85, -1, 86, 112, -1, 148,
664 -1, 148, 54, -1, 148, 20, 156, -1, 151, -1,
665 150, 91, 151, -1, 86, 92, 89, 93, -1, 153,
666 -1, -1, 94, 154, 95, -1, -1, 155, 154, -1,
667 86, 92, 89, 93, -1, 86, -1, 89, -1, 157,
668 -1, 158, -1, 162, -1, 161, -1, 163, -1, 166,
669 -1, 165, -1, 159, -1, 160, -1, 86, -1, 88,
670 -1, 71, -1, 31, -1, 164, -1, 89, -1, 49,
674 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
675 static const yytype_uint16 yyrline[] =
677 0, 239, 239, 246, 247, 249, 251, 254, 256, 259,
678 260, 263, 264, 267, 268, 271, 272, 275, 287, 293,
679 294, 297, 298, 301, 302, 305, 311, 319, 329, 330,
680 331, 334, 335, 336, 337, 338, 339, 340, 341, 342,
681 343, 344, 345, 346, 347, 350, 357, 367, 375, 383,
682 394, 399, 405, 413, 419, 424, 428, 441, 449, 452,
683 459, 467, 473, 482, 490, 491, 496, 502, 510, 519,
684 525, 533, 541, 548, 549, 552, 563, 568, 575, 591,
685 597, 600, 601, 604, 610, 618, 628, 634, 647, 656,
686 659, 663, 667, 674, 677, 681, 688, 699, 702, 707,
687 712, 717, 722, 727, 732, 737, 745, 751, 756, 767,
688 778, 784, 790, 798, 804, 811, 824, 825, 828, 835,
689 838, 849, 853, 864, 870, 871, 874, 875, 876, 877,
690 878, 881, 884, 887, 898, 906, 912, 920, 928, 931,
695 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
696 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
697 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
698 static const char *const yytname[] =
700 "$end", "error", "$undefined", "kw_ABSENT", "kw_ABSTRACT_SYNTAX",
701 "kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC", "kw_BEGIN", "kw_BIT",
702 "kw_BMPString", "kw_BOOLEAN", "kw_BY", "kw_CHARACTER", "kw_CHOICE",
703 "kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS", "kw_CONSTRAINED",
704 "kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS", "kw_EMBEDDED",
705 "kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT", "kw_EXPLICIT",
706 "kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL", "kw_FALSE", "kw_FROM",
707 "kw_GeneralString", "kw_GeneralizedTime", "kw_GraphicString",
708 "kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT", "kw_IMPLIED",
709 "kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",
710 "kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",
711 "kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",
712 "kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",
713 "kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",
714 "kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",
715 "kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",
716 "kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",
717 "kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",
718 "kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",
719 "RANGE", "EEQUAL", "ELLIPSIS", "IDENTIFIER", "referencename", "STRING",
720 "NUMBER", "';'", "','", "'('", "')'", "'{'", "'}'", "'['", "']'",
721 "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",
722 "ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList",
723 "SymbolsFromModule", "Exports", "AssignmentList", "Assignment",
724 "referencenames", "TypeAssignment", "Type", "BuiltinType", "BooleanType",
725 "range", "IntegerType", "NamedNumberList", "NamedNumber",
726 "EnumeratedType", "Enumerations", "BitStringType",
727 "ObjectIdentifierType", "OctetStringType", "NullType", "size",
728 "SequenceType", "SequenceOfType", "SetType", "SetOfType", "ChoiceType",
729 "ReferencedType", "DefinedType", "UsefulType", "ConstrainedType",
730 "Constraint", "ConstraintSpec", "GeneralConstraint",
731 "ContentsConstraint", "UserDefinedConstraint", "TaggedType", "Tag",
732 "Class", "tagenv", "ValueAssignment", "CharacterStringType",
733 "RestrictedCharactedStringType", "ComponentTypeList", "NamedType",
734 "ComponentType", "NamedBitList", "NamedBit", "objid_opt", "objid",
735 "objid_list", "objid_element", "Value", "BuiltinValue",
736 "ReferencedValue", "DefinedValue", "Valuereference",
737 "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",
738 "NullValue", "ObjectIdentifierValue", 0
743 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
745 static const yytype_uint16 yytoknum[] =
747 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
748 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
749 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
750 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
751 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
752 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
753 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
754 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
755 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
756 59, 44, 40, 41, 123, 125, 91, 93
760 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
761 static const yytype_uint8 yyr1[] =
763 0, 98, 99, 100, 100, 100, 100, 101, 101, 102,
764 102, 103, 103, 104, 104, 105, 105, 106, 107, 107,
765 107, 108, 108, 109, 109, 110, 110, 111, 112, 112,
766 112, 113, 113, 113, 113, 113, 113, 113, 113, 113,
767 113, 113, 113, 113, 113, 114, 115, 115, 115, 115,
768 116, 116, 116, 117, 117, 117, 118, 119, 120, 121,
769 121, 122, 123, 124, 125, 125, 126, 126, 127, 128,
770 128, 129, 130, 131, 131, 132, 133, 133, 134, 135,
771 136, 137, 137, 138, 138, 138, 139, 140, 141, 142,
772 142, 142, 142, 143, 143, 143, 144, 145, 146, 146,
773 146, 146, 146, 146, 146, 146, 147, 147, 147, 148,
774 149, 149, 149, 150, 150, 151, 152, 152, 153, 154,
775 154, 155, 155, 155, 156, 156, 157, 157, 157, 157,
776 157, 158, 159, 160, 161, 162, 162, 163, 164, 165,
780 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
781 static const yytype_uint8 yyr2[] =
783 0, 2, 9, 2, 2, 2, 0, 2, 0, 3,
784 0, 3, 0, 1, 0, 1, 2, 4, 3, 2,
785 0, 1, 2, 1, 1, 3, 1, 3, 1, 1,
786 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
787 1, 1, 1, 1, 1, 1, 5, 5, 5, 3,
788 1, 2, 4, 1, 3, 3, 4, 4, 1, 2,
789 5, 2, 3, 1, 0, 2, 4, 3, 4, 4,
790 3, 3, 4, 1, 1, 1, 1, 1, 2, 3,
791 1, 1, 1, 2, 3, 5, 4, 3, 4, 0,
792 1, 1, 1, 0, 1, 1, 4, 1, 1, 1,
793 1, 1, 1, 1, 1, 1, 1, 3, 3, 2,
794 1, 2, 3, 1, 3, 4, 1, 0, 3, 0,
795 2, 4, 1, 1, 1, 1, 1, 1, 1, 1,
796 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
800 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
801 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
802 means the default is an error. */
803 static const yytype_uint8 yydefact[] =
805 0, 117, 0, 119, 0, 116, 1, 122, 123, 0,
806 119, 6, 0, 118, 120, 0, 0, 0, 8, 0,
807 5, 3, 4, 0, 0, 121, 7, 0, 20, 0,
808 0, 12, 19, 26, 0, 2, 14, 0, 0, 18,
809 0, 13, 15, 0, 0, 9, 21, 23, 24, 25,
810 11, 16, 0, 0, 104, 45, 0, 0, 98, 76,
811 103, 50, 63, 0, 0, 101, 64, 0, 99, 77,
812 100, 105, 102, 0, 75, 89, 0, 28, 32, 36,
813 35, 31, 38, 39, 37, 40, 41, 42, 43, 34,
814 29, 73, 74, 30, 44, 93, 33, 97, 22, 117,
815 59, 0, 0, 0, 0, 51, 61, 64, 0, 0,
816 0, 0, 0, 27, 91, 92, 90, 0, 0, 0,
817 78, 94, 95, 0, 17, 0, 0, 0, 110, 106,
818 0, 58, 53, 0, 136, 0, 139, 135, 133, 134,
819 138, 140, 0, 124, 125, 131, 132, 127, 126, 128,
820 137, 130, 129, 0, 62, 65, 67, 0, 0, 71,
821 70, 0, 0, 96, 0, 0, 0, 0, 80, 81,
822 82, 87, 0, 0, 113, 109, 0, 72, 0, 111,
823 0, 0, 57, 0, 0, 49, 52, 66, 68, 69,
824 88, 0, 83, 0, 79, 0, 0, 60, 108, 107,
825 112, 0, 55, 54, 0, 0, 0, 0, 0, 84,
826 0, 114, 56, 48, 47, 46, 86, 0, 115, 85
829 /* YYDEFGOTO[NTERM-NUM]. */
830 static const yytype_int16 yydefgoto[] =
832 -1, 2, 18, 24, 30, 37, 40, 41, 42, 31,
833 45, 46, 43, 47, 76, 77, 78, 105, 79, 131,
834 132, 80, 133, 81, 82, 83, 84, 110, 85, 86,
835 87, 88, 89, 90, 91, 92, 93, 120, 167, 168,
836 169, 170, 94, 95, 117, 123, 48, 96, 97, 127,
837 128, 129, 173, 174, 4, 141, 9, 10, 142, 143,
838 144, 145, 146, 147, 148, 149, 150, 151, 152
841 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
843 #define YYPACT_NINF -119
844 static const yytype_int16 yypact[] =
846 -43, -56, 47, -65, 29, -119, -119, -31, -119, -25,
847 -65, 4, -1, -119, -119, 17, 20, 26, 50, 13,
848 -119, -119, -119, 63, 24, -119, -119, 104, 8, -2,
849 89, 74, -119, 33, 25, -119, 34, 39, 34, -119,
850 37, 34, -119, 98, 58, -119, 39, -119, -119, -119,
851 -119, -119, 52, 66, -119, -119, 51, 53, -119, -119,
852 -119, -79, -119, 109, 81, -119, -60, -48, -119, -119,
853 -119, -119, -119, 107, -119, 2, -74, -119, -119, -119,
854 -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
855 -119, -119, -119, -119, -119, -18, -119, -119, -119, -56,
856 55, 65, 67, -12, 67, -119, -119, 86, 68, -70,
857 102, 107, -69, 69, -119, -119, -119, 73, 40, 10,
858 -119, -119, -119, 107, -119, 71, 107, -47, -13, -119,
859 72, 75, -119, 70, -119, 80, -119, -119, -119, -119,
860 -119, -119, -71, -119, -119, -119, -119, -119, -119, -119,
861 -119, -119, -119, -46, -119, -119, -119, -39, 107, 69,
862 -119, -38, 76, -119, 155, 107, 157, 77, -119, -119,
863 -119, 69, 82, -10, -119, 69, -22, -119, 40, -119,
864 87, 19, -119, 40, 9, -119, -119, -119, 69, -119,
865 -119, 83, -19, 40, -119, 90, 71, -119, -119, -119,
866 -119, 85, -119, -119, 88, 94, 96, 95, 163, -119,
867 99, -119, -119, -119, -119, -119, -119, 40, -119, -119
870 /* YYPGOTO[NTERM-NUM]. */
871 static const yytype_int16 yypgoto[] =
873 -119, -119, -119, -119, -119, -119, -119, -119, 141, -119,
874 137, -119, -15, -119, -72, -119, -119, 91, -119, 92,
875 14, -119, -119, -119, -119, -119, -119, 84, -119, -119,
876 -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
877 -119, -119, -119, -119, -119, -119, -119, -119, -119, -82,
878 -119, 18, -119, 5, 101, 1, 187, -119, -118, -119,
879 -119, -119, -119, -119, -119, -119, 22, -119, -119
882 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
883 positive, shift that token. If negative, reduce the rule which
884 number is the opposite. If zero, do what YYDEFACT says.
885 If YYTABLE_NINF, syntax error. */
886 #define YYTABLE_NINF -11
887 static const yytype_int16 yytable[] =
889 163, 113, 5, 32, 208, 111, 108, 178, 114, 121,
890 118, 15, 184, 103, 34, 104, 126, 126, 119, 134,
891 122, 7, 185, 49, 8, 156, 160, 157, 164, 165,
892 161, 16, -10, 166, 109, 135, 29, 136, 3, 159,
893 134, 179, 17, 1, 176, 181, 112, 6, 177, 186,
894 11, 171, 176, 176, 175, 205, 187, 189, 136, 137,
895 200, 12, 115, 198, 126, 204, 206, 53, 54, 55,
896 13, 134, 56, 119, 138, 209, 139, 140, 116, 23,
897 137, 196, 3, 57, 33, 197, 188, 20, 19, 136,
898 21, 58, 59, 192, 60, 138, 22, 139, 140, 219,
899 5, 61, 26, 3, 202, 130, 25, 62, 27, 63,
900 64, 137, 28, 35, 36, 39, 53, 54, 55, 65,
901 33, 56, 66, 67, 38, 44, 138, 50, 139, 140,
902 52, 68, 57, 100, 3, 69, 70, 71, 99, 72,
903 58, 59, 73, 60, 74, 101, 106, 102, 107, 125,
904 61, 126, 108, 130, 75, 158, 62, 172, 63, 64,
905 103, 119, 162, 183, 180, 182, 181, 191, 65, 193,
906 194, 66, 67, 190, 195, 217, 140, 207, 212, 210,
907 68, 213, 51, 98, 69, 70, 71, 214, 72, 215,
908 216, 154, 218, 74, 199, 203, 153, 14, 0, 155,
912 static const yytype_int16 yycheck[] =
914 118, 73, 1, 5, 23, 53, 66, 20, 6, 27,
915 84, 7, 83, 92, 29, 94, 86, 86, 92, 31,
916 38, 86, 93, 38, 89, 95, 95, 109, 18, 19,
917 112, 27, 24, 23, 94, 47, 28, 49, 94, 111,
918 31, 54, 38, 86, 91, 91, 94, 0, 95, 95,
919 21, 123, 91, 91, 126, 46, 95, 95, 49, 71,
920 178, 92, 60, 85, 86, 183, 184, 9, 10, 11,
921 95, 31, 14, 92, 86, 193, 88, 89, 76, 29,
922 71, 91, 94, 25, 86, 95, 158, 70, 89, 49,
923 70, 33, 34, 165, 36, 86, 70, 88, 89, 217,
924 99, 43, 39, 94, 85, 86, 93, 49, 84, 51,
925 52, 71, 8, 24, 40, 90, 9, 10, 11, 61,
926 86, 14, 64, 65, 91, 86, 86, 90, 88, 89,
927 32, 73, 25, 67, 94, 77, 78, 79, 86, 81,
928 33, 34, 84, 36, 86, 94, 37, 94, 67, 94,
929 43, 86, 66, 86, 96, 53, 49, 86, 51, 52,
930 92, 92, 89, 83, 92, 95, 91, 12, 61, 12,
931 93, 64, 65, 97, 92, 12, 89, 94, 93, 89,
932 73, 93, 41, 46, 77, 78, 79, 93, 81, 93,
933 95, 107, 93, 86, 176, 181, 104, 10, -1, 108,
937 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
938 symbol of state STATE-NUM. */
939 static const yytype_uint8 yystos[] =
941 0, 86, 99, 94, 152, 153, 0, 86, 89, 154,
942 155, 21, 92, 95, 154, 7, 27, 38, 100, 89,
943 70, 70, 70, 29, 101, 93, 39, 84, 8, 28,
944 102, 107, 5, 86, 110, 24, 40, 103, 91, 90,
945 104, 105, 106, 110, 86, 108, 109, 111, 144, 110,
946 90, 106, 32, 9, 10, 11, 14, 25, 33, 34,
947 36, 43, 49, 51, 52, 61, 64, 65, 73, 77,
948 78, 79, 81, 84, 86, 96, 112, 113, 114, 116,
949 119, 121, 122, 123, 124, 126, 127, 128, 129, 130,
950 131, 132, 133, 134, 140, 141, 145, 146, 108, 86,
951 67, 94, 94, 92, 94, 115, 37, 67, 66, 94,
952 125, 53, 94, 112, 6, 60, 76, 142, 84, 92,
953 135, 27, 38, 143, 152, 94, 86, 147, 148, 149,
954 86, 117, 118, 120, 31, 47, 49, 71, 86, 88,
955 89, 153, 156, 157, 158, 159, 160, 161, 162, 163,
956 164, 165, 166, 117, 125, 115, 95, 147, 53, 112,
957 95, 147, 89, 156, 18, 19, 23, 136, 137, 138,
958 139, 112, 86, 150, 151, 112, 91, 95, 20, 54,
959 92, 91, 95, 83, 83, 93, 95, 95, 112, 95,
960 97, 12, 112, 12, 93, 92, 91, 95, 85, 149,
961 156, 164, 85, 118, 156, 46, 156, 94, 23, 156,
962 89, 151, 93, 93, 93, 93, 95, 12, 93, 156
965 #define yyerrok (yyerrstatus = 0)
966 #define yyclearin (yychar = YYEMPTY)
970 #define YYACCEPT goto yyacceptlab
971 #define YYABORT goto yyabortlab
972 #define YYERROR goto yyerrorlab
975 /* Like YYERROR except do call yyerror. This remains here temporarily
976 to ease the transition to the new meaning of YYERROR, for GCC.
977 Once GCC version 2 has supplanted version 1, this can go. */
979 #define YYFAIL goto yyerrlab
981 #define YYRECOVERING() (!!yyerrstatus)
983 #define YYBACKUP(Token, Value) \
985 if (yychar == YYEMPTY && yylen == 1) \
989 yytoken = YYTRANSLATE (yychar); \
995 yyerror (YY_("syntax error: cannot back up")); \
1002 #define YYERRCODE 256
1005 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1006 If N is 0, then set CURRENT to the empty location which ends
1007 the previous symbol: RHS[0] (always defined). */
1009 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1010 #ifndef YYLLOC_DEFAULT
1011 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1015 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1016 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1017 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1018 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1022 (Current).first_line = (Current).last_line = \
1023 YYRHSLOC (Rhs, 0).last_line; \
1024 (Current).first_column = (Current).last_column = \
1025 YYRHSLOC (Rhs, 0).last_column; \
1031 /* YY_LOCATION_PRINT -- Print the location on the stream.
1032 This macro was not mandated originally: define only if we know
1033 we won't break user code: when these are the locations we know. */
1035 #ifndef YY_LOCATION_PRINT
1036 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1037 # define YY_LOCATION_PRINT(File, Loc) \
1038 fprintf (File, "%d.%d-%d.%d", \
1039 (Loc).first_line, (Loc).first_column, \
1040 (Loc).last_line, (Loc).last_column)
1042 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1047 /* YYLEX -- calling `yylex' with the right arguments. */
1050 # define YYLEX yylex (YYLEX_PARAM)
1052 # define YYLEX yylex ()
1055 /* Enable debugging if requested. */
1059 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1060 # define YYFPRINTF fprintf
1063 # define YYDPRINTF(Args) \
1069 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1073 YYFPRINTF (stderr, "%s ", Title); \
1074 yy_symbol_print (stderr, \
1076 YYFPRINTF (stderr, "\n"); \
1081 /*--------------------------------.
1082 | Print this symbol on YYOUTPUT. |
1083 `--------------------------------*/
1086 #if (defined __STDC__ || defined __C99__FUNC__ \
1087 || defined __cplusplus || defined _MSC_VER)
1089 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1092 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1095 YYSTYPE const * const yyvaluep;
1101 if (yytype < YYNTOKENS)
1102 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1114 /*--------------------------------.
1115 | Print this symbol on YYOUTPUT. |
1116 `--------------------------------*/
1118 #if (defined __STDC__ || defined __C99__FUNC__ \
1119 || defined __cplusplus || defined _MSC_VER)
1121 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1124 yy_symbol_print (yyoutput, yytype, yyvaluep)
1127 YYSTYPE const * const yyvaluep;
1130 if (yytype < YYNTOKENS)
1131 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1133 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1135 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1136 YYFPRINTF (yyoutput, ")");
1139 /*------------------------------------------------------------------.
1140 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1142 `------------------------------------------------------------------*/
1144 #if (defined __STDC__ || defined __C99__FUNC__ \
1145 || defined __cplusplus || defined _MSC_VER)
1147 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1150 yy_stack_print (bottom, top)
1151 yytype_int16 *bottom;
1155 YYFPRINTF (stderr, "Stack now");
1156 for (; bottom <= top; ++bottom)
1157 YYFPRINTF (stderr, " %d", *bottom);
1158 YYFPRINTF (stderr, "\n");
1161 # define YY_STACK_PRINT(Bottom, Top) \
1164 yy_stack_print ((Bottom), (Top)); \
1168 /*------------------------------------------------.
1169 | Report that the YYRULE is going to be reduced. |
1170 `------------------------------------------------*/
1172 #if (defined __STDC__ || defined __C99__FUNC__ \
1173 || defined __cplusplus || defined _MSC_VER)
1175 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1178 yy_reduce_print (yyvsp, yyrule)
1183 int yynrhs = yyr2[yyrule];
1185 unsigned long int yylno = yyrline[yyrule];
1186 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1188 /* The symbols being reduced. */
1189 for (yyi = 0; yyi < yynrhs; yyi++)
1191 fprintf (stderr, " $%d = ", yyi + 1);
1192 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1193 &(yyvsp[(yyi + 1) - (yynrhs)])
1195 fprintf (stderr, "\n");
1199 # define YY_REDUCE_PRINT(Rule) \
1202 yy_reduce_print (yyvsp, Rule); \
1205 /* Nonzero means print parse trace. It is left uninitialized so that
1206 multiple parsers can coexist. */
1208 #else /* !YYDEBUG */
1209 # define YYDPRINTF(Args)
1210 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1211 # define YY_STACK_PRINT(Bottom, Top)
1212 # define YY_REDUCE_PRINT(Rule)
1213 #endif /* !YYDEBUG */
1216 /* YYINITDEPTH -- initial size of the parser's stacks. */
1218 # define YYINITDEPTH 200
1221 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1222 if the built-in stack extension method is used).
1224 Do not make this value too large; the results are undefined if
1225 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1226 evaluated with infinite-precision integer arithmetic. */
1229 # define YYMAXDEPTH 10000
1237 # if defined __GLIBC__ && defined _STRING_H
1238 # define yystrlen strlen
1240 /* Return the length of YYSTR. */
1241 #if (defined __STDC__ || defined __C99__FUNC__ \
1242 || defined __cplusplus || defined _MSC_VER)
1244 yystrlen (const char *yystr)
1252 for (yylen = 0; yystr[yylen]; yylen++)
1260 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1261 # define yystpcpy stpcpy
1263 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1265 #if (defined __STDC__ || defined __C99__FUNC__ \
1266 || defined __cplusplus || defined _MSC_VER)
1268 yystpcpy (char *yydest, const char *yysrc)
1271 yystpcpy (yydest, yysrc)
1277 const char *yys = yysrc;
1279 while ((*yyd++ = *yys++) != '\0')
1288 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1289 quotes and backslashes, so that it's suitable for yyerror. The
1290 heuristic is that double-quoting is unnecessary unless the string
1291 contains an apostrophe, a comma, or backslash (other than
1292 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1293 null, do not copy; instead, return the length of what the result
1296 yytnamerr (char *yyres, const char *yystr)
1301 char const *yyp = yystr;
1308 goto do_not_strip_quotes;
1312 goto do_not_strip_quotes;
1325 do_not_strip_quotes: ;
1329 return yystrlen (yystr);
1331 return yystpcpy (yyres, yystr) - yyres;
1335 /* Copy into YYRESULT an error message about the unexpected token
1336 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1337 including the terminating null byte. If YYRESULT is null, do not
1338 copy anything; just return the number of bytes that would be
1339 copied. As a special case, return 0 if an ordinary "syntax error"
1340 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1341 size calculation. */
1343 yysyntax_error (char *yyresult, int yystate, int yychar)
1345 int yyn = yypact[yystate];
1347 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1351 int yytype = YYTRANSLATE (yychar);
1352 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1353 YYSIZE_T yysize = yysize0;
1355 int yysize_overflow = 0;
1356 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1357 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1361 /* This is so xgettext sees the translatable formats that are
1362 constructed on the fly. */
1363 YY_("syntax error, unexpected %s");
1364 YY_("syntax error, unexpected %s, expecting %s");
1365 YY_("syntax error, unexpected %s, expecting %s or %s");
1366 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1367 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1371 static char const yyunexpected[] = "syntax error, unexpected %s";
1372 static char const yyexpecting[] = ", expecting %s";
1373 static char const yyor[] = " or %s";
1374 char yyformat[sizeof yyunexpected
1375 + sizeof yyexpecting - 1
1376 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1377 * (sizeof yyor - 1))];
1378 char const *yyprefix = yyexpecting;
1380 /* Start YYX at -YYN if negative to avoid negative indexes in
1382 int yyxbegin = yyn < 0 ? -yyn : 0;
1384 /* Stay within bounds of both yycheck and yytname. */
1385 int yychecklim = YYLAST - yyn + 1;
1386 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1389 yyarg[0] = yytname[yytype];
1390 yyfmt = yystpcpy (yyformat, yyunexpected);
1392 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1393 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1395 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1399 yyformat[sizeof yyunexpected - 1] = '\0';
1402 yyarg[yycount++] = yytname[yyx];
1403 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1404 yysize_overflow |= (yysize1 < yysize);
1406 yyfmt = yystpcpy (yyfmt, yyprefix);
1410 yyf = YY_(yyformat);
1411 yysize1 = yysize + yystrlen (yyf);
1412 yysize_overflow |= (yysize1 < yysize);
1415 if (yysize_overflow)
1416 return YYSIZE_MAXIMUM;
1420 /* Avoid sprintf, as that infringes on the user's name space.
1421 Don't have undefined behavior even if the translation
1422 produced a string with the wrong number of "%s"s. */
1423 char *yyp = yyresult;
1425 while ((*yyp = *yyf) != '\0')
1427 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1429 yyp += yytnamerr (yyp, yyarg[yyi++]);
1442 #endif /* YYERROR_VERBOSE */
1445 /*-----------------------------------------------.
1446 | Release the memory associated to this symbol. |
1447 `-----------------------------------------------*/
1450 #if (defined __STDC__ || defined __C99__FUNC__ \
1451 || defined __cplusplus || defined _MSC_VER)
1453 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1456 yydestruct (yymsg, yytype, yyvaluep)
1466 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1477 /* Prevent warnings from -Wmissing-prototypes. */
1479 #ifdef YYPARSE_PARAM
1480 #if defined __STDC__ || defined __cplusplus
1481 int yyparse (void *YYPARSE_PARAM);
1485 #else /* ! YYPARSE_PARAM */
1486 #if defined __STDC__ || defined __cplusplus
1491 #endif /* ! YYPARSE_PARAM */
1495 /* The look-ahead symbol. */
1498 /* The semantic value of the look-ahead symbol. */
1501 /* Number of syntax errors so far. */
1510 #ifdef YYPARSE_PARAM
1511 #if (defined __STDC__ || defined __C99__FUNC__ \
1512 || defined __cplusplus || defined _MSC_VER)
1514 yyparse (void *YYPARSE_PARAM)
1517 yyparse (YYPARSE_PARAM)
1518 void *YYPARSE_PARAM;
1520 #else /* ! YYPARSE_PARAM */
1521 #if (defined __STDC__ || defined __C99__FUNC__ \
1522 || defined __cplusplus || defined _MSC_VER)
1536 /* Number of tokens to shift before error messages enabled. */
1538 /* Look-ahead token as an internal (translated) token number. */
1541 /* Buffer for error messages, and its allocated size. */
1543 char *yymsg = yymsgbuf;
1544 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1547 /* Three stacks and their tools:
1548 `yyss': related to states,
1549 `yyvs': related to semantic values,
1550 `yyls': related to locations.
1552 Refer to the stacks thru separate pointers, to allow yyoverflow
1553 to reallocate them elsewhere. */
1555 /* The state stack. */
1556 yytype_int16 yyssa[YYINITDEPTH];
1557 yytype_int16 *yyss = yyssa;
1558 yytype_int16 *yyssp;
1560 /* The semantic value stack. */
1561 YYSTYPE yyvsa[YYINITDEPTH];
1562 YYSTYPE *yyvs = yyvsa;
1567 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1569 YYSIZE_T yystacksize = YYINITDEPTH;
1571 /* The variables used to return semantic value and location from the
1576 /* The number of symbols on the RHS of the reduced rule.
1577 Keep to zero when no symbol should be popped. */
1580 YYDPRINTF ((stderr, "Starting parse\n"));
1585 yychar = YYEMPTY; /* Cause a token to be read. */
1587 /* Initialize stack pointers.
1588 Waste one element of value and location stack
1589 so that they stay on the same level as the state stack.
1590 The wasted elements are never initialized. */
1597 /*------------------------------------------------------------.
1598 | yynewstate -- Push a new state, which is found in yystate. |
1599 `------------------------------------------------------------*/
1601 /* In all cases, when you get here, the value and location stacks
1602 have just been pushed. So pushing a state here evens the stacks. */
1608 if (yyss + yystacksize - 1 <= yyssp)
1610 /* Get the current used size of the three stacks, in elements. */
1611 YYSIZE_T yysize = yyssp - yyss + 1;
1615 /* Give user a chance to reallocate the stack. Use copies of
1616 these so that the &'s don't force the real ones into
1618 YYSTYPE *yyvs1 = yyvs;
1619 yytype_int16 *yyss1 = yyss;
1622 /* Each stack pointer address is followed by the size of the
1623 data in use in that stack, in bytes. This used to be a
1624 conditional around just the two extra args, but that might
1625 be undefined if yyoverflow is a macro. */
1626 yyoverflow (YY_("memory exhausted"),
1627 &yyss1, yysize * sizeof (*yyssp),
1628 &yyvs1, yysize * sizeof (*yyvsp),
1635 #else /* no yyoverflow */
1636 # ifndef YYSTACK_RELOCATE
1637 goto yyexhaustedlab;
1639 /* Extend the stack our own way. */
1640 if (YYMAXDEPTH <= yystacksize)
1641 goto yyexhaustedlab;
1643 if (YYMAXDEPTH < yystacksize)
1644 yystacksize = YYMAXDEPTH;
1647 yytype_int16 *yyss1 = yyss;
1648 union yyalloc *yyptr =
1649 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1651 goto yyexhaustedlab;
1652 YYSTACK_RELOCATE (yyss);
1653 YYSTACK_RELOCATE (yyvs);
1655 # undef YYSTACK_RELOCATE
1657 YYSTACK_FREE (yyss1);
1660 #endif /* no yyoverflow */
1662 yyssp = yyss + yysize - 1;
1663 yyvsp = yyvs + yysize - 1;
1666 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1667 (unsigned long int) yystacksize));
1669 if (yyss + yystacksize - 1 <= yyssp)
1673 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1682 /* Do appropriate processing given the current state. Read a
1683 look-ahead token if we need one and don't already have one. */
1685 /* First try to decide what to do without reference to look-ahead token. */
1686 yyn = yypact[yystate];
1687 if (yyn == YYPACT_NINF)
1690 /* Not known => get a look-ahead token if don't already have one. */
1692 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1693 if (yychar == YYEMPTY)
1695 YYDPRINTF ((stderr, "Reading a token: "));
1699 if (yychar <= YYEOF)
1701 yychar = yytoken = YYEOF;
1702 YYDPRINTF ((stderr, "Now at end of input.\n"));
1706 yytoken = YYTRANSLATE (yychar);
1707 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1710 /* If the proper action on seeing token YYTOKEN is to reduce or to
1711 detect an error, take that action. */
1713 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1718 if (yyn == 0 || yyn == YYTABLE_NINF)
1727 /* Count tokens shifted since error; after three, turn off error
1732 /* Shift the look-ahead token. */
1733 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1735 /* Discard the shifted token unless it is eof. */
1736 if (yychar != YYEOF)
1745 /*-----------------------------------------------------------.
1746 | yydefault -- do the default action for the current state. |
1747 `-----------------------------------------------------------*/
1749 yyn = yydefact[yystate];
1755 /*-----------------------------.
1756 | yyreduce -- Do a reduction. |
1757 `-----------------------------*/
1759 /* yyn is the number of a rule to reduce with. */
1762 /* If YYLEN is nonzero, implement the default value of the action:
1765 Otherwise, the following line sets YYVAL to garbage.
1766 This behavior is undocumented and Bison
1767 users should not rely upon it. Assigning to YYVAL
1768 unconditionally makes the parser a bit smaller, and it avoids a
1769 GCC warning that YYVAL may be used uninitialized. */
1770 yyval = yyvsp[1-yylen];
1773 YY_REDUCE_PRINT (yyn);
1777 #line 241 "asn1parse.y"
1784 #line 248 "asn1parse.y"
1785 { lex_error_message("implicit tagging is not supported"); }
1789 #line 250 "asn1parse.y"
1790 { lex_error_message("automatic tagging is not supported"); }
1794 #line 255 "asn1parse.y"
1795 { lex_error_message("no extensibility options supported"); }
1799 #line 276 "asn1parse.y"
1801 struct string_list *sl;
1802 for(sl = (yyvsp[(1) - (4)].sl); sl != NULL; sl = sl->next) {
1803 Symbol *s = addsym(sl->string);
1805 gen_template_import(s);
1807 add_import((yyvsp[(3) - (4)].name));
1812 #line 288 "asn1parse.y"
1814 struct string_list *sl;
1815 for(sl = (yyvsp[(2) - (3)].sl); sl != NULL; sl = sl->next)
1816 add_export(sl->string);
1821 #line 306 "asn1parse.y"
1823 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1824 (yyval.sl)->string = (yyvsp[(1) - (3)].name);
1825 (yyval.sl)->next = (yyvsp[(3) - (3)].sl);
1830 #line 312 "asn1parse.y"
1832 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1833 (yyval.sl)->string = (yyvsp[(1) - (1)].name);
1834 (yyval.sl)->next = NULL;
1839 #line 320 "asn1parse.y"
1841 Symbol *s = addsym ((yyvsp[(1) - (3)].name));
1843 s->type = (yyvsp[(3) - (3)].type);
1850 #line 351 "asn1parse.y"
1852 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
1853 TE_EXPLICIT, new_type(TBoolean));
1858 #line 358 "asn1parse.y"
1860 if((yyvsp[(2) - (5)].value)->type != integervalue)
1861 lex_error_message("Non-integer used in first part of range");
1862 if((yyvsp[(2) - (5)].value)->type != integervalue)
1863 lex_error_message("Non-integer in second part of range");
1864 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1865 (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;
1866 (yyval.range)->max = (yyvsp[(4) - (5)].value)->u.integervalue;
1871 #line 368 "asn1parse.y"
1873 if((yyvsp[(2) - (5)].value)->type != integervalue)
1874 lex_error_message("Non-integer in first part of range");
1875 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1876 (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;
1877 (yyval.range)->max = (yyvsp[(2) - (5)].value)->u.integervalue - 1;
1882 #line 376 "asn1parse.y"
1884 if((yyvsp[(4) - (5)].value)->type != integervalue)
1885 lex_error_message("Non-integer in second part of range");
1886 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1887 (yyval.range)->min = (yyvsp[(4) - (5)].value)->u.integervalue + 2;
1888 (yyval.range)->max = (yyvsp[(4) - (5)].value)->u.integervalue;
1893 #line 384 "asn1parse.y"
1895 if((yyvsp[(2) - (3)].value)->type != integervalue)
1896 lex_error_message("Non-integer used in limit");
1897 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1898 (yyval.range)->min = (yyvsp[(2) - (3)].value)->u.integervalue;
1899 (yyval.range)->max = (yyvsp[(2) - (3)].value)->u.integervalue;
1904 #line 395 "asn1parse.y"
1906 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
1907 TE_EXPLICIT, new_type(TInteger));
1912 #line 400 "asn1parse.y"
1914 (yyval.type) = new_type(TInteger);
1915 (yyval.type)->range = (yyvsp[(2) - (2)].range);
1916 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1921 #line 406 "asn1parse.y"
1923 (yyval.type) = new_type(TInteger);
1924 (yyval.type)->members = (yyvsp[(3) - (4)].members);
1925 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1930 #line 414 "asn1parse.y"
1932 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1933 ASN1_TAILQ_INIT((yyval.members));
1934 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);
1939 #line 420 "asn1parse.y"
1941 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
1942 (yyval.members) = (yyvsp[(1) - (3)].members);
1947 #line 425 "asn1parse.y"
1948 { (yyval.members) = (yyvsp[(1) - (3)].members); }
1952 #line 429 "asn1parse.y"
1954 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1955 (yyval.member)->name = (yyvsp[(1) - (4)].name);
1956 (yyval.member)->gen_name = estrdup((yyvsp[(1) - (4)].name));
1957 output_name ((yyval.member)->gen_name);
1958 (yyval.member)->val = (yyvsp[(3) - (4)].constant);
1959 (yyval.member)->optional = 0;
1960 (yyval.member)->ellipsis = 0;
1961 (yyval.member)->type = NULL;
1966 #line 442 "asn1parse.y"
1968 (yyval.type) = new_type(TInteger);
1969 (yyval.type)->members = (yyvsp[(3) - (4)].members);
1970 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));
1975 #line 453 "asn1parse.y"
1977 (yyval.type) = new_type(TBitString);
1978 (yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));
1979 ASN1_TAILQ_INIT((yyval.type)->members);
1980 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1985 #line 460 "asn1parse.y"
1987 (yyval.type) = new_type(TBitString);
1988 (yyval.type)->members = (yyvsp[(4) - (5)].members);
1989 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1994 #line 468 "asn1parse.y"
1996 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
1997 TE_EXPLICIT, new_type(TOID));
2002 #line 474 "asn1parse.y"
2004 Type *t = new_type(TOctetString);
2005 t->range = (yyvsp[(3) - (3)].range);
2006 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,
2012 #line 483 "asn1parse.y"
2014 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
2015 TE_EXPLICIT, new_type(TNull));
2020 #line 490 "asn1parse.y"
2021 { (yyval.range) = NULL; }
2025 #line 492 "asn1parse.y"
2026 { (yyval.range) = (yyvsp[(2) - (2)].range); }
2030 #line 497 "asn1parse.y"
2032 (yyval.type) = new_type(TSequence);
2033 (yyval.type)->members = (yyvsp[(3) - (4)].members);
2034 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
2039 #line 503 "asn1parse.y"
2041 (yyval.type) = new_type(TSequence);
2042 (yyval.type)->members = NULL;
2043 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
2048 #line 511 "asn1parse.y"
2050 (yyval.type) = new_type(TSequenceOf);
2051 (yyval.type)->range = (yyvsp[(2) - (4)].range);
2052 (yyval.type)->subtype = (yyvsp[(4) - (4)].type);
2053 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
2058 #line 520 "asn1parse.y"
2060 (yyval.type) = new_type(TSet);
2061 (yyval.type)->members = (yyvsp[(3) - (4)].members);
2062 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
2067 #line 526 "asn1parse.y"
2069 (yyval.type) = new_type(TSet);
2070 (yyval.type)->members = NULL;
2071 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
2076 #line 534 "asn1parse.y"
2078 (yyval.type) = new_type(TSetOf);
2079 (yyval.type)->subtype = (yyvsp[(3) - (3)].type);
2080 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
2085 #line 542 "asn1parse.y"
2087 (yyval.type) = new_type(TChoice);
2088 (yyval.type)->members = (yyvsp[(3) - (4)].members);
2093 #line 553 "asn1parse.y"
2095 Symbol *s = addsym((yyvsp[(1) - (1)].name));
2096 (yyval.type) = new_type(TType);
2097 if(s->stype != Stype && s->stype != SUndefined)
2098 lex_error_message ("%s is not a type\n", (yyvsp[(1) - (1)].name));
2100 (yyval.type)->symbol = s;
2105 #line 564 "asn1parse.y"
2107 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
2108 TE_EXPLICIT, new_type(TGeneralizedTime));
2113 #line 569 "asn1parse.y"
2115 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
2116 TE_EXPLICIT, new_type(TUTCTime));
2121 #line 576 "asn1parse.y"
2123 /* if (Constraint.type == contentConstrant) {
2124 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
2125 if (Constraint.u.constraint.type) {
2126 assert((Constraint.u.constraint.type.length % 8) == 0);
2129 if (Constraint.u.constraint.encoding) {
2130 type == der-oid|ber-oid
2137 #line 592 "asn1parse.y"
2139 (yyval.constraint_spec) = (yyvsp[(2) - (3)].constraint_spec);
2144 #line 605 "asn1parse.y"
2146 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2147 (yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (2)].type);
2148 (yyval.constraint_spec)->u.content.encoding = NULL;
2153 #line 611 "asn1parse.y"
2155 if ((yyvsp[(3) - (3)].value)->type != objectidentifiervalue)
2156 lex_error_message("Non-OID used in ENCODED BY constraint");
2157 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2158 (yyval.constraint_spec)->u.content.type = NULL;
2159 (yyval.constraint_spec)->u.content.encoding = (yyvsp[(3) - (3)].value);
2164 #line 619 "asn1parse.y"
2166 if ((yyvsp[(5) - (5)].value)->type != objectidentifiervalue)
2167 lex_error_message("Non-OID used in ENCODED BY constraint");
2168 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2169 (yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (5)].type);
2170 (yyval.constraint_spec)->u.content.encoding = (yyvsp[(5) - (5)].value);
2175 #line 629 "asn1parse.y"
2177 (yyval.constraint_spec) = new_constraint_spec(CT_USER);
2182 #line 635 "asn1parse.y"
2184 (yyval.type) = new_type(TTag);
2185 (yyval.type)->tag = (yyvsp[(1) - (3)].tag);
2186 (yyval.type)->tag.tagenv = (yyvsp[(2) - (3)].constant);
2187 if((yyvsp[(3) - (3)].type)->type == TTag && (yyvsp[(2) - (3)].constant) == TE_IMPLICIT) {
2188 (yyval.type)->subtype = (yyvsp[(3) - (3)].type)->subtype;
2189 free((yyvsp[(3) - (3)].type));
2191 (yyval.type)->subtype = (yyvsp[(3) - (3)].type);
2196 #line 648 "asn1parse.y"
2198 (yyval.tag).tagclass = (yyvsp[(2) - (4)].constant);
2199 (yyval.tag).tagvalue = (yyvsp[(3) - (4)].constant);
2200 (yyval.tag).tagenv = TE_EXPLICIT;
2205 #line 656 "asn1parse.y"
2207 (yyval.constant) = ASN1_C_CONTEXT;
2212 #line 660 "asn1parse.y"
2214 (yyval.constant) = ASN1_C_UNIV;
2219 #line 664 "asn1parse.y"
2221 (yyval.constant) = ASN1_C_APPL;
2226 #line 668 "asn1parse.y"
2228 (yyval.constant) = ASN1_C_PRIVATE;
2233 #line 674 "asn1parse.y"
2235 (yyval.constant) = TE_EXPLICIT;
2240 #line 678 "asn1parse.y"
2242 (yyval.constant) = TE_EXPLICIT;
2247 #line 682 "asn1parse.y"
2249 (yyval.constant) = TE_IMPLICIT;
2254 #line 689 "asn1parse.y"
2257 s = addsym ((yyvsp[(1) - (4)].name));
2260 s->value = (yyvsp[(4) - (4)].value);
2261 generate_constant (s);
2266 #line 703 "asn1parse.y"
2268 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
2269 TE_EXPLICIT, new_type(TGeneralString));
2274 #line 708 "asn1parse.y"
2276 (yyval.type) = new_tag(ASN1_C_UNIV, UT_TeletexString,
2277 TE_EXPLICIT, new_type(TTeletexString));
2282 #line 713 "asn1parse.y"
2284 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
2285 TE_EXPLICIT, new_type(TUTF8String));
2290 #line 718 "asn1parse.y"
2292 (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
2293 TE_EXPLICIT, new_type(TPrintableString));
2298 #line 723 "asn1parse.y"
2300 (yyval.type) = new_tag(ASN1_C_UNIV, UT_VisibleString,
2301 TE_EXPLICIT, new_type(TVisibleString));
2306 #line 728 "asn1parse.y"
2308 (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
2309 TE_EXPLICIT, new_type(TIA5String));
2314 #line 733 "asn1parse.y"
2316 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
2317 TE_EXPLICIT, new_type(TBMPString));
2322 #line 738 "asn1parse.y"
2324 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
2325 TE_EXPLICIT, new_type(TUniversalString));
2330 #line 746 "asn1parse.y"
2332 (yyval.members) = emalloc(sizeof(*(yyval.members)));
2333 ASN1_TAILQ_INIT((yyval.members));
2334 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);
2339 #line 752 "asn1parse.y"
2341 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
2342 (yyval.members) = (yyvsp[(1) - (3)].members);
2347 #line 757 "asn1parse.y"
2349 struct member *m = ecalloc(1, sizeof(*m));
2350 m->name = estrdup("...");
2351 m->gen_name = estrdup("asn1_ellipsis");
2353 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), m, members);
2354 (yyval.members) = (yyvsp[(1) - (3)].members);
2359 #line 768 "asn1parse.y"
2361 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2362 (yyval.member)->name = (yyvsp[(1) - (2)].name);
2363 (yyval.member)->gen_name = estrdup((yyvsp[(1) - (2)].name));
2364 output_name ((yyval.member)->gen_name);
2365 (yyval.member)->type = (yyvsp[(2) - (2)].type);
2366 (yyval.member)->ellipsis = 0;
2371 #line 779 "asn1parse.y"
2373 (yyval.member) = (yyvsp[(1) - (1)].member);
2374 (yyval.member)->optional = 0;
2375 (yyval.member)->defval = NULL;
2380 #line 785 "asn1parse.y"
2382 (yyval.member) = (yyvsp[(1) - (2)].member);
2383 (yyval.member)->optional = 1;
2384 (yyval.member)->defval = NULL;
2389 #line 791 "asn1parse.y"
2391 (yyval.member) = (yyvsp[(1) - (3)].member);
2392 (yyval.member)->optional = 0;
2393 (yyval.member)->defval = (yyvsp[(3) - (3)].value);
2398 #line 799 "asn1parse.y"
2400 (yyval.members) = emalloc(sizeof(*(yyval.members)));
2401 ASN1_TAILQ_INIT((yyval.members));
2402 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);
2407 #line 805 "asn1parse.y"
2409 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
2410 (yyval.members) = (yyvsp[(1) - (3)].members);
2415 #line 812 "asn1parse.y"
2417 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2418 (yyval.member)->name = (yyvsp[(1) - (4)].name);
2419 (yyval.member)->gen_name = estrdup((yyvsp[(1) - (4)].name));
2420 output_name ((yyval.member)->gen_name);
2421 (yyval.member)->val = (yyvsp[(3) - (4)].constant);
2422 (yyval.member)->optional = 0;
2423 (yyval.member)->ellipsis = 0;
2424 (yyval.member)->type = NULL;
2429 #line 825 "asn1parse.y"
2430 { (yyval.objid) = NULL; }
2434 #line 829 "asn1parse.y"
2436 (yyval.objid) = (yyvsp[(2) - (3)].objid);
2441 #line 835 "asn1parse.y"
2443 (yyval.objid) = NULL;
2448 #line 839 "asn1parse.y"
2450 if ((yyvsp[(2) - (2)].objid)) {
2451 (yyval.objid) = (yyvsp[(2) - (2)].objid);
2452 add_oid_to_tail((yyvsp[(2) - (2)].objid), (yyvsp[(1) - (2)].objid));
2454 (yyval.objid) = (yyvsp[(1) - (2)].objid);
2460 #line 850 "asn1parse.y"
2462 (yyval.objid) = new_objid((yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].constant));
2467 #line 854 "asn1parse.y"
2469 Symbol *s = addsym((yyvsp[(1) - (1)].name));
2470 if(s->stype != SValue ||
2471 s->value->type != objectidentifiervalue) {
2472 lex_error_message("%s is not an object identifier\n",
2476 (yyval.objid) = s->value->u.objectidentifiervalue;
2481 #line 865 "asn1parse.y"
2483 (yyval.objid) = new_objid(NULL, (yyvsp[(1) - (1)].constant));
2488 #line 888 "asn1parse.y"
2490 Symbol *s = addsym((yyvsp[(1) - (1)].name));
2491 if(s->stype != SValue)
2492 lex_error_message ("%s is not a value\n",
2495 (yyval.value) = s->value;
2500 #line 899 "asn1parse.y"
2502 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2503 (yyval.value)->type = stringvalue;
2504 (yyval.value)->u.stringvalue = (yyvsp[(1) - (1)].name);
2509 #line 907 "asn1parse.y"
2511 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2512 (yyval.value)->type = booleanvalue;
2513 (yyval.value)->u.booleanvalue = 0;
2518 #line 913 "asn1parse.y"
2520 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2521 (yyval.value)->type = booleanvalue;
2522 (yyval.value)->u.booleanvalue = 0;
2527 #line 921 "asn1parse.y"
2529 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2530 (yyval.value)->type = integervalue;
2531 (yyval.value)->u.integervalue = (yyvsp[(1) - (1)].constant);
2536 #line 932 "asn1parse.y"
2542 #line 937 "asn1parse.y"
2544 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2545 (yyval.value)->type = objectidentifiervalue;
2546 (yyval.value)->u.objectidentifiervalue = (yyvsp[(1) - (1)].objid);
2551 /* Line 1267 of yacc.c. */
2552 #line 2553 "asn1parse.c"
2555 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2559 YY_STACK_PRINT (yyss, yyssp);
2564 /* Now `shift' the result of the reduction. Determine what state
2565 that goes to, based on the state we popped back to and the rule
2566 number reduced by. */
2570 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2571 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2572 yystate = yytable[yystate];
2574 yystate = yydefgoto[yyn - YYNTOKENS];
2579 /*------------------------------------.
2580 | yyerrlab -- here on detecting error |
2581 `------------------------------------*/
2583 /* If not already recovering from an error, report this error. */
2587 #if ! YYERROR_VERBOSE
2588 yyerror (YY_("syntax error"));
2591 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2592 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2594 YYSIZE_T yyalloc = 2 * yysize;
2595 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2596 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2597 if (yymsg != yymsgbuf)
2598 YYSTACK_FREE (yymsg);
2599 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2601 yymsg_alloc = yyalloc;
2605 yymsg_alloc = sizeof yymsgbuf;
2609 if (0 < yysize && yysize <= yymsg_alloc)
2611 (void) yysyntax_error (yymsg, yystate, yychar);
2616 yyerror (YY_("syntax error"));
2618 goto yyexhaustedlab;
2626 if (yyerrstatus == 3)
2628 /* If just tried and failed to reuse look-ahead token after an
2629 error, discard it. */
2631 if (yychar <= YYEOF)
2633 /* Return failure if at end of input. */
2634 if (yychar == YYEOF)
2639 yydestruct ("Error: discarding",
2645 /* Else will try to reuse look-ahead token after shifting the error
2650 /*---------------------------------------------------.
2651 | yyerrorlab -- error raised explicitly by YYERROR. |
2652 `---------------------------------------------------*/
2655 /* Pacify compilers like GCC when the user code never invokes
2656 YYERROR and the label yyerrorlab therefore never appears in user
2658 if (/*CONSTCOND*/ 0)
2661 /* Do not reclaim the symbols of the rule which action triggered
2665 YY_STACK_PRINT (yyss, yyssp);
2670 /*-------------------------------------------------------------.
2671 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2672 `-------------------------------------------------------------*/
2674 yyerrstatus = 3; /* Each real token shifted decrements this. */
2678 yyn = yypact[yystate];
2679 if (yyn != YYPACT_NINF)
2682 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2690 /* Pop the current state because it cannot handle the error token. */
2695 yydestruct ("Error: popping",
2696 yystos[yystate], yyvsp);
2699 YY_STACK_PRINT (yyss, yyssp);
2708 /* Shift the error token. */
2709 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2715 /*-------------------------------------.
2716 | yyacceptlab -- YYACCEPT comes here. |
2717 `-------------------------------------*/
2722 /*-----------------------------------.
2723 | yyabortlab -- YYABORT comes here. |
2724 `-----------------------------------*/
2730 /*-------------------------------------------------.
2731 | yyexhaustedlab -- memory exhaustion comes here. |
2732 `-------------------------------------------------*/
2734 yyerror (YY_("memory exhausted"));
2740 if (yychar != YYEOF && yychar != YYEMPTY)
2741 yydestruct ("Cleanup: discarding lookahead",
2743 /* Do not reclaim the symbols of the rule which action triggered
2744 this YYABORT or YYACCEPT. */
2746 YY_STACK_PRINT (yyss, yyssp);
2747 while (yyssp != yyss)
2749 yydestruct ("Cleanup: popping",
2750 yystos[*yyssp], yyvsp);
2755 YYSTACK_FREE (yyss);
2758 if (yymsg != yymsgbuf)
2759 YYSTACK_FREE (yymsg);
2761 /* Make sure YYID is used. */
2762 return YYID (yyresult);
2766 #line 944 "asn1parse.y"
2770 yyerror (const char *s)
2772 lex_error_message ("%s\n", s);
2776 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
2779 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
2781 oldtype = oldtype->subtype; /* XXX */
2783 t = new_type (TTag);
2785 t->tag.tagclass = tagclass;
2786 t->tag.tagvalue = tagvalue;
2787 t->tag.tagenv = tagenv;
2788 t->subtype = oldtype;
2792 static struct objid *
2793 new_objid(const char *label, int value)
2796 s = emalloc(sizeof(*s));
2804 add_oid_to_tail(struct objid *head, struct objid *tail)
2814 new_type (Typetype tt)
2816 Type *t = ecalloc(1, sizeof(*t));
2821 static struct constraint_spec *
2822 new_constraint_spec(enum ctype ct)
2824 struct constraint_spec *c = ecalloc(1, sizeof(*c));
2829 static void fix_labels2(Type *t, const char *prefix);
2830 static void fix_labels1(struct memhead *members, const char *prefix)
2836 ASN1_TAILQ_FOREACH(m, members, members) {
2837 if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
2839 if (m->label == NULL)
2842 fix_labels2(m->type, m->label);
2846 static void fix_labels2(Type *t, const char *prefix)
2848 for(; t; t = t->subtype)
2849 fix_labels1(t->members, prefix);
2853 fix_labels(Symbol *s)
2856 if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
2858 fix_labels2(s->type, p);