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.27 2005/12/14 09:44:36 lha Exp $");
252 static Type *new_type (Typetype t);
253 static struct constraint_spec *new_constraint_spec(enum ctype);
254 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
255 void yyerror (const char *);
256 static struct objid *new_objid(const char *label, int value);
257 static void add_oid_to_tail(struct objid *, struct objid *);
258 static void fix_labels(Symbol *s);
262 struct string_list *next;
267 /* Enabling traces. */
272 /* Enabling verbose error messages. */
273 #ifdef YYERROR_VERBOSE
274 # undef YYERROR_VERBOSE
275 # define YYERROR_VERBOSE 1
277 # define YYERROR_VERBOSE 0
280 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
282 typedef union YYSTYPE {
291 struct string_list *sl;
293 struct memhead *members;
294 struct constraint_spec *constraint_spec;
296 /* Line 190 of yacc.c. */
298 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
299 # define YYSTYPE_IS_DECLARED 1
300 # define YYSTYPE_IS_TRIVIAL 1
305 /* Copy the second part of user declarations. */
308 /* Line 213 of yacc.c. */
311 #if ! defined (yyoverflow) || YYERROR_VERBOSE
317 # define YYMALLOC malloc
320 /* The parser invokes alloca or malloc; define the necessary symbols. */
322 # ifdef YYSTACK_USE_ALLOCA
323 # if YYSTACK_USE_ALLOCA
325 # define YYSTACK_ALLOC __builtin_alloca
327 # define YYSTACK_ALLOC alloca
332 # ifdef YYSTACK_ALLOC
333 /* Pacify GCC's `empty if-body' warning. */
334 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
336 # if defined (__STDC__) || defined (__cplusplus)
337 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
338 # define YYSIZE_T size_t
340 # define YYSTACK_ALLOC YYMALLOC
341 # define YYSTACK_FREE YYFREE
343 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
346 #if (! defined (yyoverflow) \
347 && (! defined (__cplusplus) \
348 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
350 /* A type that is properly aligned for any stack member. */
357 /* The size of the maximum gap between one aligned stack and the next. */
358 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
360 /* The size of an array large to enough to hold all stacks, each with
362 # define YYSTACK_BYTES(N) \
363 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
364 + YYSTACK_GAP_MAXIMUM)
366 /* Copy COUNT objects from FROM to TO. The source and destination do
369 # if defined (__GNUC__) && 1 < __GNUC__
370 # define YYCOPY(To, From, Count) \
371 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
373 # define YYCOPY(To, From, Count) \
376 register YYSIZE_T yyi; \
377 for (yyi = 0; yyi < (Count); yyi++) \
378 (To)[yyi] = (From)[yyi]; \
384 /* Relocate STACK from its old location to the new one. The
385 local variables YYSIZE and YYSTACKSIZE give the old and new number of
386 elements in the stack, and YYPTR gives the new location of the
387 stack. Advance YYPTR to a properly aligned location for the next
389 # define YYSTACK_RELOCATE(Stack) \
392 YYSIZE_T yynewbytes; \
393 YYCOPY (&yyptr->Stack, Stack, yysize); \
394 Stack = &yyptr->Stack; \
395 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
396 yyptr += yynewbytes / sizeof (*yyptr); \
402 #if defined (__STDC__) || defined (__cplusplus)
403 typedef signed char yysigned_char;
405 typedef short int yysigned_char;
408 /* YYFINAL -- State number of the termination state. */
410 /* YYLAST -- Last index in YYTABLE. */
413 /* YYNTOKENS -- Number of terminals. */
415 /* YYNNTS -- Number of nonterminals. */
417 /* YYNRULES -- Number of rules. */
419 /* YYNRULES -- Number of states. */
420 #define YYNSTATES 201
422 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
424 #define YYMAXUTOK 344
426 #define YYTRANSLATE(YYX) \
427 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
429 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
430 static const unsigned char yytranslate[] =
432 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 92, 93, 2, 2, 91, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 90,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 96, 2, 97, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 94, 2, 95, 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, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
458 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
459 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
460 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
461 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
462 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
463 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
464 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
465 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
470 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
472 static const unsigned short int yyprhs[] =
474 0, 0, 3, 12, 15, 18, 21, 22, 25, 26,
475 29, 30, 34, 35, 37, 38, 40, 43, 48, 50,
476 53, 55, 57, 61, 63, 67, 69, 71, 73, 75,
477 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
478 97, 99, 101, 103, 109, 111, 114, 119, 121, 125,
479 129, 134, 139, 141, 144, 150, 153, 156, 158, 163,
480 167, 171, 176, 180, 184, 189, 191, 193, 195, 197,
481 199, 202, 206, 208, 210, 212, 215, 219, 225, 230,
482 234, 239, 240, 242, 244, 246, 247, 249, 251, 256,
483 258, 260, 262, 264, 266, 268, 270, 272, 276, 280,
484 283, 285, 288, 292, 294, 298, 303, 305, 306, 310,
485 311, 314, 319, 321, 323, 325, 327, 329, 331, 333,
486 335, 337, 339, 341, 343, 345, 347, 349, 351, 353,
490 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
491 static const short int yyrhs[] =
493 99, 0, -1, 86, 21, 100, 101, 84, 8, 102,
494 24, -1, 27, 70, -1, 38, 70, -1, 7, 70,
495 -1, -1, 29, 39, -1, -1, 103, 107, -1, -1,
496 40, 104, 90, -1, -1, 105, -1, -1, 106, -1,
497 105, 106, -1, 109, 32, 86, 150, -1, 108, -1,
498 108, 107, -1, 110, -1, 142, -1, 86, 91, 109,
499 -1, 86, -1, 86, 84, 111, -1, 112, -1, 129,
500 -1, 132, -1, 120, -1, 113, -1, 143, -1, 128,
501 -1, 118, -1, 115, -1, 123, -1, 121, -1, 122,
502 -1, 124, -1, 125, -1, 126, -1, 127, -1, 138,
503 -1, 11, -1, 92, 154, 83, 154, 93, -1, 43,
504 -1, 43, 114, -1, 43, 94, 116, 95, -1, 117,
505 -1, 116, 91, 117, -1, 116, 91, 85, -1, 86,
506 92, 162, 93, -1, 25, 94, 119, 95, -1, 116,
507 -1, 9, 67, -1, 9, 67, 94, 148, 95, -1,
508 51, 37, -1, 52, 67, -1, 49, -1, 64, 94,
509 145, 95, -1, 64, 94, 95, -1, 64, 53, 111,
510 -1, 65, 94, 145, 95, -1, 65, 94, 95, -1,
511 65, 53, 111, -1, 14, 94, 145, 95, -1, 130,
512 -1, 131, -1, 86, -1, 34, -1, 77, -1, 111,
513 133, -1, 92, 134, 93, -1, 135, -1, 136, -1,
514 137, -1, 19, 111, -1, 23, 12, 154, -1, 19,
515 111, 23, 12, 154, -1, 18, 12, 94, 95, -1,
516 139, 141, 111, -1, 96, 140, 89, 97, -1, -1,
517 76, -1, 6, -1, 60, -1, -1, 27, -1, 38,
518 -1, 86, 111, 84, 154, -1, 144, -1, 33, -1,
519 78, -1, 61, -1, 36, -1, 10, -1, 79, -1,
520 147, -1, 145, 91, 147, -1, 145, 91, 85, -1,
521 86, 111, -1, 146, -1, 146, 54, -1, 146, 20,
522 154, -1, 149, -1, 148, 91, 149, -1, 86, 92,
523 89, 93, -1, 151, -1, -1, 94, 152, 95, -1,
524 -1, 153, 152, -1, 86, 92, 89, 93, -1, 86,
525 -1, 89, -1, 155, -1, 156, -1, 160, -1, 159,
526 -1, 161, -1, 164, -1, 163, -1, 157, -1, 158,
527 -1, 86, -1, 88, -1, 71, -1, 31, -1, 162,
528 -1, 89, -1, 49, -1, 151, -1
531 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
532 static const unsigned short int yyrline[] =
534 0, 231, 231, 238, 239, 241, 243, 246, 248, 251,
535 252, 255, 256, 259, 260, 263, 264, 267, 278, 279,
536 282, 283, 286, 292, 300, 310, 311, 312, 315, 316,
537 317, 318, 319, 320, 321, 322, 323, 324, 325, 326,
538 327, 328, 331, 338, 348, 353, 360, 368, 374, 379,
539 383, 396, 404, 407, 414, 422, 428, 435, 442, 448,
540 456, 464, 470, 478, 486, 493, 494, 497, 508, 513,
541 520, 536, 541, 543, 544, 547, 553, 561, 571, 577,
542 590, 599, 602, 606, 610, 617, 620, 624, 631, 642,
543 645, 650, 655, 660, 665, 670, 678, 684, 689, 700,
544 711, 717, 723, 731, 737, 744, 757, 758, 761, 768,
545 771, 782, 786, 797, 803, 804, 807, 808, 809, 810,
546 811, 814, 817, 820, 831, 839, 845, 853, 861, 864,
551 #if YYDEBUG || YYERROR_VERBOSE
552 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
553 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
554 static const char *const yytname[] =
556 "$end", "error", "$undefined", "kw_ABSENT", "kw_ABSTRACT_SYNTAX",
557 "kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC", "kw_BEGIN", "kw_BIT",
558 "kw_BMPString", "kw_BOOLEAN", "kw_BY", "kw_CHARACTER", "kw_CHOICE",
559 "kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS", "kw_CONSTRAINED",
560 "kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS", "kw_EMBEDDED",
561 "kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT", "kw_EXPLICIT",
562 "kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL", "kw_FALSE", "kw_FROM",
563 "kw_GeneralString", "kw_GeneralizedTime", "kw_GraphicString",
564 "kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT", "kw_IMPLIED",
565 "kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",
566 "kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",
567 "kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",
568 "kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",
569 "kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",
570 "kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",
571 "kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",
572 "kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",
573 "kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",
574 "kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",
575 "RANGE", "EEQUAL", "ELLIPSIS", "IDENTIFIER", "referencename", "STRING",
576 "NUMBER", "';'", "','", "'('", "')'", "'{'", "'}'", "'['", "']'",
577 "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",
578 "ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList",
579 "SymbolsFromModule", "AssignmentList", "Assignment", "referencenames",
580 "TypeAssignment", "Type", "BuiltinType", "BooleanType", "range",
581 "IntegerType", "NamedNumberList", "NamedNumber", "EnumeratedType",
582 "Enumerations", "BitStringType", "ObjectIdentifierType",
583 "OctetStringType", "NullType", "SequenceType", "SequenceOfType",
584 "SetType", "SetOfType", "ChoiceType", "ReferencedType", "DefinedType",
585 "UsefulType", "ConstrainedType", "Constraint", "ConstraintSpec",
586 "GeneralConstraint", "ContentsConstraint", "UserDefinedConstraint",
587 "TaggedType", "Tag", "Class", "tagenv", "ValueAssignment",
588 "CharacterStringType", "RestrictedCharactedStringType",
589 "ComponentTypeList", "NamedType", "ComponentType", "NamedBitList",
590 "NamedBit", "objid_opt", "objid", "objid_list", "objid_element", "Value",
591 "BuiltinValue", "ReferencedValue", "DefinedValue", "Valuereference",
592 "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",
593 "NullValue", "ObjectIdentifierValue", 0
598 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
600 static const unsigned short int yytoknum[] =
602 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
603 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
604 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
605 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
606 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
607 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
608 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
609 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
610 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
611 59, 44, 40, 41, 123, 125, 91, 93
615 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
616 static const unsigned char yyr1[] =
618 0, 98, 99, 100, 100, 100, 100, 101, 101, 102,
619 102, 103, 103, 104, 104, 105, 105, 106, 107, 107,
620 108, 108, 109, 109, 110, 111, 111, 111, 112, 112,
621 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
622 112, 112, 113, 114, 115, 115, 115, 116, 116, 116,
623 117, 118, 119, 120, 120, 121, 122, 123, 124, 124,
624 125, 126, 126, 127, 128, 129, 129, 130, 131, 131,
625 132, 133, 134, 135, 135, 136, 136, 136, 137, 138,
626 139, 140, 140, 140, 140, 141, 141, 141, 142, 143,
627 144, 144, 144, 144, 144, 144, 145, 145, 145, 146,
628 147, 147, 147, 148, 148, 149, 150, 150, 151, 152,
629 152, 153, 153, 153, 154, 154, 155, 155, 155, 155,
630 155, 156, 157, 158, 159, 160, 160, 161, 162, 163,
634 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
635 static const unsigned char yyr2[] =
637 0, 2, 8, 2, 2, 2, 0, 2, 0, 2,
638 0, 3, 0, 1, 0, 1, 2, 4, 1, 2,
639 1, 1, 3, 1, 3, 1, 1, 1, 1, 1,
640 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
641 1, 1, 1, 5, 1, 2, 4, 1, 3, 3,
642 4, 4, 1, 2, 5, 2, 2, 1, 4, 3,
643 3, 4, 3, 3, 4, 1, 1, 1, 1, 1,
644 2, 3, 1, 1, 1, 2, 3, 5, 4, 3,
645 4, 0, 1, 1, 1, 0, 1, 1, 4, 1,
646 1, 1, 1, 1, 1, 1, 1, 3, 3, 2,
647 1, 2, 3, 1, 3, 4, 1, 0, 3, 0,
648 2, 4, 1, 1, 1, 1, 1, 1, 1, 1,
649 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
653 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
654 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
655 means the default is an error. */
656 static const unsigned char yydefact[] =
658 0, 0, 0, 6, 1, 0, 0, 0, 8, 5,
659 3, 4, 0, 0, 7, 0, 10, 14, 0, 0,
660 23, 0, 13, 15, 0, 2, 0, 9, 18, 20,
661 21, 0, 11, 16, 0, 0, 94, 42, 0, 0,
662 90, 68, 93, 44, 57, 0, 0, 92, 0, 0,
663 69, 91, 95, 0, 67, 81, 0, 25, 29, 33,
664 32, 28, 35, 36, 34, 37, 38, 39, 40, 31,
665 26, 65, 66, 27, 41, 85, 30, 89, 19, 22,
666 107, 53, 0, 0, 0, 0, 45, 55, 56, 0,
667 0, 0, 0, 24, 83, 84, 82, 0, 0, 0,
668 70, 86, 87, 0, 109, 17, 106, 0, 0, 0,
669 100, 96, 0, 52, 47, 0, 126, 129, 125, 123,
670 124, 128, 130, 0, 114, 115, 121, 122, 117, 116,
671 118, 127, 120, 119, 0, 60, 59, 0, 63, 62,
672 0, 0, 88, 0, 0, 0, 0, 72, 73, 74,
673 79, 112, 113, 0, 109, 0, 0, 103, 99, 0,
674 64, 0, 101, 0, 0, 51, 0, 46, 58, 61,
675 80, 0, 75, 0, 71, 0, 108, 110, 0, 0,
676 54, 98, 97, 102, 0, 49, 48, 0, 0, 0,
677 76, 0, 0, 104, 50, 43, 78, 0, 111, 105,
681 /* YYDEFGOTO[NTERM-NUM]. */
682 static const short int yydefgoto[] =
684 -1, 2, 8, 13, 18, 19, 21, 22, 23, 27,
685 28, 24, 29, 56, 57, 58, 86, 59, 113, 114,
686 60, 115, 61, 62, 63, 64, 65, 66, 67, 68,
687 69, 70, 71, 72, 73, 100, 146, 147, 148, 149,
688 74, 75, 97, 103, 30, 76, 77, 109, 110, 111,
689 156, 157, 105, 122, 153, 154, 123, 124, 125, 126,
690 127, 128, 129, 130, 131, 132, 133
693 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
695 #define YYPACT_NINF -99
696 static const short int yypact[] =
698 -46, 20, 13, 21, -99, 11, 23, 25, 54, -99,
699 -99, -99, 58, 6, -99, 90, -34, 15, 80, 19,
700 16, 18, 15, -99, 74, -99, -7, -99, 19, -99,
701 -99, 15, -99, -99, 24, 42, -99, -99, 17, 26,
702 -99, -99, -99, -73, -99, 76, 50, -99, -45, -44,
703 -99, -99, -99, 51, -99, 4, -67, -99, -99, -99,
704 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
705 -99, -99, -99, -99, -99, -16, -99, -99, -99, -99,
706 27, 28, 33, 37, 47, 37, -99, -99, -99, 51,
707 -72, 51, -71, 22, -99, -99, -99, 35, 47, 12,
708 -99, -99, -99, 51, 2, -99, -99, 39, 51, -75,
709 -8, -99, 34, 36, -99, 43, -99, -99, -99, -99,
710 -99, -99, -99, 48, -99, -99, -99, -99, -99, -99,
711 -99, -99, -99, -99, -57, 22, -99, -48, 22, -99,
712 -22, 45, -99, 120, 51, 122, 46, -99, -99, -99,
713 22, 52, -99, 53, 2, 57, -9, -99, 22, -53,
714 -99, 47, -99, 56, -19, -99, 47, -99, -99, -99,
715 -99, 49, -18, 47, -99, 61, -99, -99, 62, 39,
716 -99, -99, -99, -99, 59, -99, -99, 60, 63, 128,
717 -99, 64, 66, -99, -99, -99, -99, 47, -99, -99,
721 /* YYPGOTO[NTERM-NUM]. */
722 static const yysigned_char yypgoto[] =
724 -99, -99, -99, -99, -99, -99, -99, -99, 124, 126,
725 -99, 125, -99, -52, -99, -99, -99, -99, 70, -4,
726 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
727 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
728 -99, -99, -99, -99, -99, -99, -99, -37, -99, 3,
729 -99, -15, -99, 81, 9, -99, -98, -99, -99, -99,
730 -99, -99, -99, -99, 5, -99, -99
733 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
734 positive, shift that token. If negative, reduce the rule which
735 number is the opposite. If zero, do what YYDEFACT says.
736 If YYTABLE_NINF, syntax error. */
737 #define YYTABLE_NINF -13
738 static const short int yytable[] =
740 142, 93, 35, 36, 37, 189, 17, 38, 89, 91,
741 94, 101, 161, 4, 108, 108, 159, 98, 39, 84,
742 160, 85, 102, 136, 139, 99, 40, 41, 5, 42,
743 143, 144, 181, 108, 164, 145, 43, 135, 167, 138,
744 1, 3, 44, 159, 45, 46, 162, 168, 6, 90,
745 92, 150, -12, 137, 47, 140, 158, 48, 49, 7,
746 35, 36, 37, 183, 95, 38, 185, 112, 187, 159,
747 50, 51, 52, 169, 99, 190, 39, 53, 116, 54,
748 96, 9, 179, 12, 40, 41, 180, 42, 151, 55,
749 15, 152, 172, 10, 43, 11, 117, 14, 16, 200,
750 44, 20, 45, 46, 25, 26, 34, 31, 32, 81,
751 80, 82, 47, 87, 99, 48, 49, 88, 118, 108,
752 83, 104, 107, 112, 141, 155, 163, 164, 50, 51,
753 52, 166, 171, 119, 173, 120, 121, 54, 165, 174,
754 197, 104, 170, 188, 175, 121, 33, 55, 176, 178,
755 191, 192, 194, 195, 78, 134, 79, 198, 196, 199,
756 186, 106, 182, 177, 193, 0, 0, 0, 184
759 static const short int yycheck[] =
761 98, 53, 9, 10, 11, 23, 40, 14, 53, 53,
762 6, 27, 20, 0, 86, 86, 91, 84, 25, 92,
763 95, 94, 38, 95, 95, 92, 33, 34, 7, 36,
764 18, 19, 85, 86, 91, 23, 43, 89, 95, 91,
765 86, 21, 49, 91, 51, 52, 54, 95, 27, 94,
766 94, 103, 86, 90, 61, 92, 108, 64, 65, 38,
767 9, 10, 11, 161, 60, 14, 85, 86, 166, 91,
768 77, 78, 79, 95, 92, 173, 25, 84, 31, 86,
769 76, 70, 91, 29, 33, 34, 95, 36, 86, 96,
770 84, 89, 144, 70, 43, 70, 49, 39, 8, 197,
771 49, 86, 51, 52, 24, 86, 32, 91, 90, 67,
772 86, 94, 61, 37, 92, 64, 65, 67, 71, 86,
773 94, 94, 94, 86, 89, 86, 92, 91, 77, 78,
774 79, 83, 12, 86, 12, 88, 89, 86, 95, 93,
775 12, 94, 97, 94, 92, 89, 22, 96, 95, 92,
776 89, 89, 93, 93, 28, 85, 31, 93, 95, 93,
777 164, 80, 159, 154, 179, -1, -1, -1, 163
780 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
781 symbol of state STATE-NUM. */
782 static const unsigned char yystos[] =
784 0, 86, 99, 21, 0, 7, 27, 38, 100, 70,
785 70, 70, 29, 101, 39, 84, 8, 40, 102, 103,
786 86, 104, 105, 106, 109, 24, 86, 107, 108, 110,
787 142, 91, 90, 106, 32, 9, 10, 11, 14, 25,
788 33, 34, 36, 43, 49, 51, 52, 61, 64, 65,
789 77, 78, 79, 84, 86, 96, 111, 112, 113, 115,
790 118, 120, 121, 122, 123, 124, 125, 126, 127, 128,
791 129, 130, 131, 132, 138, 139, 143, 144, 107, 109,
792 86, 67, 94, 94, 92, 94, 114, 37, 67, 53,
793 94, 53, 94, 111, 6, 60, 76, 140, 84, 92,
794 133, 27, 38, 141, 94, 150, 151, 94, 86, 145,
795 146, 147, 86, 116, 117, 119, 31, 49, 71, 86,
796 88, 89, 151, 154, 155, 156, 157, 158, 159, 160,
797 161, 162, 163, 164, 116, 111, 95, 145, 111, 95,
798 145, 89, 154, 18, 19, 23, 134, 135, 136, 137,
799 111, 86, 89, 152, 153, 86, 148, 149, 111, 91,
800 95, 20, 54, 92, 91, 95, 83, 95, 95, 95,
801 97, 12, 111, 12, 93, 92, 95, 152, 92, 91,
802 95, 85, 147, 154, 162, 85, 117, 154, 94, 23,
803 154, 89, 89, 149, 93, 93, 95, 12, 93, 93,
807 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
808 # define YYSIZE_T __SIZE_TYPE__
810 #if ! defined (YYSIZE_T) && defined (size_t)
811 # define YYSIZE_T size_t
813 #if ! defined (YYSIZE_T)
814 # if defined (__STDC__) || defined (__cplusplus)
815 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
816 # define YYSIZE_T size_t
819 #if ! defined (YYSIZE_T)
820 # define YYSIZE_T unsigned int
823 #define yyerrok (yyerrstatus = 0)
824 #define yyclearin (yychar = YYEMPTY)
828 #define YYACCEPT goto yyacceptlab
829 #define YYABORT goto yyabortlab
830 #define YYERROR goto yyerrorlab
833 /* Like YYERROR except do call yyerror. This remains here temporarily
834 to ease the transition to the new meaning of YYERROR, for GCC.
835 Once GCC version 2 has supplanted version 1, this can go. */
837 #define YYFAIL goto yyerrlab
839 #define YYRECOVERING() (!!yyerrstatus)
841 #define YYBACKUP(Token, Value) \
843 if (yychar == YYEMPTY && yylen == 1) \
847 yytoken = YYTRANSLATE (yychar); \
853 yyerror ("syntax error: cannot back up");\
860 #define YYERRCODE 256
863 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
864 If N is 0, then set CURRENT to the empty location which ends
865 the previous symbol: RHS[0] (always defined). */
867 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
868 #ifndef YYLLOC_DEFAULT
869 # define YYLLOC_DEFAULT(Current, Rhs, N) \
873 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
874 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
875 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
876 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
880 (Current).first_line = (Current).last_line = \
881 YYRHSLOC (Rhs, 0).last_line; \
882 (Current).first_column = (Current).last_column = \
883 YYRHSLOC (Rhs, 0).last_column; \
889 /* YY_LOCATION_PRINT -- Print the location on the stream.
890 This macro was not mandated originally: define only if we know
891 we won't break user code: when these are the locations we know. */
893 #ifndef YY_LOCATION_PRINT
894 # if YYLTYPE_IS_TRIVIAL
895 # define YY_LOCATION_PRINT(File, Loc) \
896 fprintf (File, "%d.%d-%d.%d", \
897 (Loc).first_line, (Loc).first_column, \
898 (Loc).last_line, (Loc).last_column)
900 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
905 /* YYLEX -- calling `yylex' with the right arguments. */
908 # define YYLEX yylex (YYLEX_PARAM)
910 # define YYLEX yylex ()
913 /* Enable debugging if requested. */
917 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
918 # define YYFPRINTF fprintf
921 # define YYDPRINTF(Args) \
927 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
931 YYFPRINTF (stderr, "%s ", Title); \
932 yysymprint (stderr, \
934 YYFPRINTF (stderr, "\n"); \
938 /*------------------------------------------------------------------.
939 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
941 `------------------------------------------------------------------*/
943 #if defined (__STDC__) || defined (__cplusplus)
945 yy_stack_print (short int *bottom, short int *top)
948 yy_stack_print (bottom, top)
953 YYFPRINTF (stderr, "Stack now");
954 for (/* Nothing. */; bottom <= top; ++bottom)
955 YYFPRINTF (stderr, " %d", *bottom);
956 YYFPRINTF (stderr, "\n");
959 # define YY_STACK_PRINT(Bottom, Top) \
962 yy_stack_print ((Bottom), (Top)); \
966 /*------------------------------------------------.
967 | Report that the YYRULE is going to be reduced. |
968 `------------------------------------------------*/
970 #if defined (__STDC__) || defined (__cplusplus)
972 yy_reduce_print (int yyrule)
975 yy_reduce_print (yyrule)
980 unsigned int yylno = yyrline[yyrule];
981 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
983 /* Print the symbols being reduced, and their result. */
984 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
985 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
986 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
989 # define YY_REDUCE_PRINT(Rule) \
992 yy_reduce_print (Rule); \
995 /* Nonzero means print parse trace. It is left uninitialized so that
996 multiple parsers can coexist. */
999 # define YYDPRINTF(Args)
1000 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1001 # define YY_STACK_PRINT(Bottom, Top)
1002 # define YY_REDUCE_PRINT(Rule)
1003 #endif /* !YYDEBUG */
1006 /* YYINITDEPTH -- initial size of the parser's stacks. */
1008 # define YYINITDEPTH 200
1011 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1012 if the built-in stack extension method is used).
1014 Do not make this value too large; the results are undefined if
1015 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1016 evaluated with infinite-precision integer arithmetic. */
1019 # define YYMAXDEPTH 10000
1027 # if defined (__GLIBC__) && defined (_STRING_H)
1028 # define yystrlen strlen
1030 /* Return the length of YYSTR. */
1032 # if defined (__STDC__) || defined (__cplusplus)
1033 yystrlen (const char *yystr)
1039 register const char *yys = yystr;
1041 while (*yys++ != '\0')
1044 return yys - yystr - 1;
1050 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1051 # define yystpcpy stpcpy
1053 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1056 # if defined (__STDC__) || defined (__cplusplus)
1057 yystpcpy (char *yydest, const char *yysrc)
1059 yystpcpy (yydest, yysrc)
1064 register char *yyd = yydest;
1065 register const char *yys = yysrc;
1067 while ((*yyd++ = *yys++) != '\0')
1075 #endif /* !YYERROR_VERBOSE */
1080 /*--------------------------------.
1081 | Print this symbol on YYOUTPUT. |
1082 `--------------------------------*/
1084 #if defined (__STDC__) || defined (__cplusplus)
1086 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1089 yysymprint (yyoutput, yytype, yyvaluep)
1095 /* Pacify ``unused variable'' warnings. */
1098 if (yytype < YYNTOKENS)
1099 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1101 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1105 if (yytype < YYNTOKENS)
1106 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1113 YYFPRINTF (yyoutput, ")");
1116 #endif /* ! YYDEBUG */
1117 /*-----------------------------------------------.
1118 | Release the memory associated to this symbol. |
1119 `-----------------------------------------------*/
1121 #if defined (__STDC__) || defined (__cplusplus)
1123 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1126 yydestruct (yymsg, yytype, yyvaluep)
1132 /* Pacify ``unused variable'' warnings. */
1137 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1148 /* Prevent warnings from -Wmissing-prototypes. */
1150 #ifdef YYPARSE_PARAM
1151 # if defined (__STDC__) || defined (__cplusplus)
1152 int yyparse (void *YYPARSE_PARAM);
1156 #else /* ! YYPARSE_PARAM */
1157 #if defined (__STDC__) || defined (__cplusplus)
1162 #endif /* ! YYPARSE_PARAM */
1166 /* The look-ahead symbol. */
1169 /* The semantic value of the look-ahead symbol. */
1172 /* Number of syntax errors so far. */
1181 #ifdef YYPARSE_PARAM
1182 # if defined (__STDC__) || defined (__cplusplus)
1183 int yyparse (void *YYPARSE_PARAM)
1185 int yyparse (YYPARSE_PARAM)
1186 void *YYPARSE_PARAM;
1188 #else /* ! YYPARSE_PARAM */
1189 #if defined (__STDC__) || defined (__cplusplus)
1200 register int yystate;
1203 /* Number of tokens to shift before error messages enabled. */
1205 /* Look-ahead token as an internal (translated) token number. */
1208 /* Three stacks and their tools:
1209 `yyss': related to states,
1210 `yyvs': related to semantic values,
1211 `yyls': related to locations.
1213 Refer to the stacks thru separate pointers, to allow yyoverflow
1214 to reallocate them elsewhere. */
1216 /* The state stack. */
1217 short int yyssa[YYINITDEPTH];
1218 short int *yyss = yyssa;
1219 register short int *yyssp;
1221 /* The semantic value stack. */
1222 YYSTYPE yyvsa[YYINITDEPTH];
1223 YYSTYPE *yyvs = yyvsa;
1224 register YYSTYPE *yyvsp;
1228 #define YYPOPSTACK (yyvsp--, yyssp--)
1230 YYSIZE_T yystacksize = YYINITDEPTH;
1232 /* The variables used to return semantic value and location from the
1237 /* When reducing, the number of symbols on the RHS of the reduced
1241 YYDPRINTF ((stderr, "Starting parse\n"));
1246 yychar = YYEMPTY; /* Cause a token to be read. */
1248 /* Initialize stack pointers.
1249 Waste one element of value and location stack
1250 so that they stay on the same level as the state stack.
1251 The wasted elements are never initialized. */
1261 /*------------------------------------------------------------.
1262 | yynewstate -- Push a new state, which is found in yystate. |
1263 `------------------------------------------------------------*/
1265 /* In all cases, when you get here, the value and location stacks
1266 have just been pushed. so pushing a state here evens the stacks.
1273 if (yyss + yystacksize - 1 <= yyssp)
1275 /* Get the current used size of the three stacks, in elements. */
1276 YYSIZE_T yysize = yyssp - yyss + 1;
1280 /* Give user a chance to reallocate the stack. Use copies of
1281 these so that the &'s don't force the real ones into
1283 YYSTYPE *yyvs1 = yyvs;
1284 short int *yyss1 = yyss;
1287 /* Each stack pointer address is followed by the size of the
1288 data in use in that stack, in bytes. This used to be a
1289 conditional around just the two extra args, but that might
1290 be undefined if yyoverflow is a macro. */
1291 yyoverflow ("parser stack overflow",
1292 &yyss1, yysize * sizeof (*yyssp),
1293 &yyvs1, yysize * sizeof (*yyvsp),
1300 #else /* no yyoverflow */
1301 # ifndef YYSTACK_RELOCATE
1304 /* Extend the stack our own way. */
1305 if (YYMAXDEPTH <= yystacksize)
1308 if (YYMAXDEPTH < yystacksize)
1309 yystacksize = YYMAXDEPTH;
1312 short int *yyss1 = yyss;
1313 union yyalloc *yyptr =
1314 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1317 YYSTACK_RELOCATE (yyss);
1318 YYSTACK_RELOCATE (yyvs);
1320 # undef YYSTACK_RELOCATE
1322 YYSTACK_FREE (yyss1);
1325 #endif /* no yyoverflow */
1327 yyssp = yyss + yysize - 1;
1328 yyvsp = yyvs + yysize - 1;
1331 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1332 (unsigned long int) yystacksize));
1334 if (yyss + yystacksize - 1 <= yyssp)
1338 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1347 /* Do appropriate processing given the current state. */
1348 /* Read a look-ahead token if we need one and don't already have one. */
1351 /* First try to decide what to do without reference to look-ahead token. */
1353 yyn = yypact[yystate];
1354 if (yyn == YYPACT_NINF)
1357 /* Not known => get a look-ahead token if don't already have one. */
1359 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1360 if (yychar == YYEMPTY)
1362 YYDPRINTF ((stderr, "Reading a token: "));
1366 if (yychar <= YYEOF)
1368 yychar = yytoken = YYEOF;
1369 YYDPRINTF ((stderr, "Now at end of input.\n"));
1373 yytoken = YYTRANSLATE (yychar);
1374 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1377 /* If the proper action on seeing token YYTOKEN is to reduce or to
1378 detect an error, take that action. */
1380 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1385 if (yyn == 0 || yyn == YYTABLE_NINF)
1394 /* Shift the look-ahead token. */
1395 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1397 /* Discard the token being shifted unless it is eof. */
1398 if (yychar != YYEOF)
1404 /* Count tokens shifted since error; after three, turn off error
1413 /*-----------------------------------------------------------.
1414 | yydefault -- do the default action for the current state. |
1415 `-----------------------------------------------------------*/
1417 yyn = yydefact[yystate];
1423 /*-----------------------------.
1424 | yyreduce -- Do a reduction. |
1425 `-----------------------------*/
1427 /* yyn is the number of a rule to reduce with. */
1430 /* If YYLEN is nonzero, implement the default value of the action:
1433 Otherwise, the following line sets YYVAL to garbage.
1434 This behavior is undocumented and Bison
1435 users should not rely upon it. Assigning to YYVAL
1436 unconditionally makes the parser a bit smaller, and it avoids a
1437 GCC warning that YYVAL may be used uninitialized. */
1438 yyval = yyvsp[1-yylen];
1441 YY_REDUCE_PRINT (yyn);
1453 { error_message("implicit tagging is not supported"); }
1458 { error_message("automatic tagging is not supported"); }
1463 { error_message("no extensibility options supported"); }
1469 struct string_list *sl;
1470 for(sl = (yyvsp[-3].sl); sl != NULL; sl = sl->next) {
1471 Symbol *s = addsym(sl->string);
1474 add_import((yyvsp[-1].name));
1481 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1482 (yyval.sl)->string = (yyvsp[-2].name);
1483 (yyval.sl)->next = (yyvsp[0].sl);
1490 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1491 (yyval.sl)->string = (yyvsp[0].name);
1492 (yyval.sl)->next = NULL;
1499 Symbol *s = addsym ((yyvsp[-2].name));
1501 s->type = (yyvsp[0].type);
1510 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
1511 TE_EXPLICIT, new_type(TBoolean));
1518 if((yyvsp[-3].value)->type != integervalue ||
1519 (yyvsp[-1].value)->type != integervalue)
1520 error_message("Non-integer value used in range");
1521 (yyval.range).min = (yyvsp[-3].value)->u.integervalue;
1522 (yyval.range).max = (yyvsp[-1].value)->u.integervalue;
1529 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
1530 TE_EXPLICIT, new_type(TInteger));
1537 (yyval.type) = new_type(TInteger);
1538 (yyval.type)->range = emalloc(sizeof(*(yyval.type)->range));
1539 *((yyval.type)->range) = (yyvsp[0].range);
1540 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1547 (yyval.type) = new_type(TInteger);
1548 (yyval.type)->members = (yyvsp[-1].members);
1549 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1556 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1557 ASN1_TAILQ_INIT((yyval.members));
1558 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1565 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1566 (yyval.members) = (yyvsp[-2].members);
1572 { (yyval.members) = (yyvsp[-2].members); }
1578 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1579 (yyval.member)->name = (yyvsp[-3].name);
1580 (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
1581 output_name ((yyval.member)->gen_name);
1582 (yyval.member)->val = (yyvsp[-1].constant);
1583 (yyval.member)->optional = 0;
1584 (yyval.member)->ellipsis = 0;
1585 (yyval.member)->type = NULL;
1592 (yyval.type) = new_type(TInteger);
1593 (yyval.type)->members = (yyvsp[-1].members);
1594 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));
1601 (yyval.type) = new_type(TBitString);
1602 (yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));
1603 ASN1_TAILQ_INIT((yyval.type)->members);
1604 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1611 (yyval.type) = new_type(TBitString);
1612 (yyval.type)->members = (yyvsp[-1].members);
1613 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1620 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
1621 TE_EXPLICIT, new_type(TOID));
1628 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,
1629 TE_EXPLICIT, new_type(TOctetString));
1636 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
1637 TE_EXPLICIT, new_type(TNull));
1644 (yyval.type) = new_type(TSequence);
1645 (yyval.type)->members = (yyvsp[-1].members);
1646 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1653 (yyval.type) = new_type(TSequence);
1654 (yyval.type)->members = NULL;
1655 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1662 (yyval.type) = new_type(TSequenceOf);
1663 (yyval.type)->subtype = (yyvsp[0].type);
1664 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1671 (yyval.type) = new_type(TSet);
1672 (yyval.type)->members = (yyvsp[-1].members);
1673 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1680 (yyval.type) = new_type(TSet);
1681 (yyval.type)->members = NULL;
1682 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1689 (yyval.type) = new_type(TSetOf);
1690 (yyval.type)->subtype = (yyvsp[0].type);
1691 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1698 (yyval.type) = new_type(TChoice);
1699 (yyval.type)->members = (yyvsp[-1].members);
1706 Symbol *s = addsym((yyvsp[0].name));
1707 (yyval.type) = new_type(TType);
1708 if(s->stype != Stype && s->stype != SUndefined)
1709 error_message ("%s is not a type\n", (yyvsp[0].name));
1711 (yyval.type)->symbol = s;
1718 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
1719 TE_EXPLICIT, new_type(TGeneralizedTime));
1726 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
1727 TE_EXPLICIT, new_type(TUTCTime));
1734 /* if (Constraint.type == contentConstrant) {
1735 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
1736 if (Constraint.u.constraint.type) {
1737 assert((Constraint.u.constraint.type.length % 8) == 0);
1740 if (Constraint.u.constraint.encoding) {
1741 type == der-oid|ber-oid
1750 (yyval.constraint_spec) = (yyvsp[-1].constraint_spec);
1757 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
1758 (yyval.constraint_spec)->u.content.type = (yyvsp[0].type);
1759 (yyval.constraint_spec)->u.content.encoding = NULL;
1766 if ((yyvsp[0].value)->type != objectidentifiervalue)
1767 error_message("Non-OID used in ENCODED BY constraint");
1768 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
1769 (yyval.constraint_spec)->u.content.type = NULL;
1770 (yyval.constraint_spec)->u.content.encoding = (yyvsp[0].value);
1777 if ((yyvsp[0].value)->type != objectidentifiervalue)
1778 error_message("Non-OID used in ENCODED BY constraint");
1779 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
1780 (yyval.constraint_spec)->u.content.type = (yyvsp[-3].type);
1781 (yyval.constraint_spec)->u.content.encoding = (yyvsp[0].value);
1788 (yyval.constraint_spec) = new_constraint_spec(CT_USER);
1795 (yyval.type) = new_type(TTag);
1796 (yyval.type)->tag = (yyvsp[-2].tag);
1797 (yyval.type)->tag.tagenv = (yyvsp[-1].constant);
1798 if((yyvsp[0].type)->type == TTag && (yyvsp[-1].constant) == TE_IMPLICIT) {
1799 (yyval.type)->subtype = (yyvsp[0].type)->subtype;
1800 free((yyvsp[0].type));
1802 (yyval.type)->subtype = (yyvsp[0].type);
1809 (yyval.tag).tagclass = (yyvsp[-2].constant);
1810 (yyval.tag).tagvalue = (yyvsp[-1].constant);
1811 (yyval.tag).tagenv = TE_EXPLICIT;
1818 (yyval.constant) = ASN1_C_CONTEXT;
1825 (yyval.constant) = ASN1_C_UNIV;
1832 (yyval.constant) = ASN1_C_APPL;
1839 (yyval.constant) = ASN1_C_PRIVATE;
1846 (yyval.constant) = TE_EXPLICIT;
1853 (yyval.constant) = TE_EXPLICIT;
1860 (yyval.constant) = TE_IMPLICIT;
1868 s = addsym ((yyvsp[-3].name));
1871 s->value = (yyvsp[0].value);
1872 generate_constant (s);
1879 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
1880 TE_EXPLICIT, new_type(TGeneralString));
1887 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
1888 TE_EXPLICIT, new_type(TUTF8String));
1895 (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
1896 TE_EXPLICIT, new_type(TPrintableString));
1903 (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
1904 TE_EXPLICIT, new_type(TIA5String));
1911 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
1912 TE_EXPLICIT, new_type(TBMPString));
1919 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
1920 TE_EXPLICIT, new_type(TUniversalString));
1927 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1928 ASN1_TAILQ_INIT((yyval.members));
1929 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1936 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1937 (yyval.members) = (yyvsp[-2].members);
1944 struct member *m = ecalloc(1, sizeof(*m));
1945 m->name = estrdup("...");
1946 m->gen_name = estrdup("asn1_ellipsis");
1948 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), m, members);
1949 (yyval.members) = (yyvsp[-2].members);
1956 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1957 (yyval.member)->name = (yyvsp[-1].name);
1958 (yyval.member)->gen_name = estrdup((yyvsp[-1].name));
1959 output_name ((yyval.member)->gen_name);
1960 (yyval.member)->type = (yyvsp[0].type);
1961 (yyval.member)->ellipsis = 0;
1968 (yyval.member) = (yyvsp[0].member);
1969 (yyval.member)->optional = 0;
1970 (yyval.member)->defval = NULL;
1977 (yyval.member) = (yyvsp[-1].member);
1978 (yyval.member)->optional = 1;
1979 (yyval.member)->defval = NULL;
1986 (yyval.member) = (yyvsp[-2].member);
1987 (yyval.member)->optional = 0;
1988 (yyval.member)->defval = (yyvsp[0].value);
1995 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1996 ASN1_TAILQ_INIT((yyval.members));
1997 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
2004 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
2005 (yyval.members) = (yyvsp[-2].members);
2012 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2013 (yyval.member)->name = (yyvsp[-3].name);
2014 (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
2015 output_name ((yyval.member)->gen_name);
2016 (yyval.member)->val = (yyvsp[-1].constant);
2017 (yyval.member)->optional = 0;
2018 (yyval.member)->ellipsis = 0;
2019 (yyval.member)->type = NULL;
2025 { (yyval.objid) = NULL; }
2031 (yyval.objid) = (yyvsp[-1].objid);
2038 (yyval.objid) = NULL;
2045 if ((yyvsp[0].objid)) {
2046 (yyval.objid) = (yyvsp[0].objid);
2047 add_oid_to_tail((yyvsp[0].objid), (yyvsp[-1].objid));
2049 (yyval.objid) = (yyvsp[-1].objid);
2057 (yyval.objid) = new_objid((yyvsp[-3].name), (yyvsp[-1].constant));
2064 Symbol *s = addsym((yyvsp[0].name));
2065 if(s->stype != SValue ||
2066 s->value->type != objectidentifiervalue) {
2067 error_message("%s is not an object identifier\n",
2071 (yyval.objid) = s->value->u.objectidentifiervalue;
2078 (yyval.objid) = new_objid(NULL, (yyvsp[0].constant));
2085 Symbol *s = addsym((yyvsp[0].name));
2086 if(s->stype != SValue)
2087 error_message ("%s is not a value\n",
2090 (yyval.value) = s->value;
2097 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2098 (yyval.value)->type = stringvalue;
2099 (yyval.value)->u.stringvalue = (yyvsp[0].name);
2106 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2107 (yyval.value)->type = booleanvalue;
2108 (yyval.value)->u.booleanvalue = 0;
2115 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2116 (yyval.value)->type = booleanvalue;
2117 (yyval.value)->u.booleanvalue = 0;
2124 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2125 (yyval.value)->type = integervalue;
2126 (yyval.value)->u.integervalue = (yyvsp[0].constant);
2139 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2140 (yyval.value)->type = objectidentifiervalue;
2141 (yyval.value)->u.objectidentifiervalue = (yyvsp[0].objid);
2148 /* Line 1037 of yacc.c. */
2149 #line 2150 "parse.c"
2155 YY_STACK_PRINT (yyss, yyssp);
2160 /* Now `shift' the result of the reduction. Determine what state
2161 that goes to, based on the state we popped back to and the rule
2162 number reduced by. */
2166 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2167 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2168 yystate = yytable[yystate];
2170 yystate = yydefgoto[yyn - YYNTOKENS];
2175 /*------------------------------------.
2176 | yyerrlab -- here on detecting error |
2177 `------------------------------------*/
2179 /* If not already recovering from an error, report this error. */
2184 yyn = yypact[yystate];
2186 if (YYPACT_NINF < yyn && yyn < YYLAST)
2188 YYSIZE_T yysize = 0;
2189 int yytype = YYTRANSLATE (yychar);
2190 const char* yyprefix;
2194 /* Start YYX at -YYN if negative to avoid negative indexes in
2196 int yyxbegin = yyn < 0 ? -yyn : 0;
2198 /* Stay within bounds of both yycheck and yytname. */
2199 int yychecklim = YYLAST - yyn;
2200 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2203 yyprefix = ", expecting ";
2204 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2205 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2207 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2215 yysize += (sizeof ("syntax error, unexpected ")
2216 + yystrlen (yytname[yytype]));
2217 yymsg = (char *) YYSTACK_ALLOC (yysize);
2220 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2221 yyp = yystpcpy (yyp, yytname[yytype]);
2225 yyprefix = ", expecting ";
2226 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2227 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2229 yyp = yystpcpy (yyp, yyprefix);
2230 yyp = yystpcpy (yyp, yytname[yyx]);
2235 YYSTACK_FREE (yymsg);
2238 yyerror ("syntax error; also virtual memory exhausted");
2241 #endif /* YYERROR_VERBOSE */
2242 yyerror ("syntax error");
2247 if (yyerrstatus == 3)
2249 /* If just tried and failed to reuse look-ahead token after an
2250 error, discard it. */
2252 if (yychar <= YYEOF)
2254 /* If at end of input, pop the error token,
2255 then the rest of the stack, then return failure. */
2256 if (yychar == YYEOF)
2263 yydestruct ("Error: popping",
2264 yystos[*yyssp], yyvsp);
2269 yydestruct ("Error: discarding", yytoken, &yylval);
2274 /* Else will try to reuse look-ahead token after shifting the error
2279 /*---------------------------------------------------.
2280 | yyerrorlab -- error raised explicitly by YYERROR. |
2281 `---------------------------------------------------*/
2285 /* Pacify GCC when the user code never invokes YYERROR and the label
2286 yyerrorlab therefore never appears in user code. */
2297 /*-------------------------------------------------------------.
2298 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2299 `-------------------------------------------------------------*/
2301 yyerrstatus = 3; /* Each real token shifted decrements this. */
2305 yyn = yypact[yystate];
2306 if (yyn != YYPACT_NINF)
2309 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2317 /* Pop the current state because it cannot handle the error token. */
2322 yydestruct ("Error: popping", yystos[yystate], yyvsp);
2325 YY_STACK_PRINT (yyss, yyssp);
2334 /* Shift the error token. */
2335 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2341 /*-------------------------------------.
2342 | yyacceptlab -- YYACCEPT comes here. |
2343 `-------------------------------------*/
2348 /*-----------------------------------.
2349 | yyabortlab -- YYABORT comes here. |
2350 `-----------------------------------*/
2352 yydestruct ("Error: discarding lookahead",
2359 /*----------------------------------------------.
2360 | yyoverflowlab -- parser overflow comes here. |
2361 `----------------------------------------------*/
2363 yyerror ("parser stack overflow");
2371 YYSTACK_FREE (yyss);
2381 yyerror (const char *s)
2383 error_message ("%s\n", s);
2387 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
2390 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
2392 oldtype = oldtype->subtype; /* XXX */
2394 t = new_type (TTag);
2396 t->tag.tagclass = tagclass;
2397 t->tag.tagvalue = tagvalue;
2398 t->tag.tagenv = tagenv;
2399 t->subtype = oldtype;
2403 static struct objid *
2404 new_objid(const char *label, int value)
2407 s = emalloc(sizeof(*s));
2415 add_oid_to_tail(struct objid *head, struct objid *tail)
2425 new_type (Typetype tt)
2427 Type *t = ecalloc(1, sizeof(*t));
2432 static struct constraint_spec *
2433 new_constraint_spec(enum ctype ct)
2435 struct constraint_spec *c = ecalloc(1, sizeof(*c));
2440 static void fix_labels2(Type *t, const char *prefix);
2441 static void fix_labels1(struct memhead *members, const char *prefix)
2447 ASN1_TAILQ_FOREACH(m, members, members) {
2448 asprintf(&m->label, "%s_%s", prefix, m->gen_name);
2449 if (m->label == NULL)
2452 fix_labels2(m->type, m->label);
2456 static void fix_labels2(Type *t, const char *prefix)
2458 for(; t; t = t->subtype)
2459 fix_labels1(t->members, prefix);
2463 fix_labels(Symbol *s)
2466 asprintf(&p, "choice_%s", s->gen_name);
2469 fix_labels2(s->type, p);