1 /* A Bison parser, made by GNU Bison 3.3.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
47 /* Identify Bison output. */
51 #define YYBISON_VERSION "3.3.2"
54 #define YYSKELETON_NAME "yacc.c"
68 /* First part of user prologue. */
69 #line 42 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:337 */
71 #ifndef BUILD_GENTOOLS
82 # include "gen-help.h"
88 #include "asn1-func.h"
90 /* It would be better to make yyparse static but there is no way to do
91 this. Let's hope that this macros works. */
92 #define yyparse _ksba_asn1_yyparse
94 /* #define YYDEBUG 1 */
95 #define MAX_STRING_LENGTH 129
98 /* constants used in the grammar */
104 struct parser_control_s {
112 #define PARSECTL ((struct parser_control_s *)parm)
115 #line 116 "asn1-parse.c" /* yacc.c:337 */
117 # if defined __cplusplus
118 # if 201103L <= __cplusplus
119 # define YY_NULLPTR nullptr
121 # define YY_NULLPTR 0
124 # define YY_NULLPTR ((void*)0)
128 /* Enabling verbose error messages. */
129 #ifdef YYERROR_VERBOSE
130 # undef YYERROR_VERBOSE
131 # define YYERROR_VERBOSE 1
133 # define YYERROR_VERBOSE 1
166 STR_IDENTIFIER = 274,
182 GeneralizedTime = 290,
189 PRINTABLESTRING = 297,
192 UNIVERSALSTRING = 300,
198 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
202 #line 94 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:352 */
204 unsigned int constant;
205 char str[MAX_STRING_LENGTH];
208 #line 209 "asn1-parse.c" /* yacc.c:352 */
211 typedef union YYSTYPE YYSTYPE;
212 # define YYSTYPE_IS_TRIVIAL 1
213 # define YYSTYPE_IS_DECLARED 1
218 int yyparse (void *parm);
222 /* Second part of user prologue. */
223 #line 100 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:354 */
225 static AsnNode new_node (struct parser_control_s *parsectl, node_type_t type);
226 #define NEW_NODE(a) (new_node (PARSECTL, (a)))
227 static void set_name (AsnNode node, const char *name);
228 static void set_str_value (AsnNode node, const char *text);
229 static void set_ulong_value (AsnNode node, const char *text);
230 static void set_right (AsnNode node, AsnNode right);
231 static void append_right (AsnNode node, AsnNode right);
232 static void set_down (AsnNode node, AsnNode down);
235 static int yylex (YYSTYPE *lvalp, void *parm);
236 static void yyerror (void *parm, const char *s);
238 #line 239 "asn1-parse.c" /* yacc.c:354 */
245 typedef YYTYPE_UINT8 yytype_uint8;
247 typedef unsigned char yytype_uint8;
251 typedef YYTYPE_INT8 yytype_int8;
253 typedef signed char yytype_int8;
257 typedef YYTYPE_UINT16 yytype_uint16;
259 typedef unsigned short yytype_uint16;
263 typedef YYTYPE_INT16 yytype_int16;
265 typedef short yytype_int16;
269 # ifdef __SIZE_TYPE__
270 # define YYSIZE_T __SIZE_TYPE__
271 # elif defined size_t
272 # define YYSIZE_T size_t
273 # elif ! defined YYSIZE_T
274 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
275 # define YYSIZE_T size_t
277 # define YYSIZE_T unsigned
281 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
284 # if defined YYENABLE_NLS && YYENABLE_NLS
286 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
287 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
291 # define YY_(Msgid) Msgid
296 # if (defined __GNUC__ \
297 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
298 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
299 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
301 # define YY_ATTRIBUTE(Spec) /* empty */
305 #ifndef YY_ATTRIBUTE_PURE
306 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
309 #ifndef YY_ATTRIBUTE_UNUSED
310 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
313 /* Suppress unused-variable warnings by "using" E. */
314 #if ! defined lint || defined __GNUC__
315 # define YYUSE(E) ((void) (E))
317 # define YYUSE(E) /* empty */
320 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
321 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
322 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
323 _Pragma ("GCC diagnostic push") \
324 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
325 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
326 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
327 _Pragma ("GCC diagnostic pop")
329 # define YY_INITIAL_VALUE(Value) Value
331 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
332 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
333 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
335 #ifndef YY_INITIAL_VALUE
336 # define YY_INITIAL_VALUE(Value) /* Nothing. */
340 #if ! defined yyoverflow || YYERROR_VERBOSE
342 /* The parser invokes alloca or malloc; define the necessary symbols. */
344 # ifdef YYSTACK_USE_ALLOCA
345 # if YYSTACK_USE_ALLOCA
347 # define YYSTACK_ALLOC __builtin_alloca
348 # elif defined __BUILTIN_VA_ARG_INCR
349 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
351 # define YYSTACK_ALLOC __alloca
352 # elif defined _MSC_VER
353 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
354 # define alloca _alloca
356 # define YYSTACK_ALLOC alloca
357 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
358 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
359 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
360 # ifndef EXIT_SUCCESS
361 # define EXIT_SUCCESS 0
368 # ifdef YYSTACK_ALLOC
369 /* Pacify GCC's 'empty if-body' warning. */
370 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
371 # ifndef YYSTACK_ALLOC_MAXIMUM
372 /* The OS might guarantee only one guard page at the bottom of the stack,
373 and a page size can be as small as 4096 bytes. So we cannot safely
374 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
375 to allow for a few compiler-allocated temporary stack slots. */
376 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
379 # define YYSTACK_ALLOC YYMALLOC
380 # define YYSTACK_FREE YYFREE
381 # ifndef YYSTACK_ALLOC_MAXIMUM
382 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
384 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
385 && ! ((defined YYMALLOC || defined malloc) \
386 && (defined YYFREE || defined free)))
387 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
388 # ifndef EXIT_SUCCESS
389 # define EXIT_SUCCESS 0
393 # define YYMALLOC malloc
394 # if ! defined malloc && ! defined EXIT_SUCCESS
395 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
400 # if ! defined free && ! defined EXIT_SUCCESS
401 void free (void *); /* INFRINGES ON USER NAME SPACE */
405 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
408 #if (! defined yyoverflow \
409 && (! defined __cplusplus \
410 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
412 /* A type that is properly aligned for any stack member. */
415 yytype_int16 yyss_alloc;
419 /* The size of the maximum gap between one aligned stack and the next. */
420 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
422 /* The size of an array large to enough to hold all stacks, each with
424 # define YYSTACK_BYTES(N) \
425 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
426 + YYSTACK_GAP_MAXIMUM)
428 # define YYCOPY_NEEDED 1
430 /* Relocate STACK from its old location to the new one. The
431 local variables YYSIZE and YYSTACKSIZE give the old and new number of
432 elements in the stack, and YYPTR gives the new location of the
433 stack. Advance YYPTR to a properly aligned location for the next
435 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
438 YYSIZE_T yynewbytes; \
439 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
440 Stack = &yyptr->Stack_alloc; \
441 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
442 yyptr += yynewbytes / sizeof (*yyptr); \
448 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
449 /* Copy COUNT objects from SRC to DST. The source and destination do
452 # if defined __GNUC__ && 1 < __GNUC__
453 # define YYCOPY(Dst, Src, Count) \
454 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
456 # define YYCOPY(Dst, Src, Count) \
460 for (yyi = 0; yyi < (Count); yyi++) \
461 (Dst)[yyi] = (Src)[yyi]; \
466 #endif /* !YYCOPY_NEEDED */
468 /* YYFINAL -- State number of the termination state. */
470 /* YYLAST -- Last index in YYTABLE. */
473 /* YYNTOKENS -- Number of terminals. */
475 /* YYNNTS -- Number of nonterminals. */
477 /* YYNRULES -- Number of rules. */
479 /* YYNSTATES -- Number of states. */
480 #define YYNSTATES 203
483 #define YYMAXUTOK 301
485 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
486 as returned by yylex, with out-of-bounds checking. */
487 #define YYTRANSLATE(YYX) \
488 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
490 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
491 as returned by yylex. */
492 static const yytype_uint8 yytranslate[] =
494 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 49, 50, 2, 47, 51, 48, 56, 2, 2, 2,
499 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2,
503 2, 52, 2, 53, 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, 54, 2, 55, 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, 2, 2, 2, 2,
516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
520 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
521 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
522 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
523 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
528 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
529 static const yytype_uint16 yyrline[] =
531 0, 179, 179, 180, 183, 184, 187, 194, 195, 198,
532 199, 202, 203, 206, 211, 219, 220, 245, 250, 258,
533 260, 267, 268, 269, 272, 278, 286, 288, 293, 300,
534 305, 310, 317, 321, 327, 338, 344, 348, 354, 360,
535 369, 373, 379, 383, 391, 392, 399, 400, 407, 409,
536 416, 418, 425, 426, 433, 435, 442, 443, 452, 453,
537 454, 455, 456, 457, 458, 464, 472, 476, 483, 487,
538 495, 503, 509, 514, 521, 522, 523, 524, 525, 526,
539 527, 528, 529, 530, 531, 532, 533, 539, 543, 554,
540 558, 565, 572, 579, 581, 588, 593, 598, 607, 612,
541 617, 626, 633, 637, 649, 656, 663, 672, 681, 682,
542 685, 687, 694, 703, 719, 720, 723
546 #if YYDEBUG || YYERROR_VERBOSE || 1
547 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
548 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
549 static const char *const yytname[] =
551 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER",
552 "\"OPTIONAL\"", "\"INTEGER\"", "\"SIZE\"", "\"OCTET\"", "\"STRING\"",
553 "\"SEQUENCE\"", "\"BIT\"", "\"UNIVERSAL\"", "\"PRIVATE\"", "\"DEFAULT\"",
554 "\"CHOICE\"", "\"OF\"", "\"OBJECT\"", "\"IDENTIFIER\"", "\"BOOLEAN\"",
555 "\"TRUE\"", "\"FALSE\"", "\"APPLICATION\"", "\"ANY\"", "\"DEFINED\"",
556 "\"SET\"", "\"BY\"", "\"EXPLICIT\"", "\"IMPLICIT\"", "\"DEFINITIONS\"",
557 "\"TAGS\"", "\"BEGIN\"", "\"END\"", "\"UTCTime\"", "\"GeneralizedTime\"",
558 "\"FROM\"", "\"IMPORTS\"", "\"NULL\"", "\"ENUMERATED\"",
559 "\"UTF8String\"", "\"NumericString\"", "\"PrintableString\"",
560 "\"TeletexString\"", "\"IA5String\"", "\"UniversalString\"",
561 "\"BMPString\"", "'+'", "'-'", "'('", "')'", "','", "'['", "']'", "'{'",
562 "'}'", "'.'", "$accept", "input", "pos_num", "neg_num", "pos_neg_num",
563 "num_identifier", "pos_neg_identifier", "constant", "constant_list",
564 "obj_constant", "obj_constant_list", "class", "tag_type", "tag",
565 "default", "integer_def", "boolean_def", "Time", "size_def2", "size_def",
566 "octet_string_def", "utf8_string_def", "numeric_string_def",
567 "printable_string_def", "teletex_string_def", "ia5_string_def",
568 "universal_string_def", "bmp_string_def", "string_def", "bit_element",
569 "bit_element_list", "bit_string_def", "enumerated_def", "object_def",
570 "type_assig_right", "type_assig_right_tag",
571 "type_assig_right_tag_default", "type_assig", "type_assig_list",
572 "sequence_def", "set_def", "choise_def", "any_def", "type_def",
573 "constant_def", "type_constant", "type_constant_list", "definitions_id",
574 "imports_def", "explicit_implicit", "definitions", YY_NULLPTR
579 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
580 (internal) symbol number NUM (which must be that of a token). */
581 static const yytype_uint16 yytoknum[] =
583 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
584 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
585 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
586 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
587 295, 296, 297, 298, 299, 300, 301, 43, 45, 40,
588 41, 44, 91, 93, 123, 125, 46
592 #define YYPACT_NINF -137
594 #define yypact_value_is_default(Yystate) \
595 (!!((Yystate) == (-137)))
597 #define YYTABLE_NINF -1
599 #define yytable_value_is_error(Yytable_value) \
602 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
604 static const yytype_int16 yypact[] =
606 -137, 33, -137, -39, 0, -137, 76, 115, -137, 4,
607 -137, -137, -1, -137, -137, 15, 63, -137, -137, 59,
608 77, 86, -137, -137, 105, 24, -137, -137, -137, 18,
609 52, 126, 129, 128, -137, -137, 16, 94, 139, 17,
610 140, 97, 133, -137, 130, 20, -137, -137, -137, 99,
611 16, 16, 16, 16, 16, 16, 16, 22, 117, 96,
612 107, -137, -137, -137, -137, -137, -137, -137, -137, -137,
613 -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
614 -137, 100, 153, 155, 110, 152, -137, -137, 7, 16,
615 96, 156, 146, 111, 156, -137, 137, 96, 156, 149,
616 162, -137, -137, -137, -137, -137, -137, -137, 116, -137,
617 -137, -137, 164, -137, -137, -137, 84, 76, -137, 118,
618 84, 120, 122, 37, -137, -3, -137, -137, 52, -137,
619 51, 96, 162, 58, 168, -137, 60, 96, 125, -137,
620 66, -137, 123, -137, 119, 3, 76, -6, -137, 37,
621 -137, 173, 174, -137, -137, 131, 7, -137, 34, -137,
622 156, -137, -137, 68, -137, -137, -137, -137, 175, 162,
623 -137, -137, 124, -137, 5, -137, 127, 132, -137, -137,
624 -137, -137, -137, 78, -137, -137, -137, 134, -137, 84,
625 -137, 84, -137, -137, -137, -137, -137, -137, -137, 135,
629 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
630 Performed when YYTABLE does not specify something else to do. Zero
631 means the default is an error. */
632 static const yytype_uint8 yydefact[] =
634 2, 0, 1, 0, 0, 3, 0, 0, 9, 10,
635 17, 19, 0, 114, 115, 0, 0, 112, 20, 0,
636 0, 0, 18, 113, 0, 0, 108, 109, 110, 0,
637 0, 0, 0, 0, 116, 111, 72, 32, 0, 0,
638 0, 0, 0, 35, 102, 0, 36, 37, 86, 0,
639 44, 46, 48, 50, 52, 54, 56, 0, 26, 0,
640 74, 76, 78, 79, 58, 59, 60, 61, 62, 63,
641 64, 77, 80, 75, 82, 87, 104, 81, 85, 83,
642 84, 0, 0, 0, 0, 0, 40, 73, 0, 42,
643 0, 0, 0, 68, 0, 71, 0, 0, 0, 0,
644 0, 45, 47, 49, 51, 53, 55, 57, 0, 21,
645 22, 23, 0, 27, 28, 88, 0, 0, 107, 0,
646 0, 0, 0, 0, 15, 0, 43, 96, 0, 93,
647 0, 0, 0, 0, 0, 99, 0, 0, 0, 66,
648 0, 24, 0, 10, 0, 0, 0, 0, 41, 0,
649 4, 0, 0, 7, 8, 0, 0, 33, 89, 92,
650 0, 95, 97, 0, 101, 103, 98, 100, 0, 0,
651 70, 25, 0, 106, 0, 38, 0, 0, 5, 6,
652 13, 16, 91, 0, 90, 94, 69, 0, 67, 0,
653 105, 0, 14, 12, 30, 31, 11, 29, 65, 0,
657 /* YYPGOTO[NTERM-NUM]. */
658 static const yytype_int16 yypgoto[] =
660 -137, -137, -137, -137, -136, -114, -137, 31, -137, -12,
661 -103, -137, -137, -137, -137, -137, -137, -137, 103, -34,
662 -137, -137, -137, -137, -137, -137, -137, -137, -137, 21,
663 57, -137, -137, -137, -58, 64, -137, 35, 30, -137,
664 -137, -137, -137, -137, -137, 165, -137, -137, -137, -137,
668 /* YYDEFGOTO[NTERM-NUM]. */
669 static const yytype_int16 yydefgoto[] =
671 -1, 1, 153, 154, 155, 10, 197, 124, 125, 11,
672 12, 112, 58, 59, 184, 60, 61, 62, 86, 87,
673 63, 64, 65, 66, 67, 68, 69, 70, 71, 139,
674 140, 72, 73, 74, 75, 76, 159, 129, 130, 77,
675 78, 79, 80, 26, 27, 28, 29, 4, 24, 15,
679 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
680 positive, shift that token. If negative, reduce the rule whose
681 number is the opposite. If YYTABLE_NINF, syntax error. */
682 static const yytype_uint8 yytable[] =
684 18, 115, 144, 8, 9, 92, 147, 8, 9, 8,
685 9, 99, 122, 177, 145, 6, 101, 102, 103, 104,
686 105, 106, 107, 25, 84, 84, 108, 30, 84, 31,
687 7, 32, 127, 2, 90, 109, 110, 97, 3, 135,
688 182, 150, 33, 174, 175, 111, 19, 196, 156, 183,
689 176, 34, 157, 16, 17, 126, 123, 36, 173, 37,
690 190, 38, 21, 39, 40, 85, 85, 20, 41, 85,
691 42, 91, 43, 162, 98, 199, 44, 200, 45, 167,
692 8, 9, 150, 193, 151, 152, 46, 47, 8, 143,
693 48, 49, 50, 51, 52, 53, 54, 55, 56, 194,
694 195, 36, 160, 37, 57, 38, 161, 39, 40, 160,
695 25, 160, 41, 164, 42, 166, 43, 169, 23, 169,
696 44, 170, 45, 186, 133, 151, 152, 22, 136, 81,
697 46, 47, 82, 18, 48, 49, 50, 51, 52, 53,
698 54, 55, 56, 13, 14, 113, 114, 83, 88, 89,
699 93, 94, 95, 100, 117, 96, 116, 118, 119, 120,
700 84, 128, 18, 131, 134, 132, 137, 138, 142, 141,
701 148, 149, 146, 165, 168, 172, 171, 178, 179, 187,
702 189, 180, 192, 191, 198, 201, 202, 181, 121, 163,
703 188, 0, 158, 0, 35, 185
706 static const yytype_int16 yycheck[] =
708 12, 59, 116, 4, 5, 39, 120, 4, 5, 4,
709 5, 45, 5, 149, 117, 54, 50, 51, 52, 53,
710 54, 55, 56, 5, 8, 8, 4, 3, 8, 5,
711 30, 7, 90, 0, 17, 13, 14, 17, 5, 97,
712 6, 4, 18, 146, 50, 23, 31, 183, 51, 15,
713 56, 33, 55, 49, 55, 89, 49, 5, 55, 7,
714 55, 9, 3, 11, 12, 49, 49, 4, 16, 49,
715 18, 54, 20, 131, 54, 189, 24, 191, 26, 137,
716 4, 5, 4, 5, 47, 48, 34, 35, 4, 5,
717 38, 39, 40, 41, 42, 43, 44, 45, 46, 21,
718 22, 5, 51, 7, 52, 9, 55, 11, 12, 51,
719 5, 51, 16, 55, 18, 55, 20, 51, 32, 51,
720 24, 55, 26, 55, 94, 47, 48, 50, 98, 3,
721 34, 35, 3, 145, 38, 39, 40, 41, 42, 43,
722 44, 45, 46, 28, 29, 28, 29, 19, 54, 10,
723 10, 54, 19, 54, 54, 25, 49, 4, 3, 49,
724 8, 5, 174, 17, 27, 54, 17, 5, 4, 53,
725 50, 49, 54, 5, 49, 56, 53, 4, 4, 4,
726 56, 50, 50, 56, 50, 50, 50, 156, 85, 132,
727 169, -1, 128, -1, 29, 160
730 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
731 symbol of state STATE-NUM. */
732 static const yytype_uint8 yystos[] =
734 0, 58, 0, 5, 104, 107, 54, 30, 4, 5,
735 62, 66, 67, 28, 29, 106, 49, 55, 66, 31,
736 4, 3, 50, 32, 105, 5, 100, 101, 102, 103,
737 3, 5, 7, 18, 33, 102, 5, 7, 9, 11,
738 12, 16, 18, 20, 24, 26, 34, 35, 38, 39,
739 40, 41, 42, 43, 44, 45, 46, 52, 69, 70,
740 72, 73, 74, 77, 78, 79, 80, 81, 82, 83,
741 84, 85, 88, 89, 90, 91, 92, 96, 97, 98,
742 99, 3, 3, 19, 8, 49, 75, 76, 54, 10,
743 17, 54, 76, 10, 54, 19, 25, 17, 54, 76,
744 54, 76, 76, 76, 76, 76, 76, 76, 4, 13,
745 14, 23, 68, 28, 29, 91, 49, 54, 4, 3,
746 49, 75, 5, 49, 64, 65, 76, 91, 5, 94,
747 95, 17, 54, 95, 27, 91, 95, 17, 5, 86,
748 87, 53, 4, 5, 62, 67, 54, 62, 50, 49,
749 4, 47, 48, 59, 60, 61, 51, 55, 92, 93,
750 51, 55, 91, 87, 55, 5, 55, 91, 49, 51,
751 55, 53, 56, 55, 67, 50, 56, 61, 4, 4,
752 50, 64, 6, 15, 71, 94, 55, 4, 86, 56,
753 55, 56, 50, 5, 21, 22, 61, 63, 50, 62,
757 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
758 static const yytype_uint8 yyr1[] =
760 0, 57, 58, 58, 59, 59, 60, 61, 61, 62,
761 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
762 67, 68, 68, 68, 69, 69, 70, 70, 70, 71,
763 71, 71, 72, 72, 72, 73, 74, 74, 75, 75,
764 76, 76, 77, 77, 78, 78, 79, 79, 80, 80,
765 81, 81, 82, 82, 83, 83, 84, 84, 85, 85,
766 85, 85, 85, 85, 85, 86, 87, 87, 88, 88,
767 89, 90, 91, 91, 91, 91, 91, 91, 91, 91,
768 91, 91, 91, 91, 91, 91, 91, 92, 92, 93,
769 93, 93, 94, 95, 95, 96, 96, 96, 97, 97,
770 97, 98, 99, 99, 100, 101, 101, 101, 102, 102,
771 103, 103, 104, 105, 106, 106, 107
774 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
775 static const yytype_uint8 yyr2[] =
777 0, 2, 0, 2, 1, 2, 2, 1, 1, 1,
778 1, 1, 1, 3, 4, 1, 3, 1, 4, 1,
779 2, 1, 1, 1, 3, 4, 1, 2, 2, 2,
780 2, 2, 1, 4, 7, 1, 1, 1, 4, 7,
781 1, 3, 2, 3, 1, 2, 1, 2, 1, 2,
782 1, 2, 1, 2, 1, 2, 1, 2, 1, 1,
783 1, 1, 1, 1, 1, 4, 1, 3, 2, 5,
784 4, 2, 1, 2, 1, 1, 1, 1, 1, 1,
785 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
786 2, 2, 2, 1, 3, 4, 3, 4, 4, 3,
787 4, 4, 1, 4, 3, 7, 6, 4, 1, 1,
792 #define yyerrok (yyerrstatus = 0)
793 #define yyclearin (yychar = YYEMPTY)
797 #define YYACCEPT goto yyacceptlab
798 #define YYABORT goto yyabortlab
799 #define YYERROR goto yyerrorlab
802 #define YYRECOVERING() (!!yyerrstatus)
804 #define YYBACKUP(Token, Value) \
806 if (yychar == YYEMPTY) \
810 YYPOPSTACK (yylen); \
816 yyerror (parm, YY_("syntax error: cannot back up")); \
821 /* Error token number */
823 #define YYERRCODE 256
827 /* Enable debugging if requested. */
831 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
832 # define YYFPRINTF fprintf
835 # define YYDPRINTF(Args) \
841 /* This macro is provided for backward compatibility. */
842 #ifndef YY_LOCATION_PRINT
843 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
847 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
851 YYFPRINTF (stderr, "%s ", Title); \
852 yy_symbol_print (stderr, \
853 Type, Value, parm); \
854 YYFPRINTF (stderr, "\n"); \
859 /*-----------------------------------.
860 | Print this symbol's value on YYO. |
861 `-----------------------------------*/
864 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, void *parm)
866 FILE *yyoutput = yyo;
872 if (yytype < YYNTOKENS)
873 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
879 /*---------------------------.
880 | Print this symbol on YYO. |
881 `---------------------------*/
884 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, void *parm)
886 YYFPRINTF (yyo, "%s %s (",
887 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
889 yy_symbol_value_print (yyo, yytype, yyvaluep, parm);
890 YYFPRINTF (yyo, ")");
893 /*------------------------------------------------------------------.
894 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
896 `------------------------------------------------------------------*/
899 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
901 YYFPRINTF (stderr, "Stack now");
902 for (; yybottom <= yytop; yybottom++)
904 int yybot = *yybottom;
905 YYFPRINTF (stderr, " %d", yybot);
907 YYFPRINTF (stderr, "\n");
910 # define YY_STACK_PRINT(Bottom, Top) \
913 yy_stack_print ((Bottom), (Top)); \
917 /*------------------------------------------------.
918 | Report that the YYRULE is going to be reduced. |
919 `------------------------------------------------*/
922 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *parm)
924 unsigned long yylno = yyrline[yyrule];
925 int yynrhs = yyr2[yyrule];
927 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
929 /* The symbols being reduced. */
930 for (yyi = 0; yyi < yynrhs; yyi++)
932 YYFPRINTF (stderr, " $%d = ", yyi + 1);
933 yy_symbol_print (stderr,
934 yystos[yyssp[yyi + 1 - yynrhs]],
935 &yyvsp[(yyi + 1) - (yynrhs)]
937 YYFPRINTF (stderr, "\n");
941 # define YY_REDUCE_PRINT(Rule) \
944 yy_reduce_print (yyssp, yyvsp, Rule, parm); \
947 /* Nonzero means print parse trace. It is left uninitialized so that
948 multiple parsers can coexist. */
951 # define YYDPRINTF(Args)
952 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
953 # define YY_STACK_PRINT(Bottom, Top)
954 # define YY_REDUCE_PRINT(Rule)
955 #endif /* !YYDEBUG */
958 /* YYINITDEPTH -- initial size of the parser's stacks. */
960 # define YYINITDEPTH 200
963 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
964 if the built-in stack extension method is used).
966 Do not make this value too large; the results are undefined if
967 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
968 evaluated with infinite-precision integer arithmetic. */
971 # define YYMAXDEPTH 10000
978 # if defined __GLIBC__ && defined _STRING_H
979 # define yystrlen strlen
981 /* Return the length of YYSTR. */
983 yystrlen (const char *yystr)
986 for (yylen = 0; yystr[yylen]; yylen++)
994 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
995 # define yystpcpy stpcpy
997 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1000 yystpcpy (char *yydest, const char *yysrc)
1003 const char *yys = yysrc;
1005 while ((*yyd++ = *yys++) != '\0')
1014 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1015 quotes and backslashes, so that it's suitable for yyerror. The
1016 heuristic is that double-quoting is unnecessary unless the string
1017 contains an apostrophe, a comma, or backslash (other than
1018 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1019 null, do not copy; instead, return the length of what the result
1022 yytnamerr (char *yyres, const char *yystr)
1027 char const *yyp = yystr;
1034 goto do_not_strip_quotes;
1038 goto do_not_strip_quotes;
1054 do_not_strip_quotes: ;
1058 return yystrlen (yystr);
1060 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
1064 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1065 about the unexpected token YYTOKEN for the state stack whose top is
1068 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1069 not large enough to hold the message. In that case, also set
1070 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1071 required number of bytes is too large to store. */
1073 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1074 yytype_int16 *yyssp, int yytoken)
1076 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1077 YYSIZE_T yysize = yysize0;
1078 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1079 /* Internationalized format string. */
1080 const char *yyformat = YY_NULLPTR;
1081 /* Arguments of yyformat. */
1082 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1083 /* Number of reported tokens (one for the "unexpected", one per
1087 /* There are many possibilities here to consider:
1088 - If this state is a consistent state with a default action, then
1089 the only way this function was invoked is if the default action
1090 is an error action. In that case, don't check for expected
1091 tokens because there are none.
1092 - The only way there can be no lookahead present (in yychar) is if
1093 this state is a consistent state with a default action. Thus,
1094 detecting the absence of a lookahead is sufficient to determine
1095 that there is no unexpected or expected token to report. In that
1096 case, just report a simple "syntax error".
1097 - Don't assume there isn't a lookahead just because this state is a
1098 consistent state with a default action. There might have been a
1099 previous inconsistent state, consistent state with a non-default
1100 action, or user semantic action that manipulated yychar.
1101 - Of course, the expected token list depends on states to have
1102 correct lookahead information, and it depends on the parser not
1103 to perform extra reductions after fetching a lookahead from the
1104 scanner and before detecting a syntax error. Thus, state merging
1105 (from LALR or IELR) and default reductions corrupt the expected
1106 token list. However, the list is correct for canonical LR with
1107 one exception: it will still contain any token that will not be
1108 accepted due to an error action in a later state.
1110 if (yytoken != YYEMPTY)
1112 int yyn = yypact[*yyssp];
1113 yyarg[yycount++] = yytname[yytoken];
1114 if (!yypact_value_is_default (yyn))
1116 /* Start YYX at -YYN if negative to avoid negative indexes in
1117 YYCHECK. In other words, skip the first -YYN actions for
1118 this state because they are default actions. */
1119 int yyxbegin = yyn < 0 ? -yyn : 0;
1120 /* Stay within bounds of both yycheck and yytname. */
1121 int yychecklim = YYLAST - yyn + 1;
1122 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1125 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1126 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1127 && !yytable_value_is_error (yytable[yyx + yyn]))
1129 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1135 yyarg[yycount++] = yytname[yyx];
1137 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1138 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1149 # define YYCASE_(N, S) \
1153 default: /* Avoid compiler warnings. */
1154 YYCASE_(0, YY_("syntax error"));
1155 YYCASE_(1, YY_("syntax error, unexpected %s"));
1156 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1157 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1158 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1159 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1164 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1165 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1171 if (*yymsg_alloc < yysize)
1173 *yymsg_alloc = 2 * yysize;
1174 if (! (yysize <= *yymsg_alloc
1175 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1176 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1180 /* Avoid sprintf, as that infringes on the user's name space.
1181 Don't have undefined behavior even if the translation
1182 produced a string with the wrong number of "%s"s. */
1186 while ((*yyp = *yyformat) != '\0')
1187 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1189 yyp += yytnamerr (yyp, yyarg[yyi++]);
1200 #endif /* YYERROR_VERBOSE */
1202 /*-----------------------------------------------.
1203 | Release the memory associated to this symbol. |
1204 `-----------------------------------------------*/
1207 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *parm)
1213 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1215 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1217 YY_IGNORE_MAYBE_UNINITIALIZED_END
1228 yyparse (void *parm)
1230 /* The lookahead symbol. */
1234 /* The semantic value of the lookahead symbol. */
1235 /* Default value used for initialization, for pacifying older GCCs
1236 or non-GCC compilers. */
1237 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1238 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1240 /* Number of syntax errors so far. */
1244 /* Number of tokens to shift before error messages enabled. */
1247 /* The stacks and their tools:
1248 'yyss': related to states.
1249 'yyvs': related to semantic values.
1251 Refer to the stacks through separate pointers, to allow yyoverflow
1252 to reallocate them elsewhere. */
1254 /* The state stack. */
1255 yytype_int16 yyssa[YYINITDEPTH];
1257 yytype_int16 *yyssp;
1259 /* The semantic value stack. */
1260 YYSTYPE yyvsa[YYINITDEPTH];
1264 YYSIZE_T yystacksize;
1268 /* Lookahead token as an internal (translated) token number. */
1270 /* The variables used to return semantic value and location from the
1275 /* Buffer for error messages, and its allocated size. */
1277 char *yymsg = yymsgbuf;
1278 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1281 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1283 /* The number of symbols on the RHS of the reduced rule.
1284 Keep to zero when no symbol should be popped. */
1287 yyssp = yyss = yyssa;
1288 yyvsp = yyvs = yyvsa;
1289 yystacksize = YYINITDEPTH;
1291 YYDPRINTF ((stderr, "Starting parse\n"));
1296 yychar = YYEMPTY; /* Cause a token to be read. */
1300 /*------------------------------------------------------------.
1301 | yynewstate -- push a new state, which is found in yystate. |
1302 `------------------------------------------------------------*/
1304 /* In all cases, when you get here, the value and location stacks
1305 have just been pushed. So pushing a state here evens the stacks. */
1309 /*--------------------------------------------------------------------.
1310 | yynewstate -- set current state (the top of the stack) to yystate. |
1311 `--------------------------------------------------------------------*/
1313 *yyssp = (yytype_int16) yystate;
1315 if (yyss + yystacksize - 1 <= yyssp)
1316 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1317 goto yyexhaustedlab;
1320 /* Get the current used size of the three stacks, in elements. */
1321 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1323 # if defined yyoverflow
1325 /* Give user a chance to reallocate the stack. Use copies of
1326 these so that the &'s don't force the real ones into
1328 YYSTYPE *yyvs1 = yyvs;
1329 yytype_int16 *yyss1 = yyss;
1331 /* Each stack pointer address is followed by the size of the
1332 data in use in that stack, in bytes. This used to be a
1333 conditional around just the two extra args, but that might
1334 be undefined if yyoverflow is a macro. */
1335 yyoverflow (YY_("memory exhausted"),
1336 &yyss1, yysize * sizeof (*yyssp),
1337 &yyvs1, yysize * sizeof (*yyvsp),
1342 # else /* defined YYSTACK_RELOCATE */
1343 /* Extend the stack our own way. */
1344 if (YYMAXDEPTH <= yystacksize)
1345 goto yyexhaustedlab;
1347 if (YYMAXDEPTH < yystacksize)
1348 yystacksize = YYMAXDEPTH;
1351 yytype_int16 *yyss1 = yyss;
1352 union yyalloc *yyptr =
1353 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1355 goto yyexhaustedlab;
1356 YYSTACK_RELOCATE (yyss_alloc, yyss);
1357 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1358 # undef YYSTACK_RELOCATE
1360 YYSTACK_FREE (yyss1);
1364 yyssp = yyss + yysize - 1;
1365 yyvsp = yyvs + yysize - 1;
1367 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1368 (unsigned long) yystacksize));
1370 if (yyss + yystacksize - 1 <= yyssp)
1373 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1375 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1377 if (yystate == YYFINAL)
1387 /* Do appropriate processing given the current state. Read a
1388 lookahead token if we need one and don't already have one. */
1390 /* First try to decide what to do without reference to lookahead token. */
1391 yyn = yypact[yystate];
1392 if (yypact_value_is_default (yyn))
1395 /* Not known => get a lookahead token if don't already have one. */
1397 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1398 if (yychar == YYEMPTY)
1400 YYDPRINTF ((stderr, "Reading a token: "));
1401 yychar = yylex (&yylval, parm);
1404 if (yychar <= YYEOF)
1406 yychar = yytoken = YYEOF;
1407 YYDPRINTF ((stderr, "Now at end of input.\n"));
1411 yytoken = YYTRANSLATE (yychar);
1412 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1415 /* If the proper action on seeing token YYTOKEN is to reduce or to
1416 detect an error, take that action. */
1418 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1423 if (yytable_value_is_error (yyn))
1429 /* Count tokens shifted since error; after three, turn off error
1434 /* Shift the lookahead token. */
1435 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1437 /* Discard the shifted token. */
1441 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1443 YY_IGNORE_MAYBE_UNINITIALIZED_END
1448 /*-----------------------------------------------------------.
1449 | yydefault -- do the default action for the current state. |
1450 `-----------------------------------------------------------*/
1452 yyn = yydefact[yystate];
1458 /*-----------------------------.
1459 | yyreduce -- do a reduction. |
1460 `-----------------------------*/
1462 /* yyn is the number of a rule to reduce with. */
1465 /* If YYLEN is nonzero, implement the default value of the action:
1468 Otherwise, the following line sets YYVAL to garbage.
1469 This behavior is undocumented and Bison
1470 users should not rely upon it. Assigning to YYVAL
1471 unconditionally makes the parser a bit smaller, and it avoids a
1472 GCC warning that YYVAL may be used uninitialized. */
1473 yyval = yyvsp[1-yylen];
1476 YY_REDUCE_PRINT (yyn);
1480 #line 183 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1481 { strcpy((yyval.str),(yyvsp[0].str)); }
1482 #line 1483 "asn1-parse.c" /* yacc.c:1652 */
1486 #line 184 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1487 { strcpy((yyval.str),(yyvsp[0].str)); }
1488 #line 1489 "asn1-parse.c" /* yacc.c:1652 */
1492 #line 188 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1494 strcpy((yyval.str),"-");
1495 strcat((yyval.str),(yyvsp[0].str));
1497 #line 1498 "asn1-parse.c" /* yacc.c:1652 */
1501 #line 194 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1502 { strcpy((yyval.str),(yyvsp[0].str)); }
1503 #line 1504 "asn1-parse.c" /* yacc.c:1652 */
1507 #line 195 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1508 { strcpy((yyval.str),(yyvsp[0].str)); }
1509 #line 1510 "asn1-parse.c" /* yacc.c:1652 */
1513 #line 198 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1514 {strcpy((yyval.str),(yyvsp[0].str));}
1515 #line 1516 "asn1-parse.c" /* yacc.c:1652 */
1519 #line 199 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1520 {strcpy((yyval.str),(yyvsp[0].str));}
1521 #line 1522 "asn1-parse.c" /* yacc.c:1652 */
1525 #line 202 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1526 {strcpy((yyval.str),(yyvsp[0].str));}
1527 #line 1528 "asn1-parse.c" /* yacc.c:1652 */
1531 #line 203 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1532 {strcpy((yyval.str),(yyvsp[0].str));}
1533 #line 1534 "asn1-parse.c" /* yacc.c:1652 */
1537 #line 207 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1539 (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1540 set_str_value ((yyval.node), (yyvsp[-1].str));
1542 #line 1543 "asn1-parse.c" /* yacc.c:1652 */
1546 #line 212 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1548 (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1549 set_name ((yyval.node), (yyvsp[-3].str));
1550 set_str_value ((yyval.node), (yyvsp[-1].str));
1552 #line 1553 "asn1-parse.c" /* yacc.c:1652 */
1556 #line 219 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1557 { (yyval.node)=(yyvsp[0].node); }
1558 #line 1559 "asn1-parse.c" /* yacc.c:1652 */
1562 #line 221 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1564 (yyval.node) = (yyvsp[-2].node);
1565 append_right ((yyvsp[-2].node), (yyvsp[0].node));
1567 #line 1568 "asn1-parse.c" /* yacc.c:1652 */
1571 #line 246 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1573 (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1574 set_str_value ((yyval.node), (yyvsp[0].str));
1576 #line 1577 "asn1-parse.c" /* yacc.c:1652 */
1580 #line 251 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1582 (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1583 set_name ((yyval.node), (yyvsp[-3].str));
1584 set_str_value ((yyval.node), (yyvsp[-1].str));
1586 #line 1587 "asn1-parse.c" /* yacc.c:1652 */
1590 #line 259 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1591 { (yyval.node)=(yyvsp[0].node);}
1592 #line 1593 "asn1-parse.c" /* yacc.c:1652 */
1596 #line 261 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1598 (yyval.node)=(yyvsp[-1].node);
1599 append_right ((yyval.node), (yyvsp[0].node));
1601 #line 1602 "asn1-parse.c" /* yacc.c:1652 */
1605 #line 267 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1606 { (yyval.constant) = CLASS_UNIVERSAL; }
1607 #line 1608 "asn1-parse.c" /* yacc.c:1652 */
1611 #line 268 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1612 { (yyval.constant) = CLASS_PRIVATE; }
1613 #line 1614 "asn1-parse.c" /* yacc.c:1652 */
1617 #line 269 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1618 { (yyval.constant) = CLASS_APPLICATION; }
1619 #line 1620 "asn1-parse.c" /* yacc.c:1652 */
1623 #line 273 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1625 (yyval.node) = NEW_NODE (TYPE_TAG);
1626 (yyval.node)->flags.class = CLASS_CONTEXT;
1627 set_ulong_value ((yyval.node), (yyvsp[-1].str));
1629 #line 1630 "asn1-parse.c" /* yacc.c:1652 */
1633 #line 279 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1635 (yyval.node) = NEW_NODE (TYPE_TAG);
1636 (yyval.node)->flags.class = (yyvsp[-2].constant);
1637 set_ulong_value ((yyval.node), (yyvsp[-1].str));
1639 #line 1640 "asn1-parse.c" /* yacc.c:1652 */
1643 #line 287 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1644 { (yyval.node) = (yyvsp[0].node); }
1645 #line 1646 "asn1-parse.c" /* yacc.c:1652 */
1649 #line 289 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1651 (yyval.node) = (yyvsp[-1].node);
1652 (yyval.node)->flags.explicit = 1;
1654 #line 1655 "asn1-parse.c" /* yacc.c:1652 */
1658 #line 294 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1660 (yyval.node) = (yyvsp[-1].node);
1661 (yyval.node)->flags.implicit = 1;
1663 #line 1664 "asn1-parse.c" /* yacc.c:1652 */
1667 #line 301 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1669 (yyval.node) = NEW_NODE (TYPE_DEFAULT);
1670 set_str_value ((yyval.node), (yyvsp[0].str));
1672 #line 1673 "asn1-parse.c" /* yacc.c:1652 */
1676 #line 306 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1678 (yyval.node) = NEW_NODE (TYPE_DEFAULT);
1679 (yyval.node)->flags.is_true = 1;
1681 #line 1682 "asn1-parse.c" /* yacc.c:1652 */
1685 #line 311 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1687 (yyval.node) = NEW_NODE (TYPE_DEFAULT);
1688 (yyval.node)->flags.is_false = 1;
1690 #line 1691 "asn1-parse.c" /* yacc.c:1652 */
1694 #line 318 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1696 (yyval.node) = NEW_NODE (TYPE_INTEGER);
1698 #line 1699 "asn1-parse.c" /* yacc.c:1652 */
1702 #line 322 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1704 (yyval.node) = NEW_NODE (TYPE_INTEGER);
1705 (yyval.node)->flags.has_list = 1;
1706 set_down ((yyval.node), (yyvsp[-1].node));
1708 #line 1709 "asn1-parse.c" /* yacc.c:1652 */
1712 #line 328 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1714 (yyval.node) = NEW_NODE (TYPE_INTEGER);
1715 (yyval.node)->flags.has_min_max = 1;
1716 /* the following is wrong. Better use a union for the value*/
1717 set_down ((yyval.node), NEW_NODE (TYPE_SIZE) );
1718 set_str_value ((yyval.node)->down, (yyvsp[-1].str));
1719 set_name ((yyval.node)->down, (yyvsp[-4].str));
1721 #line 1722 "asn1-parse.c" /* yacc.c:1652 */
1725 #line 339 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1727 (yyval.node) = NEW_NODE (TYPE_BOOLEAN);
1729 #line 1730 "asn1-parse.c" /* yacc.c:1652 */
1733 #line 345 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1735 (yyval.node) = NEW_NODE (TYPE_UTC_TIME);
1737 #line 1738 "asn1-parse.c" /* yacc.c:1652 */
1741 #line 349 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1743 (yyval.node) = NEW_NODE (TYPE_GENERALIZED_TIME);
1745 #line 1746 "asn1-parse.c" /* yacc.c:1652 */
1749 #line 355 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1751 (yyval.node) = NEW_NODE (TYPE_SIZE);
1752 (yyval.node)->flags.one_param = 1;
1753 set_str_value ((yyval.node), (yyvsp[-1].str));
1755 #line 1756 "asn1-parse.c" /* yacc.c:1652 */
1759 #line 361 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1761 (yyval.node) = NEW_NODE (TYPE_SIZE);
1762 (yyval.node)->flags.has_min_max = 1;
1763 set_str_value ((yyval.node), (yyvsp[-4].str));
1764 set_name ((yyval.node), (yyvsp[-1].str));
1766 #line 1767 "asn1-parse.c" /* yacc.c:1652 */
1770 #line 370 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1772 (yyval.node)=(yyvsp[0].node);
1774 #line 1775 "asn1-parse.c" /* yacc.c:1652 */
1778 #line 374 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1780 (yyval.node)=(yyvsp[-1].node);
1782 #line 1783 "asn1-parse.c" /* yacc.c:1652 */
1786 #line 380 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1788 (yyval.node) = NEW_NODE (TYPE_OCTET_STRING);
1790 #line 1791 "asn1-parse.c" /* yacc.c:1652 */
1794 #line 384 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1796 (yyval.node) = NEW_NODE (TYPE_OCTET_STRING);
1797 (yyval.node)->flags.has_size = 1;
1798 set_down ((yyval.node),(yyvsp[0].node));
1800 #line 1801 "asn1-parse.c" /* yacc.c:1652 */
1804 #line 391 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1805 { (yyval.node) = NEW_NODE (TYPE_UTF8_STRING); }
1806 #line 1807 "asn1-parse.c" /* yacc.c:1652 */
1810 #line 393 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1812 (yyval.node) = NEW_NODE (TYPE_UTF8_STRING);
1813 (yyval.node)->flags.has_size = 1;
1814 set_down ((yyval.node),(yyvsp[0].node));
1816 #line 1817 "asn1-parse.c" /* yacc.c:1652 */
1820 #line 399 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1821 { (yyval.node) = NEW_NODE (TYPE_NUMERIC_STRING); }
1822 #line 1823 "asn1-parse.c" /* yacc.c:1652 */
1826 #line 401 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1828 (yyval.node) = NEW_NODE (TYPE_NUMERIC_STRING);
1829 (yyval.node)->flags.has_size = 1;
1830 set_down ((yyval.node),(yyvsp[0].node));
1832 #line 1833 "asn1-parse.c" /* yacc.c:1652 */
1836 #line 408 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1837 { (yyval.node) = NEW_NODE (TYPE_PRINTABLE_STRING); }
1838 #line 1839 "asn1-parse.c" /* yacc.c:1652 */
1842 #line 410 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1844 (yyval.node) = NEW_NODE (TYPE_PRINTABLE_STRING);
1845 (yyval.node)->flags.has_size = 1;
1846 set_down ((yyval.node),(yyvsp[0].node));
1848 #line 1849 "asn1-parse.c" /* yacc.c:1652 */
1852 #line 417 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1853 { (yyval.node) = NEW_NODE (TYPE_TELETEX_STRING); }
1854 #line 1855 "asn1-parse.c" /* yacc.c:1652 */
1858 #line 419 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1860 (yyval.node) = NEW_NODE (TYPE_TELETEX_STRING);
1861 (yyval.node)->flags.has_size = 1;
1862 set_down ((yyval.node),(yyvsp[0].node));
1864 #line 1865 "asn1-parse.c" /* yacc.c:1652 */
1868 #line 425 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1869 { (yyval.node) = NEW_NODE (TYPE_IA5_STRING); }
1870 #line 1871 "asn1-parse.c" /* yacc.c:1652 */
1874 #line 427 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1876 (yyval.node) = NEW_NODE (TYPE_IA5_STRING);
1877 (yyval.node)->flags.has_size = 1;
1878 set_down ((yyval.node),(yyvsp[0].node));
1880 #line 1881 "asn1-parse.c" /* yacc.c:1652 */
1884 #line 434 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1885 { (yyval.node) = NEW_NODE (TYPE_UNIVERSAL_STRING); }
1886 #line 1887 "asn1-parse.c" /* yacc.c:1652 */
1890 #line 436 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1892 (yyval.node) = NEW_NODE (TYPE_UNIVERSAL_STRING);
1893 (yyval.node)->flags.has_size = 1;
1894 set_down ((yyval.node),(yyvsp[0].node));
1896 #line 1897 "asn1-parse.c" /* yacc.c:1652 */
1900 #line 442 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1901 { (yyval.node) = NEW_NODE (TYPE_BMP_STRING); }
1902 #line 1903 "asn1-parse.c" /* yacc.c:1652 */
1906 #line 444 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1908 (yyval.node) = NEW_NODE (TYPE_BMP_STRING);
1909 (yyval.node)->flags.has_size = 1;
1910 set_down ((yyval.node),(yyvsp[0].node));
1912 #line 1913 "asn1-parse.c" /* yacc.c:1652 */
1916 #line 465 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1918 (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1919 set_name ((yyval.node), (yyvsp[-3].str));
1920 set_str_value ((yyval.node), (yyvsp[-1].str));
1922 #line 1923 "asn1-parse.c" /* yacc.c:1652 */
1926 #line 473 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1928 (yyval.node)=(yyvsp[0].node);
1930 #line 1931 "asn1-parse.c" /* yacc.c:1652 */
1934 #line 477 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1936 (yyval.node)=(yyvsp[-2].node);
1937 append_right ((yyval.node), (yyvsp[0].node));
1939 #line 1940 "asn1-parse.c" /* yacc.c:1652 */
1943 #line 484 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1945 (yyval.node) = NEW_NODE (TYPE_BIT_STRING);
1947 #line 1948 "asn1-parse.c" /* yacc.c:1652 */
1951 #line 488 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1953 (yyval.node) = NEW_NODE (TYPE_BIT_STRING);
1954 (yyval.node)->flags.has_list = 1;
1955 set_down ((yyval.node), (yyvsp[-1].node));
1957 #line 1958 "asn1-parse.c" /* yacc.c:1652 */
1961 #line 496 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1963 (yyval.node) = NEW_NODE (TYPE_ENUMERATED);
1964 (yyval.node)->flags.has_list = 1;
1965 set_down ((yyval.node), (yyvsp[-1].node));
1967 #line 1968 "asn1-parse.c" /* yacc.c:1652 */
1971 #line 504 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1973 (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
1975 #line 1976 "asn1-parse.c" /* yacc.c:1652 */
1979 #line 510 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1981 (yyval.node) = NEW_NODE (TYPE_IDENTIFIER);
1982 set_str_value ((yyval.node), (yyvsp[0].str));
1984 #line 1985 "asn1-parse.c" /* yacc.c:1652 */
1988 #line 515 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
1990 (yyval.node) = NEW_NODE (TYPE_IDENTIFIER);
1991 (yyval.node)->flags.has_size = 1;
1992 set_str_value ((yyval.node), (yyvsp[-1].str));
1993 set_down ((yyval.node), (yyvsp[0].node));
1995 #line 1996 "asn1-parse.c" /* yacc.c:1652 */
1999 #line 521 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2000 {(yyval.node)=(yyvsp[0].node);}
2001 #line 2002 "asn1-parse.c" /* yacc.c:1652 */
2005 #line 522 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2006 {(yyval.node)=(yyvsp[0].node);}
2007 #line 2008 "asn1-parse.c" /* yacc.c:1652 */
2011 #line 523 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2012 {(yyval.node)=(yyvsp[0].node);}
2013 #line 2014 "asn1-parse.c" /* yacc.c:1652 */
2017 #line 524 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2018 {(yyval.node)=(yyvsp[0].node);}
2019 #line 2020 "asn1-parse.c" /* yacc.c:1652 */
2023 #line 526 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2024 {(yyval.node)=(yyvsp[0].node);}
2025 #line 2026 "asn1-parse.c" /* yacc.c:1652 */
2029 #line 527 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2030 {(yyval.node)=(yyvsp[0].node);}
2031 #line 2032 "asn1-parse.c" /* yacc.c:1652 */
2035 #line 528 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2036 {(yyval.node)=(yyvsp[0].node);}
2037 #line 2038 "asn1-parse.c" /* yacc.c:1652 */
2041 #line 529 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2042 {(yyval.node)=(yyvsp[0].node);}
2043 #line 2044 "asn1-parse.c" /* yacc.c:1652 */
2047 #line 530 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2048 {(yyval.node)=(yyvsp[0].node);}
2049 #line 2050 "asn1-parse.c" /* yacc.c:1652 */
2053 #line 531 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2054 {(yyval.node)=(yyvsp[0].node);}
2055 #line 2056 "asn1-parse.c" /* yacc.c:1652 */
2059 #line 532 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2060 {(yyval.node)=(yyvsp[0].node);}
2061 #line 2062 "asn1-parse.c" /* yacc.c:1652 */
2065 #line 534 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2067 (yyval.node) = NEW_NODE(TYPE_NULL);
2069 #line 2070 "asn1-parse.c" /* yacc.c:1652 */
2073 #line 540 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2075 (yyval.node) = (yyvsp[0].node);
2077 #line 2078 "asn1-parse.c" /* yacc.c:1652 */
2081 #line 544 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2083 /* $2->flags.has_tag = 1; */
2085 /* set_right ($1, $$->down ); */
2086 /* set_down ($$, $1); */
2087 (yyval.node) = (yyvsp[-1].node);
2088 set_down ((yyval.node), (yyvsp[0].node));
2090 #line 2091 "asn1-parse.c" /* yacc.c:1652 */
2094 #line 555 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2096 (yyval.node) = (yyvsp[0].node);
2098 #line 2099 "asn1-parse.c" /* yacc.c:1652 */
2102 #line 559 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2104 (yyvsp[-1].node)->flags.has_default = 1;
2105 (yyval.node) = (yyvsp[-1].node);
2106 set_right ((yyvsp[0].node), (yyval.node)->down);
2107 set_down ((yyval.node), (yyvsp[0].node));
2109 #line 2110 "asn1-parse.c" /* yacc.c:1652 */
2113 #line 566 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2115 (yyvsp[-1].node)->flags.is_optional = 1;
2116 (yyval.node) = (yyvsp[-1].node);
2118 #line 2119 "asn1-parse.c" /* yacc.c:1652 */
2122 #line 573 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2124 set_name ((yyvsp[0].node), (yyvsp[-1].str));
2125 (yyval.node) = (yyvsp[0].node);
2127 #line 2128 "asn1-parse.c" /* yacc.c:1652 */
2131 #line 580 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2132 { (yyval.node)=(yyvsp[0].node); }
2133 #line 2134 "asn1-parse.c" /* yacc.c:1652 */
2137 #line 582 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2139 (yyval.node)=(yyvsp[-2].node);
2140 append_right ((yyval.node), (yyvsp[0].node));
2142 #line 2143 "asn1-parse.c" /* yacc.c:1652 */
2146 #line 589 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2148 (yyval.node) = NEW_NODE (TYPE_SEQUENCE);
2149 set_down ((yyval.node), (yyvsp[-1].node));
2151 #line 2152 "asn1-parse.c" /* yacc.c:1652 */
2155 #line 594 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2157 (yyval.node) = NEW_NODE (TYPE_SEQUENCE_OF);
2158 set_down ((yyval.node), (yyvsp[0].node));
2160 #line 2161 "asn1-parse.c" /* yacc.c:1652 */
2164 #line 599 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2166 (yyval.node) = NEW_NODE (TYPE_SEQUENCE_OF);
2167 (yyval.node)->flags.has_size = 1;
2168 set_right ((yyvsp[-2].node),(yyvsp[0].node));
2169 set_down ((yyval.node),(yyvsp[-2].node));
2171 #line 2172 "asn1-parse.c" /* yacc.c:1652 */
2175 #line 608 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2177 (yyval.node) = NEW_NODE (TYPE_SET);
2178 set_down ((yyval.node), (yyvsp[-1].node));
2180 #line 2181 "asn1-parse.c" /* yacc.c:1652 */
2184 #line 613 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2186 (yyval.node) = NEW_NODE (TYPE_SET_OF);
2187 set_down ((yyval.node), (yyvsp[0].node));
2189 #line 2190 "asn1-parse.c" /* yacc.c:1652 */
2193 #line 618 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2195 (yyval.node) = NEW_NODE (TYPE_SET_OF);
2196 (yyval.node)->flags.has_size = 1;
2197 set_right ((yyvsp[-2].node), (yyvsp[0].node));
2198 set_down ((yyval.node), (yyvsp[-2].node));
2200 #line 2201 "asn1-parse.c" /* yacc.c:1652 */
2204 #line 627 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2206 (yyval.node) = NEW_NODE (TYPE_CHOICE);
2207 set_down ((yyval.node), (yyvsp[-1].node));
2209 #line 2210 "asn1-parse.c" /* yacc.c:1652 */
2213 #line 634 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2215 (yyval.node) = NEW_NODE (TYPE_ANY);
2217 #line 2218 "asn1-parse.c" /* yacc.c:1652 */
2221 #line 638 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2225 (yyval.node) = NEW_NODE (TYPE_ANY);
2226 (yyval.node)->flags.has_defined_by = 1;
2227 node = NEW_NODE (TYPE_CONSTANT);
2228 set_name (node, (yyvsp[0].str));
2229 set_down((yyval.node), node);
2231 #line 2232 "asn1-parse.c" /* yacc.c:1652 */
2235 #line 650 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2237 set_name ((yyvsp[0].node), (yyvsp[-2].str));
2238 (yyval.node) = (yyvsp[0].node);
2240 #line 2241 "asn1-parse.c" /* yacc.c:1652 */
2244 #line 657 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2246 (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2247 (yyval.node)->flags.assignment = 1;
2248 set_name ((yyval.node), (yyvsp[-6].str));
2249 set_down ((yyval.node), (yyvsp[-1].node));
2251 #line 2252 "asn1-parse.c" /* yacc.c:1652 */
2255 #line 664 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2257 (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2258 (yyval.node)->flags.assignment = 1;
2259 (yyval.node)->flags.one_param = 1;
2260 set_name ((yyval.node), (yyvsp[-5].str));
2261 set_str_value ((yyval.node), (yyvsp[-4].str));
2262 set_down ((yyval.node), (yyvsp[-1].node));
2264 #line 2265 "asn1-parse.c" /* yacc.c:1652 */
2268 #line 673 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2270 (yyval.node) = NEW_NODE (TYPE_INTEGER);
2271 (yyval.node)->flags.assignment = 1;
2272 set_name ((yyval.node), (yyvsp[-3].str));
2273 set_str_value ((yyval.node), (yyvsp[0].str));
2275 #line 2276 "asn1-parse.c" /* yacc.c:1652 */
2279 #line 681 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2280 { (yyval.node) = (yyvsp[0].node); }
2281 #line 2282 "asn1-parse.c" /* yacc.c:1652 */
2285 #line 682 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2286 { (yyval.node) = (yyvsp[0].node); }
2287 #line 2288 "asn1-parse.c" /* yacc.c:1652 */
2291 #line 686 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2292 { (yyval.node) = (yyvsp[0].node); }
2293 #line 2294 "asn1-parse.c" /* yacc.c:1652 */
2297 #line 688 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2299 (yyval.node) = (yyvsp[-1].node);
2300 append_right ((yyval.node), (yyvsp[0].node));
2302 #line 2303 "asn1-parse.c" /* yacc.c:1652 */
2306 #line 695 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2308 (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2309 set_down ((yyval.node), (yyvsp[-1].node));
2310 set_name ((yyval.node), (yyvsp[-3].str));
2312 #line 2313 "asn1-parse.c" /* yacc.c:1652 */
2316 #line 703 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2317 { (yyval.node)=NULL;}
2318 #line 2319 "asn1-parse.c" /* yacc.c:1652 */
2322 #line 719 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2323 { (yyval.constant) = CONST_EXPLICIT; }
2324 #line 2325 "asn1-parse.c" /* yacc.c:1652 */
2328 #line 720 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2329 { (yyval.constant) = CONST_IMPLICIT; }
2330 #line 2331 "asn1-parse.c" /* yacc.c:1652 */
2334 #line 726 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1652 */
2338 (yyval.node) = node = NEW_NODE (TYPE_DEFINITIONS);
2340 if ((yyvsp[-6].constant) == CONST_EXPLICIT)
2341 node->flags.explicit = 1;
2342 else if ((yyvsp[-6].constant) == CONST_IMPLICIT)
2343 node->flags.implicit = 1;
2345 if ((yyvsp[-2].node))
2346 node->flags.has_imports = 1;
2348 set_name ((yyval.node), (yyvsp[-8].node)->name);
2349 set_name ((yyvsp[-8].node), "");
2351 if (!node->flags.has_imports)
2352 set_right ((yyvsp[-8].node),(yyvsp[-1].node));
2355 set_right ((yyvsp[-2].node),(yyvsp[-1].node));
2356 set_right ((yyvsp[-8].node),(yyvsp[-2].node));
2359 set_down ((yyval.node), (yyvsp[-8].node));
2361 _ksba_asn_set_default_tag ((yyval.node));
2362 _ksba_asn_type_set_config ((yyval.node));
2363 PARSECTL->result_parse = _ksba_asn_check_identifier((yyval.node));
2364 PARSECTL->parse_tree=(yyval.node);
2366 #line 2367 "asn1-parse.c" /* yacc.c:1652 */
2370 #line 2371 "asn1-parse.c" /* yacc.c:1652 */
2373 /* User semantic actions sometimes alter yychar, and that requires
2374 that yytoken be updated with the new translation. We take the
2375 approach of translating immediately before every use of yytoken.
2376 One alternative is translating here after every semantic action,
2377 but that translation would be missed if the semantic action invokes
2378 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2379 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2380 incorrect destructor might then be invoked immediately. In the
2381 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2382 to an incorrect destructor call or verbose syntax error message
2383 before the lookahead is translated. */
2384 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2388 YY_STACK_PRINT (yyss, yyssp);
2392 /* Now 'shift' the result of the reduction. Determine what state
2393 that goes to, based on the state we popped back to and the rule
2394 number reduced by. */
2396 const int yylhs = yyr1[yyn] - YYNTOKENS;
2397 const int yyi = yypgoto[yylhs] + *yyssp;
2398 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2400 : yydefgoto[yylhs]);
2406 /*--------------------------------------.
2407 | yyerrlab -- here on detecting error. |
2408 `--------------------------------------*/
2410 /* Make sure we have latest lookahead translation. See comments at
2411 user semantic actions for why this is necessary. */
2412 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2414 /* If not already recovering from an error, report this error. */
2418 #if ! YYERROR_VERBOSE
2419 yyerror (parm, YY_("syntax error"));
2421 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2424 char const *yymsgp = YY_("syntax error");
2425 int yysyntax_error_status;
2426 yysyntax_error_status = YYSYNTAX_ERROR;
2427 if (yysyntax_error_status == 0)
2429 else if (yysyntax_error_status == 1)
2431 if (yymsg != yymsgbuf)
2432 YYSTACK_FREE (yymsg);
2433 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2437 yymsg_alloc = sizeof yymsgbuf;
2438 yysyntax_error_status = 2;
2442 yysyntax_error_status = YYSYNTAX_ERROR;
2446 yyerror (parm, yymsgp);
2447 if (yysyntax_error_status == 2)
2448 goto yyexhaustedlab;
2450 # undef YYSYNTAX_ERROR
2456 if (yyerrstatus == 3)
2458 /* If just tried and failed to reuse lookahead token after an
2459 error, discard it. */
2461 if (yychar <= YYEOF)
2463 /* Return failure if at end of input. */
2464 if (yychar == YYEOF)
2469 yydestruct ("Error: discarding",
2470 yytoken, &yylval, parm);
2475 /* Else will try to reuse lookahead token after shifting the error
2480 /*---------------------------------------------------.
2481 | yyerrorlab -- error raised explicitly by YYERROR. |
2482 `---------------------------------------------------*/
2484 /* Pacify compilers when the user code never invokes YYERROR and the
2485 label yyerrorlab therefore never appears in user code. */
2489 /* Do not reclaim the symbols of the rule whose action triggered
2493 YY_STACK_PRINT (yyss, yyssp);
2498 /*-------------------------------------------------------------.
2499 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2500 `-------------------------------------------------------------*/
2502 yyerrstatus = 3; /* Each real token shifted decrements this. */
2506 yyn = yypact[yystate];
2507 if (!yypact_value_is_default (yyn))
2510 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2518 /* Pop the current state because it cannot handle the error token. */
2523 yydestruct ("Error: popping",
2524 yystos[yystate], yyvsp, parm);
2527 YY_STACK_PRINT (yyss, yyssp);
2530 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2532 YY_IGNORE_MAYBE_UNINITIALIZED_END
2535 /* Shift the error token. */
2536 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2542 /*-------------------------------------.
2543 | yyacceptlab -- YYACCEPT comes here. |
2544 `-------------------------------------*/
2550 /*-----------------------------------.
2551 | yyabortlab -- YYABORT comes here. |
2552 `-----------------------------------*/
2558 #if !defined yyoverflow || YYERROR_VERBOSE
2559 /*-------------------------------------------------.
2560 | yyexhaustedlab -- memory exhaustion comes here. |
2561 `-------------------------------------------------*/
2563 yyerror (parm, YY_("memory exhausted"));
2569 /*-----------------------------------------------------.
2570 | yyreturn -- parsing is finished, return the result. |
2571 `-----------------------------------------------------*/
2573 if (yychar != YYEMPTY)
2575 /* Make sure we have latest lookahead translation. See comments at
2576 user semantic actions for why this is necessary. */
2577 yytoken = YYTRANSLATE (yychar);
2578 yydestruct ("Cleanup: discarding lookahead",
2579 yytoken, &yylval, parm);
2581 /* Do not reclaim the symbols of the rule whose action triggered
2582 this YYABORT or YYACCEPT. */
2584 YY_STACK_PRINT (yyss, yyssp);
2585 while (yyssp != yyss)
2587 yydestruct ("Cleanup: popping",
2588 yystos[*yyssp], yyvsp, parm);
2593 YYSTACK_FREE (yyss);
2596 if (yymsg != yymsgbuf)
2597 YYSTACK_FREE (yymsg);
2601 #line 759 "/home/wk/s/libksba/src/asn1-parse.y" /* yacc.c:1918 */
2605 struct token_table_s {
2610 static struct token_table_s token_table[] = {
2613 { "APPLICATION", APPLICATION },
2614 { "BEGIN", ksba_BEGIN },
2616 { "BMPString", BMPSTRING },
2617 { "BOOLEAN", ksba_BOOLEAN },
2619 { "CHOICE", CHOICE },
2620 { "DEFAULT", DEFAULT },
2621 { "DEFINED", DEFINED },
2622 { "DEFINITIONS", DEFINITIONS },
2623 { "END", ksba_END },
2624 { "ENUMERATED", ENUMERATED },
2625 { "EXPLICIT", EXPLICIT },
2626 { "FALSE", ksba_FALSE },
2628 { "GeneralizedTime", GeneralizedTime },
2629 { "IA5String", IA5STRING },
2630 { "IDENTIFIER", STR_IDENTIFIER },
2631 { "IMPLICIT", IMPLICIT },
2632 { "IMPORTS", IMPORTS },
2633 { "INTEGER", INTEGER },
2634 { "NULL", TOKEN_NULL },
2635 { "NumericString", NUMERICSTRING },
2636 { "OBJECT", OBJECT },
2639 { "OPTIONAL", OPTIONAL },
2640 { "PRIVATE", PRIVATE },
2641 { "PrintableString", PRINTABLESTRING },
2642 { "SEQUENCE", SEQUENCE },
2645 { "STRING", STRING },
2647 { "TRUE", ksba_TRUE },
2648 { "TeletexString", TELETEXSTRING },
2649 { "UNIVERSAL", UNIVERSAL },
2650 { "UTCTime", UTCTime },
2651 { "UTF8String", UTF8STRING },
2652 { "UniversalString", UNIVERSALSTRING },
2655 /*************************************************************/
2656 /* Function: yylex */
2657 /* Description: looks for tokens in file_asn1 pointer file. */
2659 /* Token identifier or ASCII code or 0(zero: End Of File) */
2660 /*************************************************************/
2662 yylex (YYSTYPE *lvalp, void *parm)
2665 char string[MAX_STRING_LENGTH];
2666 FILE *fp = PARSECTL->fp;
2668 if (!PARSECTL->lineno)
2669 PARSECTL->lineno++; /* start with line one */
2673 while ( (c=fgetc (fp))==' ' || c=='\t')
2683 if ( c=='(' || c==')' || c=='[' || c==']'
2684 || c=='{' || c=='}' || c==',' || c=='.' || c=='+')
2689 if ( (c=fgetc(fp))!='-')
2696 /* A comment finishes at the end of line */
2698 while ( (c=fgetc(fp))!=EOF && c != '\n' )
2703 continue; /* repeat the search */
2709 if (counter >= DIM (string)-1 )
2711 fprintf (stderr,"%s:%d: token too long\n", "myfile:",
2715 string[counter++]=c;
2717 while ( !((c=fgetc(fp))==EOF
2718 || c==' '|| c=='\t' || c=='\n'
2719 || c=='(' || c==')' || c=='[' || c==']'
2720 || c=='{' || c=='}' || c==',' || c=='.'));
2724 /*fprintf (stderr, "yylex token `%s'\n", string);*/
2726 /* Is STRING a number? */
2727 for (k=0; k<counter; k++)
2729 if(!isdigit(string[k]))
2734 strcpy (lvalp->str,string);
2735 if (PARSECTL->debug)
2736 fprintf (stderr,"%d: yylex found number `%s'\n",
2737 PARSECTL->lineno, string);
2741 /* Is STRING a keyword? */
2742 for (k = 0; k < DIM (token_table); k++)
2744 if (!strcmp (token_table[k].word, string))
2745 return token_table[k].token;
2748 /* STRING is an IDENTIFIER */
2749 strcpy(lvalp->str,string);
2750 if (PARSECTL->debug)
2751 fprintf (stderr,"%d: yylex found identifier `%s'\n",
2752 PARSECTL->lineno, string);
2758 yyerror (void *parm, const char *s)
2761 /* Sends the error description to stderr */
2762 fprintf (stderr, "%s\n", s);
2763 /* Why doesn't bison provide a way to pass the parm to yyerror?
2764 Update: Newer bison versions allow for this. We need to see how
2765 we can make use of it. */
2771 new_node (struct parser_control_s *parsectl, node_type_t type)
2775 node = xcalloc (1, sizeof *node);
2778 node->link_next = parsectl->all_nodes;
2779 parsectl->all_nodes = node;
2785 release_all_nodes (AsnNode node)
2789 for (; node; node = node2)
2791 node2 = node->link_next;
2794 if (node->valuetype == VALTYPE_CSTR)
2795 xfree (node->value.v_cstr);
2796 else if (node->valuetype == VALTYPE_MEM)
2797 xfree (node->value.v_mem.buf);
2804 set_name (AsnNode node, const char *name)
2806 _ksba_asn_set_name (node, name);
2810 set_str_value (AsnNode node, const char *text)
2813 _ksba_asn_set_value (node, VALTYPE_CSTR, text, 0);
2815 _ksba_asn_set_value (node, VALTYPE_NULL, NULL, 0);
2819 set_ulong_value (AsnNode node, const char *text)
2824 val = strtoul (text, NULL, 10);
2827 _ksba_asn_set_value (node, VALTYPE_ULONG, &val, sizeof(val));
2831 set_right (AsnNode node, AsnNode right)
2833 return_if_fail (node);
2835 node->right = right;
2841 append_right (AsnNode node, AsnNode right)
2843 return_if_fail (node);
2848 node->right = right;
2855 set_down (AsnNode node, AsnNode down)
2857 return_if_fail (node);
2866 * ksba_asn_parse_file:
2867 * @file_name: Filename with the ASN module
2868 * @pointer: Returns the syntax tree
2869 * @debug: Enable debug output
2871 * Parse an ASN.1 file and return an syntax tree.
2873 * Return value: 0 for okay or an ASN_xx error code
2876 ksba_asn_parse_file (const char *file_name, ksba_asn_tree_t *result, int debug)
2878 struct parser_control_s parsectl;
2882 parsectl.fp = file_name? fopen (file_name, "r") : NULL;
2884 return gpg_error_from_syserror ();
2886 parsectl.lineno = 0;
2887 parsectl.debug = debug;
2888 parsectl.result_parse = gpg_error (GPG_ERR_SYNTAX);
2889 parsectl.parse_tree = NULL;
2890 parsectl.all_nodes = NULL;
2892 if ( yyparse ((void*)&parsectl) || parsectl.result_parse )
2894 fprintf (stderr, "%s:%d: parse error\n",
2895 file_name?file_name:"-", parsectl.lineno );
2896 release_all_nodes (parsectl.all_nodes);
2897 parsectl.all_nodes = NULL;
2901 ksba_asn_tree_t tree;
2903 _ksba_asn_change_integer_value (parsectl.parse_tree);
2904 _ksba_asn_expand_object_id (parsectl.parse_tree);
2905 tree = xmalloc ( sizeof *tree + (file_name? strlen (file_name):1) );
2906 tree->parse_tree = parsectl.parse_tree;
2907 tree->node_list = parsectl.all_nodes;
2908 strcpy (tree->filename, file_name? file_name:"-");
2913 fclose (parsectl.fp);
2914 return parsectl.result_parse;
2918 ksba_asn_tree_release (ksba_asn_tree_t tree)
2922 release_all_nodes (tree->node_list);
2923 tree->node_list = NULL;
2929 _ksba_asn_release_nodes (AsnNode node)
2931 /* FIXME: it does not work yet because the allocation function in
2932 asn1-func.c does not link all nodes together */
2933 release_all_nodes (node);