1 /* A Bison parser, made by GNU Bison 2.0. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
57 kw_ABSTRACT_SYNTAX = 259,
82 kw_EXTENSIBILITY = 284,
86 kw_GeneralString = 288,
87 kw_GeneralizedTime = 289,
88 kw_GraphicString = 290,
97 kw_INTERSECTION = 299,
98 kw_ISO646String = 300,
101 kw_MINUS_INFINITY = 303,
103 kw_NumericString = 305,
108 kw_ObjectDescriptor = 310,
111 kw_PLUS_INFINITY = 313,
114 kw_PrintableString = 316,
116 kw_RELATIVE_OID = 318,
125 kw_TYPE_IDENTIFIER = 327,
126 kw_TeletexString = 328,
132 kw_UniversalString = 334,
133 kw_VideotexString = 335,
134 kw_VisibleString = 336,
145 #define kw_ABSENT 258
146 #define kw_ABSTRACT_SYNTAX 259
148 #define kw_APPLICATION 261
149 #define kw_AUTOMATIC 262
152 #define kw_BMPString 265
153 #define kw_BOOLEAN 266
155 #define kw_CHARACTER 268
156 #define kw_CHOICE 269
158 #define kw_COMPONENT 271
159 #define kw_COMPONENTS 272
160 #define kw_CONSTRAINED 273
161 #define kw_CONTAINING 274
162 #define kw_DEFAULT 275
163 #define kw_DEFINITIONS 276
164 #define kw_EMBEDDED 277
165 #define kw_ENCODED 278
167 #define kw_ENUMERATED 280
168 #define kw_EXCEPT 281
169 #define kw_EXPLICIT 282
170 #define kw_EXPORTS 283
171 #define kw_EXTENSIBILITY 284
172 #define kw_EXTERNAL 285
175 #define kw_GeneralString 288
176 #define kw_GeneralizedTime 289
177 #define kw_GraphicString 290
178 #define kw_IA5String 291
179 #define kw_IDENTIFIER 292
180 #define kw_IMPLICIT 293
181 #define kw_IMPLIED 294
182 #define kw_IMPORTS 295
183 #define kw_INCLUDES 296
184 #define kw_INSTANCE 297
185 #define kw_INTEGER 298
186 #define kw_INTERSECTION 299
187 #define kw_ISO646String 300
190 #define kw_MINUS_INFINITY 303
192 #define kw_NumericString 305
193 #define kw_OBJECT 306
196 #define kw_OPTIONAL 309
197 #define kw_ObjectDescriptor 310
198 #define kw_PATTERN 311
200 #define kw_PLUS_INFINITY 313
201 #define kw_PRESENT 314
202 #define kw_PRIVATE 315
203 #define kw_PrintableString 316
205 #define kw_RELATIVE_OID 318
206 #define kw_SEQUENCE 319
209 #define kw_STRING 322
210 #define kw_SYNTAX 323
211 #define kw_T61String 324
214 #define kw_TYPE_IDENTIFIER 327
215 #define kw_TeletexString 328
217 #define kw_UNIQUE 330
218 #define kw_UNIVERSAL 331
219 #define kw_UTCTime 332
220 #define kw_UTF8String 333
221 #define kw_UniversalString 334
222 #define kw_VideotexString 335
223 #define kw_VisibleString 336
228 #define IDENTIFIER 341
229 #define referencename 342
236 /* Copy the first part of user declarations. */
247 #include "gen_locl.h"
250 RCSID("$Id: parse.y,v 1.24 2005/07/12 06:27:35 lha Exp $");
252 static Type *new_type (Typetype t);
253 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
254 void yyerror (char *);
255 static struct objid *new_objid(const char *label, int value);
256 static void add_oid_to_tail(struct objid *, struct objid *);
257 static void fix_labels(Symbol *s);
261 struct string_list *next;
266 /* Enabling traces. */
271 /* Enabling verbose error messages. */
272 #ifdef YYERROR_VERBOSE
273 # undef YYERROR_VERBOSE
274 # define YYERROR_VERBOSE 1
276 # define YYERROR_VERBOSE 0
279 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
281 typedef union YYSTYPE {
290 struct string_list *sl;
292 struct memhead *members;
294 /* Line 190 of yacc.c. */
296 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
297 # define YYSTYPE_IS_DECLARED 1
298 # define YYSTYPE_IS_TRIVIAL 1
303 /* Copy the second part of user declarations. */
306 /* Line 213 of yacc.c. */
309 #if ! defined (yyoverflow) || YYERROR_VERBOSE
315 # define YYMALLOC malloc
318 /* The parser invokes alloca or malloc; define the necessary symbols. */
320 # ifdef YYSTACK_USE_ALLOCA
321 # if YYSTACK_USE_ALLOCA
323 # define YYSTACK_ALLOC __builtin_alloca
325 # define YYSTACK_ALLOC alloca
330 # ifdef YYSTACK_ALLOC
331 /* Pacify GCC's `empty if-body' warning. */
332 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
334 # if defined (__STDC__) || defined (__cplusplus)
335 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
336 # define YYSIZE_T size_t
338 # define YYSTACK_ALLOC YYMALLOC
339 # define YYSTACK_FREE YYFREE
341 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
344 #if (! defined (yyoverflow) \
345 && (! defined (__cplusplus) \
346 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
348 /* A type that is properly aligned for any stack member. */
355 /* The size of the maximum gap between one aligned stack and the next. */
356 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
358 /* The size of an array large to enough to hold all stacks, each with
360 # define YYSTACK_BYTES(N) \
361 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
362 + YYSTACK_GAP_MAXIMUM)
364 /* Copy COUNT objects from FROM to TO. The source and destination do
367 # if defined (__GNUC__) && 1 < __GNUC__
368 # define YYCOPY(To, From, Count) \
369 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
371 # define YYCOPY(To, From, Count) \
374 register YYSIZE_T yyi; \
375 for (yyi = 0; yyi < (Count); yyi++) \
376 (To)[yyi] = (From)[yyi]; \
382 /* Relocate STACK from its old location to the new one. The
383 local variables YYSIZE and YYSTACKSIZE give the old and new number of
384 elements in the stack, and YYPTR gives the new location of the
385 stack. Advance YYPTR to a properly aligned location for the next
387 # define YYSTACK_RELOCATE(Stack) \
390 YYSIZE_T yynewbytes; \
391 YYCOPY (&yyptr->Stack, Stack, yysize); \
392 Stack = &yyptr->Stack; \
393 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
394 yyptr += yynewbytes / sizeof (*yyptr); \
400 #if defined (__STDC__) || defined (__cplusplus)
401 typedef signed char yysigned_char;
403 typedef short int yysigned_char;
406 /* YYFINAL -- State number of the termination state. */
408 /* YYLAST -- Last index in YYTABLE. */
411 /* YYNTOKENS -- Number of terminals. */
413 /* YYNNTS -- Number of nonterminals. */
415 /* YYNRULES -- Number of rules. */
417 /* YYNRULES -- Number of states. */
418 #define YYNSTATES 181
420 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
422 #define YYMAXUTOK 344
424 #define YYTRANSLATE(YYX) \
425 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
427 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
428 static const unsigned char yytranslate[] =
430 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 92, 93, 2, 2, 91, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 90,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 96, 2, 97, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 94, 2, 95, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
456 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
457 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
458 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
459 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
460 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
461 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
462 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
463 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
468 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
470 static const unsigned short int yyprhs[] =
472 0, 0, 3, 12, 15, 18, 21, 22, 25, 26,
473 29, 30, 34, 35, 37, 38, 40, 43, 48, 50,
474 53, 55, 57, 61, 63, 67, 69, 71, 73, 75,
475 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
476 97, 99, 101, 107, 109, 112, 117, 119, 123, 127,
477 132, 137, 139, 142, 148, 151, 154, 156, 161, 165,
478 169, 174, 178, 182, 187, 189, 191, 193, 195, 197,
479 201, 206, 207, 209, 211, 213, 214, 216, 218, 223,
480 225, 227, 229, 231, 233, 235, 237, 239, 243, 247,
481 250, 252, 255, 259, 261, 265, 270, 272, 273, 277,
482 278, 281, 286, 288, 290, 292, 294, 296, 298, 300,
483 302, 304, 306, 308, 310, 312, 314, 316, 318, 320,
487 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
488 static const short int yyrhs[] =
490 99, 0, -1, 86, 21, 100, 101, 84, 8, 102,
491 24, -1, 27, 70, -1, 38, 70, -1, 7, 70,
492 -1, -1, 29, 39, -1, -1, 103, 107, -1, -1,
493 40, 104, 90, -1, -1, 105, -1, -1, 106, -1,
494 105, 106, -1, 109, 32, 86, 144, -1, 108, -1,
495 108, 107, -1, 110, -1, 136, -1, 86, 91, 109,
496 -1, 86, -1, 86, 84, 111, -1, 112, -1, 129,
497 -1, 120, -1, 113, -1, 137, -1, 128, -1, 118,
498 -1, 115, -1, 123, -1, 121, -1, 122, -1, 124,
499 -1, 125, -1, 126, -1, 127, -1, 132, -1, 11,
500 -1, 92, 148, 83, 148, 93, -1, 43, -1, 43,
501 114, -1, 43, 94, 116, 95, -1, 117, -1, 116,
502 91, 117, -1, 116, 91, 85, -1, 86, 92, 156,
503 93, -1, 25, 94, 119, 95, -1, 116, -1, 9,
504 67, -1, 9, 67, 94, 142, 95, -1, 51, 37,
505 -1, 52, 67, -1, 49, -1, 64, 94, 139, 95,
506 -1, 64, 94, 95, -1, 64, 53, 111, -1, 65,
507 94, 139, 95, -1, 65, 94, 95, -1, 65, 53,
508 111, -1, 14, 94, 139, 95, -1, 130, -1, 131,
509 -1, 86, -1, 34, -1, 77, -1, 133, 135, 111,
510 -1, 96, 134, 89, 97, -1, -1, 76, -1, 6,
511 -1, 60, -1, -1, 27, -1, 38, -1, 86, 111,
512 84, 148, -1, 138, -1, 33, -1, 78, -1, 61,
513 -1, 36, -1, 10, -1, 79, -1, 141, -1, 139,
514 91, 141, -1, 139, 91, 85, -1, 86, 111, -1,
515 140, -1, 140, 54, -1, 140, 20, 148, -1, 143,
516 -1, 142, 91, 143, -1, 86, 92, 89, 93, -1,
517 145, -1, -1, 94, 146, 95, -1, -1, 147, 146,
518 -1, 86, 92, 89, 93, -1, 86, -1, 89, -1,
519 149, -1, 150, -1, 154, -1, 153, -1, 155, -1,
520 158, -1, 157, -1, 151, -1, 152, -1, 86, -1,
521 88, -1, 71, -1, 31, -1, 156, -1, 89, -1,
525 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
526 static const unsigned short int yyrline[] =
528 0, 222, 222, 229, 230, 232, 234, 237, 239, 242,
529 243, 246, 247, 250, 251, 254, 255, 258, 269, 270,
530 273, 274, 277, 283, 291, 301, 302, 305, 306, 307,
531 308, 309, 310, 311, 312, 313, 314, 315, 316, 317,
532 318, 321, 328, 338, 343, 350, 358, 364, 369, 373,
533 386, 394, 397, 404, 412, 418, 425, 432, 438, 446,
534 454, 460, 468, 476, 483, 484, 487, 498, 503, 510,
535 523, 532, 535, 539, 543, 550, 553, 557, 564, 575,
536 578, 583, 588, 593, 598, 603, 611, 617, 622, 633,
537 644, 650, 656, 664, 670, 677, 690, 691, 694, 701,
538 704, 715, 719, 730, 736, 737, 740, 741, 742, 743,
539 744, 747, 750, 753, 764, 772, 778, 786, 794, 797,
544 #if YYDEBUG || YYERROR_VERBOSE
545 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
546 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
547 static const char *const yytname[] =
549 "$end", "error", "$undefined", "kw_ABSENT", "kw_ABSTRACT_SYNTAX",
550 "kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC", "kw_BEGIN", "kw_BIT",
551 "kw_BMPString", "kw_BOOLEAN", "kw_BY", "kw_CHARACTER", "kw_CHOICE",
552 "kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS", "kw_CONSTRAINED",
553 "kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS", "kw_EMBEDDED",
554 "kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT", "kw_EXPLICIT",
555 "kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL", "kw_FALSE", "kw_FROM",
556 "kw_GeneralString", "kw_GeneralizedTime", "kw_GraphicString",
557 "kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT", "kw_IMPLIED",
558 "kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",
559 "kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",
560 "kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",
561 "kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",
562 "kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",
563 "kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",
564 "kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",
565 "kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",
566 "kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",
567 "kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",
568 "RANGE", "EEQUAL", "ELLIPSIS", "IDENTIFIER", "referencename", "STRING",
569 "NUMBER", "';'", "','", "'('", "')'", "'{'", "'}'", "'['", "']'",
570 "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",
571 "ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList",
572 "SymbolsFromModule", "AssignmentList", "Assignment", "referencenames",
573 "TypeAssignment", "Type", "BuiltinType", "BooleanType", "range",
574 "IntegerType", "NamedNumberList", "NamedNumber", "EnumeratedType",
575 "Enumerations", "BitStringType", "ObjectIdentifierType",
576 "OctetStringType", "NullType", "SequenceType", "SequenceOfType",
577 "SetType", "SetOfType", "ChoiceType", "ReferencedType", "DefinedType",
578 "UsefulType", "TaggedType", "Tag", "Class", "tagenv", "ValueAssignment",
579 "CharacterStringType", "RestrictedCharactedStringType",
580 "ComponentTypeList", "NamedType", "ComponentType", "NamedBitList",
581 "NamedBit", "objid_opt", "objid", "objid_list", "objid_element", "Value",
582 "BuiltinValue", "ReferencedValue", "DefinedValue", "Valuereference",
583 "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",
584 "NullValue", "ObjectIdentifierValue", 0
589 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
591 static const unsigned short int yytoknum[] =
593 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
594 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
595 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
596 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
597 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
598 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
599 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
600 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
601 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
602 59, 44, 40, 41, 123, 125, 91, 93
606 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
607 static const unsigned char yyr1[] =
609 0, 98, 99, 100, 100, 100, 100, 101, 101, 102,
610 102, 103, 103, 104, 104, 105, 105, 106, 107, 107,
611 108, 108, 109, 109, 110, 111, 111, 112, 112, 112,
612 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
613 112, 113, 114, 115, 115, 115, 116, 116, 116, 117,
614 118, 119, 120, 120, 121, 122, 123, 124, 124, 125,
615 126, 126, 127, 128, 129, 129, 130, 131, 131, 132,
616 133, 134, 134, 134, 134, 135, 135, 135, 136, 137,
617 138, 138, 138, 138, 138, 138, 139, 139, 139, 140,
618 141, 141, 141, 142, 142, 143, 144, 144, 145, 146,
619 146, 147, 147, 147, 148, 148, 149, 149, 149, 149,
620 149, 150, 151, 152, 153, 154, 154, 155, 156, 157,
624 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
625 static const unsigned char yyr2[] =
627 0, 2, 8, 2, 2, 2, 0, 2, 0, 2,
628 0, 3, 0, 1, 0, 1, 2, 4, 1, 2,
629 1, 1, 3, 1, 3, 1, 1, 1, 1, 1,
630 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
631 1, 1, 5, 1, 2, 4, 1, 3, 3, 4,
632 4, 1, 2, 5, 2, 2, 1, 4, 3, 3,
633 4, 3, 3, 4, 1, 1, 1, 1, 1, 3,
634 4, 0, 1, 1, 1, 0, 1, 1, 4, 1,
635 1, 1, 1, 1, 1, 1, 1, 3, 3, 2,
636 1, 2, 3, 1, 3, 4, 1, 0, 3, 0,
637 2, 4, 1, 1, 1, 1, 1, 1, 1, 1,
638 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
642 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
643 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
644 means the default is an error. */
645 static const unsigned char yydefact[] =
647 0, 0, 0, 6, 1, 0, 0, 0, 8, 5,
648 3, 4, 0, 0, 7, 0, 10, 14, 0, 0,
649 23, 0, 13, 15, 0, 2, 0, 9, 18, 20,
650 21, 0, 11, 16, 0, 0, 84, 41, 0, 0,
651 80, 67, 83, 43, 56, 0, 0, 82, 0, 0,
652 68, 81, 85, 0, 66, 71, 0, 25, 28, 32,
653 31, 27, 34, 35, 33, 36, 37, 38, 39, 30,
654 26, 64, 65, 40, 75, 29, 79, 19, 22, 97,
655 52, 0, 0, 0, 0, 44, 54, 55, 0, 0,
656 0, 0, 24, 73, 74, 72, 0, 0, 76, 77,
657 0, 99, 17, 96, 0, 0, 0, 90, 86, 0,
658 51, 46, 0, 116, 119, 115, 113, 114, 118, 120,
659 0, 104, 105, 111, 112, 107, 106, 108, 117, 110,
660 109, 0, 59, 58, 0, 62, 61, 0, 0, 78,
661 69, 102, 103, 0, 99, 0, 0, 93, 89, 0,
662 63, 0, 91, 0, 0, 50, 0, 45, 57, 60,
663 70, 0, 98, 100, 0, 0, 53, 88, 87, 92,
664 0, 48, 47, 0, 0, 0, 94, 49, 42, 101,
668 /* YYDEFGOTO[NTERM-NUM]. */
669 static const short int yydefgoto[] =
671 -1, 2, 8, 13, 18, 19, 21, 22, 23, 27,
672 28, 24, 29, 56, 57, 58, 85, 59, 110, 111,
673 60, 112, 61, 62, 63, 64, 65, 66, 67, 68,
674 69, 70, 71, 72, 73, 74, 96, 100, 30, 75,
675 76, 106, 107, 108, 146, 147, 102, 119, 143, 144,
676 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
680 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
682 #define YYPACT_NINF -94
683 static const yysigned_char yypact[] =
685 -49, 5, 60, 3, -94, -6, 1, 10, 43, -94,
686 -94, -94, 42, -2, -94, 76, -33, 0, 64, 4,
687 7, 9, 0, -94, 61, -94, -9, -94, 4, -94,
688 -94, 0, -94, -94, 14, 28, -94, -94, 12, 13,
689 -94, -94, -94, -56, -94, 66, 41, -94, -50, -47,
690 -94, -94, -94, 40, -94, 2, 25, -94, -94, -94,
691 -94, -94, -94, -94, -94, -94, -94, -94, -94, -94,
692 -94, -94, -94, -94, -18, -94, -94, -94, -94, 16,
693 17, 26, 27, 8, 27, -94, -94, -94, 40, -73,
694 40, -72, -94, -94, -94, -94, 34, 8, -94, -94,
695 40, -41, -94, -94, 29, 40, -80, -8, -94, 22,
696 30, -94, 21, -94, -94, -94, -94, -94, -94, -94,
697 44, -94, -94, -94, -94, -94, -94, -94, -94, -94,
698 -94, -74, -94, -94, -63, -94, -94, -62, 31, -94,
699 -94, 33, -94, 35, -41, 37, -60, -94, -94, -67,
700 -94, 8, -94, 45, -19, -94, 8, -94, -94, -94,
701 -94, 46, -94, -94, 49, 29, -94, -94, -94, -94,
702 38, -94, -94, 47, 48, 50, -94, -94, -94, -94,
706 /* YYPGOTO[NTERM-NUM]. */
707 static const yysigned_char yypgoto[] =
709 -94, -94, -94, -94, -94, -94, -94, -94, 102, 105,
710 -94, 108, -94, 32, -94, -94, -94, -94, 58, -10,
711 -94, -94, -94, -94, -94, -94, -94, -94, -94, -94,
712 -94, -94, -94, -94, -94, -94, -94, -94, -94, -94,
713 -94, -30, -94, -4, -94, -17, -94, 67, 6, -94,
714 -93, -94, -94, -94, -94, -94, -94, -94, -1, -94,
718 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
719 positive, shift that token. If negative, reduce the rule which
720 number is the opposite. If zero, do what YYDEFACT says.
721 If YYTABLE_NINF, syntax error. */
722 #define YYTABLE_NINF -13
723 static const short int yytable[] =
725 35, 36, 37, 88, 139, 38, 90, 17, 93, 98,
726 5, 149, 151, 105, 105, 150, 39, 154, 167, 105,
727 99, 157, 133, 136, 40, 41, 3, 42, 149, 149,
728 6, 165, 158, 159, 43, 166, 83, 1, 84, 113,
729 44, 7, 45, 46, 89, 141, 152, 91, 142, 35,
730 36, 37, 47, -12, 38, 48, 49, 114, 169, 134,
731 4, 137, 94, 173, 9, 39, 171, 109, 50, 51,
732 52, 10, 12, 40, 41, 53, 42, 54, 95, 115,
733 11, 14, 15, 43, 16, 92, 20, 55, 25, 44,
734 26, 45, 46, 34, 116, 80, 117, 118, 31, 32,
735 79, 47, 101, 86, 48, 49, 81, 82, 87, 97,
736 101, 104, 105, 109, 153, 145, 155, 50, 51, 52,
737 132, 154, 135, 138, 33, 161, 54, 156, 160, 164,
738 162, 177, 140, 77, 118, 174, 55, 148, 175, 78,
739 178, 179, 131, 180, 172, 168, 103, 0, 176, 0,
743 static const short int yycheck[] =
745 9, 10, 11, 53, 97, 14, 53, 40, 6, 27,
746 7, 91, 20, 86, 86, 95, 25, 91, 85, 86,
747 38, 95, 95, 95, 33, 34, 21, 36, 91, 91,
748 27, 91, 95, 95, 43, 95, 92, 86, 94, 31,
749 49, 38, 51, 52, 94, 86, 54, 94, 89, 9,
750 10, 11, 61, 86, 14, 64, 65, 49, 151, 89,
751 0, 91, 60, 156, 70, 25, 85, 86, 77, 78,
752 79, 70, 29, 33, 34, 84, 36, 86, 76, 71,
753 70, 39, 84, 43, 8, 53, 86, 96, 24, 49,
754 86, 51, 52, 32, 86, 67, 88, 89, 91, 90,
755 86, 61, 94, 37, 64, 65, 94, 94, 67, 84,
756 94, 94, 86, 86, 92, 86, 95, 77, 78, 79,
757 88, 91, 90, 89, 22, 92, 86, 83, 97, 92,
758 95, 93, 100, 28, 89, 89, 96, 105, 89, 31,
759 93, 93, 84, 93, 154, 149, 79, -1, 165, -1,
763 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
764 symbol of state STATE-NUM. */
765 static const unsigned char yystos[] =
767 0, 86, 99, 21, 0, 7, 27, 38, 100, 70,
768 70, 70, 29, 101, 39, 84, 8, 40, 102, 103,
769 86, 104, 105, 106, 109, 24, 86, 107, 108, 110,
770 136, 91, 90, 106, 32, 9, 10, 11, 14, 25,
771 33, 34, 36, 43, 49, 51, 52, 61, 64, 65,
772 77, 78, 79, 84, 86, 96, 111, 112, 113, 115,
773 118, 120, 121, 122, 123, 124, 125, 126, 127, 128,
774 129, 130, 131, 132, 133, 137, 138, 107, 109, 86,
775 67, 94, 94, 92, 94, 114, 37, 67, 53, 94,
776 53, 94, 111, 6, 60, 76, 134, 84, 27, 38,
777 135, 94, 144, 145, 94, 86, 139, 140, 141, 86,
778 116, 117, 119, 31, 49, 71, 86, 88, 89, 145,
779 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
780 158, 116, 111, 95, 139, 111, 95, 139, 89, 148,
781 111, 86, 89, 146, 147, 86, 142, 143, 111, 91,
782 95, 20, 54, 92, 91, 95, 83, 95, 95, 95,
783 97, 92, 95, 146, 92, 91, 95, 85, 141, 148,
784 156, 85, 117, 148, 89, 89, 143, 93, 93, 93,
788 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
789 # define YYSIZE_T __SIZE_TYPE__
791 #if ! defined (YYSIZE_T) && defined (size_t)
792 # define YYSIZE_T size_t
794 #if ! defined (YYSIZE_T)
795 # if defined (__STDC__) || defined (__cplusplus)
796 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
797 # define YYSIZE_T size_t
800 #if ! defined (YYSIZE_T)
801 # define YYSIZE_T unsigned int
804 #define yyerrok (yyerrstatus = 0)
805 #define yyclearin (yychar = YYEMPTY)
809 #define YYACCEPT goto yyacceptlab
810 #define YYABORT goto yyabortlab
811 #define YYERROR goto yyerrorlab
814 /* Like YYERROR except do call yyerror. This remains here temporarily
815 to ease the transition to the new meaning of YYERROR, for GCC.
816 Once GCC version 2 has supplanted version 1, this can go. */
818 #define YYFAIL goto yyerrlab
820 #define YYRECOVERING() (!!yyerrstatus)
822 #define YYBACKUP(Token, Value) \
824 if (yychar == YYEMPTY && yylen == 1) \
828 yytoken = YYTRANSLATE (yychar); \
834 yyerror ("syntax error: cannot back up");\
841 #define YYERRCODE 256
844 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
845 If N is 0, then set CURRENT to the empty location which ends
846 the previous symbol: RHS[0] (always defined). */
848 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
849 #ifndef YYLLOC_DEFAULT
850 # define YYLLOC_DEFAULT(Current, Rhs, N) \
854 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
855 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
856 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
857 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
861 (Current).first_line = (Current).last_line = \
862 YYRHSLOC (Rhs, 0).last_line; \
863 (Current).first_column = (Current).last_column = \
864 YYRHSLOC (Rhs, 0).last_column; \
870 /* YY_LOCATION_PRINT -- Print the location on the stream.
871 This macro was not mandated originally: define only if we know
872 we won't break user code: when these are the locations we know. */
874 #ifndef YY_LOCATION_PRINT
875 # if YYLTYPE_IS_TRIVIAL
876 # define YY_LOCATION_PRINT(File, Loc) \
877 fprintf (File, "%d.%d-%d.%d", \
878 (Loc).first_line, (Loc).first_column, \
879 (Loc).last_line, (Loc).last_column)
881 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
886 /* YYLEX -- calling `yylex' with the right arguments. */
889 # define YYLEX yylex (YYLEX_PARAM)
891 # define YYLEX yylex ()
894 /* Enable debugging if requested. */
898 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
899 # define YYFPRINTF fprintf
902 # define YYDPRINTF(Args) \
908 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
912 YYFPRINTF (stderr, "%s ", Title); \
913 yysymprint (stderr, \
915 YYFPRINTF (stderr, "\n"); \
919 /*------------------------------------------------------------------.
920 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
922 `------------------------------------------------------------------*/
924 #if defined (__STDC__) || defined (__cplusplus)
926 yy_stack_print (short int *bottom, short int *top)
929 yy_stack_print (bottom, top)
934 YYFPRINTF (stderr, "Stack now");
935 for (/* Nothing. */; bottom <= top; ++bottom)
936 YYFPRINTF (stderr, " %d", *bottom);
937 YYFPRINTF (stderr, "\n");
940 # define YY_STACK_PRINT(Bottom, Top) \
943 yy_stack_print ((Bottom), (Top)); \
947 /*------------------------------------------------.
948 | Report that the YYRULE is going to be reduced. |
949 `------------------------------------------------*/
951 #if defined (__STDC__) || defined (__cplusplus)
953 yy_reduce_print (int yyrule)
956 yy_reduce_print (yyrule)
961 unsigned int yylno = yyrline[yyrule];
962 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
964 /* Print the symbols being reduced, and their result. */
965 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
966 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
967 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
970 # define YY_REDUCE_PRINT(Rule) \
973 yy_reduce_print (Rule); \
976 /* Nonzero means print parse trace. It is left uninitialized so that
977 multiple parsers can coexist. */
980 # define YYDPRINTF(Args)
981 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
982 # define YY_STACK_PRINT(Bottom, Top)
983 # define YY_REDUCE_PRINT(Rule)
984 #endif /* !YYDEBUG */
987 /* YYINITDEPTH -- initial size of the parser's stacks. */
989 # define YYINITDEPTH 200
992 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
993 if the built-in stack extension method is used).
995 Do not make this value too large; the results are undefined if
996 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
997 evaluated with infinite-precision integer arithmetic. */
1000 # define YYMAXDEPTH 10000
1008 # if defined (__GLIBC__) && defined (_STRING_H)
1009 # define yystrlen strlen
1011 /* Return the length of YYSTR. */
1013 # if defined (__STDC__) || defined (__cplusplus)
1014 yystrlen (const char *yystr)
1020 register const char *yys = yystr;
1022 while (*yys++ != '\0')
1025 return yys - yystr - 1;
1031 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1032 # define yystpcpy stpcpy
1034 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1037 # if defined (__STDC__) || defined (__cplusplus)
1038 yystpcpy (char *yydest, const char *yysrc)
1040 yystpcpy (yydest, yysrc)
1045 register char *yyd = yydest;
1046 register const char *yys = yysrc;
1048 while ((*yyd++ = *yys++) != '\0')
1056 #endif /* !YYERROR_VERBOSE */
1061 /*--------------------------------.
1062 | Print this symbol on YYOUTPUT. |
1063 `--------------------------------*/
1065 #if defined (__STDC__) || defined (__cplusplus)
1067 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1070 yysymprint (yyoutput, yytype, yyvaluep)
1076 /* Pacify ``unused variable'' warnings. */
1079 if (yytype < YYNTOKENS)
1080 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1082 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1086 if (yytype < YYNTOKENS)
1087 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1094 YYFPRINTF (yyoutput, ")");
1097 #endif /* ! YYDEBUG */
1098 /*-----------------------------------------------.
1099 | Release the memory associated to this symbol. |
1100 `-----------------------------------------------*/
1102 #if defined (__STDC__) || defined (__cplusplus)
1104 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1107 yydestruct (yymsg, yytype, yyvaluep)
1113 /* Pacify ``unused variable'' warnings. */
1118 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1129 /* Prevent warnings from -Wmissing-prototypes. */
1131 #ifdef YYPARSE_PARAM
1132 # if defined (__STDC__) || defined (__cplusplus)
1133 int yyparse (void *YYPARSE_PARAM);
1137 #else /* ! YYPARSE_PARAM */
1138 #if defined (__STDC__) || defined (__cplusplus)
1143 #endif /* ! YYPARSE_PARAM */
1147 /* The look-ahead symbol. */
1150 /* The semantic value of the look-ahead symbol. */
1153 /* Number of syntax errors so far. */
1162 #ifdef YYPARSE_PARAM
1163 # if defined (__STDC__) || defined (__cplusplus)
1164 int yyparse (void *YYPARSE_PARAM)
1166 int yyparse (YYPARSE_PARAM)
1167 void *YYPARSE_PARAM;
1169 #else /* ! YYPARSE_PARAM */
1170 #if defined (__STDC__) || defined (__cplusplus)
1181 register int yystate;
1184 /* Number of tokens to shift before error messages enabled. */
1186 /* Look-ahead token as an internal (translated) token number. */
1189 /* Three stacks and their tools:
1190 `yyss': related to states,
1191 `yyvs': related to semantic values,
1192 `yyls': related to locations.
1194 Refer to the stacks thru separate pointers, to allow yyoverflow
1195 to reallocate them elsewhere. */
1197 /* The state stack. */
1198 short int yyssa[YYINITDEPTH];
1199 short int *yyss = yyssa;
1200 register short int *yyssp;
1202 /* The semantic value stack. */
1203 YYSTYPE yyvsa[YYINITDEPTH];
1204 YYSTYPE *yyvs = yyvsa;
1205 register YYSTYPE *yyvsp;
1209 #define YYPOPSTACK (yyvsp--, yyssp--)
1211 YYSIZE_T yystacksize = YYINITDEPTH;
1213 /* The variables used to return semantic value and location from the
1218 /* When reducing, the number of symbols on the RHS of the reduced
1222 YYDPRINTF ((stderr, "Starting parse\n"));
1227 yychar = YYEMPTY; /* Cause a token to be read. */
1229 /* Initialize stack pointers.
1230 Waste one element of value and location stack
1231 so that they stay on the same level as the state stack.
1232 The wasted elements are never initialized. */
1242 /*------------------------------------------------------------.
1243 | yynewstate -- Push a new state, which is found in yystate. |
1244 `------------------------------------------------------------*/
1246 /* In all cases, when you get here, the value and location stacks
1247 have just been pushed. so pushing a state here evens the stacks.
1254 if (yyss + yystacksize - 1 <= yyssp)
1256 /* Get the current used size of the three stacks, in elements. */
1257 YYSIZE_T yysize = yyssp - yyss + 1;
1261 /* Give user a chance to reallocate the stack. Use copies of
1262 these so that the &'s don't force the real ones into
1264 YYSTYPE *yyvs1 = yyvs;
1265 short int *yyss1 = yyss;
1268 /* Each stack pointer address is followed by the size of the
1269 data in use in that stack, in bytes. This used to be a
1270 conditional around just the two extra args, but that might
1271 be undefined if yyoverflow is a macro. */
1272 yyoverflow ("parser stack overflow",
1273 &yyss1, yysize * sizeof (*yyssp),
1274 &yyvs1, yysize * sizeof (*yyvsp),
1281 #else /* no yyoverflow */
1282 # ifndef YYSTACK_RELOCATE
1285 /* Extend the stack our own way. */
1286 if (YYMAXDEPTH <= yystacksize)
1289 if (YYMAXDEPTH < yystacksize)
1290 yystacksize = YYMAXDEPTH;
1293 short int *yyss1 = yyss;
1294 union yyalloc *yyptr =
1295 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1298 YYSTACK_RELOCATE (yyss);
1299 YYSTACK_RELOCATE (yyvs);
1301 # undef YYSTACK_RELOCATE
1303 YYSTACK_FREE (yyss1);
1306 #endif /* no yyoverflow */
1308 yyssp = yyss + yysize - 1;
1309 yyvsp = yyvs + yysize - 1;
1312 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1313 (unsigned long int) yystacksize));
1315 if (yyss + yystacksize - 1 <= yyssp)
1319 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1328 /* Do appropriate processing given the current state. */
1329 /* Read a look-ahead token if we need one and don't already have one. */
1332 /* First try to decide what to do without reference to look-ahead token. */
1334 yyn = yypact[yystate];
1335 if (yyn == YYPACT_NINF)
1338 /* Not known => get a look-ahead token if don't already have one. */
1340 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1341 if (yychar == YYEMPTY)
1343 YYDPRINTF ((stderr, "Reading a token: "));
1347 if (yychar <= YYEOF)
1349 yychar = yytoken = YYEOF;
1350 YYDPRINTF ((stderr, "Now at end of input.\n"));
1354 yytoken = YYTRANSLATE (yychar);
1355 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1358 /* If the proper action on seeing token YYTOKEN is to reduce or to
1359 detect an error, take that action. */
1361 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1366 if (yyn == 0 || yyn == YYTABLE_NINF)
1375 /* Shift the look-ahead token. */
1376 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1378 /* Discard the token being shifted unless it is eof. */
1379 if (yychar != YYEOF)
1385 /* Count tokens shifted since error; after three, turn off error
1394 /*-----------------------------------------------------------.
1395 | yydefault -- do the default action for the current state. |
1396 `-----------------------------------------------------------*/
1398 yyn = yydefact[yystate];
1404 /*-----------------------------.
1405 | yyreduce -- Do a reduction. |
1406 `-----------------------------*/
1408 /* yyn is the number of a rule to reduce with. */
1411 /* If YYLEN is nonzero, implement the default value of the action:
1414 Otherwise, the following line sets YYVAL to garbage.
1415 This behavior is undocumented and Bison
1416 users should not rely upon it. Assigning to YYVAL
1417 unconditionally makes the parser a bit smaller, and it avoids a
1418 GCC warning that YYVAL may be used uninitialized. */
1419 yyval = yyvsp[1-yylen];
1422 YY_REDUCE_PRINT (yyn);
1434 { error_message("implicit tagging is not supported"); }
1439 { error_message("automatic tagging is not supported"); }
1444 { error_message("no extensibility options supported"); }
1450 struct string_list *sl;
1451 for(sl = (yyvsp[-3].sl); sl != NULL; sl = sl->next) {
1452 Symbol *s = addsym(sl->string);
1455 add_import((yyvsp[-1].name));
1462 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1463 (yyval.sl)->string = (yyvsp[-2].name);
1464 (yyval.sl)->next = (yyvsp[0].sl);
1471 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1472 (yyval.sl)->string = (yyvsp[0].name);
1473 (yyval.sl)->next = NULL;
1480 Symbol *s = addsym ((yyvsp[-2].name));
1482 s->type = (yyvsp[0].type);
1491 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
1492 TE_EXPLICIT, new_type(TBoolean));
1499 if((yyvsp[-3].value)->type != integervalue ||
1500 (yyvsp[-1].value)->type != integervalue)
1501 error_message("Non-integer value used in range");
1502 (yyval.range).min = (yyvsp[-3].value)->u.integervalue;
1503 (yyval.range).max = (yyvsp[-1].value)->u.integervalue;
1510 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
1511 TE_EXPLICIT, new_type(TInteger));
1518 (yyval.type) = new_type(TInteger);
1519 (yyval.type)->range = emalloc(sizeof(*(yyval.type)->range));
1520 *((yyval.type)->range) = (yyvsp[0].range);
1521 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1528 (yyval.type) = new_type(TInteger);
1529 (yyval.type)->members = (yyvsp[-1].members);
1530 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1537 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1538 ASN1_TAILQ_INIT((yyval.members));
1539 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1546 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1547 (yyval.members) = (yyvsp[-2].members);
1553 { (yyval.members) = (yyvsp[-2].members); }
1559 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1560 (yyval.member)->name = (yyvsp[-3].name);
1561 (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
1562 output_name ((yyval.member)->gen_name);
1563 (yyval.member)->val = (yyvsp[-1].constant);
1564 (yyval.member)->optional = 0;
1565 (yyval.member)->ellipsis = 0;
1566 (yyval.member)->type = NULL;
1573 (yyval.type) = new_type(TInteger);
1574 (yyval.type)->members = (yyvsp[-1].members);
1575 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));
1582 (yyval.type) = new_type(TBitString);
1583 (yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));
1584 ASN1_TAILQ_INIT((yyval.type)->members);
1585 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1592 (yyval.type) = new_type(TBitString);
1593 (yyval.type)->members = (yyvsp[-1].members);
1594 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1601 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
1602 TE_EXPLICIT, new_type(TOID));
1609 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,
1610 TE_EXPLICIT, new_type(TOctetString));
1617 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
1618 TE_EXPLICIT, new_type(TNull));
1625 (yyval.type) = new_type(TSequence);
1626 (yyval.type)->members = (yyvsp[-1].members);
1627 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1634 (yyval.type) = new_type(TSequence);
1635 (yyval.type)->members = NULL;
1636 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1643 (yyval.type) = new_type(TSequenceOf);
1644 (yyval.type)->subtype = (yyvsp[0].type);
1645 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1652 (yyval.type) = new_type(TSet);
1653 (yyval.type)->members = (yyvsp[-1].members);
1654 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1661 (yyval.type) = new_type(TSet);
1662 (yyval.type)->members = NULL;
1663 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1670 (yyval.type) = new_type(TSetOf);
1671 (yyval.type)->subtype = (yyvsp[0].type);
1672 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1679 (yyval.type) = new_type(TChoice);
1680 (yyval.type)->members = (yyvsp[-1].members);
1687 Symbol *s = addsym((yyvsp[0].name));
1688 (yyval.type) = new_type(TType);
1689 if(s->stype != Stype && s->stype != SUndefined)
1690 error_message ("%s is not a type\n", (yyvsp[0].name));
1692 (yyval.type)->symbol = s;
1699 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
1700 TE_EXPLICIT, new_type(TGeneralizedTime));
1707 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
1708 TE_EXPLICIT, new_type(TUTCTime));
1715 (yyval.type) = new_type(TTag);
1716 (yyval.type)->tag = (yyvsp[-2].tag);
1717 (yyval.type)->tag.tagenv = (yyvsp[-1].constant);
1718 if((yyvsp[0].type)->type == TTag && (yyvsp[-1].constant) == TE_IMPLICIT) {
1719 (yyval.type)->subtype = (yyvsp[0].type)->subtype;
1720 free((yyvsp[0].type));
1722 (yyval.type)->subtype = (yyvsp[0].type);
1729 (yyval.tag).tagclass = (yyvsp[-2].constant);
1730 (yyval.tag).tagvalue = (yyvsp[-1].constant);
1731 (yyval.tag).tagenv = TE_EXPLICIT;
1738 (yyval.constant) = ASN1_C_CONTEXT;
1745 (yyval.constant) = ASN1_C_UNIV;
1752 (yyval.constant) = ASN1_C_APPL;
1759 (yyval.constant) = ASN1_C_PRIVATE;
1766 (yyval.constant) = TE_EXPLICIT;
1773 (yyval.constant) = TE_EXPLICIT;
1780 (yyval.constant) = TE_IMPLICIT;
1788 s = addsym ((yyvsp[-3].name));
1791 s->value = (yyvsp[0].value);
1792 generate_constant (s);
1799 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
1800 TE_EXPLICIT, new_type(TGeneralString));
1807 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
1808 TE_EXPLICIT, new_type(TUTF8String));
1815 (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
1816 TE_EXPLICIT, new_type(TPrintableString));
1823 (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
1824 TE_EXPLICIT, new_type(TIA5String));
1831 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
1832 TE_EXPLICIT, new_type(TBMPString));
1839 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
1840 TE_EXPLICIT, new_type(TUniversalString));
1847 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1848 ASN1_TAILQ_INIT((yyval.members));
1849 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1856 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1857 (yyval.members) = (yyvsp[-2].members);
1864 struct member *m = ecalloc(1, sizeof(*m));
1865 m->name = estrdup("...");
1866 m->gen_name = estrdup("asn1_ellipsis");
1868 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), m, members);
1869 (yyval.members) = (yyvsp[-2].members);
1876 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1877 (yyval.member)->name = (yyvsp[-1].name);
1878 (yyval.member)->gen_name = estrdup((yyvsp[-1].name));
1879 output_name ((yyval.member)->gen_name);
1880 (yyval.member)->type = (yyvsp[0].type);
1881 (yyval.member)->ellipsis = 0;
1888 (yyval.member) = (yyvsp[0].member);
1889 (yyval.member)->optional = 0;
1890 (yyval.member)->defval = NULL;
1897 (yyval.member) = (yyvsp[-1].member);
1898 (yyval.member)->optional = 1;
1899 (yyval.member)->defval = NULL;
1906 (yyval.member) = (yyvsp[-2].member);
1907 (yyval.member)->optional = 0;
1908 (yyval.member)->defval = (yyvsp[0].value);
1915 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1916 ASN1_TAILQ_INIT((yyval.members));
1917 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1924 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1925 (yyval.members) = (yyvsp[-2].members);
1932 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1933 (yyval.member)->name = (yyvsp[-3].name);
1934 (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
1935 output_name ((yyval.member)->gen_name);
1936 (yyval.member)->val = (yyvsp[-1].constant);
1937 (yyval.member)->optional = 0;
1938 (yyval.member)->ellipsis = 0;
1939 (yyval.member)->type = NULL;
1945 { (yyval.objid) = NULL; }
1951 (yyval.objid) = (yyvsp[-1].objid);
1958 (yyval.objid) = NULL;
1965 if ((yyvsp[0].objid)) {
1966 (yyval.objid) = (yyvsp[0].objid);
1967 add_oid_to_tail((yyvsp[0].objid), (yyvsp[-1].objid));
1969 (yyval.objid) = (yyvsp[-1].objid);
1977 (yyval.objid) = new_objid((yyvsp[-3].name), (yyvsp[-1].constant));
1984 Symbol *s = addsym((yyvsp[0].name));
1985 if(s->stype != SValue ||
1986 s->value->type != objectidentifiervalue) {
1987 error_message("%s is not an object identifier\n",
1991 (yyval.objid) = s->value->u.objectidentifiervalue;
1998 (yyval.objid) = new_objid(NULL, (yyvsp[0].constant));
2005 Symbol *s = addsym((yyvsp[0].name));
2006 if(s->stype != SValue)
2007 error_message ("%s is not a value\n",
2010 (yyval.value) = s->value;
2017 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2018 (yyval.value)->type = stringvalue;
2019 (yyval.value)->u.stringvalue = (yyvsp[0].name);
2026 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2027 (yyval.value)->type = booleanvalue;
2028 (yyval.value)->u.booleanvalue = 0;
2035 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2036 (yyval.value)->type = booleanvalue;
2037 (yyval.value)->u.booleanvalue = 0;
2044 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2045 (yyval.value)->type = integervalue;
2046 (yyval.value)->u.integervalue = (yyvsp[0].constant);
2059 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2060 (yyval.value)->type = objectidentifiervalue;
2061 (yyval.value)->u.objectidentifiervalue = (yyvsp[0].objid);
2068 /* Line 1037 of yacc.c. */
2069 #line 2070 "parse.c"
2075 YY_STACK_PRINT (yyss, yyssp);
2080 /* Now `shift' the result of the reduction. Determine what state
2081 that goes to, based on the state we popped back to and the rule
2082 number reduced by. */
2086 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2087 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2088 yystate = yytable[yystate];
2090 yystate = yydefgoto[yyn - YYNTOKENS];
2095 /*------------------------------------.
2096 | yyerrlab -- here on detecting error |
2097 `------------------------------------*/
2099 /* If not already recovering from an error, report this error. */
2104 yyn = yypact[yystate];
2106 if (YYPACT_NINF < yyn && yyn < YYLAST)
2108 YYSIZE_T yysize = 0;
2109 int yytype = YYTRANSLATE (yychar);
2110 const char* yyprefix;
2114 /* Start YYX at -YYN if negative to avoid negative indexes in
2116 int yyxbegin = yyn < 0 ? -yyn : 0;
2118 /* Stay within bounds of both yycheck and yytname. */
2119 int yychecklim = YYLAST - yyn;
2120 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2123 yyprefix = ", expecting ";
2124 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2125 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2127 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2135 yysize += (sizeof ("syntax error, unexpected ")
2136 + yystrlen (yytname[yytype]));
2137 yymsg = (char *) YYSTACK_ALLOC (yysize);
2140 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2141 yyp = yystpcpy (yyp, yytname[yytype]);
2145 yyprefix = ", expecting ";
2146 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2147 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2149 yyp = yystpcpy (yyp, yyprefix);
2150 yyp = yystpcpy (yyp, yytname[yyx]);
2155 YYSTACK_FREE (yymsg);
2158 yyerror ("syntax error; also virtual memory exhausted");
2161 #endif /* YYERROR_VERBOSE */
2162 yyerror ("syntax error");
2167 if (yyerrstatus == 3)
2169 /* If just tried and failed to reuse look-ahead token after an
2170 error, discard it. */
2172 if (yychar <= YYEOF)
2174 /* If at end of input, pop the error token,
2175 then the rest of the stack, then return failure. */
2176 if (yychar == YYEOF)
2183 yydestruct ("Error: popping",
2184 yystos[*yyssp], yyvsp);
2189 yydestruct ("Error: discarding", yytoken, &yylval);
2194 /* Else will try to reuse look-ahead token after shifting the error
2199 /*---------------------------------------------------.
2200 | yyerrorlab -- error raised explicitly by YYERROR. |
2201 `---------------------------------------------------*/
2205 /* Pacify GCC when the user code never invokes YYERROR and the label
2206 yyerrorlab therefore never appears in user code. */
2217 /*-------------------------------------------------------------.
2218 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2219 `-------------------------------------------------------------*/
2221 yyerrstatus = 3; /* Each real token shifted decrements this. */
2225 yyn = yypact[yystate];
2226 if (yyn != YYPACT_NINF)
2229 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2237 /* Pop the current state because it cannot handle the error token. */
2242 yydestruct ("Error: popping", yystos[yystate], yyvsp);
2245 YY_STACK_PRINT (yyss, yyssp);
2254 /* Shift the error token. */
2255 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2261 /*-------------------------------------.
2262 | yyacceptlab -- YYACCEPT comes here. |
2263 `-------------------------------------*/
2268 /*-----------------------------------.
2269 | yyabortlab -- YYABORT comes here. |
2270 `-----------------------------------*/
2272 yydestruct ("Error: discarding lookahead",
2279 /*----------------------------------------------.
2280 | yyoverflowlab -- parser overflow comes here. |
2281 `----------------------------------------------*/
2283 yyerror ("parser stack overflow");
2291 YYSTACK_FREE (yyss);
2303 error_message ("%s\n", s);
2307 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
2310 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
2312 oldtype = oldtype->subtype; /* XXX */
2314 t = new_type (TTag);
2316 t->tag.tagclass = tagclass;
2317 t->tag.tagvalue = tagvalue;
2318 t->tag.tagenv = tagenv;
2319 t->subtype = oldtype;
2323 static struct objid *
2324 new_objid(const char *label, int value)
2327 s = emalloc(sizeof(*s));
2335 add_oid_to_tail(struct objid *head, struct objid *tail)
2345 new_type (Typetype tt)
2347 Type *t = ecalloc(1, sizeof(*t));
2352 static void fix_labels2(Type *t, const char *prefix);
2353 static void fix_labels1(struct memhead *members, const char *prefix)
2359 ASN1_TAILQ_FOREACH(m, members, members) {
2360 asprintf(&m->label, "%s_%s", prefix, m->gen_name);
2361 if (m->label == NULL)
2364 fix_labels2(m->type, m->label);
2368 static void fix_labels2(Type *t, const char *prefix)
2370 for(; t; t = t->subtype)
2371 fix_labels1(t->members, prefix);
2375 fix_labels(Symbol *s)
2378 asprintf(&p, "choice_%s", s->gen_name);
2381 fix_labels2(s->type, p);