1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, 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 YYBISON_VERSION "2.1"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
56 /* Put the tokens into the symbol table, so that GDB and other debuggers
60 kw_ABSTRACT_SYNTAX = 259,
85 kw_EXTENSIBILITY = 284,
89 kw_GeneralString = 288,
90 kw_GeneralizedTime = 289,
91 kw_GraphicString = 290,
100 kw_INTERSECTION = 299,
101 kw_ISO646String = 300,
104 kw_MINUS_INFINITY = 303,
106 kw_NumericString = 305,
111 kw_ObjectDescriptor = 310,
114 kw_PLUS_INFINITY = 313,
117 kw_PrintableString = 316,
119 kw_RELATIVE_OID = 318,
128 kw_TYPE_IDENTIFIER = 327,
129 kw_TeletexString = 328,
135 kw_UniversalString = 334,
136 kw_VideotexString = 335,
137 kw_VisibleString = 336,
149 #define kw_ABSENT 258
150 #define kw_ABSTRACT_SYNTAX 259
152 #define kw_APPLICATION 261
153 #define kw_AUTOMATIC 262
156 #define kw_BMPString 265
157 #define kw_BOOLEAN 266
159 #define kw_CHARACTER 268
160 #define kw_CHOICE 269
162 #define kw_COMPONENT 271
163 #define kw_COMPONENTS 272
164 #define kw_CONSTRAINED 273
165 #define kw_CONTAINING 274
166 #define kw_DEFAULT 275
167 #define kw_DEFINITIONS 276
168 #define kw_EMBEDDED 277
169 #define kw_ENCODED 278
171 #define kw_ENUMERATED 280
172 #define kw_EXCEPT 281
173 #define kw_EXPLICIT 282
174 #define kw_EXPORTS 283
175 #define kw_EXTENSIBILITY 284
176 #define kw_EXTERNAL 285
179 #define kw_GeneralString 288
180 #define kw_GeneralizedTime 289
181 #define kw_GraphicString 290
182 #define kw_IA5String 291
183 #define kw_IDENTIFIER 292
184 #define kw_IMPLICIT 293
185 #define kw_IMPLIED 294
186 #define kw_IMPORTS 295
187 #define kw_INCLUDES 296
188 #define kw_INSTANCE 297
189 #define kw_INTEGER 298
190 #define kw_INTERSECTION 299
191 #define kw_ISO646String 300
194 #define kw_MINUS_INFINITY 303
196 #define kw_NumericString 305
197 #define kw_OBJECT 306
200 #define kw_OPTIONAL 309
201 #define kw_ObjectDescriptor 310
202 #define kw_PATTERN 311
204 #define kw_PLUS_INFINITY 313
205 #define kw_PRESENT 314
206 #define kw_PRIVATE 315
207 #define kw_PrintableString 316
209 #define kw_RELATIVE_OID 318
210 #define kw_SEQUENCE 319
213 #define kw_STRING 322
214 #define kw_SYNTAX 323
215 #define kw_T61String 324
218 #define kw_TYPE_IDENTIFIER 327
219 #define kw_TeletexString 328
221 #define kw_UNIQUE 330
222 #define kw_UNIVERSAL 331
223 #define kw_UTCTime 332
224 #define kw_UTF8String 333
225 #define kw_UniversalString 334
226 #define kw_VideotexString 335
227 #define kw_VisibleString 336
232 #define IDENTIFIER 341
233 #define referencename 342
240 /* Copy the first part of user declarations. */
251 #include "gen_locl.h"
254 RCSID("$Id: parse.y,v 1.27 2005/12/14 09:44:36 lha Exp $");
256 static Type *new_type (Typetype t);
257 static struct constraint_spec *new_constraint_spec(enum ctype);
258 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
259 void yyerror (const char *);
260 static struct objid *new_objid(const char *label, int value);
261 static void add_oid_to_tail(struct objid *, struct objid *);
262 static void fix_labels(Symbol *s);
266 struct string_list *next;
271 /* Enabling traces. */
276 /* Enabling verbose error messages. */
277 #ifdef YYERROR_VERBOSE
278 # undef YYERROR_VERBOSE
279 # define YYERROR_VERBOSE 1
281 # define YYERROR_VERBOSE 0
284 /* Enabling the token table. */
285 #ifndef YYTOKEN_TABLE
286 # define YYTOKEN_TABLE 0
289 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
291 typedef union YYSTYPE {
300 struct string_list *sl;
302 struct memhead *members;
303 struct constraint_spec *constraint_spec;
305 /* Line 196 of yacc.c. */
307 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
308 # define YYSTYPE_IS_DECLARED 1
309 # define YYSTYPE_IS_TRIVIAL 1
314 /* Copy the second part of user declarations. */
317 /* Line 219 of yacc.c. */
320 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
321 # define YYSIZE_T __SIZE_TYPE__
323 #if ! defined (YYSIZE_T) && defined (size_t)
324 # define YYSIZE_T size_t
326 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
327 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
328 # define YYSIZE_T size_t
330 #if ! defined (YYSIZE_T)
331 # define YYSIZE_T unsigned int
337 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
338 # define YY_(msgid) dgettext ("bison-runtime", msgid)
342 # define YY_(msgid) msgid
346 #if ! defined (yyoverflow) || YYERROR_VERBOSE
348 /* The parser invokes alloca or malloc; define the necessary symbols. */
350 # ifdef YYSTACK_USE_ALLOCA
351 # if YYSTACK_USE_ALLOCA
353 # define YYSTACK_ALLOC __builtin_alloca
355 # define YYSTACK_ALLOC alloca
356 # if defined (__STDC__) || defined (__cplusplus)
357 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
358 # define YYINCLUDED_STDLIB_H
364 # ifdef YYSTACK_ALLOC
365 /* Pacify GCC's `empty if-body' warning. */
366 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
367 # ifndef YYSTACK_ALLOC_MAXIMUM
368 /* The OS might guarantee only one guard page at the bottom of the stack,
369 and a page size can be as small as 4096 bytes. So we cannot safely
370 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
371 to allow for a few compiler-allocated temporary stack slots. */
372 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
375 # define YYSTACK_ALLOC YYMALLOC
376 # define YYSTACK_FREE YYFREE
377 # ifndef YYSTACK_ALLOC_MAXIMUM
378 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
384 # define YYMALLOC malloc
385 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
386 && (defined (__STDC__) || defined (__cplusplus)))
387 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
392 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
393 && (defined (__STDC__) || defined (__cplusplus)))
394 void free (void *); /* INFRINGES ON USER NAME SPACE */
401 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
404 #if (! defined (yyoverflow) \
405 && (! defined (__cplusplus) \
406 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
408 /* A type that is properly aligned for any stack member. */
415 /* The size of the maximum gap between one aligned stack and the next. */
416 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
418 /* The size of an array large to enough to hold all stacks, each with
420 # define YYSTACK_BYTES(N) \
421 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
422 + YYSTACK_GAP_MAXIMUM)
424 /* Copy COUNT objects from FROM to TO. The source and destination do
427 # if defined (__GNUC__) && 1 < __GNUC__
428 # define YYCOPY(To, From, Count) \
429 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
431 # define YYCOPY(To, From, Count) \
435 for (yyi = 0; yyi < (Count); yyi++) \
436 (To)[yyi] = (From)[yyi]; \
442 /* Relocate STACK from its old location to the new one. The
443 local variables YYSIZE and YYSTACKSIZE give the old and new number of
444 elements in the stack, and YYPTR gives the new location of the
445 stack. Advance YYPTR to a properly aligned location for the next
447 # define YYSTACK_RELOCATE(Stack) \
450 YYSIZE_T yynewbytes; \
451 YYCOPY (&yyptr->Stack, Stack, yysize); \
452 Stack = &yyptr->Stack; \
453 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
454 yyptr += yynewbytes / sizeof (*yyptr); \
460 #if defined (__STDC__) || defined (__cplusplus)
461 typedef signed char yysigned_char;
463 typedef short int yysigned_char;
466 /* YYFINAL -- State number of the termination state. */
468 /* YYLAST -- Last index in YYTABLE. */
471 /* YYNTOKENS -- Number of terminals. */
473 /* YYNNTS -- Number of nonterminals. */
475 /* YYNRULES -- Number of rules. */
477 /* YYNRULES -- Number of states. */
478 #define YYNSTATES 201
480 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
482 #define YYMAXUTOK 344
484 #define YYTRANSLATE(YYX) \
485 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
487 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
488 static const unsigned char yytranslate[] =
490 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 92, 93, 2, 2, 91, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 90,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 96, 2, 97, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 94, 2, 95, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
516 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
517 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
518 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
519 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
520 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
521 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
522 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
523 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
528 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
530 static const unsigned short int yyprhs[] =
532 0, 0, 3, 12, 15, 18, 21, 22, 25, 26,
533 29, 30, 34, 35, 37, 38, 40, 43, 48, 50,
534 53, 55, 57, 61, 63, 67, 69, 71, 73, 75,
535 77, 79, 81, 83, 85, 87, 89, 91, 93, 95,
536 97, 99, 101, 103, 109, 111, 114, 119, 121, 125,
537 129, 134, 139, 141, 144, 150, 153, 156, 158, 163,
538 167, 171, 176, 180, 184, 189, 191, 193, 195, 197,
539 199, 202, 206, 208, 210, 212, 215, 219, 225, 230,
540 234, 239, 240, 242, 244, 246, 247, 249, 251, 256,
541 258, 260, 262, 264, 266, 268, 270, 272, 276, 280,
542 283, 285, 288, 292, 294, 298, 303, 305, 306, 310,
543 311, 314, 319, 321, 323, 325, 327, 329, 331, 333,
544 335, 337, 339, 341, 343, 345, 347, 349, 351, 353,
548 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
549 static const short int yyrhs[] =
551 99, 0, -1, 86, 21, 100, 101, 84, 8, 102,
552 24, -1, 27, 70, -1, 38, 70, -1, 7, 70,
553 -1, -1, 29, 39, -1, -1, 103, 107, -1, -1,
554 40, 104, 90, -1, -1, 105, -1, -1, 106, -1,
555 105, 106, -1, 109, 32, 86, 150, -1, 108, -1,
556 108, 107, -1, 110, -1, 142, -1, 86, 91, 109,
557 -1, 86, -1, 86, 84, 111, -1, 112, -1, 129,
558 -1, 132, -1, 120, -1, 113, -1, 143, -1, 128,
559 -1, 118, -1, 115, -1, 123, -1, 121, -1, 122,
560 -1, 124, -1, 125, -1, 126, -1, 127, -1, 138,
561 -1, 11, -1, 92, 154, 83, 154, 93, -1, 43,
562 -1, 43, 114, -1, 43, 94, 116, 95, -1, 117,
563 -1, 116, 91, 117, -1, 116, 91, 85, -1, 86,
564 92, 162, 93, -1, 25, 94, 119, 95, -1, 116,
565 -1, 9, 67, -1, 9, 67, 94, 148, 95, -1,
566 51, 37, -1, 52, 67, -1, 49, -1, 64, 94,
567 145, 95, -1, 64, 94, 95, -1, 64, 53, 111,
568 -1, 65, 94, 145, 95, -1, 65, 94, 95, -1,
569 65, 53, 111, -1, 14, 94, 145, 95, -1, 130,
570 -1, 131, -1, 86, -1, 34, -1, 77, -1, 111,
571 133, -1, 92, 134, 93, -1, 135, -1, 136, -1,
572 137, -1, 19, 111, -1, 23, 12, 154, -1, 19,
573 111, 23, 12, 154, -1, 18, 12, 94, 95, -1,
574 139, 141, 111, -1, 96, 140, 89, 97, -1, -1,
575 76, -1, 6, -1, 60, -1, -1, 27, -1, 38,
576 -1, 86, 111, 84, 154, -1, 144, -1, 33, -1,
577 78, -1, 61, -1, 36, -1, 10, -1, 79, -1,
578 147, -1, 145, 91, 147, -1, 145, 91, 85, -1,
579 86, 111, -1, 146, -1, 146, 54, -1, 146, 20,
580 154, -1, 149, -1, 148, 91, 149, -1, 86, 92,
581 89, 93, -1, 151, -1, -1, 94, 152, 95, -1,
582 -1, 153, 152, -1, 86, 92, 89, 93, -1, 86,
583 -1, 89, -1, 155, -1, 156, -1, 160, -1, 159,
584 -1, 161, -1, 164, -1, 163, -1, 157, -1, 158,
585 -1, 86, -1, 88, -1, 71, -1, 31, -1, 162,
586 -1, 89, -1, 49, -1, 151, -1
589 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
590 static const unsigned short int yyrline[] =
592 0, 231, 231, 238, 239, 241, 243, 246, 248, 251,
593 252, 255, 256, 259, 260, 263, 264, 267, 278, 279,
594 282, 283, 286, 292, 300, 310, 311, 312, 315, 316,
595 317, 318, 319, 320, 321, 322, 323, 324, 325, 326,
596 327, 328, 331, 338, 348, 353, 360, 368, 374, 379,
597 383, 396, 404, 407, 414, 422, 428, 435, 442, 448,
598 456, 464, 470, 478, 486, 493, 494, 497, 508, 513,
599 520, 536, 541, 543, 544, 547, 553, 561, 571, 577,
600 590, 599, 602, 606, 610, 617, 620, 624, 631, 642,
601 645, 650, 655, 660, 665, 670, 678, 684, 689, 700,
602 711, 717, 723, 731, 737, 744, 757, 758, 761, 768,
603 771, 782, 786, 797, 803, 804, 807, 808, 809, 810,
604 811, 814, 817, 820, 831, 839, 845, 853, 861, 864,
609 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
610 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
611 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
612 static const char *const yytname[] =
614 "$end", "error", "$undefined", "kw_ABSENT", "kw_ABSTRACT_SYNTAX",
615 "kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC", "kw_BEGIN", "kw_BIT",
616 "kw_BMPString", "kw_BOOLEAN", "kw_BY", "kw_CHARACTER", "kw_CHOICE",
617 "kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS", "kw_CONSTRAINED",
618 "kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS", "kw_EMBEDDED",
619 "kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT", "kw_EXPLICIT",
620 "kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL", "kw_FALSE", "kw_FROM",
621 "kw_GeneralString", "kw_GeneralizedTime", "kw_GraphicString",
622 "kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT", "kw_IMPLIED",
623 "kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",
624 "kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",
625 "kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",
626 "kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",
627 "kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",
628 "kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",
629 "kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",
630 "kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",
631 "kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",
632 "kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",
633 "RANGE", "EEQUAL", "ELLIPSIS", "IDENTIFIER", "referencename", "STRING",
634 "NUMBER", "';'", "','", "'('", "')'", "'{'", "'}'", "'['", "']'",
635 "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",
636 "ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList",
637 "SymbolsFromModule", "AssignmentList", "Assignment", "referencenames",
638 "TypeAssignment", "Type", "BuiltinType", "BooleanType", "range",
639 "IntegerType", "NamedNumberList", "NamedNumber", "EnumeratedType",
640 "Enumerations", "BitStringType", "ObjectIdentifierType",
641 "OctetStringType", "NullType", "SequenceType", "SequenceOfType",
642 "SetType", "SetOfType", "ChoiceType", "ReferencedType", "DefinedType",
643 "UsefulType", "ConstrainedType", "Constraint", "ConstraintSpec",
644 "GeneralConstraint", "ContentsConstraint", "UserDefinedConstraint",
645 "TaggedType", "Tag", "Class", "tagenv", "ValueAssignment",
646 "CharacterStringType", "RestrictedCharactedStringType",
647 "ComponentTypeList", "NamedType", "ComponentType", "NamedBitList",
648 "NamedBit", "objid_opt", "objid", "objid_list", "objid_element", "Value",
649 "BuiltinValue", "ReferencedValue", "DefinedValue", "Valuereference",
650 "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",
651 "NullValue", "ObjectIdentifierValue", 0
656 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
658 static const unsigned short int yytoknum[] =
660 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
661 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
662 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
663 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
664 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
665 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
666 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
667 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
668 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
669 59, 44, 40, 41, 123, 125, 91, 93
673 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
674 static const unsigned char yyr1[] =
676 0, 98, 99, 100, 100, 100, 100, 101, 101, 102,
677 102, 103, 103, 104, 104, 105, 105, 106, 107, 107,
678 108, 108, 109, 109, 110, 111, 111, 111, 112, 112,
679 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
680 112, 112, 113, 114, 115, 115, 115, 116, 116, 116,
681 117, 118, 119, 120, 120, 121, 122, 123, 124, 124,
682 125, 126, 126, 127, 128, 129, 129, 130, 131, 131,
683 132, 133, 134, 135, 135, 136, 136, 136, 137, 138,
684 139, 140, 140, 140, 140, 141, 141, 141, 142, 143,
685 144, 144, 144, 144, 144, 144, 145, 145, 145, 146,
686 147, 147, 147, 148, 148, 149, 150, 150, 151, 152,
687 152, 153, 153, 153, 154, 154, 155, 155, 155, 155,
688 155, 156, 157, 158, 159, 160, 160, 161, 162, 163,
692 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
693 static const unsigned char yyr2[] =
695 0, 2, 8, 2, 2, 2, 0, 2, 0, 2,
696 0, 3, 0, 1, 0, 1, 2, 4, 1, 2,
697 1, 1, 3, 1, 3, 1, 1, 1, 1, 1,
698 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
699 1, 1, 1, 5, 1, 2, 4, 1, 3, 3,
700 4, 4, 1, 2, 5, 2, 2, 1, 4, 3,
701 3, 4, 3, 3, 4, 1, 1, 1, 1, 1,
702 2, 3, 1, 1, 1, 2, 3, 5, 4, 3,
703 4, 0, 1, 1, 1, 0, 1, 1, 4, 1,
704 1, 1, 1, 1, 1, 1, 1, 3, 3, 2,
705 1, 2, 3, 1, 3, 4, 1, 0, 3, 0,
706 2, 4, 1, 1, 1, 1, 1, 1, 1, 1,
707 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
711 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
712 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
713 means the default is an error. */
714 static const unsigned char yydefact[] =
716 0, 0, 0, 6, 1, 0, 0, 0, 8, 5,
717 3, 4, 0, 0, 7, 0, 10, 14, 0, 0,
718 23, 0, 13, 15, 0, 2, 0, 9, 18, 20,
719 21, 0, 11, 16, 0, 0, 94, 42, 0, 0,
720 90, 68, 93, 44, 57, 0, 0, 92, 0, 0,
721 69, 91, 95, 0, 67, 81, 0, 25, 29, 33,
722 32, 28, 35, 36, 34, 37, 38, 39, 40, 31,
723 26, 65, 66, 27, 41, 85, 30, 89, 19, 22,
724 107, 53, 0, 0, 0, 0, 45, 55, 56, 0,
725 0, 0, 0, 24, 83, 84, 82, 0, 0, 0,
726 70, 86, 87, 0, 109, 17, 106, 0, 0, 0,
727 100, 96, 0, 52, 47, 0, 126, 129, 125, 123,
728 124, 128, 130, 0, 114, 115, 121, 122, 117, 116,
729 118, 127, 120, 119, 0, 60, 59, 0, 63, 62,
730 0, 0, 88, 0, 0, 0, 0, 72, 73, 74,
731 79, 112, 113, 0, 109, 0, 0, 103, 99, 0,
732 64, 0, 101, 0, 0, 51, 0, 46, 58, 61,
733 80, 0, 75, 0, 71, 0, 108, 110, 0, 0,
734 54, 98, 97, 102, 0, 49, 48, 0, 0, 0,
735 76, 0, 0, 104, 50, 43, 78, 0, 111, 105,
739 /* YYDEFGOTO[NTERM-NUM]. */
740 static const short int yydefgoto[] =
742 -1, 2, 8, 13, 18, 19, 21, 22, 23, 27,
743 28, 24, 29, 56, 57, 58, 86, 59, 113, 114,
744 60, 115, 61, 62, 63, 64, 65, 66, 67, 68,
745 69, 70, 71, 72, 73, 100, 146, 147, 148, 149,
746 74, 75, 97, 103, 30, 76, 77, 109, 110, 111,
747 156, 157, 105, 122, 153, 154, 123, 124, 125, 126,
748 127, 128, 129, 130, 131, 132, 133
751 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
753 #define YYPACT_NINF -99
754 static const short int yypact[] =
756 -46, 20, 13, 21, -99, 11, 23, 25, 54, -99,
757 -99, -99, 58, 6, -99, 90, -34, 15, 80, 19,
758 16, 18, 15, -99, 74, -99, -7, -99, 19, -99,
759 -99, 15, -99, -99, 24, 42, -99, -99, 17, 26,
760 -99, -99, -99, -73, -99, 76, 50, -99, -45, -44,
761 -99, -99, -99, 51, -99, 4, -67, -99, -99, -99,
762 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
763 -99, -99, -99, -99, -99, -16, -99, -99, -99, -99,
764 27, 28, 33, 37, 47, 37, -99, -99, -99, 51,
765 -72, 51, -71, 22, -99, -99, -99, 35, 47, 12,
766 -99, -99, -99, 51, 2, -99, -99, 39, 51, -75,
767 -8, -99, 34, 36, -99, 43, -99, -99, -99, -99,
768 -99, -99, -99, 48, -99, -99, -99, -99, -99, -99,
769 -99, -99, -99, -99, -57, 22, -99, -48, 22, -99,
770 -22, 45, -99, 120, 51, 122, 46, -99, -99, -99,
771 22, 52, -99, 53, 2, 57, -9, -99, 22, -53,
772 -99, 47, -99, 56, -19, -99, 47, -99, -99, -99,
773 -99, 49, -18, 47, -99, 61, -99, -99, 62, 39,
774 -99, -99, -99, -99, 59, -99, -99, 60, 63, 128,
775 -99, 64, 66, -99, -99, -99, -99, 47, -99, -99,
779 /* YYPGOTO[NTERM-NUM]. */
780 static const yysigned_char yypgoto[] =
782 -99, -99, -99, -99, -99, -99, -99, -99, 124, 126,
783 -99, 125, -99, -52, -99, -99, -99, -99, 70, -4,
784 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
785 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
786 -99, -99, -99, -99, -99, -99, -99, -37, -99, 3,
787 -99, -15, -99, 81, 9, -99, -98, -99, -99, -99,
788 -99, -99, -99, -99, 5, -99, -99
791 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
792 positive, shift that token. If negative, reduce the rule which
793 number is the opposite. If zero, do what YYDEFACT says.
794 If YYTABLE_NINF, syntax error. */
795 #define YYTABLE_NINF -13
796 static const short int yytable[] =
798 142, 93, 35, 36, 37, 189, 17, 38, 89, 91,
799 94, 101, 161, 4, 108, 108, 159, 98, 39, 84,
800 160, 85, 102, 136, 139, 99, 40, 41, 5, 42,
801 143, 144, 181, 108, 164, 145, 43, 135, 167, 138,
802 1, 3, 44, 159, 45, 46, 162, 168, 6, 90,
803 92, 150, -12, 137, 47, 140, 158, 48, 49, 7,
804 35, 36, 37, 183, 95, 38, 185, 112, 187, 159,
805 50, 51, 52, 169, 99, 190, 39, 53, 116, 54,
806 96, 9, 179, 12, 40, 41, 180, 42, 151, 55,
807 15, 152, 172, 10, 43, 11, 117, 14, 16, 200,
808 44, 20, 45, 46, 25, 26, 34, 31, 32, 81,
809 80, 82, 47, 87, 99, 48, 49, 88, 118, 108,
810 83, 104, 107, 112, 141, 155, 163, 164, 50, 51,
811 52, 166, 171, 119, 173, 120, 121, 54, 165, 174,
812 197, 104, 170, 188, 175, 121, 33, 55, 176, 178,
813 191, 192, 194, 195, 78, 134, 79, 198, 196, 199,
814 186, 106, 182, 177, 193, 0, 0, 0, 184
817 static const short int yycheck[] =
819 98, 53, 9, 10, 11, 23, 40, 14, 53, 53,
820 6, 27, 20, 0, 86, 86, 91, 84, 25, 92,
821 95, 94, 38, 95, 95, 92, 33, 34, 7, 36,
822 18, 19, 85, 86, 91, 23, 43, 89, 95, 91,
823 86, 21, 49, 91, 51, 52, 54, 95, 27, 94,
824 94, 103, 86, 90, 61, 92, 108, 64, 65, 38,
825 9, 10, 11, 161, 60, 14, 85, 86, 166, 91,
826 77, 78, 79, 95, 92, 173, 25, 84, 31, 86,
827 76, 70, 91, 29, 33, 34, 95, 36, 86, 96,
828 84, 89, 144, 70, 43, 70, 49, 39, 8, 197,
829 49, 86, 51, 52, 24, 86, 32, 91, 90, 67,
830 86, 94, 61, 37, 92, 64, 65, 67, 71, 86,
831 94, 94, 94, 86, 89, 86, 92, 91, 77, 78,
832 79, 83, 12, 86, 12, 88, 89, 86, 95, 93,
833 12, 94, 97, 94, 92, 89, 22, 96, 95, 92,
834 89, 89, 93, 93, 28, 85, 31, 93, 95, 93,
835 164, 80, 159, 154, 179, -1, -1, -1, 163
838 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
839 symbol of state STATE-NUM. */
840 static const unsigned char yystos[] =
842 0, 86, 99, 21, 0, 7, 27, 38, 100, 70,
843 70, 70, 29, 101, 39, 84, 8, 40, 102, 103,
844 86, 104, 105, 106, 109, 24, 86, 107, 108, 110,
845 142, 91, 90, 106, 32, 9, 10, 11, 14, 25,
846 33, 34, 36, 43, 49, 51, 52, 61, 64, 65,
847 77, 78, 79, 84, 86, 96, 111, 112, 113, 115,
848 118, 120, 121, 122, 123, 124, 125, 126, 127, 128,
849 129, 130, 131, 132, 138, 139, 143, 144, 107, 109,
850 86, 67, 94, 94, 92, 94, 114, 37, 67, 53,
851 94, 53, 94, 111, 6, 60, 76, 140, 84, 92,
852 133, 27, 38, 141, 94, 150, 151, 94, 86, 145,
853 146, 147, 86, 116, 117, 119, 31, 49, 71, 86,
854 88, 89, 151, 154, 155, 156, 157, 158, 159, 160,
855 161, 162, 163, 164, 116, 111, 95, 145, 111, 95,
856 145, 89, 154, 18, 19, 23, 134, 135, 136, 137,
857 111, 86, 89, 152, 153, 86, 148, 149, 111, 91,
858 95, 20, 54, 92, 91, 95, 83, 95, 95, 95,
859 97, 12, 111, 12, 93, 92, 95, 152, 92, 91,
860 95, 85, 147, 154, 162, 85, 117, 154, 94, 23,
861 154, 89, 89, 149, 93, 93, 95, 12, 93, 93,
865 #define yyerrok (yyerrstatus = 0)
866 #define yyclearin (yychar = YYEMPTY)
870 #define YYACCEPT goto yyacceptlab
871 #define YYABORT goto yyabortlab
872 #define YYERROR goto yyerrorlab
875 /* Like YYERROR except do call yyerror. This remains here temporarily
876 to ease the transition to the new meaning of YYERROR, for GCC.
877 Once GCC version 2 has supplanted version 1, this can go. */
879 #define YYFAIL goto yyerrlab
881 #define YYRECOVERING() (!!yyerrstatus)
883 #define YYBACKUP(Token, Value) \
885 if (yychar == YYEMPTY && yylen == 1) \
889 yytoken = YYTRANSLATE (yychar); \
895 yyerror (YY_("syntax error: cannot back up")); \
902 #define YYERRCODE 256
905 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
906 If N is 0, then set CURRENT to the empty location which ends
907 the previous symbol: RHS[0] (always defined). */
909 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
910 #ifndef YYLLOC_DEFAULT
911 # define YYLLOC_DEFAULT(Current, Rhs, N) \
915 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
916 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
917 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
918 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
922 (Current).first_line = (Current).last_line = \
923 YYRHSLOC (Rhs, 0).last_line; \
924 (Current).first_column = (Current).last_column = \
925 YYRHSLOC (Rhs, 0).last_column; \
931 /* YY_LOCATION_PRINT -- Print the location on the stream.
932 This macro was not mandated originally: define only if we know
933 we won't break user code: when these are the locations we know. */
935 #ifndef YY_LOCATION_PRINT
936 # if YYLTYPE_IS_TRIVIAL
937 # define YY_LOCATION_PRINT(File, Loc) \
938 fprintf (File, "%d.%d-%d.%d", \
939 (Loc).first_line, (Loc).first_column, \
940 (Loc).last_line, (Loc).last_column)
942 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
947 /* YYLEX -- calling `yylex' with the right arguments. */
950 # define YYLEX yylex (YYLEX_PARAM)
952 # define YYLEX yylex ()
955 /* Enable debugging if requested. */
959 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
960 # define YYFPRINTF fprintf
963 # define YYDPRINTF(Args) \
969 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
973 YYFPRINTF (stderr, "%s ", Title); \
974 yysymprint (stderr, \
976 YYFPRINTF (stderr, "\n"); \
980 /*------------------------------------------------------------------.
981 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
983 `------------------------------------------------------------------*/
985 #if defined (__STDC__) || defined (__cplusplus)
987 yy_stack_print (short int *bottom, short int *top)
990 yy_stack_print (bottom, top)
995 YYFPRINTF (stderr, "Stack now");
996 for (/* Nothing. */; bottom <= top; ++bottom)
997 YYFPRINTF (stderr, " %d", *bottom);
998 YYFPRINTF (stderr, "\n");
1001 # define YY_STACK_PRINT(Bottom, Top) \
1004 yy_stack_print ((Bottom), (Top)); \
1008 /*------------------------------------------------.
1009 | Report that the YYRULE is going to be reduced. |
1010 `------------------------------------------------*/
1012 #if defined (__STDC__) || defined (__cplusplus)
1014 yy_reduce_print (int yyrule)
1017 yy_reduce_print (yyrule)
1022 unsigned long int yylno = yyrline[yyrule];
1023 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
1025 /* Print the symbols being reduced, and their result. */
1026 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1027 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1028 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
1031 # define YY_REDUCE_PRINT(Rule) \
1034 yy_reduce_print (Rule); \
1037 /* Nonzero means print parse trace. It is left uninitialized so that
1038 multiple parsers can coexist. */
1040 #else /* !YYDEBUG */
1041 # define YYDPRINTF(Args)
1042 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1043 # define YY_STACK_PRINT(Bottom, Top)
1044 # define YY_REDUCE_PRINT(Rule)
1045 #endif /* !YYDEBUG */
1048 /* YYINITDEPTH -- initial size of the parser's stacks. */
1050 # define YYINITDEPTH 200
1053 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1054 if the built-in stack extension method is used).
1056 Do not make this value too large; the results are undefined if
1057 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1058 evaluated with infinite-precision integer arithmetic. */
1061 # define YYMAXDEPTH 10000
1069 # if defined (__GLIBC__) && defined (_STRING_H)
1070 # define yystrlen strlen
1072 /* Return the length of YYSTR. */
1074 # if defined (__STDC__) || defined (__cplusplus)
1075 yystrlen (const char *yystr)
1081 const char *yys = yystr;
1083 while (*yys++ != '\0')
1086 return yys - yystr - 1;
1092 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1093 # define yystpcpy stpcpy
1095 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1098 # if defined (__STDC__) || defined (__cplusplus)
1099 yystpcpy (char *yydest, const char *yysrc)
1101 yystpcpy (yydest, yysrc)
1107 const char *yys = yysrc;
1109 while ((*yyd++ = *yys++) != '\0')
1118 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1119 quotes and backslashes, so that it's suitable for yyerror. The
1120 heuristic is that double-quoting is unnecessary unless the string
1121 contains an apostrophe, a comma, or backslash (other than
1122 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1123 null, do not copy; instead, return the length of what the result
1126 yytnamerr (char *yyres, const char *yystr)
1131 char const *yyp = yystr;
1138 goto do_not_strip_quotes;
1142 goto do_not_strip_quotes;
1155 do_not_strip_quotes: ;
1159 return yystrlen (yystr);
1161 return yystpcpy (yyres, yystr) - yyres;
1165 #endif /* YYERROR_VERBOSE */
1170 /*--------------------------------.
1171 | Print this symbol on YYOUTPUT. |
1172 `--------------------------------*/
1174 #if defined (__STDC__) || defined (__cplusplus)
1176 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1179 yysymprint (yyoutput, yytype, yyvaluep)
1185 /* Pacify ``unused variable'' warnings. */
1188 if (yytype < YYNTOKENS)
1189 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1191 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1195 if (yytype < YYNTOKENS)
1196 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1203 YYFPRINTF (yyoutput, ")");
1206 #endif /* ! YYDEBUG */
1207 /*-----------------------------------------------.
1208 | Release the memory associated to this symbol. |
1209 `-----------------------------------------------*/
1211 #if defined (__STDC__) || defined (__cplusplus)
1213 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1216 yydestruct (yymsg, yytype, yyvaluep)
1222 /* Pacify ``unused variable'' warnings. */
1227 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1238 /* Prevent warnings from -Wmissing-prototypes. */
1240 #ifdef YYPARSE_PARAM
1241 # if defined (__STDC__) || defined (__cplusplus)
1242 int yyparse (void *YYPARSE_PARAM);
1246 #else /* ! YYPARSE_PARAM */
1247 #if defined (__STDC__) || defined (__cplusplus)
1252 #endif /* ! YYPARSE_PARAM */
1256 /* The look-ahead symbol. */
1259 /* The semantic value of the look-ahead symbol. */
1262 /* Number of syntax errors so far. */
1271 #ifdef YYPARSE_PARAM
1272 # if defined (__STDC__) || defined (__cplusplus)
1273 int yyparse (void *YYPARSE_PARAM)
1275 int yyparse (YYPARSE_PARAM)
1276 void *YYPARSE_PARAM;
1278 #else /* ! YYPARSE_PARAM */
1279 #if defined (__STDC__) || defined (__cplusplus)
1293 /* Number of tokens to shift before error messages enabled. */
1295 /* Look-ahead token as an internal (translated) token number. */
1298 /* Three stacks and their tools:
1299 `yyss': related to states,
1300 `yyvs': related to semantic values,
1301 `yyls': related to locations.
1303 Refer to the stacks thru separate pointers, to allow yyoverflow
1304 to reallocate them elsewhere. */
1306 /* The state stack. */
1307 short int yyssa[YYINITDEPTH];
1308 short int *yyss = yyssa;
1311 /* The semantic value stack. */
1312 YYSTYPE yyvsa[YYINITDEPTH];
1313 YYSTYPE *yyvs = yyvsa;
1318 #define YYPOPSTACK (yyvsp--, yyssp--)
1320 YYSIZE_T yystacksize = YYINITDEPTH;
1322 /* The variables used to return semantic value and location from the
1327 /* When reducing, the number of symbols on the RHS of the reduced
1331 YYDPRINTF ((stderr, "Starting parse\n"));
1336 yychar = YYEMPTY; /* Cause a token to be read. */
1338 /* Initialize stack pointers.
1339 Waste one element of value and location stack
1340 so that they stay on the same level as the state stack.
1341 The wasted elements are never initialized. */
1348 /*------------------------------------------------------------.
1349 | yynewstate -- Push a new state, which is found in yystate. |
1350 `------------------------------------------------------------*/
1352 /* In all cases, when you get here, the value and location stacks
1353 have just been pushed. so pushing a state here evens the stacks.
1360 if (yyss + yystacksize - 1 <= yyssp)
1362 /* Get the current used size of the three stacks, in elements. */
1363 YYSIZE_T yysize = yyssp - yyss + 1;
1367 /* Give user a chance to reallocate the stack. Use copies of
1368 these so that the &'s don't force the real ones into
1370 YYSTYPE *yyvs1 = yyvs;
1371 short int *yyss1 = yyss;
1374 /* Each stack pointer address is followed by the size of the
1375 data in use in that stack, in bytes. This used to be a
1376 conditional around just the two extra args, but that might
1377 be undefined if yyoverflow is a macro. */
1378 yyoverflow (YY_("memory exhausted"),
1379 &yyss1, yysize * sizeof (*yyssp),
1380 &yyvs1, yysize * sizeof (*yyvsp),
1387 #else /* no yyoverflow */
1388 # ifndef YYSTACK_RELOCATE
1389 goto yyexhaustedlab;
1391 /* Extend the stack our own way. */
1392 if (YYMAXDEPTH <= yystacksize)
1393 goto yyexhaustedlab;
1395 if (YYMAXDEPTH < yystacksize)
1396 yystacksize = YYMAXDEPTH;
1399 short int *yyss1 = yyss;
1400 union yyalloc *yyptr =
1401 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1403 goto yyexhaustedlab;
1404 YYSTACK_RELOCATE (yyss);
1405 YYSTACK_RELOCATE (yyvs);
1407 # undef YYSTACK_RELOCATE
1409 YYSTACK_FREE (yyss1);
1412 #endif /* no yyoverflow */
1414 yyssp = yyss + yysize - 1;
1415 yyvsp = yyvs + yysize - 1;
1418 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1419 (unsigned long int) yystacksize));
1421 if (yyss + yystacksize - 1 <= yyssp)
1425 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1434 /* Do appropriate processing given the current state. */
1435 /* Read a look-ahead token if we need one and don't already have one. */
1438 /* First try to decide what to do without reference to look-ahead token. */
1440 yyn = yypact[yystate];
1441 if (yyn == YYPACT_NINF)
1444 /* Not known => get a look-ahead token if don't already have one. */
1446 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1447 if (yychar == YYEMPTY)
1449 YYDPRINTF ((stderr, "Reading a token: "));
1453 if (yychar <= YYEOF)
1455 yychar = yytoken = YYEOF;
1456 YYDPRINTF ((stderr, "Now at end of input.\n"));
1460 yytoken = YYTRANSLATE (yychar);
1461 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1464 /* If the proper action on seeing token YYTOKEN is to reduce or to
1465 detect an error, take that action. */
1467 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1472 if (yyn == 0 || yyn == YYTABLE_NINF)
1481 /* Shift the look-ahead token. */
1482 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1484 /* Discard the token being shifted unless it is eof. */
1485 if (yychar != YYEOF)
1491 /* Count tokens shifted since error; after three, turn off error
1500 /*-----------------------------------------------------------.
1501 | yydefault -- do the default action for the current state. |
1502 `-----------------------------------------------------------*/
1504 yyn = yydefact[yystate];
1510 /*-----------------------------.
1511 | yyreduce -- Do a reduction. |
1512 `-----------------------------*/
1514 /* yyn is the number of a rule to reduce with. */
1517 /* If YYLEN is nonzero, implement the default value of the action:
1520 Otherwise, the following line sets YYVAL to garbage.
1521 This behavior is undocumented and Bison
1522 users should not rely upon it. Assigning to YYVAL
1523 unconditionally makes the parser a bit smaller, and it avoids a
1524 GCC warning that YYVAL may be used uninitialized. */
1525 yyval = yyvsp[1-yylen];
1528 YY_REDUCE_PRINT (yyn);
1540 { error_message("implicit tagging is not supported"); }
1545 { error_message("automatic tagging is not supported"); }
1550 { error_message("no extensibility options supported"); }
1556 struct string_list *sl;
1557 for(sl = (yyvsp[-3].sl); sl != NULL; sl = sl->next) {
1558 Symbol *s = addsym(sl->string);
1561 add_import((yyvsp[-1].name));
1568 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1569 (yyval.sl)->string = (yyvsp[-2].name);
1570 (yyval.sl)->next = (yyvsp[0].sl);
1577 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1578 (yyval.sl)->string = (yyvsp[0].name);
1579 (yyval.sl)->next = NULL;
1586 Symbol *s = addsym ((yyvsp[-2].name));
1588 s->type = (yyvsp[0].type);
1597 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
1598 TE_EXPLICIT, new_type(TBoolean));
1605 if((yyvsp[-3].value)->type != integervalue ||
1606 (yyvsp[-1].value)->type != integervalue)
1607 error_message("Non-integer value used in range");
1608 (yyval.range).min = (yyvsp[-3].value)->u.integervalue;
1609 (yyval.range).max = (yyvsp[-1].value)->u.integervalue;
1616 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
1617 TE_EXPLICIT, new_type(TInteger));
1624 (yyval.type) = new_type(TInteger);
1625 (yyval.type)->range = emalloc(sizeof(*(yyval.type)->range));
1626 *((yyval.type)->range) = (yyvsp[0].range);
1627 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1634 (yyval.type) = new_type(TInteger);
1635 (yyval.type)->members = (yyvsp[-1].members);
1636 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1643 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1644 ASN1_TAILQ_INIT((yyval.members));
1645 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
1652 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
1653 (yyval.members) = (yyvsp[-2].members);
1659 { (yyval.members) = (yyvsp[-2].members); }
1665 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1666 (yyval.member)->name = (yyvsp[-3].name);
1667 (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
1668 output_name ((yyval.member)->gen_name);
1669 (yyval.member)->val = (yyvsp[-1].constant);
1670 (yyval.member)->optional = 0;
1671 (yyval.member)->ellipsis = 0;
1672 (yyval.member)->type = NULL;
1679 (yyval.type) = new_type(TInteger);
1680 (yyval.type)->members = (yyvsp[-1].members);
1681 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));
1688 (yyval.type) = new_type(TBitString);
1689 (yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));
1690 ASN1_TAILQ_INIT((yyval.type)->members);
1691 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1698 (yyval.type) = new_type(TBitString);
1699 (yyval.type)->members = (yyvsp[-1].members);
1700 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1707 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
1708 TE_EXPLICIT, new_type(TOID));
1715 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,
1716 TE_EXPLICIT, new_type(TOctetString));
1723 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
1724 TE_EXPLICIT, new_type(TNull));
1731 (yyval.type) = new_type(TSequence);
1732 (yyval.type)->members = (yyvsp[-1].members);
1733 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1740 (yyval.type) = new_type(TSequence);
1741 (yyval.type)->members = NULL;
1742 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1749 (yyval.type) = new_type(TSequenceOf);
1750 (yyval.type)->subtype = (yyvsp[0].type);
1751 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
1758 (yyval.type) = new_type(TSet);
1759 (yyval.type)->members = (yyvsp[-1].members);
1760 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1767 (yyval.type) = new_type(TSet);
1768 (yyval.type)->members = NULL;
1769 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1776 (yyval.type) = new_type(TSetOf);
1777 (yyval.type)->subtype = (yyvsp[0].type);
1778 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
1785 (yyval.type) = new_type(TChoice);
1786 (yyval.type)->members = (yyvsp[-1].members);
1793 Symbol *s = addsym((yyvsp[0].name));
1794 (yyval.type) = new_type(TType);
1795 if(s->stype != Stype && s->stype != SUndefined)
1796 error_message ("%s is not a type\n", (yyvsp[0].name));
1798 (yyval.type)->symbol = s;
1805 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
1806 TE_EXPLICIT, new_type(TGeneralizedTime));
1813 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
1814 TE_EXPLICIT, new_type(TUTCTime));
1821 /* if (Constraint.type == contentConstrant) {
1822 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
1823 if (Constraint.u.constraint.type) {
1824 assert((Constraint.u.constraint.type.length % 8) == 0);
1827 if (Constraint.u.constraint.encoding) {
1828 type == der-oid|ber-oid
1837 (yyval.constraint_spec) = (yyvsp[-1].constraint_spec);
1844 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
1845 (yyval.constraint_spec)->u.content.type = (yyvsp[0].type);
1846 (yyval.constraint_spec)->u.content.encoding = NULL;
1853 if ((yyvsp[0].value)->type != objectidentifiervalue)
1854 error_message("Non-OID used in ENCODED BY constraint");
1855 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
1856 (yyval.constraint_spec)->u.content.type = NULL;
1857 (yyval.constraint_spec)->u.content.encoding = (yyvsp[0].value);
1864 if ((yyvsp[0].value)->type != objectidentifiervalue)
1865 error_message("Non-OID used in ENCODED BY constraint");
1866 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
1867 (yyval.constraint_spec)->u.content.type = (yyvsp[-3].type);
1868 (yyval.constraint_spec)->u.content.encoding = (yyvsp[0].value);
1875 (yyval.constraint_spec) = new_constraint_spec(CT_USER);
1882 (yyval.type) = new_type(TTag);
1883 (yyval.type)->tag = (yyvsp[-2].tag);
1884 (yyval.type)->tag.tagenv = (yyvsp[-1].constant);
1885 if((yyvsp[0].type)->type == TTag && (yyvsp[-1].constant) == TE_IMPLICIT) {
1886 (yyval.type)->subtype = (yyvsp[0].type)->subtype;
1887 free((yyvsp[0].type));
1889 (yyval.type)->subtype = (yyvsp[0].type);
1896 (yyval.tag).tagclass = (yyvsp[-2].constant);
1897 (yyval.tag).tagvalue = (yyvsp[-1].constant);
1898 (yyval.tag).tagenv = TE_EXPLICIT;
1905 (yyval.constant) = ASN1_C_CONTEXT;
1912 (yyval.constant) = ASN1_C_UNIV;
1919 (yyval.constant) = ASN1_C_APPL;
1926 (yyval.constant) = ASN1_C_PRIVATE;
1933 (yyval.constant) = TE_EXPLICIT;
1940 (yyval.constant) = TE_EXPLICIT;
1947 (yyval.constant) = TE_IMPLICIT;
1955 s = addsym ((yyvsp[-3].name));
1958 s->value = (yyvsp[0].value);
1959 generate_constant (s);
1966 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
1967 TE_EXPLICIT, new_type(TGeneralString));
1974 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
1975 TE_EXPLICIT, new_type(TUTF8String));
1982 (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
1983 TE_EXPLICIT, new_type(TPrintableString));
1990 (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
1991 TE_EXPLICIT, new_type(TIA5String));
1998 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
1999 TE_EXPLICIT, new_type(TBMPString));
2006 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
2007 TE_EXPLICIT, new_type(TUniversalString));
2014 (yyval.members) = emalloc(sizeof(*(yyval.members)));
2015 ASN1_TAILQ_INIT((yyval.members));
2016 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
2023 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
2024 (yyval.members) = (yyvsp[-2].members);
2031 struct member *m = ecalloc(1, sizeof(*m));
2032 m->name = estrdup("...");
2033 m->gen_name = estrdup("asn1_ellipsis");
2035 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), m, members);
2036 (yyval.members) = (yyvsp[-2].members);
2043 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2044 (yyval.member)->name = (yyvsp[-1].name);
2045 (yyval.member)->gen_name = estrdup((yyvsp[-1].name));
2046 output_name ((yyval.member)->gen_name);
2047 (yyval.member)->type = (yyvsp[0].type);
2048 (yyval.member)->ellipsis = 0;
2055 (yyval.member) = (yyvsp[0].member);
2056 (yyval.member)->optional = 0;
2057 (yyval.member)->defval = NULL;
2064 (yyval.member) = (yyvsp[-1].member);
2065 (yyval.member)->optional = 1;
2066 (yyval.member)->defval = NULL;
2073 (yyval.member) = (yyvsp[-2].member);
2074 (yyval.member)->optional = 0;
2075 (yyval.member)->defval = (yyvsp[0].value);
2082 (yyval.members) = emalloc(sizeof(*(yyval.members)));
2083 ASN1_TAILQ_INIT((yyval.members));
2084 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[0].member), members);
2091 ASN1_TAILQ_INSERT_TAIL((yyvsp[-2].members), (yyvsp[0].member), members);
2092 (yyval.members) = (yyvsp[-2].members);
2099 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2100 (yyval.member)->name = (yyvsp[-3].name);
2101 (yyval.member)->gen_name = estrdup((yyvsp[-3].name));
2102 output_name ((yyval.member)->gen_name);
2103 (yyval.member)->val = (yyvsp[-1].constant);
2104 (yyval.member)->optional = 0;
2105 (yyval.member)->ellipsis = 0;
2106 (yyval.member)->type = NULL;
2112 { (yyval.objid) = NULL; }
2118 (yyval.objid) = (yyvsp[-1].objid);
2125 (yyval.objid) = NULL;
2132 if ((yyvsp[0].objid)) {
2133 (yyval.objid) = (yyvsp[0].objid);
2134 add_oid_to_tail((yyvsp[0].objid), (yyvsp[-1].objid));
2136 (yyval.objid) = (yyvsp[-1].objid);
2144 (yyval.objid) = new_objid((yyvsp[-3].name), (yyvsp[-1].constant));
2151 Symbol *s = addsym((yyvsp[0].name));
2152 if(s->stype != SValue ||
2153 s->value->type != objectidentifiervalue) {
2154 error_message("%s is not an object identifier\n",
2158 (yyval.objid) = s->value->u.objectidentifiervalue;
2165 (yyval.objid) = new_objid(NULL, (yyvsp[0].constant));
2172 Symbol *s = addsym((yyvsp[0].name));
2173 if(s->stype != SValue)
2174 error_message ("%s is not a value\n",
2177 (yyval.value) = s->value;
2184 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2185 (yyval.value)->type = stringvalue;
2186 (yyval.value)->u.stringvalue = (yyvsp[0].name);
2193 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2194 (yyval.value)->type = booleanvalue;
2195 (yyval.value)->u.booleanvalue = 0;
2202 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2203 (yyval.value)->type = booleanvalue;
2204 (yyval.value)->u.booleanvalue = 0;
2211 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2212 (yyval.value)->type = integervalue;
2213 (yyval.value)->u.integervalue = (yyvsp[0].constant);
2226 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2227 (yyval.value)->type = objectidentifiervalue;
2228 (yyval.value)->u.objectidentifiervalue = (yyvsp[0].objid);
2236 /* Line 1126 of yacc.c. */
2237 #line 2238 "$base.c"
2243 YY_STACK_PRINT (yyss, yyssp);
2248 /* Now `shift' the result of the reduction. Determine what state
2249 that goes to, based on the state we popped back to and the rule
2250 number reduced by. */
2254 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2255 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2256 yystate = yytable[yystate];
2258 yystate = yydefgoto[yyn - YYNTOKENS];
2263 /*------------------------------------.
2264 | yyerrlab -- here on detecting error |
2265 `------------------------------------*/
2267 /* If not already recovering from an error, report this error. */
2272 yyn = yypact[yystate];
2274 if (YYPACT_NINF < yyn && yyn < YYLAST)
2276 int yytype = YYTRANSLATE (yychar);
2277 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2278 YYSIZE_T yysize = yysize0;
2280 int yysize_overflow = 0;
2282 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
2283 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2287 /* This is so xgettext sees the translatable formats that are
2288 constructed on the fly. */
2289 YY_("syntax error, unexpected %s");
2290 YY_("syntax error, unexpected %s, expecting %s");
2291 YY_("syntax error, unexpected %s, expecting %s or %s");
2292 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2293 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2297 static char const yyunexpected[] = "syntax error, unexpected %s";
2298 static char const yyexpecting[] = ", expecting %s";
2299 static char const yyor[] = " or %s";
2300 char yyformat[sizeof yyunexpected
2301 + sizeof yyexpecting - 1
2302 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2303 * (sizeof yyor - 1))];
2304 char const *yyprefix = yyexpecting;
2306 /* Start YYX at -YYN if negative to avoid negative indexes in
2308 int yyxbegin = yyn < 0 ? -yyn : 0;
2310 /* Stay within bounds of both yycheck and yytname. */
2311 int yychecklim = YYLAST - yyn;
2312 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2315 yyarg[0] = yytname[yytype];
2316 yyfmt = yystpcpy (yyformat, yyunexpected);
2318 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2319 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2321 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2325 yyformat[sizeof yyunexpected - 1] = '\0';
2328 yyarg[yycount++] = yytname[yyx];
2329 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2330 yysize_overflow |= yysize1 < yysize;
2332 yyfmt = yystpcpy (yyfmt, yyprefix);
2336 yyf = YY_(yyformat);
2337 yysize1 = yysize + yystrlen (yyf);
2338 yysize_overflow |= yysize1 < yysize;
2341 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
2342 yymsg = (char *) YYSTACK_ALLOC (yysize);
2345 /* Avoid sprintf, as that infringes on the user's name space.
2346 Don't have undefined behavior even if the translation
2347 produced a string with the wrong number of "%s"s. */
2350 while ((*yyp = *yyf))
2352 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2354 yyp += yytnamerr (yyp, yyarg[yyi++]);
2364 YYSTACK_FREE (yymsg);
2368 yyerror (YY_("syntax error"));
2369 goto yyexhaustedlab;
2373 #endif /* YYERROR_VERBOSE */
2374 yyerror (YY_("syntax error"));
2379 if (yyerrstatus == 3)
2381 /* If just tried and failed to reuse look-ahead token after an
2382 error, discard it. */
2384 if (yychar <= YYEOF)
2386 /* Return failure if at end of input. */
2387 if (yychar == YYEOF)
2392 yydestruct ("Error: discarding", yytoken, &yylval);
2397 /* Else will try to reuse look-ahead token after shifting the error
2402 /*---------------------------------------------------.
2403 | yyerrorlab -- error raised explicitly by YYERROR. |
2404 `---------------------------------------------------*/
2407 /* Pacify compilers like GCC when the user code never invokes
2408 YYERROR and the label yyerrorlab therefore never appears in user
2419 /*-------------------------------------------------------------.
2420 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2421 `-------------------------------------------------------------*/
2423 yyerrstatus = 3; /* Each real token shifted decrements this. */
2427 yyn = yypact[yystate];
2428 if (yyn != YYPACT_NINF)
2431 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2439 /* Pop the current state because it cannot handle the error token. */
2444 yydestruct ("Error: popping", yystos[yystate], yyvsp);
2447 YY_STACK_PRINT (yyss, yyssp);
2456 /* Shift the error token. */
2457 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2463 /*-------------------------------------.
2464 | yyacceptlab -- YYACCEPT comes here. |
2465 `-------------------------------------*/
2470 /*-----------------------------------.
2471 | yyabortlab -- YYABORT comes here. |
2472 `-----------------------------------*/
2478 /*-------------------------------------------------.
2479 | yyexhaustedlab -- memory exhaustion comes here. |
2480 `-------------------------------------------------*/
2482 yyerror (YY_("memory exhausted"));
2488 if (yychar != YYEOF && yychar != YYEMPTY)
2489 yydestruct ("Cleanup: discarding lookahead",
2491 while (yyssp != yyss)
2493 yydestruct ("Cleanup: popping",
2494 yystos[*yyssp], yyvsp);
2499 YYSTACK_FREE (yyss);
2509 yyerror (const char *s)
2511 error_message ("%s\n", s);
2515 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
2518 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
2520 oldtype = oldtype->subtype; /* XXX */
2522 t = new_type (TTag);
2524 t->tag.tagclass = tagclass;
2525 t->tag.tagvalue = tagvalue;
2526 t->tag.tagenv = tagenv;
2527 t->subtype = oldtype;
2531 static struct objid *
2532 new_objid(const char *label, int value)
2535 s = emalloc(sizeof(*s));
2543 add_oid_to_tail(struct objid *head, struct objid *tail)
2553 new_type (Typetype tt)
2555 Type *t = ecalloc(1, sizeof(*t));
2560 static struct constraint_spec *
2561 new_constraint_spec(enum ctype ct)
2563 struct constraint_spec *c = ecalloc(1, sizeof(*c));
2568 static void fix_labels2(Type *t, const char *prefix);
2569 static void fix_labels1(struct memhead *members, const char *prefix)
2575 ASN1_TAILQ_FOREACH(m, members, members) {
2576 asprintf(&m->label, "%s_%s", prefix, m->gen_name);
2577 if (m->label == NULL)
2580 fix_labels2(m->type, m->label);
2584 static void fix_labels2(Type *t, const char *prefix)
2586 for(; t; t = t->subtype)
2587 fix_labels1(t->members, prefix);
2591 fix_labels(Symbol *s)
2594 asprintf(&p, "choice_%s", s->gen_name);
2597 fix_labels2(s->type, p);