1 /* A Bison parser, made by GNU Bison 2.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2011 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 "2.5"
50 #define YYSKELETON_NAME "yacc.c"
61 /* Using locations. */
62 #define YYLSP_NEEDED 0
64 /* Substitute the variable and function names. */
65 #define yyparse _asn1_yyparse
66 #define yylex _asn1_yylex
67 #define yyerror _asn1_yyerror
68 #define yylval _asn1_yylval
69 #define yychar _asn1_yychar
70 #define yydebug _asn1_yydebug
71 #define yynerrs _asn1_yynerrs
74 /* Copy the first part of user declarations. */
76 /* Line 268 of yacc.c */
80 * Copyright (C) 2001-2012 Free Software Foundation, Inc.
82 * This file is part of LIBTASN1.
84 * The LIBTASN1 library is free software; you can redistribute it
85 * and/or modify it under the terms of the GNU Lesser General Public
86 * License as published by the Free Software Foundation; either
87 * version 2.1 of the License, or (at your option) any later version.
89 * This library is distributed in the hope that it will be useful, but
90 * WITHOUT ANY WARRANTY; without even the implied warranty of
91 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92 * Lesser General Public License for more details.
94 * You should have received a copy of the GNU Lesser General Public
95 * License along with this library; if not, write to the Free Software
96 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
100 /*****************************************************/
101 /* File: x509_ASN.y */
102 /* Description: input file for 'bison' program. */
103 /* The output file is a parser (in C language) for */
105 /*****************************************************/
108 #include <parser_aux.h>
109 #include <structure.h>
110 #include <libtasn1.h>
112 static FILE *file_asn1; /* Pointer to file to parse */
113 static int result_parse = 0; /* result of the parser
115 static asn1_node p_tree; /* pointer to the root of the
116 structure created by the
118 static unsigned int line_number; /* line number describing the
119 parser position inside the
121 static char last_error[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = "";
122 static char last_error_token[ASN1_MAX_NAME_SIZE+1] = ""; /* used when expected errors occur */
123 static char last_token[ASN1_MAX_NAME_SIZE+1] = ""; /* last token find in the file
124 to parse before the 'parse
126 extern char _asn1_identifierMissing[];
127 static const char *file_name; /* file to parse */
129 static void _asn1_yyerror (const char *);
130 static int _asn1_yylex(void);
134 /* Line 268 of yacc.c */
137 /* Enabling traces. */
142 /* Enabling verbose error messages. */
143 #ifdef YYERROR_VERBOSE
144 # undef YYERROR_VERBOSE
145 # define YYERROR_VERBOSE 1
147 # define YYERROR_VERBOSE 1
150 /* Enabling the token table. */
151 #ifndef YYTOKEN_TABLE
152 # define YYTOKEN_TABLE 0
159 /* Put the tokens into the symbol table, so that GDB and other debuggers
179 STR_IDENTIFIER = 275,
195 GeneralizedTime = 291,
200 PrintableString = 296,
201 UniversalString = 297,
213 #define IDENTIFIER 260
221 #define UNIVERSAL 268
223 #define APPLICATION 270
228 #define STR_IDENTIFIER 275
230 #define ASN1_TRUE 277
231 #define ASN1_FALSE 278
232 #define TOKEN_NULL 279
239 #define DEFINITIONS 286
244 #define GeneralizedTime 291
245 #define GeneralString 292
246 #define NumericString 293
247 #define IA5String 294
248 #define TeletexString 295
249 #define PrintableString 296
250 #define UniversalString 297
251 #define BMPString 298
252 #define UTF8String 299
253 #define VisibleString 300
256 #define ENUMERATED 303
261 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
262 typedef union YYSTYPE
265 /* Line 293 of yacc.c */
268 unsigned int constant;
269 char str[ASN1_MAX_NAME_SIZE+1];
274 /* Line 293 of yacc.c */
277 # define YYSTYPE_IS_TRIVIAL 1
278 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
279 # define YYSTYPE_IS_DECLARED 1
283 /* Copy the second part of user declarations. */
286 /* Line 343 of yacc.c */
294 typedef YYTYPE_UINT8 yytype_uint8;
296 typedef unsigned char yytype_uint8;
300 typedef YYTYPE_INT8 yytype_int8;
301 #elif (defined __STDC__ || defined __C99__FUNC__ \
302 || defined __cplusplus || defined _MSC_VER)
303 typedef signed char yytype_int8;
305 typedef short int yytype_int8;
309 typedef YYTYPE_UINT16 yytype_uint16;
311 typedef unsigned short int yytype_uint16;
315 typedef YYTYPE_INT16 yytype_int16;
317 typedef short int yytype_int16;
321 # ifdef __SIZE_TYPE__
322 # define YYSIZE_T __SIZE_TYPE__
323 # elif defined size_t
324 # define YYSIZE_T size_t
325 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
326 || defined __cplusplus || defined _MSC_VER)
327 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
328 # define YYSIZE_T size_t
330 # define YYSIZE_T unsigned int
334 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
337 # if defined YYENABLE_NLS && YYENABLE_NLS
339 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
340 # define YY_(msgid) dgettext ("bison-runtime", msgid)
344 # define YY_(msgid) msgid
348 /* Suppress unused-variable warnings by "using" E. */
349 #if ! defined lint || defined __GNUC__
350 # define YYUSE(e) ((void) (e))
352 # define YYUSE(e) /* empty */
355 /* Identity function, used to suppress warnings about constant conditions. */
359 #if (defined __STDC__ || defined __C99__FUNC__ \
360 || defined __cplusplus || defined _MSC_VER)
373 #if ! defined yyoverflow || YYERROR_VERBOSE
375 /* The parser invokes alloca or malloc; define the necessary symbols. */
377 # ifdef YYSTACK_USE_ALLOCA
378 # if YYSTACK_USE_ALLOCA
380 # define YYSTACK_ALLOC __builtin_alloca
381 # elif defined __BUILTIN_VA_ARG_INCR
382 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
384 # define YYSTACK_ALLOC __alloca
385 # elif defined _MSC_VER
386 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
387 # define alloca _alloca
389 # define YYSTACK_ALLOC alloca
390 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
391 || defined __cplusplus || defined _MSC_VER)
392 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
393 # ifndef EXIT_SUCCESS
394 # define EXIT_SUCCESS 0
401 # ifdef YYSTACK_ALLOC
402 /* Pacify GCC's `empty if-body' warning. */
403 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
404 # ifndef YYSTACK_ALLOC_MAXIMUM
405 /* The OS might guarantee only one guard page at the bottom of the stack,
406 and a page size can be as small as 4096 bytes. So we cannot safely
407 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
408 to allow for a few compiler-allocated temporary stack slots. */
409 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
412 # define YYSTACK_ALLOC YYMALLOC
413 # define YYSTACK_FREE YYFREE
414 # ifndef YYSTACK_ALLOC_MAXIMUM
415 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
417 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
418 && ! ((defined YYMALLOC || defined malloc) \
419 && (defined YYFREE || defined free)))
420 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
421 # ifndef EXIT_SUCCESS
422 # define EXIT_SUCCESS 0
426 # define YYMALLOC malloc
427 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
428 || defined __cplusplus || defined _MSC_VER)
429 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
434 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
435 || defined __cplusplus || defined _MSC_VER)
436 void free (void *); /* INFRINGES ON USER NAME SPACE */
440 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
443 #if (! defined yyoverflow \
444 && (! defined __cplusplus \
445 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
447 /* A type that is properly aligned for any stack member. */
450 yytype_int16 yyss_alloc;
454 /* The size of the maximum gap between one aligned stack and the next. */
455 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
457 /* The size of an array large to enough to hold all stacks, each with
459 # define YYSTACK_BYTES(N) \
460 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
461 + YYSTACK_GAP_MAXIMUM)
463 # define YYCOPY_NEEDED 1
465 /* Relocate STACK from its old location to the new one. The
466 local variables YYSIZE and YYSTACKSIZE give the old and new number of
467 elements in the stack, and YYPTR gives the new location of the
468 stack. Advance YYPTR to a properly aligned location for the next
470 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
473 YYSIZE_T yynewbytes; \
474 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
475 Stack = &yyptr->Stack_alloc; \
476 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
477 yyptr += yynewbytes / sizeof (*yyptr); \
483 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
484 /* Copy COUNT objects from FROM to TO. The source and destination do
487 # if defined __GNUC__ && 1 < __GNUC__
488 # define YYCOPY(To, From, Count) \
489 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
491 # define YYCOPY(To, From, Count) \
495 for (yyi = 0; yyi < (Count); yyi++) \
496 (To)[yyi] = (From)[yyi]; \
501 #endif /* !YYCOPY_NEEDED */
503 /* YYFINAL -- State number of the termination state. */
505 /* YYLAST -- Last index in YYTABLE. */
508 /* YYNTOKENS -- Number of terminals. */
510 /* YYNNTS -- Number of nonterminals. */
512 /* YYNRULES -- Number of rules. */
514 /* YYNRULES -- Number of states. */
515 #define YYNSTATES 217
517 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
519 #define YYMAXUTOK 303
521 #define YYTRANSLATE(YYX) \
522 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
524 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
525 static const yytype_uint8 yytranslate[] =
527 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 51, 52, 2, 49, 53, 50, 59, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 54, 2, 55, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 57, 56, 58, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 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 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
553 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
554 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
555 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
556 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
561 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
563 static const yytype_uint16 yyprhs[] =
565 0, 0, 3, 12, 14, 17, 20, 22, 24, 26,
566 28, 30, 32, 36, 41, 43, 47, 49, 54, 56,
567 59, 61, 63, 65, 69, 74, 76, 79, 82, 85,
568 88, 91, 93, 97, 99, 104, 109, 117, 119, 121,
569 123, 128, 136, 138, 142, 144, 147, 149, 152, 154,
570 157, 159, 162, 164, 167, 169, 172, 174, 177, 179,
571 182, 184, 187, 190, 194, 199, 201, 205, 208, 212,
572 218, 223, 226, 228, 231, 233, 235, 237, 239, 241,
573 243, 245, 247, 249, 251, 253, 255, 257, 259, 261,
574 263, 265, 267, 269, 271, 273, 275, 278, 280, 283,
575 286, 289, 291, 295, 300, 304, 309, 314, 318, 323,
576 328, 330, 335, 339, 343, 351, 358, 363, 365, 367,
577 369, 372, 377, 381, 383, 385
580 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
581 static const yytype_int8 yyrhs[] =
583 61, 0, -1, 109, 31, 110, 32, 3, 33, 108,
584 34, -1, 4, -1, 49, 4, -1, 50, 4, -1,
585 62, -1, 63, -1, 4, -1, 5, -1, 64, -1,
586 5, -1, 51, 64, 52, -1, 5, 51, 64, 52,
587 -1, 67, -1, 68, 53, 67, -1, 65, -1, 5,
588 51, 4, 52, -1, 69, -1, 70, 69, -1, 13,
589 -1, 14, -1, 15, -1, 54, 4, 55, -1, 54,
590 71, 4, 55, -1, 72, -1, 72, 29, -1, 72,
591 30, -1, 16, 66, -1, 16, 22, -1, 16, 23,
592 -1, 64, -1, 75, 56, 64, -1, 7, -1, 7,
593 57, 68, 58, -1, 76, 51, 75, 52, -1, 76,
594 51, 65, 59, 59, 65, 52, -1, 21, -1, 35,
595 -1, 36, -1, 8, 51, 65, 52, -1, 8, 51,
596 65, 59, 59, 65, 52, -1, 79, -1, 51, 79,
597 52, -1, 37, -1, 37, 80, -1, 38, -1, 38,
598 80, -1, 39, -1, 39, 80, -1, 40, -1, 40,
599 80, -1, 41, -1, 41, 80, -1, 42, -1, 42,
600 80, -1, 43, -1, 43, 80, -1, 44, -1, 44,
601 80, -1, 45, -1, 45, 80, -1, 9, 10, -1,
602 9, 10, 80, -1, 5, 51, 4, 52, -1, 91,
603 -1, 92, 53, 91, -1, 12, 10, -1, 12, 10,
604 80, -1, 12, 10, 57, 92, 58, -1, 48, 57,
605 92, 58, -1, 19, 20, -1, 5, -1, 5, 80,
606 -1, 76, -1, 94, -1, 77, -1, 78, -1, 90,
607 -1, 93, -1, 81, -1, 82, -1, 83, -1, 84,
608 -1, 85, -1, 86, -1, 87, -1, 88, -1, 89,
609 -1, 101, -1, 95, -1, 103, -1, 104, -1, 102,
610 -1, 24, -1, 96, -1, 73, 96, -1, 97, -1,
611 97, 74, -1, 97, 6, -1, 5, 98, -1, 99,
612 -1, 100, 53, 99, -1, 11, 57, 100, 58, -1,
613 11, 18, 96, -1, 11, 80, 18, 96, -1, 28,
614 57, 100, 58, -1, 28, 18, 96, -1, 28, 80,
615 18, 96, -1, 17, 57, 100, 58, -1, 25, -1,
616 25, 26, 27, 5, -1, 5, 3, 97, -1, 1,
617 3, 97, -1, 5, 19, 20, 3, 57, 70, 58,
618 -1, 5, 5, 3, 57, 70, 58, -1, 5, 7,
619 3, 64, -1, 105, -1, 106, -1, 107, -1, 108,
620 107, -1, 5, 57, 70, 58, -1, 5, 57, 58,
621 -1, 5, -1, 29, -1, 30, -1
624 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
625 static const yytype_uint16 yyrline[] =
627 0, 134, 134, 147, 148, 151, 155, 156, 159, 160,
628 163, 164, 167, 169, 174, 175, 179, 181, 186, 187,
629 191, 192, 193, 196, 198, 202, 203, 204, 207, 209,
630 210, 214, 215, 219, 220, 222, 223, 230, 233, 234,
631 237, 239, 245, 246, 249, 250, 254, 255, 259, 260,
632 264, 265, 269, 270, 274, 275, 279, 280, 284, 285,
633 289, 290, 294, 295, 299, 304, 305, 309, 310, 311,
634 316, 322, 325, 327, 330, 331, 332, 333, 334, 335,
635 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
636 346, 347, 348, 349, 350, 353, 354, 359, 360, 363,
637 366, 369, 370, 374, 376, 378, 383, 385, 387, 392,
638 396, 397, 402, 404, 407, 411, 416, 422, 423, 426,
639 427, 431, 434, 436, 460, 461
643 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
644 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
645 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
646 static const char *const yytname[] =
648 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER",
649 "OPTIONAL", "INTEGER", "SIZE", "OCTET", "STRING", "SEQUENCE", "BIT",
650 "UNIVERSAL", "PRIVATE", "APPLICATION", "DEFAULT", "CHOICE", "OF",
651 "OBJECT", "STR_IDENTIFIER", "BOOLEAN", "ASN1_TRUE", "ASN1_FALSE",
652 "TOKEN_NULL", "ANY", "DEFINED", "BY", "SET", "EXPLICIT", "IMPLICIT",
653 "DEFINITIONS", "TAGS", "BEGIN", "END", "UTCTime", "GeneralizedTime",
654 "GeneralString", "NumericString", "IA5String", "TeletexString",
655 "PrintableString", "UniversalString", "BMPString", "UTF8String",
656 "VisibleString", "FROM", "IMPORTS", "ENUMERATED", "'+'", "'-'", "'('",
657 "')'", "','", "'['", "']'", "'|'", "'{'", "'}'", "'.'", "$accept",
658 "definitions", "pos_num", "neg_num", "pos_neg_num", "num_identifier",
659 "pos_neg_identifier", "constant", "constant_list", "obj_constant",
660 "obj_constant_list", "class", "tag_type", "tag", "default",
661 "pos_neg_list", "integer_def", "boolean_def", "Time", "size_def2",
662 "size_def", "generalstring_def", "numericstring_def", "ia5string_def",
663 "teletexstring_def", "printablestring_def", "universalstring_def",
664 "bmpstring_def", "utf8string_def", "visiblestring_def",
665 "octet_string_def", "bit_element", "bit_element_list", "bit_string_def",
666 "enumerated_def", "object_def", "type_assig_right",
667 "type_assig_right_tag", "type_assig_right_tag_default", "type_assig",
668 "type_assig_list", "sequence_def", "set_def", "choise_def", "any_def",
669 "type_def", "constant_def", "type_constant", "type_constant_list",
670 "definitions_id", "explicit_implicit", 0
675 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
677 static const yytype_uint16 yytoknum[] =
679 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
680 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
681 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
682 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
683 295, 296, 297, 298, 299, 300, 301, 302, 303, 43,
684 45, 40, 41, 44, 91, 93, 124, 123, 125, 46
688 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
689 static const yytype_uint8 yyr1[] =
691 0, 60, 61, 62, 62, 63, 64, 64, 65, 65,
692 66, 66, 67, 67, 68, 68, 69, 69, 70, 70,
693 71, 71, 71, 72, 72, 73, 73, 73, 74, 74,
694 74, 75, 75, 76, 76, 76, 76, 77, 78, 78,
695 79, 79, 80, 80, 81, 81, 82, 82, 83, 83,
696 84, 84, 85, 85, 86, 86, 87, 87, 88, 88,
697 89, 89, 90, 90, 91, 92, 92, 93, 93, 93,
698 94, 95, 96, 96, 96, 96, 96, 96, 96, 96,
699 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
700 96, 96, 96, 96, 96, 97, 97, 98, 98, 98,
701 99, 100, 100, 101, 101, 101, 102, 102, 102, 103,
702 104, 104, 105, 105, 106, 106, 106, 107, 107, 108,
703 108, 109, 109, 109, 110, 110
706 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
707 static const yytype_uint8 yyr2[] =
709 0, 2, 8, 1, 2, 2, 1, 1, 1, 1,
710 1, 1, 3, 4, 1, 3, 1, 4, 1, 2,
711 1, 1, 1, 3, 4, 1, 2, 2, 2, 2,
712 2, 1, 3, 1, 4, 4, 7, 1, 1, 1,
713 4, 7, 1, 3, 1, 2, 1, 2, 1, 2,
714 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
715 1, 2, 2, 3, 4, 1, 3, 2, 3, 5,
716 4, 2, 1, 2, 1, 1, 1, 1, 1, 1,
717 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
718 1, 1, 1, 1, 1, 1, 2, 1, 2, 2,
719 2, 1, 3, 4, 3, 4, 4, 3, 4, 4,
720 1, 4, 3, 3, 7, 6, 4, 1, 1, 1,
724 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
725 Performed when YYTABLE doesn't specify something else to do. Zero
726 means the default is an error. */
727 static const yytype_uint8 yydefact[] =
729 0, 123, 0, 0, 0, 1, 0, 8, 9, 122,
730 16, 18, 0, 124, 125, 0, 0, 121, 19, 0,
731 0, 0, 17, 0, 0, 0, 117, 118, 119, 0,
732 0, 0, 0, 0, 0, 2, 120, 72, 33, 0,
733 0, 0, 0, 0, 37, 94, 110, 0, 38, 39,
734 44, 46, 48, 50, 52, 54, 56, 58, 60, 0,
735 0, 25, 0, 74, 76, 77, 80, 81, 82, 83,
736 84, 85, 86, 87, 88, 78, 79, 75, 90, 95,
737 113, 89, 93, 91, 92, 112, 0, 0, 0, 0,
738 0, 42, 73, 0, 62, 0, 0, 0, 67, 0,
739 71, 0, 0, 0, 0, 45, 47, 49, 51, 53,
740 55, 57, 59, 61, 0, 0, 20, 21, 22, 0,
741 26, 27, 96, 0, 0, 3, 0, 0, 6, 7,
742 116, 0, 0, 0, 0, 0, 14, 0, 63, 104,
743 0, 101, 0, 0, 0, 68, 0, 0, 107, 0,
744 0, 0, 65, 0, 23, 0, 3, 9, 31, 0,
745 0, 0, 4, 5, 0, 0, 43, 0, 0, 0,
746 34, 97, 100, 0, 103, 105, 0, 109, 111, 106,
747 108, 0, 0, 70, 24, 0, 35, 0, 115, 0,
748 40, 0, 0, 12, 15, 99, 0, 98, 102, 69,
749 0, 66, 0, 32, 114, 0, 13, 11, 29, 30,
750 10, 28, 64, 0, 0, 36, 41
753 /* YYDEFGOTO[NTERM-NUM]. */
754 static const yytype_int16 yydefgoto[] =
756 -1, 2, 128, 129, 130, 10, 211, 136, 137, 11,
757 12, 119, 61, 62, 197, 160, 63, 64, 65, 91,
758 92, 66, 67, 68, 69, 70, 71, 72, 73, 74,
759 75, 152, 153, 76, 77, 78, 79, 80, 172, 141,
760 142, 81, 82, 83, 84, 26, 27, 28, 29, 3,
764 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
766 #define YYPACT_NINF -121
767 static const yytype_int16 yypact[] =
769 10, -16, 49, 20, 1, -121, 28, -121, 9, -121,
770 -121, -121, 4, -121, -121, 44, 69, -121, -121, 91,
771 55, 100, -121, 112, 144, 99, -121, -121, -121, 29,
772 84, 84, 148, 150, 136, -121, -121, 5, 101, 147,
773 21, 149, 104, 145, -121, -121, 137, 35, -121, -121,
774 5, 5, 5, 5, 5, 5, 5, 5, 5, 109,
775 32, 37, 143, 118, -121, -121, -121, -121, -121, -121,
776 -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
777 -121, -121, -121, -121, -121, -121, 113, 48, 169, 122,
778 166, -121, -121, 23, 5, 143, 170, 158, 24, 170,
779 -121, 162, 143, 170, 172, -121, -121, -121, -121, -121,
780 -121, -121, -121, -121, 187, 139, -121, -121, -121, 189,
781 -121, -121, -121, 50, 138, -121, 191, 192, -121, -121,
782 -121, 140, 141, 146, 151, 48, -121, -20, -121, -121,
783 84, -121, 26, 143, 187, -121, 58, 194, -121, 77,
784 143, 152, -121, 78, -121, 153, 142, -121, -121, 154,
785 85, 6, -121, -121, 138, -15, -121, 48, 155, 23,
786 -121, 34, -121, 170, -121, -121, 81, -121, -121, -121,
787 -121, 196, 187, -121, -121, 156, -121, 48, -121, 22,
788 -121, 157, 159, -121, -121, -121, 65, -121, -121, -121,
789 160, -121, 141, -121, -121, 141, -121, -121, -121, -121,
790 -121, -121, -121, 165, 167, -121, -121
793 /* YYPGOTO[NTERM-NUM]. */
794 static const yytype_int16 yypgoto[] =
796 -121, -121, -121, -121, -119, -120, -121, 36, -121, -12,
797 -93, -121, -121, -121, -121, -121, -121, -121, -121, 114,
798 -33, -121, -121, -121, -121, -121, -121, -121, -121, -121,
799 -121, 27, 62, -121, -121, -121, -60, -30, -121, 45,
800 41, -121, -121, -121, -121, -121, -121, 181, -121, -121,
804 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
805 positive, shift that token. If negative, reduce the rule which
806 number is the opposite. If YYTABLE_NINF, syntax error. */
807 #define YYTABLE_NINF -9
808 static const yytype_int16 yytable[] =
810 18, 85, 122, 159, 158, 7, 8, 97, 7, 8,
811 7, 8, 165, 89, 104, 1, 168, 105, 106, 107,
812 108, 109, 110, 111, 112, 113, 7, 8, 134, 89,
813 24, 161, 89, 169, 25, 139, 115, 190, 170, 95,
814 195, 4, 148, 89, 191, 116, 117, 118, 192, 5,
815 196, 6, 125, 102, 156, 157, 90, 13, 14, 9,
816 16, 138, 17, 35, 188, 145, 120, 121, 203, 125,
817 207, 189, 90, 20, 135, 90, 19, 210, 96, 173,
818 204, 144, 213, 175, 174, 214, 90, 208, 209, 37,
819 180, 38, 103, 39, 21, 40, 41, 126, 127, 126,
820 127, 42, 31, 43, 32, 44, 33, 22, 45, 46,
821 171, 173, 47, 24, 126, 127, 177, 25, 34, 48,
822 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
823 173, 182, 59, 23, 182, 179, 183, 186, 60, 199,
824 146, 187, 7, 8, 149, 7, 157, 30, 37, 18,
825 38, 86, 39, 87, 40, 41, 88, 94, 93, 98,
826 42, 99, 43, 101, 44, 100, 114, 45, 46, 123,
827 124, 47, 131, 132, 89, 140, 143, 18, 48, 49,
828 50, 51, 52, 53, 54, 55, 56, 57, 58, 147,
829 150, 59, 151, 155, 154, 162, 163, 164, 166, 178,
830 200, -8, 167, 181, 133, 194, 176, 193, 184, 201,
831 36, 206, 212, 185, 0, 202, 205, 215, 198, 216
834 #define yypact_value_is_default(yystate) \
835 ((yystate) == (-121))
837 #define yytable_value_is_error(yytable_value) \
840 static const yytype_int16 yycheck[] =
842 12, 31, 62, 123, 123, 4, 5, 40, 4, 5,
843 4, 5, 132, 8, 47, 5, 135, 50, 51, 52,
844 53, 54, 55, 56, 57, 58, 4, 5, 5, 8,
845 1, 124, 8, 53, 5, 95, 4, 52, 58, 18,
846 6, 57, 102, 8, 59, 13, 14, 15, 167, 0,
847 16, 31, 4, 18, 4, 5, 51, 29, 30, 58,
848 51, 94, 58, 34, 58, 98, 29, 30, 187, 4,
849 5, 164, 51, 4, 51, 51, 32, 196, 57, 53,
850 58, 57, 202, 143, 58, 205, 51, 22, 23, 5,
851 150, 7, 57, 9, 3, 11, 12, 49, 50, 49,
852 50, 17, 3, 19, 5, 21, 7, 52, 24, 25,
853 140, 53, 28, 1, 49, 50, 58, 5, 19, 35,
854 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
855 53, 53, 48, 33, 53, 58, 58, 52, 54, 58,
856 99, 56, 4, 5, 103, 4, 5, 3, 5, 161,
857 7, 3, 9, 3, 11, 12, 20, 10, 57, 10,
858 17, 57, 19, 26, 21, 20, 57, 24, 25, 51,
859 57, 28, 3, 51, 8, 5, 18, 189, 35, 36,
860 37, 38, 39, 40, 41, 42, 43, 44, 45, 27,
861 18, 48, 5, 4, 55, 4, 4, 57, 52, 5,
862 4, 59, 51, 51, 90, 169, 144, 52, 55, 182,
863 29, 52, 52, 59, -1, 59, 59, 52, 173, 52
866 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
867 symbol of state STATE-NUM. */
868 static const yytype_uint8 yystos[] =
870 0, 5, 61, 109, 57, 0, 31, 4, 5, 58,
871 65, 69, 70, 29, 30, 110, 51, 58, 69, 32,
872 4, 3, 52, 33, 1, 5, 105, 106, 107, 108,
873 3, 3, 5, 7, 19, 34, 107, 5, 7, 9,
874 11, 12, 17, 19, 21, 24, 25, 28, 35, 36,
875 37, 38, 39, 40, 41, 42, 43, 44, 45, 48,
876 54, 72, 73, 76, 77, 78, 81, 82, 83, 84,
877 85, 86, 87, 88, 89, 90, 93, 94, 95, 96,
878 97, 101, 102, 103, 104, 97, 3, 3, 20, 8,
879 51, 79, 80, 57, 10, 18, 57, 80, 10, 57,
880 20, 26, 18, 57, 80, 80, 80, 80, 80, 80,
881 80, 80, 80, 80, 57, 4, 13, 14, 15, 71,
882 29, 30, 96, 51, 57, 4, 49, 50, 62, 63,
883 64, 3, 51, 79, 5, 51, 67, 68, 80, 96,
884 5, 99, 100, 18, 57, 80, 100, 27, 96, 100,
885 18, 5, 91, 92, 55, 4, 4, 5, 64, 65,
886 75, 70, 4, 4, 57, 65, 52, 51, 64, 53,
887 58, 97, 98, 53, 58, 96, 92, 58, 5, 58,
888 96, 51, 53, 58, 55, 59, 52, 56, 58, 70,
889 52, 59, 64, 52, 67, 6, 16, 74, 99, 58,
890 4, 91, 59, 64, 58, 59, 52, 5, 22, 23,
891 64, 66, 52, 65, 65, 52, 52
894 #define yyerrok (yyerrstatus = 0)
895 #define yyclearin (yychar = YYEMPTY)
899 #define YYACCEPT goto yyacceptlab
900 #define YYABORT goto yyabortlab
901 #define YYERROR goto yyerrorlab
904 /* Like YYERROR except do call yyerror. This remains here temporarily
905 to ease the transition to the new meaning of YYERROR, for GCC.
906 Once GCC version 2 has supplanted version 1, this can go. However,
907 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
908 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
911 #define YYFAIL goto yyerrlab
913 /* This is here to suppress warnings from the GCC cpp's
914 -Wunused-macros. Normally we don't worry about that warning, but
915 some users do, and we want to make it easy for users to remove
916 YYFAIL uses, which will produce warnings from Bison 2.5. */
919 #define YYRECOVERING() (!!yyerrstatus)
921 #define YYBACKUP(Token, Value) \
923 if (yychar == YYEMPTY && yylen == 1) \
932 yyerror (YY_("syntax error: cannot back up")); \
939 #define YYERRCODE 256
942 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
943 If N is 0, then set CURRENT to the empty location which ends
944 the previous symbol: RHS[0] (always defined). */
946 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
947 #ifndef YYLLOC_DEFAULT
948 # define YYLLOC_DEFAULT(Current, Rhs, N) \
952 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
953 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
954 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
955 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
959 (Current).first_line = (Current).last_line = \
960 YYRHSLOC (Rhs, 0).last_line; \
961 (Current).first_column = (Current).last_column = \
962 YYRHSLOC (Rhs, 0).last_column; \
968 /* This macro is provided for backward compatibility. */
970 #ifndef YY_LOCATION_PRINT
971 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
975 /* YYLEX -- calling `yylex' with the right arguments. */
978 # define YYLEX yylex (YYLEX_PARAM)
980 # define YYLEX yylex ()
983 /* Enable debugging if requested. */
987 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
988 # define YYFPRINTF fprintf
991 # define YYDPRINTF(Args) \
997 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1001 YYFPRINTF (stderr, "%s ", Title); \
1002 yy_symbol_print (stderr, \
1004 YYFPRINTF (stderr, "\n"); \
1009 /*--------------------------------.
1010 | Print this symbol on YYOUTPUT. |
1011 `--------------------------------*/
1014 #if (defined __STDC__ || defined __C99__FUNC__ \
1015 || defined __cplusplus || defined _MSC_VER)
1017 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1020 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1023 YYSTYPE const * const yyvaluep;
1029 if (yytype < YYNTOKENS)
1030 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1042 /*--------------------------------.
1043 | Print this symbol on YYOUTPUT. |
1044 `--------------------------------*/
1046 #if (defined __STDC__ || defined __C99__FUNC__ \
1047 || defined __cplusplus || defined _MSC_VER)
1049 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1052 yy_symbol_print (yyoutput, yytype, yyvaluep)
1055 YYSTYPE const * const yyvaluep;
1058 if (yytype < YYNTOKENS)
1059 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1061 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1063 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1064 YYFPRINTF (yyoutput, ")");
1067 /*------------------------------------------------------------------.
1068 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1070 `------------------------------------------------------------------*/
1072 #if (defined __STDC__ || defined __C99__FUNC__ \
1073 || defined __cplusplus || defined _MSC_VER)
1075 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1078 yy_stack_print (yybottom, yytop)
1079 yytype_int16 *yybottom;
1080 yytype_int16 *yytop;
1083 YYFPRINTF (stderr, "Stack now");
1084 for (; yybottom <= yytop; yybottom++)
1086 int yybot = *yybottom;
1087 YYFPRINTF (stderr, " %d", yybot);
1089 YYFPRINTF (stderr, "\n");
1092 # define YY_STACK_PRINT(Bottom, Top) \
1095 yy_stack_print ((Bottom), (Top)); \
1099 /*------------------------------------------------.
1100 | Report that the YYRULE is going to be reduced. |
1101 `------------------------------------------------*/
1103 #if (defined __STDC__ || defined __C99__FUNC__ \
1104 || defined __cplusplus || defined _MSC_VER)
1106 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1109 yy_reduce_print (yyvsp, yyrule)
1114 int yynrhs = yyr2[yyrule];
1116 unsigned long int yylno = yyrline[yyrule];
1117 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1119 /* The symbols being reduced. */
1120 for (yyi = 0; yyi < yynrhs; yyi++)
1122 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1123 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1124 &(yyvsp[(yyi + 1) - (yynrhs)])
1126 YYFPRINTF (stderr, "\n");
1130 # define YY_REDUCE_PRINT(Rule) \
1133 yy_reduce_print (yyvsp, Rule); \
1136 /* Nonzero means print parse trace. It is left uninitialized so that
1137 multiple parsers can coexist. */
1139 #else /* !YYDEBUG */
1140 # define YYDPRINTF(Args)
1141 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1142 # define YY_STACK_PRINT(Bottom, Top)
1143 # define YY_REDUCE_PRINT(Rule)
1144 #endif /* !YYDEBUG */
1147 /* YYINITDEPTH -- initial size of the parser's stacks. */
1149 # define YYINITDEPTH 200
1152 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1153 if the built-in stack extension method is used).
1155 Do not make this value too large; the results are undefined if
1156 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1157 evaluated with infinite-precision integer arithmetic. */
1160 # define YYMAXDEPTH 10000
1167 # if defined __GLIBC__ && defined _STRING_H
1168 # define yystrlen strlen
1170 /* Return the length of YYSTR. */
1171 #if (defined __STDC__ || defined __C99__FUNC__ \
1172 || defined __cplusplus || defined _MSC_VER)
1174 yystrlen (const char *yystr)
1182 for (yylen = 0; yystr[yylen]; yylen++)
1190 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1191 # define yystpcpy stpcpy
1193 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1195 #if (defined __STDC__ || defined __C99__FUNC__ \
1196 || defined __cplusplus || defined _MSC_VER)
1198 yystpcpy (char *yydest, const char *yysrc)
1201 yystpcpy (yydest, yysrc)
1207 const char *yys = yysrc;
1209 while ((*yyd++ = *yys++) != '\0')
1218 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1219 quotes and backslashes, so that it's suitable for yyerror. The
1220 heuristic is that double-quoting is unnecessary unless the string
1221 contains an apostrophe, a comma, or backslash (other than
1222 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1223 null, do not copy; instead, return the length of what the result
1226 yytnamerr (char *yyres, const char *yystr)
1231 char const *yyp = yystr;
1238 goto do_not_strip_quotes;
1242 goto do_not_strip_quotes;
1255 do_not_strip_quotes: ;
1259 return yystrlen (yystr);
1261 return yystpcpy (yyres, yystr) - yyres;
1265 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1266 about the unexpected token YYTOKEN for the state stack whose top is
1269 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1270 not large enough to hold the message. In that case, also set
1271 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1272 required number of bytes is too large to store. */
1274 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1275 yytype_int16 *yyssp, int yytoken)
1277 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1278 YYSIZE_T yysize = yysize0;
1280 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1281 /* Internationalized format string. */
1282 const char *yyformat = 0;
1283 /* Arguments of yyformat. */
1284 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1285 /* Number of reported tokens (one for the "unexpected", one per
1289 /* There are many possibilities here to consider:
1290 - Assume YYFAIL is not used. It's too flawed to consider. See
1291 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1292 for details. YYERROR is fine as it does not invoke this
1294 - If this state is a consistent state with a default action, then
1295 the only way this function was invoked is if the default action
1296 is an error action. In that case, don't check for expected
1297 tokens because there are none.
1298 - The only way there can be no lookahead present (in yychar) is if
1299 this state is a consistent state with a default action. Thus,
1300 detecting the absence of a lookahead is sufficient to determine
1301 that there is no unexpected or expected token to report. In that
1302 case, just report a simple "syntax error".
1303 - Don't assume there isn't a lookahead just because this state is a
1304 consistent state with a default action. There might have been a
1305 previous inconsistent state, consistent state with a non-default
1306 action, or user semantic action that manipulated yychar.
1307 - Of course, the expected token list depends on states to have
1308 correct lookahead information, and it depends on the parser not
1309 to perform extra reductions after fetching a lookahead from the
1310 scanner and before detecting a syntax error. Thus, state merging
1311 (from LALR or IELR) and default reductions corrupt the expected
1312 token list. However, the list is correct for canonical LR with
1313 one exception: it will still contain any token that will not be
1314 accepted due to an error action in a later state.
1316 if (yytoken != YYEMPTY)
1318 int yyn = yypact[*yyssp];
1319 yyarg[yycount++] = yytname[yytoken];
1320 if (!yypact_value_is_default (yyn))
1322 /* Start YYX at -YYN if negative to avoid negative indexes in
1323 YYCHECK. In other words, skip the first -YYN actions for
1324 this state because they are default actions. */
1325 int yyxbegin = yyn < 0 ? -yyn : 0;
1326 /* Stay within bounds of both yycheck and yytname. */
1327 int yychecklim = YYLAST - yyn + 1;
1328 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1331 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1332 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1333 && !yytable_value_is_error (yytable[yyx + yyn]))
1335 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1341 yyarg[yycount++] = yytname[yyx];
1342 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1343 if (! (yysize <= yysize1
1344 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1353 # define YYCASE_(N, S) \
1357 YYCASE_(0, YY_("syntax error"));
1358 YYCASE_(1, YY_("syntax error, unexpected %s"));
1359 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1360 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1361 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1362 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1366 yysize1 = yysize + yystrlen (yyformat);
1367 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1371 if (*yymsg_alloc < yysize)
1373 *yymsg_alloc = 2 * yysize;
1374 if (! (yysize <= *yymsg_alloc
1375 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1376 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1380 /* Avoid sprintf, as that infringes on the user's name space.
1381 Don't have undefined behavior even if the translation
1382 produced a string with the wrong number of "%s"s. */
1386 while ((*yyp = *yyformat) != '\0')
1387 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1389 yyp += yytnamerr (yyp, yyarg[yyi++]);
1400 #endif /* YYERROR_VERBOSE */
1402 /*-----------------------------------------------.
1403 | Release the memory associated to this symbol. |
1404 `-----------------------------------------------*/
1407 #if (defined __STDC__ || defined __C99__FUNC__ \
1408 || defined __cplusplus || defined _MSC_VER)
1410 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1413 yydestruct (yymsg, yytype, yyvaluep)
1423 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1434 /* Prevent warnings from -Wmissing-prototypes. */
1435 #ifdef YYPARSE_PARAM
1436 #if defined __STDC__ || defined __cplusplus
1437 int yyparse (void *YYPARSE_PARAM);
1441 #else /* ! YYPARSE_PARAM */
1442 #if defined __STDC__ || defined __cplusplus
1447 #endif /* ! YYPARSE_PARAM */
1450 /* The lookahead symbol. */
1453 /* The semantic value of the lookahead symbol. */
1456 /* Number of syntax errors so far. */
1464 #ifdef YYPARSE_PARAM
1465 #if (defined __STDC__ || defined __C99__FUNC__ \
1466 || defined __cplusplus || defined _MSC_VER)
1468 yyparse (void *YYPARSE_PARAM)
1471 yyparse (YYPARSE_PARAM)
1472 void *YYPARSE_PARAM;
1474 #else /* ! YYPARSE_PARAM */
1475 #if (defined __STDC__ || defined __C99__FUNC__ \
1476 || defined __cplusplus || defined _MSC_VER)
1487 /* Number of tokens to shift before error messages enabled. */
1490 /* The stacks and their tools:
1491 `yyss': related to states.
1492 `yyvs': related to semantic values.
1494 Refer to the stacks thru separate pointers, to allow yyoverflow
1495 to reallocate them elsewhere. */
1497 /* The state stack. */
1498 yytype_int16 yyssa[YYINITDEPTH];
1500 yytype_int16 *yyssp;
1502 /* The semantic value stack. */
1503 YYSTYPE yyvsa[YYINITDEPTH];
1507 YYSIZE_T yystacksize;
1511 /* Lookahead token as an internal (translated) token number. */
1513 /* The variables used to return semantic value and location from the
1518 /* Buffer for error messages, and its allocated size. */
1520 char *yymsg = yymsgbuf;
1521 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1524 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1526 /* The number of symbols on the RHS of the reduced rule.
1527 Keep to zero when no symbol should be popped. */
1533 yystacksize = YYINITDEPTH;
1535 YYDPRINTF ((stderr, "Starting parse\n"));
1540 yychar = YYEMPTY; /* Cause a token to be read. */
1542 /* Initialize stack pointers.
1543 Waste one element of value and location stack
1544 so that they stay on the same level as the state stack.
1545 The wasted elements are never initialized. */
1551 /*------------------------------------------------------------.
1552 | yynewstate -- Push a new state, which is found in yystate. |
1553 `------------------------------------------------------------*/
1555 /* In all cases, when you get here, the value and location stacks
1556 have just been pushed. So pushing a state here evens the stacks. */
1562 if (yyss + yystacksize - 1 <= yyssp)
1564 /* Get the current used size of the three stacks, in elements. */
1565 YYSIZE_T yysize = yyssp - yyss + 1;
1569 /* Give user a chance to reallocate the stack. Use copies of
1570 these so that the &'s don't force the real ones into
1572 YYSTYPE *yyvs1 = yyvs;
1573 yytype_int16 *yyss1 = yyss;
1575 /* Each stack pointer address is followed by the size of the
1576 data in use in that stack, in bytes. This used to be a
1577 conditional around just the two extra args, but that might
1578 be undefined if yyoverflow is a macro. */
1579 yyoverflow (YY_("memory exhausted"),
1580 &yyss1, yysize * sizeof (*yyssp),
1581 &yyvs1, yysize * sizeof (*yyvsp),
1587 #else /* no yyoverflow */
1588 # ifndef YYSTACK_RELOCATE
1589 goto yyexhaustedlab;
1591 /* Extend the stack our own way. */
1592 if (YYMAXDEPTH <= yystacksize)
1593 goto yyexhaustedlab;
1595 if (YYMAXDEPTH < yystacksize)
1596 yystacksize = YYMAXDEPTH;
1599 yytype_int16 *yyss1 = yyss;
1600 union yyalloc *yyptr =
1601 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1603 goto yyexhaustedlab;
1604 YYSTACK_RELOCATE (yyss_alloc, yyss);
1605 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1606 # undef YYSTACK_RELOCATE
1608 YYSTACK_FREE (yyss1);
1611 #endif /* no yyoverflow */
1613 yyssp = yyss + yysize - 1;
1614 yyvsp = yyvs + yysize - 1;
1616 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1617 (unsigned long int) yystacksize));
1619 if (yyss + yystacksize - 1 <= yyssp)
1623 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1625 if (yystate == YYFINAL)
1635 /* Do appropriate processing given the current state. Read a
1636 lookahead token if we need one and don't already have one. */
1638 /* First try to decide what to do without reference to lookahead token. */
1639 yyn = yypact[yystate];
1640 if (yypact_value_is_default (yyn))
1643 /* Not known => get a lookahead token if don't already have one. */
1645 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1646 if (yychar == YYEMPTY)
1648 YYDPRINTF ((stderr, "Reading a token: "));
1652 if (yychar <= YYEOF)
1654 yychar = yytoken = YYEOF;
1655 YYDPRINTF ((stderr, "Now at end of input.\n"));
1659 yytoken = YYTRANSLATE (yychar);
1660 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1663 /* If the proper action on seeing token YYTOKEN is to reduce or to
1664 detect an error, take that action. */
1666 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1671 if (yytable_value_is_error (yyn))
1677 /* Count tokens shifted since error; after three, turn off error
1682 /* Shift the lookahead token. */
1683 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1685 /* Discard the shifted token. */
1694 /*-----------------------------------------------------------.
1695 | yydefault -- do the default action for the current state. |
1696 `-----------------------------------------------------------*/
1698 yyn = yydefact[yystate];
1704 /*-----------------------------.
1705 | yyreduce -- Do a reduction. |
1706 `-----------------------------*/
1708 /* yyn is the number of a rule to reduce with. */
1711 /* If YYLEN is nonzero, implement the default value of the action:
1714 Otherwise, the following line sets YYVAL to garbage.
1715 This behavior is undocumented and Bison
1716 users should not rely upon it. Assigning to YYVAL
1717 unconditionally makes the parser a bit smaller, and it avoids a
1718 GCC warning that YYVAL may be used uninitialized. */
1719 yyval = yyvsp[1-yylen];
1722 YY_REDUCE_PRINT (yyn);
1727 /* Line 1806 of yacc.c */
1729 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFINITIONS|(yyvsp[(3) - (8)].constant));
1730 _asn1_set_name((yyval.node),_asn1_get_name((yyvsp[(1) - (8)].node)));
1731 _asn1_set_name((yyvsp[(1) - (8)].node),"");
1732 _asn1_set_right((yyvsp[(1) - (8)].node),(yyvsp[(7) - (8)].node));
1733 _asn1_set_down((yyval.node),(yyvsp[(1) - (8)].node));
1735 p_tree=(yyval.node);
1741 /* Line 1806 of yacc.c */
1743 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1748 /* Line 1806 of yacc.c */
1750 {strcpy((yyval.str),(yyvsp[(2) - (2)].str));}
1755 /* Line 1806 of yacc.c */
1757 {strcpy((yyval.str),"-");
1758 strcat((yyval.str),(yyvsp[(2) - (2)].str));}
1763 /* Line 1806 of yacc.c */
1765 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1770 /* Line 1806 of yacc.c */
1772 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1777 /* Line 1806 of yacc.c */
1779 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1784 /* Line 1806 of yacc.c */
1786 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1791 /* Line 1806 of yacc.c */
1793 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1798 /* Line 1806 of yacc.c */
1800 {strcpy((yyval.str),(yyvsp[(1) - (1)].str));}
1805 /* Line 1806 of yacc.c */
1807 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1808 _asn1_set_value((yyval.node),(yyvsp[(2) - (3)].str),strlen((yyvsp[(2) - (3)].str))+1);}
1813 /* Line 1806 of yacc.c */
1815 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1816 _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
1817 _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
1822 /* Line 1806 of yacc.c */
1824 {(yyval.node)=(yyvsp[(1) - (1)].node);}
1829 /* Line 1806 of yacc.c */
1831 {(yyval.node)=(yyvsp[(1) - (3)].node);
1832 _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (3)].node)),(yyvsp[(3) - (3)].node));}
1837 /* Line 1806 of yacc.c */
1839 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1840 _asn1_set_value((yyval.node),(yyvsp[(1) - (1)].str),strlen((yyvsp[(1) - (1)].str))+1);}
1845 /* Line 1806 of yacc.c */
1847 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
1848 _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
1849 _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
1854 /* Line 1806 of yacc.c */
1856 {(yyval.node)=(yyvsp[(1) - (1)].node);}
1861 /* Line 1806 of yacc.c */
1863 {(yyval.node)=(yyvsp[(1) - (2)].node);
1864 _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (2)].node)),(yyvsp[(2) - (2)].node));}
1869 /* Line 1806 of yacc.c */
1871 {(yyval.constant)=CONST_UNIVERSAL;}
1876 /* Line 1806 of yacc.c */
1878 {(yyval.constant)=CONST_PRIVATE;}
1883 /* Line 1806 of yacc.c */
1885 {(yyval.constant)=CONST_APPLICATION;}
1890 /* Line 1806 of yacc.c */
1892 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TAG);
1893 _asn1_set_value((yyval.node),(yyvsp[(2) - (3)].str),strlen((yyvsp[(2) - (3)].str))+1);}
1898 /* Line 1806 of yacc.c */
1900 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TAG | (yyvsp[(2) - (4)].constant));
1901 _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
1906 /* Line 1806 of yacc.c */
1908 {(yyval.node)=(yyvsp[(1) - (1)].node);}
1913 /* Line 1806 of yacc.c */
1915 {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_EXPLICIT);}
1920 /* Line 1806 of yacc.c */
1922 {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_IMPLICIT);}
1927 /* Line 1806 of yacc.c */
1929 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT);
1930 _asn1_set_value((yyval.node),(yyvsp[(2) - (2)].str),strlen((yyvsp[(2) - (2)].str))+1);}
1935 /* Line 1806 of yacc.c */
1937 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT|CONST_TRUE);}
1942 /* Line 1806 of yacc.c */
1944 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_DEFAULT|CONST_FALSE);}
1949 /* Line 1806 of yacc.c */
1951 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER);}
1956 /* Line 1806 of yacc.c */
1958 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_LIST);
1959 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
1964 /* Line 1806 of yacc.c */
1966 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER);}
1971 /* Line 1806 of yacc.c */
1973 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_MIN_MAX);
1974 _asn1_set_down((yyval.node),_asn1_add_static_node(ASN1_ETYPE_SIZE));
1975 _asn1_set_value(_asn1_get_down((yyval.node)),(yyvsp[(6) - (7)].str),strlen((yyvsp[(6) - (7)].str))+1);
1976 _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[(3) - (7)].str));}
1981 /* Line 1806 of yacc.c */
1983 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BOOLEAN);}
1988 /* Line 1806 of yacc.c */
1990 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTC_TIME);}
1995 /* Line 1806 of yacc.c */
1997 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALIZED_TIME);}
2002 /* Line 1806 of yacc.c */
2004 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SIZE|CONST_1_PARAM);
2005 _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
2010 /* Line 1806 of yacc.c */
2012 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SIZE|CONST_MIN_MAX);
2013 _asn1_set_value((yyval.node),(yyvsp[(3) - (7)].str),strlen((yyvsp[(3) - (7)].str))+1);
2014 _asn1_set_name((yyval.node),(yyvsp[(6) - (7)].str));}
2019 /* Line 1806 of yacc.c */
2021 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2026 /* Line 1806 of yacc.c */
2028 {(yyval.node)=(yyvsp[(2) - (3)].node);}
2033 /* Line 1806 of yacc.c */
2035 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALSTRING);}
2040 /* Line 1806 of yacc.c */
2042 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_GENERALSTRING|CONST_SIZE);
2043 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2048 /* Line 1806 of yacc.c */
2050 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NUMERIC_STRING|CONST_UNIVERSAL);}
2055 /* Line 1806 of yacc.c */
2057 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NUMERIC_STRING|CONST_SIZE);
2058 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2063 /* Line 1806 of yacc.c */
2065 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IA5_STRING);}
2070 /* Line 1806 of yacc.c */
2072 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IA5_STRING|CONST_SIZE);
2073 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2078 /* Line 1806 of yacc.c */
2080 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TELETEX_STRING);}
2085 /* Line 1806 of yacc.c */
2087 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_TELETEX_STRING|CONST_SIZE);
2088 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2093 /* Line 1806 of yacc.c */
2095 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_PRINTABLE_STRING);}
2100 /* Line 1806 of yacc.c */
2102 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_PRINTABLE_STRING|CONST_SIZE);
2103 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2108 /* Line 1806 of yacc.c */
2110 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UNIVERSAL_STRING);}
2115 /* Line 1806 of yacc.c */
2117 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UNIVERSAL_STRING|CONST_SIZE);
2118 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2123 /* Line 1806 of yacc.c */
2125 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BMP_STRING);}
2130 /* Line 1806 of yacc.c */
2132 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BMP_STRING|CONST_SIZE);
2133 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2138 /* Line 1806 of yacc.c */
2140 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTF8_STRING);}
2145 /* Line 1806 of yacc.c */
2147 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_UTF8_STRING|CONST_SIZE);
2148 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2153 /* Line 1806 of yacc.c */
2155 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_VISIBLE_STRING);}
2160 /* Line 1806 of yacc.c */
2162 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_VISIBLE_STRING|CONST_SIZE);
2163 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2168 /* Line 1806 of yacc.c */
2170 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OCTET_STRING);}
2175 /* Line 1806 of yacc.c */
2177 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OCTET_STRING|CONST_SIZE);
2178 _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));}
2183 /* Line 1806 of yacc.c */
2185 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CONSTANT);
2186 _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
2187 _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);}
2192 /* Line 1806 of yacc.c */
2194 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2199 /* Line 1806 of yacc.c */
2201 {(yyval.node)=(yyvsp[(1) - (3)].node);
2202 _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (3)].node)),(yyvsp[(3) - (3)].node));}
2207 /* Line 1806 of yacc.c */
2209 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING);}
2214 /* Line 1806 of yacc.c */
2216 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING|CONST_SIZE);}
2221 /* Line 1806 of yacc.c */
2223 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_BIT_STRING|CONST_LIST);
2224 _asn1_set_down((yyval.node),(yyvsp[(4) - (5)].node));}
2229 /* Line 1806 of yacc.c */
2231 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ENUMERATED|CONST_LIST);
2232 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
2237 /* Line 1806 of yacc.c */
2239 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);}
2244 /* Line 1806 of yacc.c */
2246 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IDENTIFIER);
2247 _asn1_set_value((yyval.node),(yyvsp[(1) - (1)].str),strlen((yyvsp[(1) - (1)].str))+1);}
2252 /* Line 1806 of yacc.c */
2254 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_IDENTIFIER|CONST_SIZE);
2255 _asn1_set_value((yyval.node),(yyvsp[(1) - (2)].str),strlen((yyvsp[(1) - (2)].str))+1);
2256 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2261 /* Line 1806 of yacc.c */
2263 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2268 /* Line 1806 of yacc.c */
2270 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2275 /* Line 1806 of yacc.c */
2277 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2282 /* Line 1806 of yacc.c */
2284 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2289 /* Line 1806 of yacc.c */
2291 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2296 /* Line 1806 of yacc.c */
2298 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2303 /* Line 1806 of yacc.c */
2305 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2310 /* Line 1806 of yacc.c */
2312 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2317 /* Line 1806 of yacc.c */
2319 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2324 /* Line 1806 of yacc.c */
2326 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2331 /* Line 1806 of yacc.c */
2333 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2338 /* Line 1806 of yacc.c */
2340 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2345 /* Line 1806 of yacc.c */
2347 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2352 /* Line 1806 of yacc.c */
2354 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2359 /* Line 1806 of yacc.c */
2361 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2366 /* Line 1806 of yacc.c */
2368 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2373 /* Line 1806 of yacc.c */
2375 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2380 /* Line 1806 of yacc.c */
2382 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2387 /* Line 1806 of yacc.c */
2389 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2394 /* Line 1806 of yacc.c */
2396 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_NULL);}
2401 /* Line 1806 of yacc.c */
2403 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2408 /* Line 1806 of yacc.c */
2410 {(yyval.node)=_asn1_mod_type((yyvsp[(2) - (2)].node),CONST_TAG);
2411 _asn1_set_right((yyvsp[(1) - (2)].node),_asn1_get_down((yyval.node)));
2412 _asn1_set_down((yyval.node),(yyvsp[(1) - (2)].node));}
2417 /* Line 1806 of yacc.c */
2419 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2424 /* Line 1806 of yacc.c */
2426 {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_DEFAULT);
2427 _asn1_set_right((yyvsp[(2) - (2)].node),_asn1_get_down((yyval.node)));
2428 _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));}
2433 /* Line 1806 of yacc.c */
2435 {(yyval.node)=_asn1_mod_type((yyvsp[(1) - (2)].node),CONST_OPTION);}
2440 /* Line 1806 of yacc.c */
2442 {(yyval.node)=_asn1_set_name((yyvsp[(2) - (2)].node),(yyvsp[(1) - (2)].str));}
2447 /* Line 1806 of yacc.c */
2449 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2454 /* Line 1806 of yacc.c */
2456 {(yyval.node)=(yyvsp[(1) - (3)].node);
2457 _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (3)].node)),(yyvsp[(3) - (3)].node));}
2462 /* Line 1806 of yacc.c */
2464 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE);
2465 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
2470 /* Line 1806 of yacc.c */
2472 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE_OF);
2473 _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));}
2478 /* Line 1806 of yacc.c */
2480 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SEQUENCE_OF|CONST_SIZE);
2481 _asn1_set_right((yyvsp[(2) - (4)].node),(yyvsp[(4) - (4)].node));
2482 _asn1_set_down((yyval.node),(yyvsp[(2) - (4)].node));}
2487 /* Line 1806 of yacc.c */
2489 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET);
2490 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
2495 /* Line 1806 of yacc.c */
2497 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET_OF);
2498 _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));}
2503 /* Line 1806 of yacc.c */
2505 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_SET_OF|CONST_SIZE);
2506 _asn1_set_right((yyvsp[(2) - (4)].node),(yyvsp[(4) - (4)].node));
2507 _asn1_set_down((yyval.node),(yyvsp[(2) - (4)].node));}
2512 /* Line 1806 of yacc.c */
2514 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_CHOICE);
2515 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));}
2520 /* Line 1806 of yacc.c */
2522 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ANY);}
2527 /* Line 1806 of yacc.c */
2529 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_ANY|CONST_DEFINED_BY);
2530 _asn1_set_down((yyval.node),_asn1_add_static_node(ASN1_ETYPE_CONSTANT));
2531 _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[(4) - (4)].str));}
2536 /* Line 1806 of yacc.c */
2538 {(yyval.node)=_asn1_set_name((yyvsp[(3) - (3)].node),(yyvsp[(1) - (3)].str));}
2543 /* Line 1806 of yacc.c */
2545 {(yyval.node)=_asn1_set_name((yyvsp[(3) - (3)].node), last_error_token);}
2550 /* Line 1806 of yacc.c */
2552 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN);
2553 _asn1_set_name((yyval.node),(yyvsp[(1) - (7)].str));
2554 _asn1_set_down((yyval.node),(yyvsp[(6) - (7)].node));}
2559 /* Line 1806 of yacc.c */
2561 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM);
2562 _asn1_set_name((yyval.node),(yyvsp[(1) - (6)].str));
2563 _asn1_set_value((yyval.node),(yyvsp[(2) - (6)].str),strlen((yyvsp[(2) - (6)].str))+1);
2564 _asn1_set_down((yyval.node),(yyvsp[(5) - (6)].node));}
2569 /* Line 1806 of yacc.c */
2571 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_INTEGER|CONST_ASSIGN);
2572 _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));
2573 _asn1_set_value((yyval.node),(yyvsp[(4) - (4)].str),strlen((yyvsp[(4) - (4)].str))+1);}
2578 /* Line 1806 of yacc.c */
2580 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2585 /* Line 1806 of yacc.c */
2587 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2592 /* Line 1806 of yacc.c */
2594 {(yyval.node)=(yyvsp[(1) - (1)].node);}
2599 /* Line 1806 of yacc.c */
2601 {(yyval.node)=(yyvsp[(1) - (2)].node);
2602 _asn1_set_right(_asn1_get_last_right((yyvsp[(1) - (2)].node)),(yyvsp[(2) - (2)].node));}
2607 /* Line 1806 of yacc.c */
2609 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);
2610 _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));
2611 _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));}
2616 /* Line 1806 of yacc.c */
2618 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);
2619 _asn1_set_name((yyval.node),(yyvsp[(1) - (3)].str));}
2624 /* Line 1806 of yacc.c */
2626 {(yyval.node)=_asn1_add_static_node(ASN1_ETYPE_OBJECT_ID);
2627 _asn1_set_name((yyval.node),(yyvsp[(1) - (1)].str));}
2632 /* Line 1806 of yacc.c */
2634 {(yyval.constant)=CONST_EXPLICIT;}
2639 /* Line 1806 of yacc.c */
2641 {(yyval.constant)=CONST_IMPLICIT;}
2646 /* Line 1806 of yacc.c */
2650 /* User semantic actions sometimes alter yychar, and that requires
2651 that yytoken be updated with the new translation. We take the
2652 approach of translating immediately before every use of yytoken.
2653 One alternative is translating here after every semantic action,
2654 but that translation would be missed if the semantic action invokes
2655 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2656 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2657 incorrect destructor might then be invoked immediately. In the
2658 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2659 to an incorrect destructor call or verbose syntax error message
2660 before the lookahead is translated. */
2661 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2665 YY_STACK_PRINT (yyss, yyssp);
2669 /* Now `shift' the result of the reduction. Determine what state
2670 that goes to, based on the state we popped back to and the rule
2671 number reduced by. */
2675 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2676 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2677 yystate = yytable[yystate];
2679 yystate = yydefgoto[yyn - YYNTOKENS];
2684 /*------------------------------------.
2685 | yyerrlab -- here on detecting error |
2686 `------------------------------------*/
2688 /* Make sure we have latest lookahead translation. See comments at
2689 user semantic actions for why this is necessary. */
2690 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2692 /* If not already recovering from an error, report this error. */
2696 #if ! YYERROR_VERBOSE
2697 yyerror (YY_("syntax error"));
2699 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2702 char const *yymsgp = YY_("syntax error");
2703 int yysyntax_error_status;
2704 yysyntax_error_status = YYSYNTAX_ERROR;
2705 if (yysyntax_error_status == 0)
2707 else if (yysyntax_error_status == 1)
2709 if (yymsg != yymsgbuf)
2710 YYSTACK_FREE (yymsg);
2711 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2715 yymsg_alloc = sizeof yymsgbuf;
2716 yysyntax_error_status = 2;
2720 yysyntax_error_status = YYSYNTAX_ERROR;
2725 if (yysyntax_error_status == 2)
2726 goto yyexhaustedlab;
2728 # undef YYSYNTAX_ERROR
2734 if (yyerrstatus == 3)
2736 /* If just tried and failed to reuse lookahead token after an
2737 error, discard it. */
2739 if (yychar <= YYEOF)
2741 /* Return failure if at end of input. */
2742 if (yychar == YYEOF)
2747 yydestruct ("Error: discarding",
2753 /* Else will try to reuse lookahead token after shifting the error
2758 /*---------------------------------------------------.
2759 | yyerrorlab -- error raised explicitly by YYERROR. |
2760 `---------------------------------------------------*/
2763 /* Pacify compilers like GCC when the user code never invokes
2764 YYERROR and the label yyerrorlab therefore never appears in user
2766 if (/*CONSTCOND*/ 0)
2769 /* Do not reclaim the symbols of the rule which action triggered
2773 YY_STACK_PRINT (yyss, yyssp);
2778 /*-------------------------------------------------------------.
2779 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2780 `-------------------------------------------------------------*/
2782 yyerrstatus = 3; /* Each real token shifted decrements this. */
2786 yyn = yypact[yystate];
2787 if (!yypact_value_is_default (yyn))
2790 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2798 /* Pop the current state because it cannot handle the error token. */
2803 yydestruct ("Error: popping",
2804 yystos[yystate], yyvsp);
2807 YY_STACK_PRINT (yyss, yyssp);
2813 /* Shift the error token. */
2814 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2820 /*-------------------------------------.
2821 | yyacceptlab -- YYACCEPT comes here. |
2822 `-------------------------------------*/
2827 /*-----------------------------------.
2828 | yyabortlab -- YYABORT comes here. |
2829 `-----------------------------------*/
2834 #if !defined(yyoverflow) || YYERROR_VERBOSE
2835 /*-------------------------------------------------.
2836 | yyexhaustedlab -- memory exhaustion comes here. |
2837 `-------------------------------------------------*/
2839 yyerror (YY_("memory exhausted"));
2845 if (yychar != YYEMPTY)
2847 /* Make sure we have latest lookahead translation. See comments at
2848 user semantic actions for why this is necessary. */
2849 yytoken = YYTRANSLATE (yychar);
2850 yydestruct ("Cleanup: discarding lookahead",
2853 /* Do not reclaim the symbols of the rule which action triggered
2854 this YYABORT or YYACCEPT. */
2856 YY_STACK_PRINT (yyss, yyssp);
2857 while (yyssp != yyss)
2859 yydestruct ("Cleanup: popping",
2860 yystos[*yyssp], yyvsp);
2865 YYSTACK_FREE (yyss);
2868 if (yymsg != yymsgbuf)
2869 YYSTACK_FREE (yymsg);
2871 /* Make sure YYID is used. */
2872 return YYID (yyresult);
2877 /* Line 2067 of yacc.c */
2883 static const char *key_word[] = {
2884 "::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING",
2885 "SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL",
2886 "DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER",
2887 "BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED",
2888 "SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS",
2889 "BEGIN","END","UTCTime","GeneralizedTime",
2890 "GeneralString","FROM","IMPORTS","NULL","ENUMERATED",
2891 "NumericString", "IA5String", "TeletexString", "PrintableString",
2892 "UniversalString", "BMPString", "UTF8String", "VisibleString"};
2894 static const int key_word_token[] = {
2895 ASSIG, OPTIONAL, INTEGER, SIZE, OCTET, STRING, SEQUENCE, BIT, UNIVERSAL,
2896 PRIVATE, OPTIONAL, DEFAULT, CHOICE, OF, OBJECT, STR_IDENTIFIER,
2897 BOOLEAN, ASN1_TRUE, ASN1_FALSE, APPLICATION, ANY, DEFINED, SET, BY,
2898 EXPLICIT, IMPLICIT, DEFINITIONS, TAGS, BEGIN, END, UTCTime,
2899 GeneralizedTime, GeneralString, FROM, IMPORTS, TOKEN_NULL,
2900 ENUMERATED, NumericString, IA5String, TeletexString, PrintableString,
2901 UniversalString, BMPString, UTF8String, VisibleString
2904 /*************************************************************/
2905 /* Function: _asn1_yylex */
2906 /* Description: looks for tokens in file_asn1 pointer file. */
2908 /* Token identifier or ASCII code or 0(zero: End Of File) */
2909 /*************************************************************/
2913 int c, counter = 0, k, lastc;
2914 char string[ASN1_MAX_NAME_SIZE + 1]; /* will contain the next token */
2919 while ((c = fgetc (file_asn1)) == ' ' || c == '\t' || c == '\n')
2925 strcpy (last_token, "End Of File");
2929 if (c == '(' || c == ')' || c == '[' || c == ']' ||
2930 c == '{' || c == '}' || c == ',' || c == '.' ||
2931 c == '+' || c == '|')
2938 { /* Maybe the first '-' of a comment */
2939 if ((c = fgetc (file_asn1)) != '-')
2941 ungetc (c, file_asn1);
2942 last_token[0] = '-';
2950 /* A comment finishes at the next double hypen or the end of line */
2951 while ((c = fgetc (file_asn1)) != EOF && c != '\n' &&
2952 (lastc != '-' || (lastc == '-' && c != '-')))
2956 strcpy (last_token, "End Of File");
2963 continue; /* next char, please! (repeat the search) */
2967 string[counter++] = c;
2968 /* Till the end of the token */
2970 ((c = fgetc (file_asn1)) == EOF || c == ' ' || c == '\t'
2971 || c == '\n' || c == '(' || c == ')' || c == '[' || c == ']'
2972 || c == '{' || c == '}' || c == ',' || c == '.'))
2974 if (counter >= ASN1_MAX_NAME_SIZE)
2976 result_parse = ASN1_NAME_TOO_LONG;
2979 string[counter++] = c;
2981 ungetc (c, file_asn1);
2982 string[counter] = 0;
2983 strcpy (last_token, string);
2985 /* Is STRING a number? */
2986 for (k = 0; k < counter; k++)
2987 if (!isdigit (string[k]))
2991 strcpy (yylval.str, string);
2992 return NUM; /* return the number */
2995 /* Is STRING a keyword? */
2996 for (i = 0; i < (sizeof (key_word) / sizeof (char *)); i++)
2997 if (!strcmp (string, key_word[i]))
2998 return key_word_token[i];
3000 /* STRING is an IDENTIFIER */
3001 strcpy (yylval.str, string);
3006 /*************************************************************/
3007 /* Function: _asn1_create_errorDescription */
3008 /* Description: creates a string with the description of the*/
3011 /* error : error to describe. */
3012 /* error_desc: string that will contain the */
3014 /*************************************************************/
3016 _asn1_create_errorDescription (int error, char *error_desc)
3018 if (error_desc == NULL)
3024 case ASN1_FILE_NOT_FOUND:
3025 snprintf(error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s file was not found", file_name);
3027 case ASN1_SYNTAX_ERROR:
3028 strcpy(error_desc, last_error);
3030 case ASN1_NAME_TOO_LONG:
3031 snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE,
3032 "%s:%u: name too long (more than %u characters)", file_name,
3033 line_number, ASN1_MAX_NAME_SIZE);
3035 case ASN1_IDENTIFIER_NOT_FOUND:
3036 snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE,
3037 "%s:: identifier '%s' not found", file_name,
3038 _asn1_identifierMissing);
3049 * @file: specify the path and the name of file that contains
3050 * ASN.1 declarations.
3051 * @definitions: return the pointer to the structure created from
3052 * "file" ASN.1 declarations.
3053 * @error_desc: return the error description or an empty
3054 * string if success.
3056 * Function used to start the parse algorithm. Creates the structures
3057 * needed to manage the definitions included in @file file.
3059 * Returns: %ASN1_SUCCESS if the file has a correct syntax and every
3060 * identifier is known, %ASN1_ELEMENT_NOT_EMPTY if @definitions not
3061 * %NULL, %ASN1_FILE_NOT_FOUND if an error occured while
3062 * opening @file, %ASN1_SYNTAX_ERROR if the syntax is not
3063 * correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an
3064 * identifier that is not defined, %ASN1_NAME_TOO_LONG if in the
3065 * file there is an identifier whith more than %ASN1_MAX_NAME_SIZE
3069 asn1_parser2tree (const char *file, asn1_node * definitions,
3075 if (*definitions != NULL)
3076 return ASN1_ELEMENT_NOT_EMPTY;
3078 *definitions = NULL;
3082 /* open the file to parse */
3083 file_asn1 = fopen (file, "r");
3085 if (file_asn1 == NULL)
3087 result_parse = ASN1_FILE_NOT_FOUND;
3091 result_parse = ASN1_SUCCESS;
3098 if (result_parse == ASN1_SUCCESS)
3100 /* set IMPLICIT or EXPLICIT property */
3101 _asn1_set_default_tag (p_tree);
3102 /* set CONST_SET and CONST_NOT_USED */
3103 _asn1_type_set_config (p_tree);
3104 /* check the identifier definitions */
3105 result_parse = _asn1_check_identifier (p_tree);
3106 if (result_parse == ASN1_SUCCESS)
3107 { /* all identifier defined */
3108 /* Delete the list and keep the ASN1 structure */
3109 _asn1_delete_list ();
3110 /* Convert into DER coding the value assign to INTEGER constants */
3111 _asn1_change_integer_value (p_tree);
3112 /* Expand the IDs of OBJECT IDENTIFIER constants */
3113 _asn1_expand_object_id (p_tree);
3115 *definitions = p_tree;
3117 else /* some identifiers not defined */
3118 /* Delete the list and the ASN1 structure */
3119 _asn1_delete_list_and_nodes ();
3121 else /* syntax error */
3122 /* Delete the list and the ASN1 structure */
3123 _asn1_delete_list_and_nodes ();
3126 _asn1_create_errorDescription (result_parse, error_desc);
3128 return result_parse;
3132 * asn1_parser2array:
3133 * @inputFileName: specify the path and the name of file that
3134 * contains ASN.1 declarations.
3135 * @outputFileName: specify the path and the name of file that will
3136 * contain the C vector definition.
3137 * @vectorName: specify the name of the C vector.
3138 * @error_desc : return the error description or an empty
3139 * string if success.
3141 * Function that generates a C structure from an ASN1 file. Creates a
3142 * file containing a C vector to use to manage the definitions
3143 * included in @inputFileName file. If @inputFileName is
3144 * "/aa/bb/xx.yy" and @outputFileName is %NULL, the file created is
3145 * "/aa/bb/xx_asn1_tab.c". If @vectorName is %NULL the vector name
3146 * will be "xx_asn1_tab".
3148 * Returns: %ASN1_SUCCESS if the file has a correct syntax and every
3149 * identifier is known, %ASN1_FILE_NOT_FOUND if an error occured
3150 * while opening @inputFileName, %ASN1_SYNTAX_ERROR if the syntax is
3151 * not correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is
3152 * an identifier that is not defined, %ASN1_NAME_TOO_LONG if in the
3153 * file there is an identifier whith more than %ASN1_MAX_NAME_SIZE
3157 asn1_parser2array (const char *inputFileName, const char *outputFileName,
3158 const char *vectorName, char *error_desc)
3160 char *file_out_name = NULL;
3161 char *vector_name = NULL;
3162 const char *char_p, *slash_p, *dot_p;
3166 file_name = inputFileName;
3168 /* open the file to parse */
3169 file_asn1 = fopen (inputFileName, "r");
3171 if (file_asn1 == NULL)
3172 result_parse = ASN1_FILE_NOT_FOUND;
3175 result_parse = ASN1_SUCCESS;
3182 if (result_parse == ASN1_SUCCESS)
3184 /* set IMPLICIT or EXPLICIT property */
3185 _asn1_set_default_tag (p_tree);
3186 /* set CONST_SET and CONST_NOT_USED */
3187 _asn1_type_set_config (p_tree);
3188 /* check the identifier definitions */
3189 result_parse = _asn1_check_identifier (p_tree);
3191 if (result_parse == ASN1_SUCCESS)
3192 { /* all identifier defined */
3194 /* searching the last '/' and '.' in inputFileName */
3195 char_p = inputFileName;
3196 slash_p = inputFileName;
3197 while ((char_p = strchr (char_p, '/')))
3204 dot_p = inputFileName + strlen (inputFileName);
3206 while ((char_p = strchr (char_p, '.')))
3212 if (outputFileName == NULL)
3214 /* file_out_name = inputFileName + _asn1_tab.c */
3215 file_out_name = malloc (dot_p - inputFileName + 1 +
3216 strlen ("_asn1_tab.c"));
3217 memcpy (file_out_name, inputFileName,
3218 dot_p - inputFileName);
3219 file_out_name[dot_p - inputFileName] = 0;
3220 strcat (file_out_name, "_asn1_tab.c");
3224 /* file_out_name = inputFileName */
3226 (char *) malloc (strlen (outputFileName) + 1);
3227 strcpy (file_out_name, outputFileName);
3230 if (vectorName == NULL)
3232 /* vector_name = file name + _asn1_tab */
3233 vector_name = malloc (dot_p - slash_p + 1 +
3234 strlen ("_asn1_tab"));
3235 memcpy (vector_name, slash_p, dot_p - slash_p);
3236 vector_name[dot_p - slash_p] = 0;
3237 strcat (vector_name, "_asn1_tab");
3241 /* vector_name = vectorName */
3242 vector_name = (char *) malloc (strlen (vectorName) + 1);
3243 strcpy (vector_name, vectorName);
3246 /* Save structure in a file */
3247 _asn1_create_static_structure (p_tree,
3248 file_out_name, vector_name);
3250 free (file_out_name);
3252 } /* result == OK */
3253 } /* result == OK */
3255 /* Delete the list and the ASN1 structure */
3256 _asn1_delete_list_and_nodes ();
3257 } /* inputFile exist */
3259 _asn1_create_errorDescription (result_parse, error_desc);
3261 return result_parse;
3264 /*************************************************************/
3265 /* Function: _asn1_yyerror */
3266 /* Description: function called when there are syntax errors*/
3268 /* char *s : error description */
3271 /*************************************************************/
3273 _asn1_yyerror (const char *s)
3275 /* Sends the error description to the std_out */
3277 if (strcmp (last_token, "VisibleString") == 0 ||
3278 strcmp (last_token, "PrintableString") == 0 ||
3279 strcmp (last_token, "UniversalString") == 0 ||
3280 strcmp (last_token, "IA5String") == 0 ||
3281 strcmp (last_token, "UTF8String") == 0 ||
3282 strcmp (last_token, "NumericString") == 0 ||
3283 strcmp (last_token, "TeletexString") == 0 ||
3284 strcmp (last_token, "BMPString") == 0)
3286 snprintf (last_error_token, ASN1_MAX_ERROR_DESCRIPTION_SIZE,
3289 "%s:%u: Warning: %s is a built-in ASN.1 type.\n",
3290 file_name, line_number, last_token);
3293 last_error_token[0] = 0;
3295 if (result_parse != ASN1_NAME_TOO_LONG)
3297 snprintf (last_error, ASN1_MAX_ERROR_DESCRIPTION_SIZE,
3298 "%s:%u: Error: %s near '%s'", file_name,
3299 line_number, s, last_token);
3300 result_parse = ASN1_SYNTAX_ERROR;