1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.2"
50 #define YYSKELETON_NAME "yacc.c"
62 /* Substitute the variable and function names. */
63 #define yyparse _asn1_yyparse
64 #define yylex _asn1_yylex
65 #define yyerror _asn1_yyerror
66 #define yydebug _asn1_yydebug
67 #define yynerrs _asn1_yynerrs
69 #define yylval _asn1_yylval
70 #define yychar _asn1_yychar
72 /* Copy the first part of user declarations. */
73 #line 1 "ASN1.y" /* yacc.c:339 */
76 * Copyright (C) 2001-2014 Free Software Foundation, Inc.
78 * This file is part of LIBTASN1.
80 * The LIBTASN1 library is free software; you can redistribute it
81 * and/or modify it under the terms of the GNU Lesser General Public
82 * License as published by the Free Software Foundation; either
83 * version 2.1 of the License, or (at your option) any later version.
85 * This library is distributed in the hope that it will be useful, but
86 * WITHOUT ANY WARRANTY; without even the implied warranty of
87 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
88 * Lesser General Public License for more details.
90 * You should have received a copy of the GNU Lesser General Public
91 * License along with this library; if not, write to the Free Software
92 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
96 /*****************************************************/
97 /* File: x509_ASN.y */
98 /* Description: input file for 'bison' program. */
99 /* The output file is a parser (in C language) for */
101 /*****************************************************/
104 #include <parser_aux.h>
105 #include <structure.h>
106 #include <libtasn1.h>
108 static FILE *file_asn1; /* Pointer to file to parse */
109 static int result_parse = 0; /* result of the parser
111 static asn1_node p_tree; /* pointer to the root of the
112 structure created by the
114 static unsigned int line_number; /* line number describing the
115 parser position inside the
117 static char last_error[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = "";
118 static char last_error_token[ASN1_MAX_ERROR_DESCRIPTION_SIZE+1] = ""; /* used when expected errors occur */
119 static char last_token[ASN1_MAX_NAME_SIZE+1] = ""; /* last token find in the file
120 to parse before the 'parse
122 extern char _asn1_identifierMissing[];
123 static const char *file_name; /* file to parse */
125 static void _asn1_yyerror (const char *);
126 static int _asn1_yylex(void);
129 #line 130 "ASN1.c" /* yacc.c:339 */
132 # if defined __cplusplus && 201103L <= __cplusplus
133 # define YY_NULLPTR nullptr
135 # define YY_NULLPTR 0
139 /* Enabling verbose error messages. */
140 #ifdef YYERROR_VERBOSE
141 # undef YYERROR_VERBOSE
142 # define YYERROR_VERBOSE 1
144 # define YYERROR_VERBOSE 1
153 extern int _asn1_yydebug;
178 STR_IDENTIFIER = 275,
194 GeneralizedTime = 291,
199 PrintableString = 296,
200 UniversalString = 297,
212 #define IDENTIFIER 260
220 #define UNIVERSAL 268
222 #define APPLICATION 270
227 #define STR_IDENTIFIER 275
229 #define ASN1_TRUE 277
230 #define ASN1_FALSE 278
231 #define TOKEN_NULL 279
238 #define DEFINITIONS 286
243 #define GeneralizedTime 291
244 #define GeneralString 292
245 #define NumericString 293
246 #define IA5String 294
247 #define TeletexString 295
248 #define PrintableString 296
249 #define UniversalString 297
250 #define BMPString 298
251 #define UTF8String 299
252 #define VisibleString 300
255 #define ENUMERATED 303
258 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
259 typedef union YYSTYPE YYSTYPE;
262 #line 62 "ASN1.y" /* yacc.c:355 */
264 unsigned int constant;
265 char str[ASN1_MAX_NAME_SIZE+1];
268 #line 269 "ASN1.c" /* yacc.c:355 */
270 # define YYSTYPE_IS_TRIVIAL 1
271 # define YYSTYPE_IS_DECLARED 1
275 extern YYSTYPE _asn1_yylval;
277 int _asn1_yyparse (void);
281 /* Copy the second part of user declarations. */
283 #line 284 "ASN1.c" /* yacc.c:358 */
290 typedef YYTYPE_UINT8 yytype_uint8;
292 typedef unsigned char yytype_uint8;
296 typedef YYTYPE_INT8 yytype_int8;
298 typedef signed char yytype_int8;
302 typedef YYTYPE_UINT16 yytype_uint16;
304 typedef unsigned short int yytype_uint16;
308 typedef YYTYPE_INT16 yytype_int16;
310 typedef short int yytype_int16;
314 # ifdef __SIZE_TYPE__
315 # define YYSIZE_T __SIZE_TYPE__
316 # elif defined size_t
317 # define YYSIZE_T size_t
318 # elif ! defined YYSIZE_T
319 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
320 # define YYSIZE_T size_t
322 # define YYSIZE_T unsigned int
326 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
329 # if defined YYENABLE_NLS && YYENABLE_NLS
331 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
332 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
336 # define YY_(Msgid) Msgid
341 # if (defined __GNUC__ \
342 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
343 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
344 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
346 # define YY_ATTRIBUTE(Spec) /* empty */
350 #ifndef YY_ATTRIBUTE_PURE
351 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
354 #ifndef YY_ATTRIBUTE_UNUSED
355 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
358 #if !defined _Noreturn \
359 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
360 # if defined _MSC_VER && 1200 <= _MSC_VER
361 # define _Noreturn __declspec (noreturn)
363 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
367 /* Suppress unused-variable warnings by "using" E. */
368 #if ! defined lint || defined __GNUC__
369 # define YYUSE(E) ((void) (E))
371 # define YYUSE(E) /* empty */
374 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
375 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
376 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
377 _Pragma ("GCC diagnostic push") \
378 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
379 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
380 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
381 _Pragma ("GCC diagnostic pop")
383 # define YY_INITIAL_VALUE(Value) Value
385 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
386 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
387 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
389 #ifndef YY_INITIAL_VALUE
390 # define YY_INITIAL_VALUE(Value) /* Nothing. */
394 #if ! defined yyoverflow || YYERROR_VERBOSE
396 /* The parser invokes alloca or malloc; define the necessary symbols. */
398 # ifdef YYSTACK_USE_ALLOCA
399 # if YYSTACK_USE_ALLOCA
401 # define YYSTACK_ALLOC __builtin_alloca
402 # elif defined __BUILTIN_VA_ARG_INCR
403 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
405 # define YYSTACK_ALLOC __alloca
406 # elif defined _MSC_VER
407 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
408 # define alloca _alloca
410 # define YYSTACK_ALLOC alloca
411 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
412 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
413 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
414 # ifndef EXIT_SUCCESS
415 # define EXIT_SUCCESS 0
422 # ifdef YYSTACK_ALLOC
423 /* Pacify GCC's 'empty if-body' warning. */
424 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
425 # ifndef YYSTACK_ALLOC_MAXIMUM
426 /* The OS might guarantee only one guard page at the bottom of the stack,
427 and a page size can be as small as 4096 bytes. So we cannot safely
428 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
429 to allow for a few compiler-allocated temporary stack slots. */
430 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
433 # define YYSTACK_ALLOC YYMALLOC
434 # define YYSTACK_FREE YYFREE
435 # ifndef YYSTACK_ALLOC_MAXIMUM
436 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
438 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
439 && ! ((defined YYMALLOC || defined malloc) \
440 && (defined YYFREE || defined free)))
441 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
442 # ifndef EXIT_SUCCESS
443 # define EXIT_SUCCESS 0
447 # define YYMALLOC malloc
448 # if ! defined malloc && ! defined EXIT_SUCCESS
449 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
454 # if ! defined free && ! defined EXIT_SUCCESS
455 void free (void *); /* INFRINGES ON USER NAME SPACE */
459 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
462 #if (! defined yyoverflow \
463 && (! defined __cplusplus \
464 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
466 /* A type that is properly aligned for any stack member. */
469 yytype_int16 yyss_alloc;
473 /* The size of the maximum gap between one aligned stack and the next. */
474 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
476 /* The size of an array large to enough to hold all stacks, each with
478 # define YYSTACK_BYTES(N) \
479 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
480 + YYSTACK_GAP_MAXIMUM)
482 # define YYCOPY_NEEDED 1
484 /* Relocate STACK from its old location to the new one. The
485 local variables YYSIZE and YYSTACKSIZE give the old and new number of
486 elements in the stack, and YYPTR gives the new location of the
487 stack. Advance YYPTR to a properly aligned location for the next
489 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
492 YYSIZE_T yynewbytes; \
493 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
494 Stack = &yyptr->Stack_alloc; \
495 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
496 yyptr += yynewbytes / sizeof (*yyptr); \
502 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
503 /* Copy COUNT objects from SRC to DST. The source and destination do
506 # if defined __GNUC__ && 1 < __GNUC__
507 # define YYCOPY(Dst, Src, Count) \
508 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
510 # define YYCOPY(Dst, Src, Count) \
514 for (yyi = 0; yyi < (Count); yyi++) \
515 (Dst)[yyi] = (Src)[yyi]; \
520 #endif /* !YYCOPY_NEEDED */
522 /* YYFINAL -- State number of the termination state. */
524 /* YYLAST -- Last index in YYTABLE. */
527 /* YYNTOKENS -- Number of terminals. */
529 /* YYNNTS -- Number of nonterminals. */
531 /* YYNRULES -- Number of rules. */
533 /* YYNSTATES -- Number of states. */
534 #define YYNSTATES 223
536 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
537 by yylex, with out-of-bounds checking. */
539 #define YYMAXUTOK 303
541 #define YYTRANSLATE(YYX) \
542 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
544 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
545 as returned by yylex, without out-of-bounds checking. */
546 static const yytype_uint8 yytranslate[] =
548 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 51, 52, 2, 49, 53, 50, 59, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 54, 2, 55, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 57, 56, 58, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
574 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
575 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
576 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
577 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
582 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
583 static const yytype_uint16 yyrline[] =
585 0, 135, 135, 148, 149, 152, 155, 156, 159, 160,
586 163, 164, 165, 168, 169, 172, 174, 179, 180, 184,
587 186, 191, 192, 196, 197, 198, 201, 203, 207, 208,
588 209, 212, 214, 215, 219, 220, 224, 225, 227, 228,
589 235, 238, 239, 242, 244, 250, 251, 254, 255, 259,
590 260, 264, 265, 269, 270, 274, 275, 279, 280, 284,
591 285, 289, 290, 294, 295, 299, 300, 304, 309, 310,
592 314, 315, 316, 321, 327, 330, 332, 335, 336, 337,
593 338, 339, 340, 341, 342, 343, 344, 345, 346, 347,
594 348, 349, 350, 351, 352, 353, 354, 355, 358, 359,
595 364, 365, 368, 371, 374, 375, 379, 381, 383, 388,
596 390, 392, 397, 401, 402, 407, 409, 412, 416, 421,
597 427, 428, 431, 432, 436, 439, 441, 465, 466
601 #if YYDEBUG || YYERROR_VERBOSE || 1
602 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
603 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
604 static const char *const yytname[] =
606 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER",
607 "OPTIONAL", "INTEGER", "SIZE", "OCTET", "STRING", "SEQUENCE", "BIT",
608 "UNIVERSAL", "PRIVATE", "APPLICATION", "DEFAULT", "CHOICE", "OF",
609 "OBJECT", "STR_IDENTIFIER", "BOOLEAN", "ASN1_TRUE", "ASN1_FALSE",
610 "TOKEN_NULL", "ANY", "DEFINED", "BY", "SET", "EXPLICIT", "IMPLICIT",
611 "DEFINITIONS", "TAGS", "BEGIN", "END", "UTCTime", "GeneralizedTime",
612 "GeneralString", "NumericString", "IA5String", "TeletexString",
613 "PrintableString", "UniversalString", "BMPString", "UTF8String",
614 "VisibleString", "FROM", "IMPORTS", "ENUMERATED", "'+'", "'-'", "'('",
615 "')'", "','", "'['", "']'", "'|'", "'{'", "'}'", "'.'", "$accept",
616 "definitions", "pos_num", "neg_num", "pos_neg_num", "num_identifier",
617 "int_identifier", "pos_neg_identifier", "constant", "constant_list",
618 "obj_constant", "obj_constant_list", "class", "tag_type", "tag",
619 "default", "pos_neg_list", "integer_def", "boolean_def", "Time",
620 "size_def2", "size_def", "generalstring_def", "numericstring_def",
621 "ia5string_def", "teletexstring_def", "printablestring_def",
622 "universalstring_def", "bmpstring_def", "utf8string_def",
623 "visiblestring_def", "octet_string_def", "bit_element",
624 "bit_element_list", "bit_string_def", "enumerated_def", "object_def",
625 "type_assig_right", "type_assig_right_tag",
626 "type_assig_right_tag_default", "type_assig", "type_assig_list",
627 "sequence_def", "set_def", "choise_def", "any_def", "type_def",
628 "constant_def", "type_constant", "type_constant_list", "definitions_id",
629 "explicit_implicit", YY_NULLPTR
634 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
635 (internal) symbol number NUM (which must be that of a token). */
636 static const yytype_uint16 yytoknum[] =
638 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
639 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
640 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
641 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
642 295, 296, 297, 298, 299, 300, 301, 302, 303, 43,
643 45, 40, 41, 44, 91, 93, 124, 123, 125, 46
647 #define YYPACT_NINF -129
649 #define yypact_value_is_default(Yystate) \
650 (!!((Yystate) == (-129)))
652 #define YYTABLE_NINF -12
654 #define yytable_value_is_error(Yytable_value) \
657 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
659 static const yytype_int16 yypact[] =
661 36, -7, 74, 22, 3, -129, 26, -129, 34, -129,
662 -129, -129, 5, -129, -129, 55, 89, -129, -129, 97,
663 57, 101, -129, 122, 141, 132, -129, -129, -129, 32,
664 77, 77, 152, 165, 150, -129, -129, 6, 119, 167,
665 18, 168, 124, 159, -129, -129, 156, 21, -129, -129,
666 6, 6, 6, 6, 6, 6, 6, 6, 6, 126,
667 30, 38, 121, 133, -129, -129, -129, -129, -129, -129,
668 -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
669 -129, -129, -129, -129, -129, -129, 128, 58, 183, 136,
670 180, -129, -129, 20, 6, 121, 184, 172, -3, 184,
671 -129, 164, 121, 184, 174, -129, -129, -129, -129, -129,
672 -129, -129, -129, -129, 188, 139, -129, -129, -129, 191,
673 -129, -129, -129, 42, 149, -129, 192, 193, -129, -129,
674 -129, 142, 169, 146, 151, 58, -129, 53, -129, -129,
675 77, -129, 71, 121, 188, -129, 83, 195, -129, 90,
676 121, 153, -129, 94, -129, 148, 147, -129, 197, -129,
677 154, 43, 7, -129, -129, 149, -129, -21, -129, 58,
678 155, 20, -129, 24, -129, 184, -129, -129, 114, -129,
679 -129, -129, -129, 201, 188, -129, -129, 157, 158, -129,
680 58, -129, 23, -129, 160, 162, -129, -129, -129, 54,
681 -129, -129, -129, 163, -129, 47, -129, -129, 169, -129,
682 -129, -129, -129, -129, -129, -129, -129, 204, 166, 170,
686 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
687 Performed when YYTABLE does not specify something else to do. Zero
688 means the default is an error. */
689 static const yytype_uint8 yydefact[] =
691 0, 126, 0, 0, 0, 1, 0, 8, 9, 125,
692 19, 21, 0, 127, 128, 0, 0, 124, 22, 0,
693 0, 0, 20, 0, 0, 0, 120, 121, 122, 0,
694 0, 0, 0, 0, 0, 2, 123, 75, 36, 0,
695 0, 0, 0, 0, 40, 97, 113, 0, 41, 42,
696 47, 49, 51, 53, 55, 57, 59, 61, 63, 0,
697 0, 28, 0, 77, 79, 80, 83, 84, 85, 86,
698 87, 88, 89, 90, 91, 81, 82, 78, 93, 98,
699 116, 92, 96, 94, 95, 115, 0, 0, 0, 0,
700 0, 45, 76, 0, 65, 0, 0, 0, 70, 0,
701 74, 0, 0, 0, 0, 48, 50, 52, 54, 56,
702 58, 60, 62, 64, 0, 0, 23, 24, 25, 0,
703 29, 30, 99, 0, 0, 3, 0, 0, 6, 7,
704 119, 0, 0, 0, 0, 0, 17, 0, 66, 107,
705 0, 104, 0, 0, 0, 71, 0, 0, 110, 0,
706 0, 0, 68, 0, 26, 0, 3, 12, 0, 34,
707 0, 0, 0, 4, 5, 0, 9, 0, 46, 0,
708 0, 0, 37, 100, 103, 0, 106, 108, 0, 112,
709 114, 109, 111, 0, 0, 73, 27, 5, 0, 38,
710 0, 118, 0, 43, 0, 0, 15, 18, 102, 0,
711 101, 105, 72, 0, 69, 0, 35, 117, 0, 16,
712 14, 32, 33, 13, 31, 67, 10, 0, 0, 0,
716 /* YYPGOTO[NTERM-NUM]. */
717 static const yytype_int16 yypgoto[] =
719 -129, -129, -129, -129, -120, -128, 4, -129, 39, -129,
720 -12, -92, -129, -129, -129, -129, -129, -129, -129, -129,
721 130, -34, -129, -129, -129, -129, -129, -129, -129, -129,
722 -129, -129, 27, 68, -129, -129, -129, -60, -30, -129,
723 46, 72, -129, -129, -129, -129, -129, -129, 194, -129,
727 /* YYDEFGOTO[NTERM-NUM]. */
728 static const yytype_int16 yydefgoto[] =
730 -1, 2, 128, 129, 130, 10, 160, 214, 136, 137,
731 11, 12, 119, 61, 62, 200, 161, 63, 64, 65,
732 91, 92, 66, 67, 68, 69, 70, 71, 72, 73,
733 74, 75, 152, 153, 76, 77, 78, 79, 80, 174,
734 141, 142, 81, 82, 83, 84, 26, 27, 28, 29,
738 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
739 positive, shift that token. If negative, reduce the rule whose
740 number is the opposite. If YYTABLE_NINF, syntax error. */
741 static const yytype_int16 yytable[] =
743 18, 85, 122, 159, 167, 89, 97, 7, 8, 7,
744 8, 7, 8, 104, 89, 170, 105, 106, 107, 108,
745 109, 110, 111, 112, 113, 134, 89, 7, 8, 89,
746 198, 193, 162, 24, 115, 139, 95, 25, 194, 102,
747 199, 1, 148, 116, 117, 118, 156, 157, 90, 195,
748 4, 216, 157, 6, 144, 13, 14, 90, 125, 210,
749 138, 9, 125, 17, 145, 191, 35, 120, 121, 90,
750 206, 135, 90, 192, 5, 96, 211, 212, 103, 213,
751 219, 207, 37, 177, 38, 16, 39, 19, 40, 41,
752 182, 126, 158, 20, 42, 189, 43, 217, 44, 190,
753 21, 45, 46, 126, 127, 47, 171, 126, 127, 22,
754 173, 172, 48, 49, 50, 51, 52, 53, 54, 55,
755 56, 57, 58, 24, 175, 59, 37, 25, 38, 176,
756 39, 60, 40, 41, 23, 31, 175, 32, 42, 33,
757 43, 179, 44, 175, 30, 45, 46, 184, 181, 47,
758 18, 34, 185, 7, 8, 86, 48, 49, 50, 51,
759 52, 53, 54, 55, 56, 57, 58, 184, 87, 59,
760 88, 146, 202, 7, 166, 149, 93, 94, 98, 100,
761 18, 99, 101, 114, 123, 124, 131, 132, 89, 140,
762 143, 147, 150, 151, 154, 155, 163, 164, 168, 165,
763 180, 187, 169, 186, 183, 203, -10, 196, 220, 218,
764 197, 204, 178, 188, 209, 215, -11, 205, 221, 208,
768 static const yytype_uint8 yycheck[] =
770 12, 31, 62, 123, 132, 8, 40, 4, 5, 4,
771 5, 4, 5, 47, 8, 135, 50, 51, 52, 53,
772 54, 55, 56, 57, 58, 5, 8, 4, 5, 8,
773 6, 52, 124, 1, 4, 95, 18, 5, 59, 18,
774 16, 5, 102, 13, 14, 15, 4, 5, 51, 169,
775 57, 4, 5, 31, 57, 29, 30, 51, 4, 5,
776 94, 58, 4, 58, 98, 58, 34, 29, 30, 51,
777 190, 51, 51, 165, 0, 57, 22, 23, 57, 199,
778 208, 58, 5, 143, 7, 51, 9, 32, 11, 12,
779 150, 49, 50, 4, 17, 52, 19, 50, 21, 56,
780 3, 24, 25, 49, 50, 28, 53, 49, 50, 52,
781 140, 58, 35, 36, 37, 38, 39, 40, 41, 42,
782 43, 44, 45, 1, 53, 48, 5, 5, 7, 58,
783 9, 54, 11, 12, 33, 3, 53, 5, 17, 7,
784 19, 58, 21, 53, 3, 24, 25, 53, 58, 28,
785 162, 19, 58, 4, 5, 3, 35, 36, 37, 38,
786 39, 40, 41, 42, 43, 44, 45, 53, 3, 48,
787 20, 99, 58, 4, 5, 103, 57, 10, 10, 20,
788 192, 57, 26, 57, 51, 57, 3, 51, 8, 5,
789 18, 27, 18, 5, 55, 4, 4, 4, 52, 57,
790 5, 4, 51, 55, 51, 4, 59, 52, 4, 205,
791 171, 184, 144, 59, 52, 52, 59, 59, 52, 59,
795 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
796 symbol of state STATE-NUM. */
797 static const yytype_uint8 yystos[] =
799 0, 5, 61, 110, 57, 0, 31, 4, 5, 58,
800 65, 70, 71, 29, 30, 111, 51, 58, 70, 32,
801 4, 3, 52, 33, 1, 5, 106, 107, 108, 109,
802 3, 3, 5, 7, 19, 34, 108, 5, 7, 9,
803 11, 12, 17, 19, 21, 24, 25, 28, 35, 36,
804 37, 38, 39, 40, 41, 42, 43, 44, 45, 48,
805 54, 73, 74, 77, 78, 79, 82, 83, 84, 85,
806 86, 87, 88, 89, 90, 91, 94, 95, 96, 97,
807 98, 102, 103, 104, 105, 98, 3, 3, 20, 8,
808 51, 80, 81, 57, 10, 18, 57, 81, 10, 57,
809 20, 26, 18, 57, 81, 81, 81, 81, 81, 81,
810 81, 81, 81, 81, 57, 4, 13, 14, 15, 72,
811 29, 30, 97, 51, 57, 4, 49, 50, 62, 63,
812 64, 3, 51, 80, 5, 51, 68, 69, 81, 97,
813 5, 100, 101, 18, 57, 81, 101, 27, 97, 101,
814 18, 5, 92, 93, 55, 4, 4, 5, 50, 64,
815 66, 76, 71, 4, 4, 57, 5, 65, 52, 51,
816 64, 53, 58, 98, 99, 53, 58, 97, 93, 58,
817 5, 58, 97, 51, 53, 58, 55, 4, 59, 52,
818 56, 58, 71, 52, 59, 64, 52, 68, 6, 16,
819 75, 100, 58, 4, 92, 59, 64, 58, 59, 52,
820 5, 22, 23, 64, 67, 52, 4, 50, 66, 65,
824 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
825 static const yytype_uint8 yyr1[] =
827 0, 60, 61, 62, 62, 63, 64, 64, 65, 65,
828 66, 66, 66, 67, 67, 68, 68, 69, 69, 70,
829 70, 71, 71, 72, 72, 72, 73, 73, 74, 74,
830 74, 75, 75, 75, 76, 76, 77, 77, 77, 77,
831 78, 79, 79, 80, 80, 81, 81, 82, 82, 83,
832 83, 84, 84, 85, 85, 86, 86, 87, 87, 88,
833 88, 89, 89, 90, 90, 91, 91, 92, 93, 93,
834 94, 94, 94, 95, 96, 97, 97, 97, 97, 97,
835 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
836 97, 97, 97, 97, 97, 97, 97, 97, 98, 98,
837 99, 99, 99, 100, 101, 101, 102, 102, 102, 103,
838 103, 103, 104, 105, 105, 106, 106, 107, 107, 107,
839 108, 108, 109, 109, 110, 110, 110, 111, 111
842 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
843 static const yytype_uint8 yyr2[] =
845 0, 2, 8, 1, 2, 2, 1, 1, 1, 1,
846 1, 2, 1, 1, 1, 3, 4, 1, 3, 1,
847 4, 1, 2, 1, 1, 1, 3, 4, 1, 2,
848 2, 2, 2, 2, 1, 3, 1, 4, 4, 7,
849 1, 1, 1, 4, 7, 1, 3, 1, 2, 1,
850 2, 1, 2, 1, 2, 1, 2, 1, 2, 1,
851 2, 1, 2, 1, 2, 2, 3, 4, 1, 3,
852 2, 3, 5, 4, 2, 1, 2, 1, 1, 1,
853 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
854 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
855 1, 2, 2, 2, 1, 3, 4, 3, 4, 4,
856 3, 4, 4, 1, 4, 3, 3, 7, 6, 4,
857 1, 1, 1, 2, 4, 3, 1, 1, 1
861 #define yyerrok (yyerrstatus = 0)
862 #define yyclearin (yychar = YYEMPTY)
866 #define YYACCEPT goto yyacceptlab
867 #define YYABORT goto yyabortlab
868 #define YYERROR goto yyerrorlab
871 #define YYRECOVERING() (!!yyerrstatus)
873 #define YYBACKUP(Token, Value) \
875 if (yychar == YYEMPTY) \
879 YYPOPSTACK (yylen); \
885 yyerror (YY_("syntax error: cannot back up")); \
890 /* Error token number */
892 #define YYERRCODE 256
896 /* Enable debugging if requested. */
900 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
901 # define YYFPRINTF fprintf
904 # define YYDPRINTF(Args) \
910 /* This macro is provided for backward compatibility. */
911 #ifndef YY_LOCATION_PRINT
912 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
916 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
920 YYFPRINTF (stderr, "%s ", Title); \
921 yy_symbol_print (stderr, \
923 YYFPRINTF (stderr, "\n"); \
928 /*----------------------------------------.
929 | Print this symbol's value on YYOUTPUT. |
930 `----------------------------------------*/
933 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
935 FILE *yyo = yyoutput;
940 if (yytype < YYNTOKENS)
941 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
947 /*--------------------------------.
948 | Print this symbol on YYOUTPUT. |
949 `--------------------------------*/
952 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
954 YYFPRINTF (yyoutput, "%s %s (",
955 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
957 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
958 YYFPRINTF (yyoutput, ")");
961 /*------------------------------------------------------------------.
962 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
964 `------------------------------------------------------------------*/
967 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
969 YYFPRINTF (stderr, "Stack now");
970 for (; yybottom <= yytop; yybottom++)
972 int yybot = *yybottom;
973 YYFPRINTF (stderr, " %d", yybot);
975 YYFPRINTF (stderr, "\n");
978 # define YY_STACK_PRINT(Bottom, Top) \
981 yy_stack_print ((Bottom), (Top)); \
985 /*------------------------------------------------.
986 | Report that the YYRULE is going to be reduced. |
987 `------------------------------------------------*/
990 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
992 unsigned long int yylno = yyrline[yyrule];
993 int yynrhs = yyr2[yyrule];
995 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
997 /* The symbols being reduced. */
998 for (yyi = 0; yyi < yynrhs; yyi++)
1000 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1001 yy_symbol_print (stderr,
1002 yystos[yyssp[yyi + 1 - yynrhs]],
1003 &(yyvsp[(yyi + 1) - (yynrhs)])
1005 YYFPRINTF (stderr, "\n");
1009 # define YY_REDUCE_PRINT(Rule) \
1012 yy_reduce_print (yyssp, yyvsp, Rule); \
1015 /* Nonzero means print parse trace. It is left uninitialized so that
1016 multiple parsers can coexist. */
1018 #else /* !YYDEBUG */
1019 # define YYDPRINTF(Args)
1020 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1021 # define YY_STACK_PRINT(Bottom, Top)
1022 # define YY_REDUCE_PRINT(Rule)
1023 #endif /* !YYDEBUG */
1026 /* YYINITDEPTH -- initial size of the parser's stacks. */
1028 # define YYINITDEPTH 200
1031 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1032 if the built-in stack extension method is used).
1034 Do not make this value too large; the results are undefined if
1035 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1036 evaluated with infinite-precision integer arithmetic. */
1039 # define YYMAXDEPTH 10000
1046 # if defined __GLIBC__ && defined _STRING_H
1047 # define yystrlen strlen
1049 /* Return the length of YYSTR. */
1051 yystrlen (const char *yystr)
1054 for (yylen = 0; yystr[yylen]; yylen++)
1062 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1063 # define yystpcpy stpcpy
1065 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1068 yystpcpy (char *yydest, const char *yysrc)
1071 const char *yys = yysrc;
1073 while ((*yyd++ = *yys++) != '\0')
1082 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1083 quotes and backslashes, so that it's suitable for yyerror. The
1084 heuristic is that double-quoting is unnecessary unless the string
1085 contains an apostrophe, a comma, or backslash (other than
1086 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1087 null, do not copy; instead, return the length of what the result
1090 yytnamerr (char *yyres, const char *yystr)
1095 char const *yyp = yystr;
1102 goto do_not_strip_quotes;
1106 goto do_not_strip_quotes;
1119 do_not_strip_quotes: ;
1123 return yystrlen (yystr);
1125 return yystpcpy (yyres, yystr) - yyres;
1129 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1130 about the unexpected token YYTOKEN for the state stack whose top is
1133 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1134 not large enough to hold the message. In that case, also set
1135 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1136 required number of bytes is too large to store. */
1138 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1139 yytype_int16 *yyssp, int yytoken)
1141 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1142 YYSIZE_T yysize = yysize0;
1143 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1144 /* Internationalized format string. */
1145 const char *yyformat = YY_NULLPTR;
1146 /* Arguments of yyformat. */
1147 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1148 /* Number of reported tokens (one for the "unexpected", one per
1152 /* There are many possibilities here to consider:
1153 - If this state is a consistent state with a default action, then
1154 the only way this function was invoked is if the default action
1155 is an error action. In that case, don't check for expected
1156 tokens because there are none.
1157 - The only way there can be no lookahead present (in yychar) is if
1158 this state is a consistent state with a default action. Thus,
1159 detecting the absence of a lookahead is sufficient to determine
1160 that there is no unexpected or expected token to report. In that
1161 case, just report a simple "syntax error".
1162 - Don't assume there isn't a lookahead just because this state is a
1163 consistent state with a default action. There might have been a
1164 previous inconsistent state, consistent state with a non-default
1165 action, or user semantic action that manipulated yychar.
1166 - Of course, the expected token list depends on states to have
1167 correct lookahead information, and it depends on the parser not
1168 to perform extra reductions after fetching a lookahead from the
1169 scanner and before detecting a syntax error. Thus, state merging
1170 (from LALR or IELR) and default reductions corrupt the expected
1171 token list. However, the list is correct for canonical LR with
1172 one exception: it will still contain any token that will not be
1173 accepted due to an error action in a later state.
1175 if (yytoken != YYEMPTY)
1177 int yyn = yypact[*yyssp];
1178 yyarg[yycount++] = yytname[yytoken];
1179 if (!yypact_value_is_default (yyn))
1181 /* Start YYX at -YYN if negative to avoid negative indexes in
1182 YYCHECK. In other words, skip the first -YYN actions for
1183 this state because they are default actions. */
1184 int yyxbegin = yyn < 0 ? -yyn : 0;
1185 /* Stay within bounds of both yycheck and yytname. */
1186 int yychecklim = YYLAST - yyn + 1;
1187 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1190 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1191 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1192 && !yytable_value_is_error (yytable[yyx + yyn]))
1194 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1200 yyarg[yycount++] = yytname[yyx];
1202 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1203 if (! (yysize <= yysize1
1204 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1214 # define YYCASE_(N, S) \
1218 YYCASE_(0, YY_("syntax error"));
1219 YYCASE_(1, YY_("syntax error, unexpected %s"));
1220 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1221 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1222 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1223 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1228 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1229 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1234 if (*yymsg_alloc < yysize)
1236 *yymsg_alloc = 2 * yysize;
1237 if (! (yysize <= *yymsg_alloc
1238 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1239 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1243 /* Avoid sprintf, as that infringes on the user's name space.
1244 Don't have undefined behavior even if the translation
1245 produced a string with the wrong number of "%s"s. */
1249 while ((*yyp = *yyformat) != '\0')
1250 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1252 yyp += yytnamerr (yyp, yyarg[yyi++]);
1263 #endif /* YYERROR_VERBOSE */
1265 /*-----------------------------------------------.
1266 | Release the memory associated to this symbol. |
1267 `-----------------------------------------------*/
1270 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1275 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1277 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1279 YY_IGNORE_MAYBE_UNINITIALIZED_END
1285 /* The lookahead symbol. */
1288 /* The semantic value of the lookahead symbol. */
1290 /* Number of syntax errors so far. */
1302 /* Number of tokens to shift before error messages enabled. */
1305 /* The stacks and their tools:
1306 'yyss': related to states.
1307 'yyvs': related to semantic values.
1309 Refer to the stacks through separate pointers, to allow yyoverflow
1310 to reallocate them elsewhere. */
1312 /* The state stack. */
1313 yytype_int16 yyssa[YYINITDEPTH];
1315 yytype_int16 *yyssp;
1317 /* The semantic value stack. */
1318 YYSTYPE yyvsa[YYINITDEPTH];
1322 YYSIZE_T yystacksize;
1326 /* Lookahead token as an internal (translated) token number. */
1328 /* The variables used to return semantic value and location from the
1333 /* Buffer for error messages, and its allocated size. */
1335 char *yymsg = yymsgbuf;
1336 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1339 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1341 /* The number of symbols on the RHS of the reduced rule.
1342 Keep to zero when no symbol should be popped. */
1345 yyssp = yyss = yyssa;
1346 yyvsp = yyvs = yyvsa;
1347 yystacksize = YYINITDEPTH;
1349 YYDPRINTF ((stderr, "Starting parse\n"));
1354 yychar = YYEMPTY; /* Cause a token to be read. */
1357 /*------------------------------------------------------------.
1358 | yynewstate -- Push a new state, which is found in yystate. |
1359 `------------------------------------------------------------*/
1361 /* In all cases, when you get here, the value and location stacks
1362 have just been pushed. So pushing a state here evens the stacks. */
1368 if (yyss + yystacksize - 1 <= yyssp)
1370 /* Get the current used size of the three stacks, in elements. */
1371 YYSIZE_T yysize = yyssp - yyss + 1;
1375 /* Give user a chance to reallocate the stack. Use copies of
1376 these so that the &'s don't force the real ones into
1378 YYSTYPE *yyvs1 = yyvs;
1379 yytype_int16 *yyss1 = yyss;
1381 /* Each stack pointer address is followed by the size of the
1382 data in use in that stack, in bytes. This used to be a
1383 conditional around just the two extra args, but that might
1384 be undefined if yyoverflow is a macro. */
1385 yyoverflow (YY_("memory exhausted"),
1386 &yyss1, yysize * sizeof (*yyssp),
1387 &yyvs1, yysize * sizeof (*yyvsp),
1393 #else /* no yyoverflow */
1394 # ifndef YYSTACK_RELOCATE
1395 goto yyexhaustedlab;
1397 /* Extend the stack our own way. */
1398 if (YYMAXDEPTH <= yystacksize)
1399 goto yyexhaustedlab;
1401 if (YYMAXDEPTH < yystacksize)
1402 yystacksize = YYMAXDEPTH;
1405 yytype_int16 *yyss1 = yyss;
1406 union yyalloc *yyptr =
1407 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1409 goto yyexhaustedlab;
1410 YYSTACK_RELOCATE (yyss_alloc, yyss);
1411 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1412 # undef YYSTACK_RELOCATE
1414 YYSTACK_FREE (yyss1);
1417 #endif /* no yyoverflow */
1419 yyssp = yyss + yysize - 1;
1420 yyvsp = yyvs + yysize - 1;
1422 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1423 (unsigned long int) yystacksize));
1425 if (yyss + yystacksize - 1 <= yyssp)
1429 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1431 if (yystate == YYFINAL)
1441 /* Do appropriate processing given the current state. Read a
1442 lookahead token if we need one and don't already have one. */
1444 /* First try to decide what to do without reference to lookahead token. */
1445 yyn = yypact[yystate];
1446 if (yypact_value_is_default (yyn))
1449 /* Not known => get a lookahead token if don't already have one. */
1451 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1452 if (yychar == YYEMPTY)
1454 YYDPRINTF ((stderr, "Reading a token: "));
1458 if (yychar <= YYEOF)
1460 yychar = yytoken = YYEOF;
1461 YYDPRINTF ((stderr, "Now at end of input.\n"));
1465 yytoken = YYTRANSLATE (yychar);
1466 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1469 /* If the proper action on seeing token YYTOKEN is to reduce or to
1470 detect an error, take that action. */
1472 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1477 if (yytable_value_is_error (yyn))
1483 /* Count tokens shifted since error; after three, turn off error
1488 /* Shift the lookahead token. */
1489 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1491 /* Discard the shifted token. */
1495 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1497 YY_IGNORE_MAYBE_UNINITIALIZED_END
1502 /*-----------------------------------------------------------.
1503 | yydefault -- do the default action for the current state. |
1504 `-----------------------------------------------------------*/
1506 yyn = yydefact[yystate];
1512 /*-----------------------------.
1513 | yyreduce -- Do a reduction. |
1514 `-----------------------------*/
1516 /* yyn is the number of a rule to reduce with. */
1519 /* If YYLEN is nonzero, implement the default value of the action:
1522 Otherwise, the following line sets YYVAL to garbage.
1523 This behavior is undocumented and Bison
1524 users should not rely upon it. Assigning to YYVAL
1525 unconditionally makes the parser a bit smaller, and it avoids a
1526 GCC warning that YYVAL may be used uninitialized. */
1527 yyval = yyvsp[1-yylen];
1530 YY_REDUCE_PRINT (yyn);
1534 #line 138 "ASN1.y" /* yacc.c:1646 */
1535 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFINITIONS|(yyvsp[-5].constant));
1536 _asn1_set_name((yyval.node),_asn1_get_name((yyvsp[-7].node)));
1537 _asn1_set_name((yyvsp[-7].node),"");
1538 _asn1_set_right((yyvsp[-7].node),(yyvsp[-1].node));
1539 _asn1_set_down((yyval.node),(yyvsp[-7].node));
1541 p_tree=(yyval.node);
1543 #line 1544 "ASN1.c" /* yacc.c:1646 */
1547 #line 148 "ASN1.y" /* yacc.c:1646 */
1548 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1549 #line 1550 "ASN1.c" /* yacc.c:1646 */
1553 #line 149 "ASN1.y" /* yacc.c:1646 */
1554 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1555 #line 1556 "ASN1.c" /* yacc.c:1646 */
1559 #line 152 "ASN1.y" /* yacc.c:1646 */
1560 {snprintf((yyval.str),sizeof((yyval.str)),"-%s",(yyvsp[0].str));}
1561 #line 1562 "ASN1.c" /* yacc.c:1646 */
1565 #line 155 "ASN1.y" /* yacc.c:1646 */
1566 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1567 #line 1568 "ASN1.c" /* yacc.c:1646 */
1571 #line 156 "ASN1.y" /* yacc.c:1646 */
1572 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1573 #line 1574 "ASN1.c" /* yacc.c:1646 */
1577 #line 159 "ASN1.y" /* yacc.c:1646 */
1578 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1579 #line 1580 "ASN1.c" /* yacc.c:1646 */
1583 #line 160 "ASN1.y" /* yacc.c:1646 */
1584 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1585 #line 1586 "ASN1.c" /* yacc.c:1646 */
1589 #line 163 "ASN1.y" /* yacc.c:1646 */
1590 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1591 #line 1592 "ASN1.c" /* yacc.c:1646 */
1595 #line 164 "ASN1.y" /* yacc.c:1646 */
1596 {snprintf((yyval.str),sizeof((yyval.str)),"-%s",(yyvsp[0].str));}
1597 #line 1598 "ASN1.c" /* yacc.c:1646 */
1601 #line 165 "ASN1.y" /* yacc.c:1646 */
1602 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1603 #line 1604 "ASN1.c" /* yacc.c:1646 */
1607 #line 168 "ASN1.y" /* yacc.c:1646 */
1608 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1609 #line 1610 "ASN1.c" /* yacc.c:1646 */
1613 #line 169 "ASN1.y" /* yacc.c:1646 */
1614 {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));}
1615 #line 1616 "ASN1.c" /* yacc.c:1646 */
1619 #line 172 "ASN1.y" /* yacc.c:1646 */
1620 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1621 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1622 #line 1623 "ASN1.c" /* yacc.c:1646 */
1626 #line 174 "ASN1.y" /* yacc.c:1646 */
1627 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1628 _asn1_set_name((yyval.node),(yyvsp[-3].str));
1629 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1630 #line 1631 "ASN1.c" /* yacc.c:1646 */
1634 #line 179 "ASN1.y" /* yacc.c:1646 */
1635 {(yyval.node)=(yyvsp[0].node);}
1636 #line 1637 "ASN1.c" /* yacc.c:1646 */
1640 #line 180 "ASN1.y" /* yacc.c:1646 */
1641 {(yyval.node)=(yyvsp[-2].node);
1642 _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));}
1643 #line 1644 "ASN1.c" /* yacc.c:1646 */
1647 #line 184 "ASN1.y" /* yacc.c:1646 */
1648 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1649 _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);}
1650 #line 1651 "ASN1.c" /* yacc.c:1646 */
1654 #line 186 "ASN1.y" /* yacc.c:1646 */
1655 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1656 _asn1_set_name((yyval.node),(yyvsp[-3].str));
1657 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1658 #line 1659 "ASN1.c" /* yacc.c:1646 */
1662 #line 191 "ASN1.y" /* yacc.c:1646 */
1663 {(yyval.node)=(yyvsp[0].node);}
1664 #line 1665 "ASN1.c" /* yacc.c:1646 */
1668 #line 192 "ASN1.y" /* yacc.c:1646 */
1669 {(yyval.node)=(yyvsp[-1].node);
1670 _asn1_set_right(_asn1_get_last_right((yyvsp[-1].node)),(yyvsp[0].node));}
1671 #line 1672 "ASN1.c" /* yacc.c:1646 */
1675 #line 196 "ASN1.y" /* yacc.c:1646 */
1676 {(yyval.constant)=CONST_UNIVERSAL;}
1677 #line 1678 "ASN1.c" /* yacc.c:1646 */
1681 #line 197 "ASN1.y" /* yacc.c:1646 */
1682 {(yyval.constant)=CONST_PRIVATE;}
1683 #line 1684 "ASN1.c" /* yacc.c:1646 */
1687 #line 198 "ASN1.y" /* yacc.c:1646 */
1688 {(yyval.constant)=CONST_APPLICATION;}
1689 #line 1690 "ASN1.c" /* yacc.c:1646 */
1693 #line 201 "ASN1.y" /* yacc.c:1646 */
1694 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TAG);
1695 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1696 #line 1697 "ASN1.c" /* yacc.c:1646 */
1700 #line 203 "ASN1.y" /* yacc.c:1646 */
1701 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TAG | (yyvsp[-2].constant));
1702 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1703 #line 1704 "ASN1.c" /* yacc.c:1646 */
1707 #line 207 "ASN1.y" /* yacc.c:1646 */
1708 {(yyval.node)=(yyvsp[0].node);}
1709 #line 1710 "ASN1.c" /* yacc.c:1646 */
1713 #line 208 "ASN1.y" /* yacc.c:1646 */
1714 {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_EXPLICIT);}
1715 #line 1716 "ASN1.c" /* yacc.c:1646 */
1719 #line 209 "ASN1.y" /* yacc.c:1646 */
1720 {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_IMPLICIT);}
1721 #line 1722 "ASN1.c" /* yacc.c:1646 */
1725 #line 212 "ASN1.y" /* yacc.c:1646 */
1726 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT);
1727 _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);}
1728 #line 1729 "ASN1.c" /* yacc.c:1646 */
1732 #line 214 "ASN1.y" /* yacc.c:1646 */
1733 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT|CONST_TRUE);}
1734 #line 1735 "ASN1.c" /* yacc.c:1646 */
1738 #line 215 "ASN1.y" /* yacc.c:1646 */
1739 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT|CONST_FALSE);}
1740 #line 1741 "ASN1.c" /* yacc.c:1646 */
1744 #line 224 "ASN1.y" /* yacc.c:1646 */
1745 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER);}
1746 #line 1747 "ASN1.c" /* yacc.c:1646 */
1750 #line 225 "ASN1.y" /* yacc.c:1646 */
1751 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_LIST);
1752 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
1753 #line 1754 "ASN1.c" /* yacc.c:1646 */
1757 #line 227 "ASN1.y" /* yacc.c:1646 */
1758 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER);}
1759 #line 1760 "ASN1.c" /* yacc.c:1646 */
1763 #line 229 "ASN1.y" /* yacc.c:1646 */
1764 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_MIN_MAX);
1765 _asn1_set_down((yyval.node),_asn1_add_static_node(ASN1_ETYPE_SIZE));
1766 _asn1_set_value(_asn1_get_down((yyval.node)),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);
1767 _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[-4].str));}
1768 #line 1769 "ASN1.c" /* yacc.c:1646 */
1772 #line 235 "ASN1.y" /* yacc.c:1646 */
1773 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BOOLEAN);}
1774 #line 1775 "ASN1.c" /* yacc.c:1646 */
1778 #line 238 "ASN1.y" /* yacc.c:1646 */
1779 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTC_TIME);}
1780 #line 1781 "ASN1.c" /* yacc.c:1646 */
1784 #line 239 "ASN1.y" /* yacc.c:1646 */
1785 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALIZED_TIME);}
1786 #line 1787 "ASN1.c" /* yacc.c:1646 */
1790 #line 242 "ASN1.y" /* yacc.c:1646 */
1791 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SIZE|CONST_1_PARAM);
1792 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1793 #line 1794 "ASN1.c" /* yacc.c:1646 */
1797 #line 245 "ASN1.y" /* yacc.c:1646 */
1798 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SIZE|CONST_MIN_MAX);
1799 _asn1_set_value((yyval.node),(yyvsp[-4].str),strlen((yyvsp[-4].str))+1);
1800 _asn1_set_name((yyval.node),(yyvsp[-1].str));}
1801 #line 1802 "ASN1.c" /* yacc.c:1646 */
1805 #line 250 "ASN1.y" /* yacc.c:1646 */
1806 {(yyval.node)=(yyvsp[0].node);}
1807 #line 1808 "ASN1.c" /* yacc.c:1646 */
1811 #line 251 "ASN1.y" /* yacc.c:1646 */
1812 {(yyval.node)=(yyvsp[-1].node);}
1813 #line 1814 "ASN1.c" /* yacc.c:1646 */
1817 #line 254 "ASN1.y" /* yacc.c:1646 */
1818 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALSTRING);}
1819 #line 1820 "ASN1.c" /* yacc.c:1646 */
1823 #line 255 "ASN1.y" /* yacc.c:1646 */
1824 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALSTRING|CONST_SIZE);
1825 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1826 #line 1827 "ASN1.c" /* yacc.c:1646 */
1830 #line 259 "ASN1.y" /* yacc.c:1646 */
1831 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NUMERIC_STRING|CONST_UNIVERSAL);}
1832 #line 1833 "ASN1.c" /* yacc.c:1646 */
1836 #line 260 "ASN1.y" /* yacc.c:1646 */
1837 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NUMERIC_STRING|CONST_SIZE);
1838 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1839 #line 1840 "ASN1.c" /* yacc.c:1646 */
1843 #line 264 "ASN1.y" /* yacc.c:1646 */
1844 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IA5_STRING);}
1845 #line 1846 "ASN1.c" /* yacc.c:1646 */
1849 #line 265 "ASN1.y" /* yacc.c:1646 */
1850 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IA5_STRING|CONST_SIZE);
1851 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1852 #line 1853 "ASN1.c" /* yacc.c:1646 */
1856 #line 269 "ASN1.y" /* yacc.c:1646 */
1857 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TELETEX_STRING);}
1858 #line 1859 "ASN1.c" /* yacc.c:1646 */
1862 #line 270 "ASN1.y" /* yacc.c:1646 */
1863 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TELETEX_STRING|CONST_SIZE);
1864 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1865 #line 1866 "ASN1.c" /* yacc.c:1646 */
1869 #line 274 "ASN1.y" /* yacc.c:1646 */
1870 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_PRINTABLE_STRING);}
1871 #line 1872 "ASN1.c" /* yacc.c:1646 */
1875 #line 275 "ASN1.y" /* yacc.c:1646 */
1876 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_PRINTABLE_STRING|CONST_SIZE);
1877 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1878 #line 1879 "ASN1.c" /* yacc.c:1646 */
1882 #line 279 "ASN1.y" /* yacc.c:1646 */
1883 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UNIVERSAL_STRING);}
1884 #line 1885 "ASN1.c" /* yacc.c:1646 */
1888 #line 280 "ASN1.y" /* yacc.c:1646 */
1889 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UNIVERSAL_STRING|CONST_SIZE);
1890 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1891 #line 1892 "ASN1.c" /* yacc.c:1646 */
1895 #line 284 "ASN1.y" /* yacc.c:1646 */
1896 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BMP_STRING);}
1897 #line 1898 "ASN1.c" /* yacc.c:1646 */
1901 #line 285 "ASN1.y" /* yacc.c:1646 */
1902 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BMP_STRING|CONST_SIZE);
1903 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1904 #line 1905 "ASN1.c" /* yacc.c:1646 */
1908 #line 289 "ASN1.y" /* yacc.c:1646 */
1909 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTF8_STRING);}
1910 #line 1911 "ASN1.c" /* yacc.c:1646 */
1914 #line 290 "ASN1.y" /* yacc.c:1646 */
1915 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTF8_STRING|CONST_SIZE);
1916 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1917 #line 1918 "ASN1.c" /* yacc.c:1646 */
1921 #line 294 "ASN1.y" /* yacc.c:1646 */
1922 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_VISIBLE_STRING);}
1923 #line 1924 "ASN1.c" /* yacc.c:1646 */
1927 #line 295 "ASN1.y" /* yacc.c:1646 */
1928 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_VISIBLE_STRING|CONST_SIZE);
1929 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1930 #line 1931 "ASN1.c" /* yacc.c:1646 */
1934 #line 299 "ASN1.y" /* yacc.c:1646 */
1935 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OCTET_STRING);}
1936 #line 1937 "ASN1.c" /* yacc.c:1646 */
1940 #line 300 "ASN1.y" /* yacc.c:1646 */
1941 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OCTET_STRING|CONST_SIZE);
1942 _asn1_set_down((yyval.node),(yyvsp[0].node));}
1943 #line 1944 "ASN1.c" /* yacc.c:1646 */
1947 #line 304 "ASN1.y" /* yacc.c:1646 */
1948 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1949 _asn1_set_name((yyval.node),(yyvsp[-3].str));
1950 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);}
1951 #line 1952 "ASN1.c" /* yacc.c:1646 */
1955 #line 309 "ASN1.y" /* yacc.c:1646 */
1956 {(yyval.node)=(yyvsp[0].node);}
1957 #line 1958 "ASN1.c" /* yacc.c:1646 */
1961 #line 310 "ASN1.y" /* yacc.c:1646 */
1962 {(yyval.node)=(yyvsp[-2].node);
1963 _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));}
1964 #line 1965 "ASN1.c" /* yacc.c:1646 */
1968 #line 314 "ASN1.y" /* yacc.c:1646 */
1969 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING);}
1970 #line 1971 "ASN1.c" /* yacc.c:1646 */
1974 #line 315 "ASN1.y" /* yacc.c:1646 */
1975 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING|CONST_SIZE);}
1976 #line 1977 "ASN1.c" /* yacc.c:1646 */
1980 #line 317 "ASN1.y" /* yacc.c:1646 */
1981 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING|CONST_LIST);
1982 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
1983 #line 1984 "ASN1.c" /* yacc.c:1646 */
1987 #line 322 "ASN1.y" /* yacc.c:1646 */
1988 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ENUMERATED|CONST_LIST);
1989 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
1990 #line 1991 "ASN1.c" /* yacc.c:1646 */
1994 #line 327 "ASN1.y" /* yacc.c:1646 */
1995 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);}
1996 #line 1997 "ASN1.c" /* yacc.c:1646 */
2000 #line 330 "ASN1.y" /* yacc.c:1646 */
2001 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IDENTIFIER);
2002 _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);}
2003 #line 2004 "ASN1.c" /* yacc.c:1646 */
2007 #line 332 "ASN1.y" /* yacc.c:1646 */
2008 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IDENTIFIER|CONST_SIZE);
2009 _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);
2010 _asn1_set_down((yyval.node),(yyvsp[0].node));}
2011 #line 2012 "ASN1.c" /* yacc.c:1646 */
2015 #line 335 "ASN1.y" /* yacc.c:1646 */
2016 {(yyval.node)=(yyvsp[0].node);}
2017 #line 2018 "ASN1.c" /* yacc.c:1646 */
2021 #line 336 "ASN1.y" /* yacc.c:1646 */
2022 {(yyval.node)=(yyvsp[0].node);}
2023 #line 2024 "ASN1.c" /* yacc.c:1646 */
2027 #line 337 "ASN1.y" /* yacc.c:1646 */
2028 {(yyval.node)=(yyvsp[0].node);}
2029 #line 2030 "ASN1.c" /* yacc.c:1646 */
2033 #line 339 "ASN1.y" /* yacc.c:1646 */
2034 {(yyval.node)=(yyvsp[0].node);}
2035 #line 2036 "ASN1.c" /* yacc.c:1646 */
2039 #line 340 "ASN1.y" /* yacc.c:1646 */
2040 {(yyval.node)=(yyvsp[0].node);}
2041 #line 2042 "ASN1.c" /* yacc.c:1646 */
2045 #line 341 "ASN1.y" /* yacc.c:1646 */
2046 {(yyval.node)=(yyvsp[0].node);}
2047 #line 2048 "ASN1.c" /* yacc.c:1646 */
2051 #line 342 "ASN1.y" /* yacc.c:1646 */
2052 {(yyval.node)=(yyvsp[0].node);}
2053 #line 2054 "ASN1.c" /* yacc.c:1646 */
2057 #line 343 "ASN1.y" /* yacc.c:1646 */
2058 {(yyval.node)=(yyvsp[0].node);}
2059 #line 2060 "ASN1.c" /* yacc.c:1646 */
2063 #line 344 "ASN1.y" /* yacc.c:1646 */
2064 {(yyval.node)=(yyvsp[0].node);}
2065 #line 2066 "ASN1.c" /* yacc.c:1646 */
2069 #line 345 "ASN1.y" /* yacc.c:1646 */
2070 {(yyval.node)=(yyvsp[0].node);}
2071 #line 2072 "ASN1.c" /* yacc.c:1646 */
2075 #line 346 "ASN1.y" /* yacc.c:1646 */
2076 {(yyval.node)=(yyvsp[0].node);}
2077 #line 2078 "ASN1.c" /* yacc.c:1646 */
2081 #line 347 "ASN1.y" /* yacc.c:1646 */
2082 {(yyval.node)=(yyvsp[0].node);}
2083 #line 2084 "ASN1.c" /* yacc.c:1646 */
2087 #line 348 "ASN1.y" /* yacc.c:1646 */
2088 {(yyval.node)=(yyvsp[0].node);}
2089 #line 2090 "ASN1.c" /* yacc.c:1646 */
2093 #line 349 "ASN1.y" /* yacc.c:1646 */
2094 {(yyval.node)=(yyvsp[0].node);}
2095 #line 2096 "ASN1.c" /* yacc.c:1646 */
2099 #line 350 "ASN1.y" /* yacc.c:1646 */
2100 {(yyval.node)=(yyvsp[0].node);}
2101 #line 2102 "ASN1.c" /* yacc.c:1646 */
2105 #line 351 "ASN1.y" /* yacc.c:1646 */
2106 {(yyval.node)=(yyvsp[0].node);}
2107 #line 2108 "ASN1.c" /* yacc.c:1646 */
2111 #line 352 "ASN1.y" /* yacc.c:1646 */
2112 {(yyval.node)=(yyvsp[0].node);}
2113 #line 2114 "ASN1.c" /* yacc.c:1646 */
2117 #line 353 "ASN1.y" /* yacc.c:1646 */
2118 {(yyval.node)=(yyvsp[0].node);}
2119 #line 2120 "ASN1.c" /* yacc.c:1646 */
2123 #line 354 "ASN1.y" /* yacc.c:1646 */
2124 {(yyval.node)=(yyvsp[0].node);}
2125 #line 2126 "ASN1.c" /* yacc.c:1646 */
2129 #line 355 "ASN1.y" /* yacc.c:1646 */
2130 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NULL);}
2131 #line 2132 "ASN1.c" /* yacc.c:1646 */
2135 #line 358 "ASN1.y" /* yacc.c:1646 */
2136 {(yyval.node)=(yyvsp[0].node);}
2137 #line 2138 "ASN1.c" /* yacc.c:1646 */
2141 #line 359 "ASN1.y" /* yacc.c:1646 */
2142 {(yyval.node)=_asn1_mod_type((yyvsp[0].node),CONST_TAG);
2143 _asn1_set_right((yyvsp[-1].node),_asn1_get_down((yyval.node)));
2144 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
2145 #line 2146 "ASN1.c" /* yacc.c:1646 */
2149 #line 364 "ASN1.y" /* yacc.c:1646 */
2150 {(yyval.node)=(yyvsp[0].node);}
2151 #line 2152 "ASN1.c" /* yacc.c:1646 */
2155 #line 365 "ASN1.y" /* yacc.c:1646 */
2156 {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_DEFAULT);
2157 _asn1_set_right((yyvsp[0].node),_asn1_get_down((yyval.node)));
2158 _asn1_set_down((yyval.node),(yyvsp[0].node));}
2159 #line 2160 "ASN1.c" /* yacc.c:1646 */
2163 #line 368 "ASN1.y" /* yacc.c:1646 */
2164 {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_OPTION);}
2165 #line 2166 "ASN1.c" /* yacc.c:1646 */
2169 #line 371 "ASN1.y" /* yacc.c:1646 */
2170 {(yyval.node)=_asn1_set_name((yyvsp[0].node),(yyvsp[-1].str));}
2171 #line 2172 "ASN1.c" /* yacc.c:1646 */
2175 #line 374 "ASN1.y" /* yacc.c:1646 */
2176 {(yyval.node)=(yyvsp[0].node);}
2177 #line 2178 "ASN1.c" /* yacc.c:1646 */
2181 #line 375 "ASN1.y" /* yacc.c:1646 */
2182 {(yyval.node)=(yyvsp[-2].node);
2183 _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));}
2184 #line 2185 "ASN1.c" /* yacc.c:1646 */
2188 #line 379 "ASN1.y" /* yacc.c:1646 */
2189 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE);
2190 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
2191 #line 2192 "ASN1.c" /* yacc.c:1646 */
2195 #line 381 "ASN1.y" /* yacc.c:1646 */
2196 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE_OF);
2197 _asn1_set_down((yyval.node),(yyvsp[0].node));}
2198 #line 2199 "ASN1.c" /* yacc.c:1646 */
2202 #line 383 "ASN1.y" /* yacc.c:1646 */
2203 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE_OF|CONST_SIZE);
2204 _asn1_set_right((yyvsp[-2].node),(yyvsp[0].node));
2205 _asn1_set_down((yyval.node),(yyvsp[-2].node));}
2206 #line 2207 "ASN1.c" /* yacc.c:1646 */
2210 #line 388 "ASN1.y" /* yacc.c:1646 */
2211 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET);
2212 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
2213 #line 2214 "ASN1.c" /* yacc.c:1646 */
2217 #line 390 "ASN1.y" /* yacc.c:1646 */
2218 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET_OF);
2219 _asn1_set_down((yyval.node),(yyvsp[0].node));}
2220 #line 2221 "ASN1.c" /* yacc.c:1646 */
2224 #line 392 "ASN1.y" /* yacc.c:1646 */
2225 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET_OF|CONST_SIZE);
2226 _asn1_set_right((yyvsp[-2].node),(yyvsp[0].node));
2227 _asn1_set_down((yyval.node),(yyvsp[-2].node));}
2228 #line 2229 "ASN1.c" /* yacc.c:1646 */
2232 #line 397 "ASN1.y" /* yacc.c:1646 */
2233 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CHOICE);
2234 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
2235 #line 2236 "ASN1.c" /* yacc.c:1646 */
2239 #line 401 "ASN1.y" /* yacc.c:1646 */
2240 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ANY);}
2241 #line 2242 "ASN1.c" /* yacc.c:1646 */
2245 #line 402 "ASN1.y" /* yacc.c:1646 */
2246 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ANY|CONST_DEFINED_BY);
2247 _asn1_set_down((yyval.node),_asn1_add_static_node(ASN1_ETYPE_CONSTANT));
2248 _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[0].str));}
2249 #line 2250 "ASN1.c" /* yacc.c:1646 */
2253 #line 407 "ASN1.y" /* yacc.c:1646 */
2254 {(yyval.node)=_asn1_set_name((yyvsp[0].node),(yyvsp[-2].str));}
2255 #line 2256 "ASN1.c" /* yacc.c:1646 */
2259 #line 409 "ASN1.y" /* yacc.c:1646 */
2260 {(yyval.node)=_asn1_set_name((yyvsp[0].node), last_error_token);}
2261 #line 2262 "ASN1.c" /* yacc.c:1646 */
2265 #line 413 "ASN1.y" /* yacc.c:1646 */
2266 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN);
2267 _asn1_set_name((yyval.node),(yyvsp[-6].str));
2268 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
2269 #line 2270 "ASN1.c" /* yacc.c:1646 */
2273 #line 417 "ASN1.y" /* yacc.c:1646 */
2274 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM);
2275 _asn1_set_name((yyval.node),(yyvsp[-5].str));
2276 _asn1_set_value((yyval.node),(yyvsp[-4].str),strlen((yyvsp[-4].str))+1);
2277 _asn1_set_down((yyval.node),(yyvsp[-1].node));}
2278 #line 2279 "ASN1.c" /* yacc.c:1646 */
2282 #line 422 "ASN1.y" /* yacc.c:1646 */
2283 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_ASSIGN);
2284 _asn1_set_name((yyval.node),(yyvsp[-3].str));
2285 _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);}
2286 #line 2287 "ASN1.c" /* yacc.c:1646 */
2290 #line 427 "ASN1.y" /* yacc.c:1646 */
2291 {(yyval.node)=(yyvsp[0].node);}
2292 #line 2293 "ASN1.c" /* yacc.c:1646 */
2296 #line 428 "ASN1.y" /* yacc.c:1646 */
2297 {(yyval.node)=(yyvsp[0].node);}
2298 #line 2299 "ASN1.c" /* yacc.c:1646 */
2302 #line 431 "ASN1.y" /* yacc.c:1646 */
2303 {(yyval.node)=(yyvsp[0].node);}
2304 #line 2305 "ASN1.c" /* yacc.c:1646 */
2308 #line 432 "ASN1.y" /* yacc.c:1646 */
2309 {(yyval.node)=(yyvsp[-1].node);
2310 _asn1_set_right(_asn1_get_last_right((yyvsp[-1].node)),(yyvsp[0].node));}
2311 #line 2312 "ASN1.c" /* yacc.c:1646 */
2315 #line 436 "ASN1.y" /* yacc.c:1646 */
2316 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);
2317 _asn1_set_down((yyval.node),(yyvsp[-1].node));
2318 _asn1_set_name((yyval.node),(yyvsp[-3].str));}
2319 #line 2320 "ASN1.c" /* yacc.c:1646 */
2323 #line 439 "ASN1.y" /* yacc.c:1646 */
2324 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);
2325 _asn1_set_name((yyval.node),(yyvsp[-2].str));}
2326 #line 2327 "ASN1.c" /* yacc.c:1646 */
2330 #line 441 "ASN1.y" /* yacc.c:1646 */
2331 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);
2332 _asn1_set_name((yyval.node),(yyvsp[0].str));}
2333 #line 2334 "ASN1.c" /* yacc.c:1646 */
2337 #line 465 "ASN1.y" /* yacc.c:1646 */
2338 {(yyval.constant)=CONST_EXPLICIT;}
2339 #line 2340 "ASN1.c" /* yacc.c:1646 */
2343 #line 466 "ASN1.y" /* yacc.c:1646 */
2344 {(yyval.constant)=CONST_IMPLICIT;}
2345 #line 2346 "ASN1.c" /* yacc.c:1646 */
2349 #line 2350 "ASN1.c" /* yacc.c:1646 */
2352 /* User semantic actions sometimes alter yychar, and that requires
2353 that yytoken be updated with the new translation. We take the
2354 approach of translating immediately before every use of yytoken.
2355 One alternative is translating here after every semantic action,
2356 but that translation would be missed if the semantic action invokes
2357 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2358 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2359 incorrect destructor might then be invoked immediately. In the
2360 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2361 to an incorrect destructor call or verbose syntax error message
2362 before the lookahead is translated. */
2363 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2367 YY_STACK_PRINT (yyss, yyssp);
2371 /* Now 'shift' the result of the reduction. Determine what state
2372 that goes to, based on the state we popped back to and the rule
2373 number reduced by. */
2377 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2378 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2379 yystate = yytable[yystate];
2381 yystate = yydefgoto[yyn - YYNTOKENS];
2386 /*--------------------------------------.
2387 | yyerrlab -- here on detecting error. |
2388 `--------------------------------------*/
2390 /* Make sure we have latest lookahead translation. See comments at
2391 user semantic actions for why this is necessary. */
2392 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2394 /* If not already recovering from an error, report this error. */
2398 #if ! YYERROR_VERBOSE
2399 yyerror (YY_("syntax error"));
2401 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2404 char const *yymsgp = YY_("syntax error");
2405 int yysyntax_error_status;
2406 yysyntax_error_status = YYSYNTAX_ERROR;
2407 if (yysyntax_error_status == 0)
2409 else if (yysyntax_error_status == 1)
2411 if (yymsg != yymsgbuf)
2412 YYSTACK_FREE (yymsg);
2413 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2417 yymsg_alloc = sizeof yymsgbuf;
2418 yysyntax_error_status = 2;
2422 yysyntax_error_status = YYSYNTAX_ERROR;
2427 if (yysyntax_error_status == 2)
2428 goto yyexhaustedlab;
2430 # undef YYSYNTAX_ERROR
2436 if (yyerrstatus == 3)
2438 /* If just tried and failed to reuse lookahead token after an
2439 error, discard it. */
2441 if (yychar <= YYEOF)
2443 /* Return failure if at end of input. */
2444 if (yychar == YYEOF)
2449 yydestruct ("Error: discarding",
2455 /* Else will try to reuse lookahead token after shifting the error
2460 /*---------------------------------------------------.
2461 | yyerrorlab -- error raised explicitly by YYERROR. |
2462 `---------------------------------------------------*/
2465 /* Pacify compilers like GCC when the user code never invokes
2466 YYERROR and the label yyerrorlab therefore never appears in user
2468 if (/*CONSTCOND*/ 0)
2471 /* Do not reclaim the symbols of the rule whose action triggered
2475 YY_STACK_PRINT (yyss, yyssp);
2480 /*-------------------------------------------------------------.
2481 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2482 `-------------------------------------------------------------*/
2484 yyerrstatus = 3; /* Each real token shifted decrements this. */
2488 yyn = yypact[yystate];
2489 if (!yypact_value_is_default (yyn))
2492 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2500 /* Pop the current state because it cannot handle the error token. */
2505 yydestruct ("Error: popping",
2506 yystos[yystate], yyvsp);
2509 YY_STACK_PRINT (yyss, yyssp);
2512 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2514 YY_IGNORE_MAYBE_UNINITIALIZED_END
2517 /* Shift the error token. */
2518 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2524 /*-------------------------------------.
2525 | yyacceptlab -- YYACCEPT comes here. |
2526 `-------------------------------------*/
2531 /*-----------------------------------.
2532 | yyabortlab -- YYABORT comes here. |
2533 `-----------------------------------*/
2538 #if !defined yyoverflow || YYERROR_VERBOSE
2539 /*-------------------------------------------------.
2540 | yyexhaustedlab -- memory exhaustion comes here. |
2541 `-------------------------------------------------*/
2543 yyerror (YY_("memory exhausted"));
2549 if (yychar != YYEMPTY)
2551 /* Make sure we have latest lookahead translation. See comments at
2552 user semantic actions for why this is necessary. */
2553 yytoken = YYTRANSLATE (yychar);
2554 yydestruct ("Cleanup: discarding lookahead",
2557 /* Do not reclaim the symbols of the rule whose action triggered
2558 this YYABORT or YYACCEPT. */
2560 YY_STACK_PRINT (yyss, yyssp);
2561 while (yyssp != yyss)
2563 yydestruct ("Cleanup: popping",
2564 yystos[*yyssp], yyvsp);
2569 YYSTACK_FREE (yyss);
2572 if (yymsg != yymsgbuf)
2573 YYSTACK_FREE (yymsg);
2577 #line 470 "ASN1.y" /* yacc.c:1906 */
2582 static const char *key_word[] = {
2583 "::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING",
2584 "SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL",
2585 "DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER",
2586 "BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED",
2587 "SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS",
2588 "BEGIN","END","UTCTime","GeneralizedTime",
2589 "GeneralString","FROM","IMPORTS","NULL","ENUMERATED",
2590 "NumericString", "IA5String", "TeletexString", "PrintableString",
2591 "UniversalString", "BMPString", "UTF8String", "VisibleString"};
2593 static const int key_word_token[] = {
2594 ASSIG, OPTIONAL, INTEGER, SIZE, OCTET, STRING, SEQUENCE, BIT, UNIVERSAL,
2595 PRIVATE, OPTIONAL, DEFAULT, CHOICE, OF, OBJECT, STR_IDENTIFIER,
2596 BOOLEAN, ASN1_TRUE, ASN1_FALSE, APPLICATION, ANY, DEFINED, SET, BY,
2597 EXPLICIT, IMPLICIT, DEFINITIONS, TAGS, BEGIN, END, UTCTime,
2598 GeneralizedTime, GeneralString, FROM, IMPORTS, TOKEN_NULL,
2599 ENUMERATED, NumericString, IA5String, TeletexString, PrintableString,
2600 UniversalString, BMPString, UTF8String, VisibleString
2603 /*************************************************************/
2604 /* Function: _asn1_yylex */
2605 /* Description: looks for tokens in file_asn1 pointer file. */
2607 /* Token identifier or ASCII code or 0(zero: End Of File) */
2608 /*************************************************************/
2612 int c, counter = 0, k, lastc;
2613 char string[ASN1_MAX_NAME_SIZE + 1]; /* will contain the next token */
2618 while ((c = fgetc (file_asn1)) == ' ' || c == '\t' || c == '\n')
2624 snprintf (last_token, sizeof(last_token), "End Of File");
2628 if (c == '(' || c == ')' || c == '[' || c == ']' ||
2629 c == '{' || c == '}' || c == ',' || c == '.' ||
2630 c == '+' || c == '|')
2637 { /* Maybe the first '-' of a comment */
2638 if ((c = fgetc (file_asn1)) != '-')
2640 ungetc (c, file_asn1);
2641 last_token[0] = '-';
2649 /* A comment finishes at the next double hypen or the end of line */
2650 while ((c = fgetc (file_asn1)) != EOF && c != '\n' &&
2651 (lastc != '-' || (lastc == '-' && c != '-')))
2655 snprintf (last_token, sizeof(last_token), "End Of File");
2662 continue; /* next char, please! (repeat the search) */
2666 string[counter++] = c;
2667 /* Till the end of the token */
2669 ((c = fgetc (file_asn1)) == EOF || c == ' ' || c == '\t'
2670 || c == '\n' || c == '(' || c == ')' || c == '[' || c == ']'
2671 || c == '{' || c == '}' || c == ',' || c == '.'))
2673 if (counter >= ASN1_MAX_NAME_SIZE)
2675 result_parse = ASN1_NAME_TOO_LONG;
2678 string[counter++] = c;
2680 ungetc (c, file_asn1);
2681 string[counter] = 0;
2682 snprintf (last_token, sizeof(last_token), "%s", string);
2684 /* Is STRING a number? */
2685 for (k = 0; k < counter; k++)
2686 if (!isdigit (string[k]))
2690 snprintf (yylval.str, sizeof(yylval.str), "%s", string);
2691 return NUM; /* return the number */
2694 /* Is STRING a keyword? */
2695 for (i = 0; i < (sizeof (key_word) / sizeof (char *)); i++)
2696 if (!strcmp (string, key_word[i]))
2697 return key_word_token[i];
2699 /* STRING is an IDENTIFIER */
2700 snprintf (yylval.str, sizeof(yylval.str), "%s", string);
2705 /*************************************************************/
2706 /* Function: _asn1_create_errorDescription */
2707 /* Description: creates a string with the description of the*/
2710 /* error : error to describe. */
2711 /* error_desc: string that will contain the */
2713 /*************************************************************/
2715 _asn1_create_errorDescription (int error, char *error_desc)
2717 if (error_desc == NULL)
2723 case ASN1_FILE_NOT_FOUND:
2724 snprintf(error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s file was not found", file_name);
2726 case ASN1_SYNTAX_ERROR:
2727 snprintf(error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s", last_error);
2729 case ASN1_NAME_TOO_LONG:
2730 snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE,
2731 "%s:%u: name too long (more than %u characters)", file_name,
2732 line_number, ASN1_MAX_NAME_SIZE);
2734 case ASN1_IDENTIFIER_NOT_FOUND:
2735 snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE,
2736 "%s:: identifier '%s' not found", file_name,
2737 _asn1_identifierMissing);
2748 * @file: specify the path and the name of file that contains
2749 * ASN.1 declarations.
2750 * @definitions: return the pointer to the structure created from
2751 * "file" ASN.1 declarations.
2752 * @error_desc: return the error description or an empty
2753 * string if success.
2755 * Function used to start the parse algorithm. Creates the structures
2756 * needed to manage the definitions included in @file file.
2758 * Returns: %ASN1_SUCCESS if the file has a correct syntax and every
2759 * identifier is known, %ASN1_ELEMENT_NOT_EMPTY if @definitions not
2760 * %NULL, %ASN1_FILE_NOT_FOUND if an error occured while
2761 * opening @file, %ASN1_SYNTAX_ERROR if the syntax is not
2762 * correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an
2763 * identifier that is not defined, %ASN1_NAME_TOO_LONG if in the
2764 * file there is an identifier whith more than %ASN1_MAX_NAME_SIZE
2768 asn1_parser2tree (const char *file, asn1_node * definitions,
2774 if (*definitions != NULL)
2775 return ASN1_ELEMENT_NOT_EMPTY;
2777 *definitions = NULL;
2781 /* open the file to parse */
2782 file_asn1 = fopen (file, "r");
2784 if (file_asn1 == NULL)
2786 result_parse = ASN1_FILE_NOT_FOUND;
2790 result_parse = ASN1_SUCCESS;
2797 if (result_parse == ASN1_SUCCESS)
2799 /* set IMPLICIT or EXPLICIT property */
2800 _asn1_set_default_tag (p_tree);
2801 /* set CONST_SET and CONST_NOT_USED */
2802 _asn1_type_set_config (p_tree);
2803 /* check the identifier definitions */
2804 result_parse = _asn1_check_identifier (p_tree);
2805 if (result_parse == ASN1_SUCCESS)
2806 { /* all identifier defined */
2807 /* Delete the list and keep the ASN1 structure */
2808 _asn1_delete_list ();
2809 /* Convert into DER coding the value assign to INTEGER constants */
2810 _asn1_change_integer_value (p_tree);
2811 /* Expand the IDs of OBJECT IDENTIFIER constants */
2812 _asn1_expand_object_id (p_tree);
2814 *definitions = p_tree;
2816 else /* some identifiers not defined */
2817 /* Delete the list and the ASN1 structure */
2818 _asn1_delete_list_and_nodes ();
2820 else /* syntax error */
2821 /* Delete the list and the ASN1 structure */
2822 _asn1_delete_list_and_nodes ();
2825 _asn1_create_errorDescription (result_parse, error_desc);
2827 return result_parse;
2831 * asn1_parser2array:
2832 * @inputFileName: specify the path and the name of file that
2833 * contains ASN.1 declarations.
2834 * @outputFileName: specify the path and the name of file that will
2835 * contain the C vector definition.
2836 * @vectorName: specify the name of the C vector.
2837 * @error_desc: return the error description or an empty
2838 * string if success.
2840 * Function that generates a C structure from an ASN1 file. Creates a
2841 * file containing a C vector to use to manage the definitions
2842 * included in @inputFileName file. If @inputFileName is
2843 * "/aa/bb/xx.yy" and @outputFileName is %NULL, the file created is
2844 * "/aa/bb/xx_asn1_tab.c". If @vectorName is %NULL the vector name
2845 * will be "xx_asn1_tab".
2847 * Returns: %ASN1_SUCCESS if the file has a correct syntax and every
2848 * identifier is known, %ASN1_FILE_NOT_FOUND if an error occured
2849 * while opening @inputFileName, %ASN1_SYNTAX_ERROR if the syntax is
2850 * not correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is
2851 * an identifier that is not defined, %ASN1_NAME_TOO_LONG if in the
2852 * file there is an identifier whith more than %ASN1_MAX_NAME_SIZE
2856 asn1_parser2array (const char *inputFileName, const char *outputFileName,
2857 const char *vectorName, char *error_desc)
2859 char *file_out_name = NULL;
2860 char *vector_name = NULL;
2861 const char *char_p, *slash_p, *dot_p;
2865 file_name = inputFileName;
2867 /* open the file to parse */
2868 file_asn1 = fopen (inputFileName, "r");
2870 if (file_asn1 == NULL)
2871 result_parse = ASN1_FILE_NOT_FOUND;
2874 result_parse = ASN1_SUCCESS;
2881 if (result_parse == ASN1_SUCCESS)
2883 /* set IMPLICIT or EXPLICIT property */
2884 _asn1_set_default_tag (p_tree);
2885 /* set CONST_SET and CONST_NOT_USED */
2886 _asn1_type_set_config (p_tree);
2887 /* check the identifier definitions */
2888 result_parse = _asn1_check_identifier (p_tree);
2890 if (result_parse == ASN1_SUCCESS)
2891 { /* all identifier defined */
2893 /* searching the last '/' and '.' in inputFileName */
2894 char_p = inputFileName;
2895 slash_p = inputFileName;
2896 while ((char_p = strchr (char_p, '/')))
2903 dot_p = inputFileName + strlen (inputFileName);
2905 while ((char_p = strchr (char_p, '.')))
2911 if (outputFileName == NULL)
2913 /* file_out_name = inputFileName + _asn1_tab.c */
2914 file_out_name = malloc (dot_p - inputFileName + 1 +
2915 strlen ("_asn1_tab.c"));
2916 memcpy (file_out_name, inputFileName,
2917 dot_p - inputFileName);
2918 file_out_name[dot_p - inputFileName] = 0;
2919 strcat (file_out_name, "_asn1_tab.c");
2923 /* file_out_name = inputFileName */
2925 (char *) malloc (strlen (outputFileName) + 1);
2926 strcpy (file_out_name, outputFileName);
2929 if (vectorName == NULL)
2931 /* vector_name = file name + _asn1_tab */
2932 vector_name = malloc (dot_p - slash_p + 1 +
2933 strlen ("_asn1_tab"));
2934 memcpy (vector_name, slash_p, dot_p - slash_p);
2935 vector_name[dot_p - slash_p] = 0;
2936 strcat (vector_name, "_asn1_tab");
2940 /* vector_name = vectorName */
2941 vector_name = (char *) malloc (strlen (vectorName) + 1);
2942 strcpy (vector_name, vectorName);
2945 /* Save structure in a file */
2946 _asn1_create_static_structure (p_tree,
2947 file_out_name, vector_name);
2949 free (file_out_name);
2951 } /* result == OK */
2952 } /* result == OK */
2954 /* Delete the list and the ASN1 structure */
2955 _asn1_delete_list_and_nodes ();
2956 } /* inputFile exist */
2958 _asn1_create_errorDescription (result_parse, error_desc);
2960 return result_parse;
2963 /*************************************************************/
2964 /* Function: _asn1_yyerror */
2965 /* Description: function called when there are syntax errors*/
2967 /* char *s : error description */
2970 /*************************************************************/
2972 _asn1_yyerror (const char *s)
2974 /* Sends the error description to the std_out */
2976 if (strcmp (last_token, "VisibleString") == 0 ||
2977 strcmp (last_token, "PrintableString") == 0 ||
2978 strcmp (last_token, "UniversalString") == 0 ||
2979 strcmp (last_token, "IA5String") == 0 ||
2980 strcmp (last_token, "UTF8String") == 0 ||
2981 strcmp (last_token, "NumericString") == 0 ||
2982 strcmp (last_token, "TeletexString") == 0 ||
2983 strcmp (last_token, "BMPString") == 0)
2985 snprintf (last_error_token, sizeof(last_error_token),
2987 fprintf(stderr, "%s:%u: Warning: %s is a built-in ASN.1 type.\n",
2988 file_name, line_number, last_token);
2991 last_error_token[0] = 0;
2993 if (result_parse != ASN1_NAME_TOO_LONG)
2995 snprintf (last_error, sizeof(last_error),
2996 "%s:%u: Error: %s near '%s'", file_name,
2997 line_number, s, last_token);
2998 result_parse = ASN1_SYNTAX_ERROR;