1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
61 /* Substitute the variable and function names. */
62 #define yyparse _asn1_yyparse
63 #define yylex _asn1_yylex
64 #define yyerror _asn1_yyerror
65 #define yylval _asn1_yylval
66 #define yychar _asn1_yychar
67 #define yydebug _asn1_yydebug
68 #define yynerrs _asn1_yynerrs
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
110 GeneralizedTime
= 291,
120 #define IDENTIFIER 260
128 #define UNIVERSAL 268
130 #define APPLICATION 270
135 #define STR_IDENTIFIER 275
139 #define TOKEN_NULL 279
146 #define DEFINITIONS 286
151 #define GeneralizedTime 291
152 #define GeneralString 292
155 #define ENUMERATED 295
160 /* Copy the first part of user declarations. */
165 #include <parser_aux.h>
166 #include <structure.h>
169 static FILE *file_asn1
; /* Pointer to file to parse */
170 static asn1_retCode result_parse
; /* result of the parser
172 static node_asn
*p_tree
; /* pointer to the root of the
173 structure created by the
175 static unsigned long lineNumber
; /* line number describing the
176 parser position inside the
178 static char lastToken
[MAX_NAME_SIZE
+1]; /* last token find in the file
179 to parse before the 'parse
181 extern char _asn1_identifierMissing
[];
182 static const char *fileName
; /* file to parse */
184 int _asn1_yyerror (char *);
185 int _asn1_yylex(void);
189 /* Enabling traces. */
194 /* Enabling verbose error messages. */
195 #ifdef YYERROR_VERBOSE
196 # undef YYERROR_VERBOSE
197 # define YYERROR_VERBOSE 1
199 # define YYERROR_VERBOSE 0
202 /* Enabling the token table. */
203 #ifndef YYTOKEN_TABLE
204 # define YYTOKEN_TABLE 0
207 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
208 typedef union YYSTYPE
211 unsigned int constant
;
212 char str
[MAX_NAME_SIZE
+1];
215 /* Line 187 of yacc.c. */
218 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
219 # define YYSTYPE_IS_DECLARED 1
220 # define YYSTYPE_IS_TRIVIAL 1
225 /* Copy the second part of user declarations. */
228 /* Line 216 of yacc.c. */
236 typedef YYTYPE_UINT8 yytype_uint8
;
238 typedef unsigned char yytype_uint8
;
242 typedef YYTYPE_INT8 yytype_int8
;
243 #elif (defined __STDC__ || defined __C99__FUNC__ \
244 || defined __cplusplus || defined _MSC_VER)
245 typedef signed char yytype_int8
;
247 typedef short int yytype_int8
;
251 typedef YYTYPE_UINT16 yytype_uint16
;
253 typedef unsigned short int yytype_uint16
;
257 typedef YYTYPE_INT16 yytype_int16
;
259 typedef short int yytype_int16
;
263 # ifdef __SIZE_TYPE__
264 # define YYSIZE_T __SIZE_TYPE__
265 # elif defined size_t
266 # define YYSIZE_T size_t
267 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
268 || defined __cplusplus || defined _MSC_VER)
269 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
270 # define YYSIZE_T size_t
272 # define YYSIZE_T unsigned int
276 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
281 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
282 # define YY_(msgid) dgettext ("bison-runtime", msgid)
286 # define YY_(msgid) msgid
290 /* Suppress unused-variable warnings by "using" E. */
291 #if ! defined lint || defined __GNUC__
292 # define YYUSE(e) ((void) (e))
294 # define YYUSE(e) /* empty */
297 /* Identity function, used to suppress warnings about constant conditions. */
301 #if (defined __STDC__ || defined __C99__FUNC__ \
302 || defined __cplusplus || defined _MSC_VER)
315 #if ! defined yyoverflow || YYERROR_VERBOSE
317 /* The parser invokes alloca or malloc; define the necessary symbols. */
319 # ifdef YYSTACK_USE_ALLOCA
320 # if YYSTACK_USE_ALLOCA
322 # define YYSTACK_ALLOC __builtin_alloca
323 # elif defined __BUILTIN_VA_ARG_INCR
324 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
326 # define YYSTACK_ALLOC __alloca
327 # elif defined _MSC_VER
328 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
329 # define alloca _alloca
331 # define YYSTACK_ALLOC alloca
332 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
333 || defined __cplusplus || defined _MSC_VER)
334 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
343 # ifdef YYSTACK_ALLOC
344 /* Pacify GCC's `empty if-body' warning. */
345 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
346 # ifndef YYSTACK_ALLOC_MAXIMUM
347 /* The OS might guarantee only one guard page at the bottom of the stack,
348 and a page size can be as small as 4096 bytes. So we cannot safely
349 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
350 to allow for a few compiler-allocated temporary stack slots. */
351 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
354 # define YYSTACK_ALLOC YYMALLOC
355 # define YYSTACK_FREE YYFREE
356 # ifndef YYSTACK_ALLOC_MAXIMUM
357 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
359 # if (defined __cplusplus && ! defined _STDLIB_H \
360 && ! ((defined YYMALLOC || defined malloc) \
361 && (defined YYFREE || defined free)))
362 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
368 # define YYMALLOC malloc
369 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
370 || defined __cplusplus || defined _MSC_VER)
371 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
376 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
377 || defined __cplusplus || defined _MSC_VER)
378 void free (void *); /* INFRINGES ON USER NAME SPACE */
382 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
385 #if (! defined yyoverflow \
386 && (! defined __cplusplus \
387 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
389 /* A type that is properly aligned for any stack member. */
396 /* The size of the maximum gap between one aligned stack and the next. */
397 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
399 /* The size of an array large to enough to hold all stacks, each with
401 # define YYSTACK_BYTES(N) \
402 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
403 + YYSTACK_GAP_MAXIMUM)
405 /* Copy COUNT objects from FROM to TO. The source and destination do
408 # if defined __GNUC__ && 1 < __GNUC__
409 # define YYCOPY(To, From, Count) \
410 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
412 # define YYCOPY(To, From, Count) \
416 for (yyi = 0; yyi < (Count); yyi++) \
417 (To)[yyi] = (From)[yyi]; \
423 /* Relocate STACK from its old location to the new one. The
424 local variables YYSIZE and YYSTACKSIZE give the old and new number of
425 elements in the stack, and YYPTR gives the new location of the
426 stack. Advance YYPTR to a properly aligned location for the next
428 # define YYSTACK_RELOCATE(Stack) \
431 YYSIZE_T yynewbytes; \
432 YYCOPY (&yyptr->Stack, Stack, yysize); \
433 Stack = &yyptr->Stack; \
434 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
435 yyptr += yynewbytes / sizeof (*yyptr); \
441 /* YYFINAL -- State number of the termination state. */
443 /* YYLAST -- Last index in YYTABLE. */
446 /* YYNTOKENS -- Number of terminals. */
448 /* YYNNTS -- Number of nonterminals. */
450 /* YYNRULES -- Number of rules. */
452 /* YYNRULES -- Number of states. */
453 #define YYNSTATES 190
455 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
457 #define YYMAXUTOK 295
459 #define YYTRANSLATE(YYX) \
460 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
462 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
463 static const yytype_uint8 yytranslate
[] =
465 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 43, 44, 2, 41, 45, 42, 51, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 46, 2, 47, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
477 2, 2, 2, 49, 48, 50, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
491 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
492 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
493 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
494 35, 36, 37, 38, 39, 40
498 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
500 static const yytype_uint16 yyprhs
[] =
502 0, 0, 3, 12, 14, 17, 20, 22, 24, 26,
503 28, 30, 32, 36, 41, 43, 47, 49, 54, 56,
504 59, 61, 63, 65, 69, 74, 76, 79, 82, 85,
505 88, 91, 93, 97, 99, 104, 109, 117, 119, 121,
506 123, 128, 136, 138, 142, 144, 147, 150, 154, 159,
507 161, 165, 168, 172, 178, 183, 186, 188, 191, 193,
508 195, 197, 199, 201, 203, 205, 207, 209, 211, 213,
509 215, 217, 219, 222, 224, 227, 230, 233, 235, 239,
510 244, 248, 253, 258, 262, 267, 272, 274, 279, 283,
511 291, 298, 303, 305, 307, 309, 312, 317, 321, 323
514 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
515 static const yytype_int8 yyrhs
[] =
517 53, 0, -1, 93, 31, 94, 32, 3, 33, 92,
518 34, -1, 4, -1, 41, 4, -1, 42, 4, -1,
519 54, -1, 55, -1, 4, -1, 5, -1, 56, -1,
520 5, -1, 43, 56, 44, -1, 5, 43, 56, 44,
521 -1, 59, -1, 60, 45, 59, -1, 57, -1, 5,
522 43, 4, 44, -1, 61, -1, 62, 61, -1, 13,
523 -1, 14, -1, 15, -1, 46, 4, 47, -1, 46,
524 63, 4, 47, -1, 64, -1, 64, 29, -1, 64,
525 30, -1, 16, 58, -1, 16, 22, -1, 16, 23,
526 -1, 56, -1, 67, 48, 56, -1, 7, -1, 7,
527 49, 60, 50, -1, 68, 43, 67, 44, -1, 68,
528 43, 57, 51, 51, 57, 44, -1, 21, -1, 35,
529 -1, 36, -1, 8, 43, 57, 44, -1, 8, 43,
530 57, 51, 51, 57, 44, -1, 71, -1, 43, 71,
531 44, -1, 37, -1, 37, 72, -1, 9, 10, -1,
532 9, 10, 72, -1, 5, 43, 4, 44, -1, 75,
533 -1, 76, 45, 75, -1, 12, 10, -1, 12, 10,
534 72, -1, 12, 10, 49, 76, 50, -1, 40, 49,
535 76, 50, -1, 19, 20, -1, 5, -1, 5, 72,
536 -1, 68, -1, 78, -1, 69, -1, 70, -1, 74,
537 -1, 77, -1, 73, -1, 85, -1, 79, -1, 87,
538 -1, 88, -1, 86, -1, 24, -1, 80, -1, 65,
539 80, -1, 81, -1, 81, 66, -1, 81, 6, -1,
540 5, 82, -1, 83, -1, 84, 45, 83, -1, 11,
541 49, 84, 50, -1, 11, 18, 80, -1, 11, 72,
542 18, 80, -1, 28, 49, 84, 50, -1, 28, 18,
543 80, -1, 28, 72, 18, 80, -1, 17, 49, 84,
544 50, -1, 25, -1, 25, 26, 27, 5, -1, 5,
545 3, 81, -1, 5, 19, 20, 3, 49, 62, 50,
546 -1, 5, 5, 3, 49, 62, 50, -1, 5, 7,
547 3, 56, -1, 89, -1, 90, -1, 91, -1, 92,
548 91, -1, 5, 49, 62, 50, -1, 5, 49, 50,
552 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
553 static const yytype_uint16 yyrline
[] =
555 0, 124, 124, 137, 138, 141, 145, 146, 149, 150,
556 153, 154, 157, 159, 164, 165, 169, 171, 176, 177,
557 181, 182, 183, 186, 188, 192, 193, 194, 197, 199,
558 200, 204, 205, 209, 210, 212, 213, 220, 223, 224,
559 227, 229, 235, 236, 239, 240, 244, 245, 249, 254,
560 255, 259, 260, 261, 266, 272, 275, 277, 280, 281,
561 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
562 292, 295, 296, 301, 302, 305, 308, 311, 312, 316,
563 318, 320, 325, 327, 329, 334, 338, 339, 344, 347,
564 351, 356, 362, 363, 366, 367, 371, 374, 398, 399
568 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
569 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
570 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
571 static const char *const yytname
[] =
573 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER",
574 "OPTIONAL", "INTEGER", "SIZE", "OCTET", "STRING", "SEQUENCE", "BIT",
575 "UNIVERSAL", "PRIVATE", "APPLICATION", "DEFAULT", "CHOICE", "OF",
576 "OBJECT", "STR_IDENTIFIER", "BOOLEAN", "TRUE", "FALSE", "TOKEN_NULL",
577 "ANY", "DEFINED", "BY", "SET", "EXPLICIT", "IMPLICIT", "DEFINITIONS",
578 "TAGS", "BEGIN", "END", "UTCTime", "GeneralizedTime", "GeneralString",
579 "FROM", "IMPORTS", "ENUMERATED", "'+'", "'-'", "'('", "')'", "','",
580 "'['", "']'", "'|'", "'{'", "'}'", "'.'", "$accept", "definitions",
581 "pos_num", "neg_num", "pos_neg_num", "num_identifier",
582 "pos_neg_identifier", "constant", "constant_list", "obj_constant",
583 "obj_constant_list", "class", "tag_type", "tag", "default",
584 "pos_neg_list", "integer_def", "boolean_def", "Time", "size_def2",
585 "size_def", "generalstring_def", "octet_string_def", "bit_element",
586 "bit_element_list", "bit_string_def", "enumerated_def", "object_def",
587 "type_assig_right", "type_assig_right_tag",
588 "type_assig_right_tag_default", "type_assig", "type_assig_list",
589 "sequence_def", "set_def", "choise_def", "any_def", "type_def",
590 "constant_def", "type_constant", "type_constant_list", "definitions_id",
591 "explicit_implicit", 0
596 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
598 static const yytype_uint16 yytoknum
[] =
600 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
601 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
602 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
603 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
604 295, 43, 45, 40, 41, 44, 91, 93, 124, 123,
609 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
610 static const yytype_uint8 yyr1
[] =
612 0, 52, 53, 54, 54, 55, 56, 56, 57, 57,
613 58, 58, 59, 59, 60, 60, 61, 61, 62, 62,
614 63, 63, 63, 64, 64, 65, 65, 65, 66, 66,
615 66, 67, 67, 68, 68, 68, 68, 69, 70, 70,
616 71, 71, 72, 72, 73, 73, 74, 74, 75, 76,
617 76, 77, 77, 77, 78, 79, 80, 80, 80, 80,
618 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
619 80, 81, 81, 82, 82, 82, 83, 84, 84, 85,
620 85, 85, 86, 86, 86, 87, 88, 88, 89, 90,
621 90, 90, 91, 91, 92, 92, 93, 93, 94, 94
624 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
625 static const yytype_uint8 yyr2
[] =
627 0, 2, 8, 1, 2, 2, 1, 1, 1, 1,
628 1, 1, 3, 4, 1, 3, 1, 4, 1, 2,
629 1, 1, 1, 3, 4, 1, 2, 2, 2, 2,
630 2, 1, 3, 1, 4, 4, 7, 1, 1, 1,
631 4, 7, 1, 3, 1, 2, 2, 3, 4, 1,
632 3, 2, 3, 5, 4, 2, 1, 2, 1, 1,
633 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
634 1, 1, 2, 1, 2, 2, 2, 1, 3, 4,
635 3, 4, 4, 3, 4, 4, 1, 4, 3, 7,
636 6, 4, 1, 1, 1, 2, 4, 3, 1, 1
639 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
640 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
641 means the default is an error. */
642 static const yytype_uint8 yydefact
[] =
644 0, 0, 0, 0, 0, 1, 0, 8, 9, 97,
645 16, 18, 0, 98, 99, 0, 0, 96, 19, 0,
646 0, 0, 17, 0, 0, 92, 93, 94, 0, 0,
647 0, 0, 0, 2, 95, 56, 33, 0, 0, 0,
648 0, 0, 37, 70, 86, 0, 38, 39, 44, 0,
649 0, 25, 0, 58, 60, 61, 64, 62, 63, 59,
650 66, 71, 88, 65, 69, 67, 68, 0, 0, 0,
651 0, 0, 42, 57, 0, 46, 0, 0, 0, 51,
652 0, 55, 0, 0, 0, 0, 45, 0, 0, 20,
653 21, 22, 0, 26, 27, 72, 0, 0, 3, 0,
654 0, 6, 7, 91, 0, 0, 0, 0, 0, 14,
655 0, 47, 80, 0, 77, 0, 0, 0, 52, 0,
656 0, 83, 0, 0, 0, 49, 0, 23, 0, 3,
657 9, 31, 0, 0, 0, 4, 5, 0, 0, 43,
658 0, 0, 0, 34, 73, 76, 0, 79, 81, 0,
659 85, 87, 82, 84, 0, 0, 54, 24, 0, 35,
660 0, 90, 0, 40, 0, 0, 12, 15, 75, 0,
661 74, 78, 53, 0, 50, 0, 32, 89, 0, 13,
662 11, 29, 30, 10, 28, 48, 0, 0, 36, 41
665 /* YYDEFGOTO[NTERM-NUM]. */
666 static const yytype_int16 yydefgoto
[] =
668 -1, 2, 101, 102, 103, 10, 184, 109, 110, 11,
669 12, 92, 51, 52, 170, 133, 53, 54, 55, 72,
670 73, 56, 57, 125, 126, 58, 59, 60, 61, 62,
671 145, 114, 115, 63, 64, 65, 66, 25, 26, 27,
675 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
677 #define YYPACT_NINF -96
678 static const yytype_int16 yypact
[] =
680 24, -14, 48, 56, 0, -96, -10, -96, -2, -96,
681 -96, -96, 2, -96, -96, 71, 111, -96, -96, 117,
682 83, 96, -96, 127, 42, -96, -96, -96, 10, 77,
683 130, 131, 115, -96, -96, 8, 90, 132, 13, 135,
684 92, 126, -96, -96, 122, 15, -96, -96, 8, 100,
685 93, 49, 119, 94, -96, -96, -96, -96, -96, -96,
686 -96, -96, -96, -96, -96, -96, -96, 102, 28, 149,
687 110, 150, -96, -96, 17, 8, 119, 152, 142, 22,
688 152, -96, 134, 119, 152, 144, -96, 158, 118, -96,
689 -96, -96, 160, -96, -96, -96, 35, 88, -96, 162,
690 163, -96, -96, -96, 120, 114, 124, 128, 28, -96,
691 -8, -96, -96, 77, -96, -7, 119, 158, -96, 18,
692 165, -96, 50, 119, 129, -96, 54, -96, 133, 123,
693 -96, -96, 125, 37, 4, -96, -96, 88, -27, -96,
694 28, 137, 17, -96, 20, -96, 152, -96, -96, 66,
695 -96, -96, -96, -96, 169, 158, -96, -96, 136, -96,
696 28, -96, 7, -96, 138, 139, -96, -96, -96, 68,
697 -96, -96, -96, 140, -96, 114, -96, -96, 114, -96,
698 -96, -96, -96, -96, -96, -96, 141, 146, -96, -96
701 /* YYPGOTO[NTERM-NUM]. */
702 static const yytype_int16 yypgoto
[] =
704 -96, -96, -96, -96, -94, -95, -96, 33, -96, -12,
705 -84, -96, -96, -96, -96, -96, -96, -96, -96, 106,
706 -20, -96, -96, 23, 62, -96, -96, -96, -49, 69,
707 -96, 40, 41, -96, -96, -96, -96, -96, -96, 164,
711 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
712 positive, shift that token. If negative, reduce the rule which
713 number is the opposite. If zero, do what YYDEFACT says.
714 If YYTABLE_NINF, syntax error. */
715 #define YYTABLE_NINF -9
716 static const yytype_int16 yytable
[] =
718 18, 132, 131, 95, 7, 8, 7, 8, 7, 8,
719 138, 7, 8, 134, 141, 24, 70, 163, 78, 13,
720 14, 70, 107, 70, 164, 85, 168, 112, 86, 1,
721 70, 76, 98, 83, 121, 4, 169, 142, 146, 129,
722 130, 16, 143, 147, 33, 29, 165, 30, 5, 31,
723 9, 71, 17, 162, 161, 111, 71, 177, 71, 118,
724 108, 32, 77, 146, 84, 71, 176, 148, 150, 99,
725 100, 117, 98, 180, 153, 183, 99, 100, 93, 94,
726 186, 159, 35, 187, 36, 160, 37, 6, 38, 39,
727 181, 182, 7, 8, 40, 146, 41, 88, 42, 155,
728 152, 43, 44, 19, 156, 45, 89, 90, 91, 99,
729 100, 155, 46, 47, 48, 20, 172, 49, 7, 130,
730 21, 119, 18, 50, 35, 122, 36, 22, 37, 23,
731 38, 39, 24, 67, 68, 69, 40, 96, 41, 74,
732 42, 80, 75, 43, 44, 79, 81, 45, 82, 87,
733 18, 97, 104, 105, 46, 47, 48, 113, 70, 49,
734 116, 120, 123, 124, 128, 127, 135, 136, 139, 137,
735 151, 140, 154, 173, -8, 167, 158, 106, 174, 149,
736 157, 166, 144, 179, 185, 188, 171, 175, 0, 178,
740 static const yytype_int16 yycheck
[] =
742 12, 96, 96, 52, 4, 5, 4, 5, 4, 5,
743 105, 4, 5, 97, 108, 5, 8, 44, 38, 29,
744 30, 8, 5, 8, 51, 45, 6, 76, 48, 5,
745 8, 18, 4, 18, 83, 49, 16, 45, 45, 4,
746 5, 43, 50, 50, 34, 3, 140, 5, 0, 7,
747 50, 43, 50, 137, 50, 75, 43, 50, 43, 79,
748 43, 19, 49, 45, 49, 43, 160, 116, 50, 41,
749 42, 49, 4, 5, 123, 169, 41, 42, 29, 30,
750 175, 44, 5, 178, 7, 48, 9, 31, 11, 12,
751 22, 23, 4, 5, 17, 45, 19, 4, 21, 45,
752 50, 24, 25, 32, 50, 28, 13, 14, 15, 41,
753 42, 45, 35, 36, 37, 4, 50, 40, 4, 5,
754 3, 80, 134, 46, 5, 84, 7, 44, 9, 33,
755 11, 12, 5, 3, 3, 20, 17, 43, 19, 49,
756 21, 49, 10, 24, 25, 10, 20, 28, 26, 49,
757 162, 49, 3, 43, 35, 36, 37, 5, 8, 40,
758 18, 27, 18, 5, 4, 47, 4, 4, 44, 49,
759 5, 43, 43, 4, 51, 142, 51, 71, 155, 117,
760 47, 44, 113, 44, 44, 44, 146, 51, -1, 51,
764 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
765 symbol of state STATE-NUM. */
766 static const yytype_uint8 yystos
[] =
768 0, 5, 53, 93, 49, 0, 31, 4, 5, 50,
769 57, 61, 62, 29, 30, 94, 43, 50, 61, 32,
770 4, 3, 44, 33, 5, 89, 90, 91, 92, 3,
771 5, 7, 19, 34, 91, 5, 7, 9, 11, 12,
772 17, 19, 21, 24, 25, 28, 35, 36, 37, 40,
773 46, 64, 65, 68, 69, 70, 73, 74, 77, 78,
774 79, 80, 81, 85, 86, 87, 88, 3, 3, 20,
775 8, 43, 71, 72, 49, 10, 18, 49, 72, 10,
776 49, 20, 26, 18, 49, 72, 72, 49, 4, 13,
777 14, 15, 63, 29, 30, 80, 43, 49, 4, 41,
778 42, 54, 55, 56, 3, 43, 71, 5, 43, 59,
779 60, 72, 80, 5, 83, 84, 18, 49, 72, 84,
780 27, 80, 84, 18, 5, 75, 76, 47, 4, 4,
781 5, 56, 57, 67, 62, 4, 4, 49, 57, 44,
782 43, 56, 45, 50, 81, 82, 45, 50, 80, 76,
783 50, 5, 50, 80, 43, 45, 50, 47, 51, 44,
784 48, 50, 62, 44, 51, 56, 44, 59, 6, 16,
785 66, 83, 50, 4, 75, 51, 56, 50, 51, 44,
786 5, 22, 23, 56, 58, 44, 57, 57, 44, 44
789 #define yyerrok (yyerrstatus = 0)
790 #define yyclearin (yychar = YYEMPTY)
794 #define YYACCEPT goto yyacceptlab
795 #define YYABORT goto yyabortlab
796 #define YYERROR goto yyerrorlab
799 /* Like YYERROR except do call yyerror. This remains here temporarily
800 to ease the transition to the new meaning of YYERROR, for GCC.
801 Once GCC version 2 has supplanted version 1, this can go. */
803 #define YYFAIL goto yyerrlab
805 #define YYRECOVERING() (!!yyerrstatus)
807 #define YYBACKUP(Token, Value) \
809 if (yychar == YYEMPTY && yylen == 1) \
813 yytoken = YYTRANSLATE (yychar); \
819 yyerror (YY_("syntax error: cannot back up")); \
826 #define YYERRCODE 256
829 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
830 If N is 0, then set CURRENT to the empty location which ends
831 the previous symbol: RHS[0] (always defined). */
833 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
834 #ifndef YYLLOC_DEFAULT
835 # define YYLLOC_DEFAULT(Current, Rhs, N) \
839 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
840 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
841 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
842 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
846 (Current).first_line = (Current).last_line = \
847 YYRHSLOC (Rhs, 0).last_line; \
848 (Current).first_column = (Current).last_column = \
849 YYRHSLOC (Rhs, 0).last_column; \
855 /* YY_LOCATION_PRINT -- Print the location on the stream.
856 This macro was not mandated originally: define only if we know
857 we won't break user code: when these are the locations we know. */
859 #ifndef YY_LOCATION_PRINT
860 # if YYLTYPE_IS_TRIVIAL
861 # define YY_LOCATION_PRINT(File, Loc) \
862 fprintf (File, "%d.%d-%d.%d", \
863 (Loc).first_line, (Loc).first_column, \
864 (Loc).last_line, (Loc).last_column)
866 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
871 /* YYLEX -- calling `yylex' with the right arguments. */
874 # define YYLEX yylex (YYLEX_PARAM)
876 # define YYLEX yylex ()
879 /* Enable debugging if requested. */
883 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
884 # define YYFPRINTF fprintf
887 # define YYDPRINTF(Args) \
893 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
897 YYFPRINTF (stderr, "%s ", Title); \
898 yy_symbol_print (stderr, \
900 YYFPRINTF (stderr, "\n"); \
905 /*--------------------------------.
906 | Print this symbol on YYOUTPUT. |
907 `--------------------------------*/
910 #if (defined __STDC__ || defined __C99__FUNC__ \
911 || defined __cplusplus || defined _MSC_VER)
913 yy_symbol_value_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
916 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
919 YYSTYPE
const * const yyvaluep
;
925 if (yytype
< YYNTOKENS
)
926 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
938 /*--------------------------------.
939 | Print this symbol on YYOUTPUT. |
940 `--------------------------------*/
942 #if (defined __STDC__ || defined __C99__FUNC__ \
943 || defined __cplusplus || defined _MSC_VER)
945 yy_symbol_print (FILE *yyoutput
, int yytype
, YYSTYPE
const * const yyvaluep
)
948 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
951 YYSTYPE
const * const yyvaluep
;
954 if (yytype
< YYNTOKENS
)
955 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
957 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
959 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
960 YYFPRINTF (yyoutput
, ")");
963 /*------------------------------------------------------------------.
964 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
966 `------------------------------------------------------------------*/
968 #if (defined __STDC__ || defined __C99__FUNC__ \
969 || defined __cplusplus || defined _MSC_VER)
971 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
974 yy_stack_print (bottom
, top
)
975 yytype_int16
*bottom
;
979 YYFPRINTF (stderr
, "Stack now");
980 for (; bottom
<= top
; ++bottom
)
981 YYFPRINTF (stderr
, " %d", *bottom
);
982 YYFPRINTF (stderr
, "\n");
985 # define YY_STACK_PRINT(Bottom, Top) \
988 yy_stack_print ((Bottom), (Top)); \
992 /*------------------------------------------------.
993 | Report that the YYRULE is going to be reduced. |
994 `------------------------------------------------*/
996 #if (defined __STDC__ || defined __C99__FUNC__ \
997 || defined __cplusplus || defined _MSC_VER)
999 yy_reduce_print (YYSTYPE
*yyvsp
, int yyrule
)
1002 yy_reduce_print (yyvsp
, yyrule
)
1007 int yynrhs
= yyr2
[yyrule
];
1009 unsigned long int yylno
= yyrline
[yyrule
];
1010 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1012 /* The symbols being reduced. */
1013 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1015 fprintf (stderr
, " $%d = ", yyi
+ 1);
1016 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1017 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1019 fprintf (stderr
, "\n");
1023 # define YY_REDUCE_PRINT(Rule) \
1026 yy_reduce_print (yyvsp, Rule); \
1029 /* Nonzero means print parse trace. It is left uninitialized so that
1030 multiple parsers can coexist. */
1032 #else /* !YYDEBUG */
1033 # define YYDPRINTF(Args)
1034 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1035 # define YY_STACK_PRINT(Bottom, Top)
1036 # define YY_REDUCE_PRINT(Rule)
1037 #endif /* !YYDEBUG */
1040 /* YYINITDEPTH -- initial size of the parser's stacks. */
1042 # define YYINITDEPTH 200
1045 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1046 if the built-in stack extension method is used).
1048 Do not make this value too large; the results are undefined if
1049 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1050 evaluated with infinite-precision integer arithmetic. */
1053 # define YYMAXDEPTH 10000
1061 # if defined __GLIBC__ && defined _STRING_H
1062 # define yystrlen strlen
1064 /* Return the length of YYSTR. */
1065 #if (defined __STDC__ || defined __C99__FUNC__ \
1066 || defined __cplusplus || defined _MSC_VER)
1068 yystrlen (const char *yystr
)
1076 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1084 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1085 # define yystpcpy stpcpy
1087 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1089 #if (defined __STDC__ || defined __C99__FUNC__ \
1090 || defined __cplusplus || defined _MSC_VER)
1092 yystpcpy (char *yydest
, const char *yysrc
)
1095 yystpcpy (yydest
, yysrc
)
1101 const char *yys
= yysrc
;
1103 while ((*yyd
++ = *yys
++) != '\0')
1112 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1113 quotes and backslashes, so that it's suitable for yyerror. The
1114 heuristic is that double-quoting is unnecessary unless the string
1115 contains an apostrophe, a comma, or backslash (other than
1116 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1117 null, do not copy; instead, return the length of what the result
1120 yytnamerr (char *yyres
, const char *yystr
)
1125 char const *yyp
= yystr
;
1132 goto do_not_strip_quotes
;
1136 goto do_not_strip_quotes
;
1149 do_not_strip_quotes
: ;
1153 return yystrlen (yystr
);
1155 return yystpcpy (yyres
, yystr
) - yyres
;
1159 /* Copy into YYRESULT an error message about the unexpected token
1160 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1161 including the terminating null byte. If YYRESULT is null, do not
1162 copy anything; just return the number of bytes that would be
1163 copied. As a special case, return 0 if an ordinary "syntax error"
1164 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1165 size calculation. */
1167 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1169 int yyn
= yypact
[yystate
];
1171 if (! (YYPACT_NINF
< yyn
&& yyn
<= YYLAST
))
1175 int yytype
= YYTRANSLATE (yychar
);
1176 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1177 YYSIZE_T yysize
= yysize0
;
1179 int yysize_overflow
= 0;
1180 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1181 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1185 /* This is so xgettext sees the translatable formats that are
1186 constructed on the fly. */
1187 YY_("syntax error, unexpected %s");
1188 YY_("syntax error, unexpected %s, expecting %s");
1189 YY_("syntax error, unexpected %s, expecting %s or %s");
1190 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1191 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1195 static char const yyunexpected
[] = "syntax error, unexpected %s";
1196 static char const yyexpecting
[] = ", expecting %s";
1197 static char const yyor
[] = " or %s";
1198 char yyformat
[sizeof yyunexpected
1199 + sizeof yyexpecting
- 1
1200 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1201 * (sizeof yyor
- 1))];
1202 char const *yyprefix
= yyexpecting
;
1204 /* Start YYX at -YYN if negative to avoid negative indexes in
1206 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1208 /* Stay within bounds of both yycheck and yytname. */
1209 int yychecklim
= YYLAST
- yyn
+ 1;
1210 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1213 yyarg
[0] = yytname
[yytype
];
1214 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1216 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1217 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1219 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1223 yyformat
[sizeof yyunexpected
- 1] = '\0';
1226 yyarg
[yycount
++] = yytname
[yyx
];
1227 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1228 yysize_overflow
|= (yysize1
< yysize
);
1230 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1234 yyf
= YY_(yyformat
);
1235 yysize1
= yysize
+ yystrlen (yyf
);
1236 yysize_overflow
|= (yysize1
< yysize
);
1239 if (yysize_overflow
)
1240 return YYSIZE_MAXIMUM
;
1244 /* Avoid sprintf, as that infringes on the user's name space.
1245 Don't have undefined behavior even if the translation
1246 produced a string with the wrong number of "%s"s. */
1247 char *yyp
= yyresult
;
1249 while ((*yyp
= *yyf
) != '\0')
1251 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1253 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1266 #endif /* YYERROR_VERBOSE */
1269 /*-----------------------------------------------.
1270 | Release the memory associated to this symbol. |
1271 `-----------------------------------------------*/
1274 #if (defined __STDC__ || defined __C99__FUNC__ \
1275 || defined __cplusplus || defined _MSC_VER)
1277 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1280 yydestruct (yymsg
, yytype
, yyvaluep
)
1290 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1301 /* Prevent warnings from -Wmissing-prototypes. */
1303 #ifdef YYPARSE_PARAM
1304 #if defined __STDC__ || defined __cplusplus
1305 int yyparse (void *YYPARSE_PARAM
);
1309 #else /* ! YYPARSE_PARAM */
1310 #if defined __STDC__ || defined __cplusplus
1315 #endif /* ! YYPARSE_PARAM */
1319 /* The look-ahead symbol. */
1322 /* The semantic value of the look-ahead symbol. */
1325 /* Number of syntax errors so far. */
1334 #ifdef YYPARSE_PARAM
1335 #if (defined __STDC__ || defined __C99__FUNC__ \
1336 || defined __cplusplus || defined _MSC_VER)
1338 yyparse (void *YYPARSE_PARAM
)
1341 yyparse (YYPARSE_PARAM
)
1342 void *YYPARSE_PARAM
;
1344 #else /* ! YYPARSE_PARAM */
1345 #if (defined __STDC__ || defined __C99__FUNC__ \
1346 || defined __cplusplus || defined _MSC_VER)
1360 /* Number of tokens to shift before error messages enabled. */
1362 /* Look-ahead token as an internal (translated) token number. */
1365 /* Buffer for error messages, and its allocated size. */
1367 char *yymsg
= yymsgbuf
;
1368 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1371 /* Three stacks and their tools:
1372 `yyss': related to states,
1373 `yyvs': related to semantic values,
1374 `yyls': related to locations.
1376 Refer to the stacks thru separate pointers, to allow yyoverflow
1377 to reallocate them elsewhere. */
1379 /* The state stack. */
1380 yytype_int16 yyssa
[YYINITDEPTH
];
1381 yytype_int16
*yyss
= yyssa
;
1382 yytype_int16
*yyssp
;
1384 /* The semantic value stack. */
1385 YYSTYPE yyvsa
[YYINITDEPTH
];
1386 YYSTYPE
*yyvs
= yyvsa
;
1391 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1393 YYSIZE_T yystacksize
= YYINITDEPTH
;
1395 /* The variables used to return semantic value and location from the
1400 /* The number of symbols on the RHS of the reduced rule.
1401 Keep to zero when no symbol should be popped. */
1404 YYDPRINTF ((stderr
, "Starting parse\n"));
1409 yychar
= YYEMPTY
; /* Cause a token to be read. */
1411 /* Initialize stack pointers.
1412 Waste one element of value and location stack
1413 so that they stay on the same level as the state stack.
1414 The wasted elements are never initialized. */
1421 /*------------------------------------------------------------.
1422 | yynewstate -- Push a new state, which is found in yystate. |
1423 `------------------------------------------------------------*/
1425 /* In all cases, when you get here, the value and location stacks
1426 have just been pushed. So pushing a state here evens the stacks. */
1432 if (yyss
+ yystacksize
- 1 <= yyssp
)
1434 /* Get the current used size of the three stacks, in elements. */
1435 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1439 /* Give user a chance to reallocate the stack. Use copies of
1440 these so that the &'s don't force the real ones into
1442 YYSTYPE
*yyvs1
= yyvs
;
1443 yytype_int16
*yyss1
= yyss
;
1446 /* Each stack pointer address is followed by the size of the
1447 data in use in that stack, in bytes. This used to be a
1448 conditional around just the two extra args, but that might
1449 be undefined if yyoverflow is a macro. */
1450 yyoverflow (YY_("memory exhausted"),
1451 &yyss1
, yysize
* sizeof (*yyssp
),
1452 &yyvs1
, yysize
* sizeof (*yyvsp
),
1459 #else /* no yyoverflow */
1460 # ifndef YYSTACK_RELOCATE
1461 goto yyexhaustedlab
;
1463 /* Extend the stack our own way. */
1464 if (YYMAXDEPTH
<= yystacksize
)
1465 goto yyexhaustedlab
;
1467 if (YYMAXDEPTH
< yystacksize
)
1468 yystacksize
= YYMAXDEPTH
;
1471 yytype_int16
*yyss1
= yyss
;
1472 union yyalloc
*yyptr
=
1473 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1475 goto yyexhaustedlab
;
1476 YYSTACK_RELOCATE (yyss
);
1477 YYSTACK_RELOCATE (yyvs
);
1479 # undef YYSTACK_RELOCATE
1481 YYSTACK_FREE (yyss1
);
1484 #endif /* no yyoverflow */
1486 yyssp
= yyss
+ yysize
- 1;
1487 yyvsp
= yyvs
+ yysize
- 1;
1490 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1491 (unsigned long int) yystacksize
));
1493 if (yyss
+ yystacksize
- 1 <= yyssp
)
1497 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1506 /* Do appropriate processing given the current state. Read a
1507 look-ahead token if we need one and don't already have one. */
1509 /* First try to decide what to do without reference to look-ahead token. */
1510 yyn
= yypact
[yystate
];
1511 if (yyn
== YYPACT_NINF
)
1514 /* Not known => get a look-ahead token if don't already have one. */
1516 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1517 if (yychar
== YYEMPTY
)
1519 YYDPRINTF ((stderr
, "Reading a token: "));
1523 if (yychar
<= YYEOF
)
1525 yychar
= yytoken
= YYEOF
;
1526 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1530 yytoken
= YYTRANSLATE (yychar
);
1531 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1534 /* If the proper action on seeing token YYTOKEN is to reduce or to
1535 detect an error, take that action. */
1537 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1542 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1551 /* Count tokens shifted since error; after three, turn off error
1556 /* Shift the look-ahead token. */
1557 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1559 /* Discard the shifted token unless it is eof. */
1560 if (yychar
!= YYEOF
)
1569 /*-----------------------------------------------------------.
1570 | yydefault -- do the default action for the current state. |
1571 `-----------------------------------------------------------*/
1573 yyn
= yydefact
[yystate
];
1579 /*-----------------------------.
1580 | yyreduce -- Do a reduction. |
1581 `-----------------------------*/
1583 /* yyn is the number of a rule to reduce with. */
1586 /* If YYLEN is nonzero, implement the default value of the action:
1589 Otherwise, the following line sets YYVAL to garbage.
1590 This behavior is undocumented and Bison
1591 users should not rely upon it. Assigning to YYVAL
1592 unconditionally makes the parser a bit smaller, and it avoids a
1593 GCC warning that YYVAL may be used uninitialized. */
1594 yyval
= yyvsp
[1-yylen
];
1597 YY_REDUCE_PRINT (yyn
);
1602 {(yyval
.node
)=_asn1_add_node(TYPE_DEFINITIONS
|(yyvsp
[(3) - (8)].constant
));
1603 _asn1_set_name((yyval
.node
),_asn1_get_name((yyvsp
[(1) - (8)].node
)));
1604 _asn1_set_name((yyvsp
[(1) - (8)].node
),"");
1605 _asn1_set_right((yyvsp
[(1) - (8)].node
),(yyvsp
[(7) - (8)].node
));
1606 _asn1_set_down((yyval
.node
),(yyvsp
[(1) - (8)].node
));
1608 p_tree
=(yyval
.node
);
1614 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1619 {strcpy((yyval
.str
),(yyvsp
[(2) - (2)].str
));}
1624 {strcpy((yyval
.str
),"-");
1625 strcat((yyval
.str
),(yyvsp
[(2) - (2)].str
));}
1630 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1635 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1640 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1645 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1650 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1655 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1660 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1661 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (3)].str
),strlen((yyvsp
[(2) - (3)].str
))+1);}
1666 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1667 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
1668 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1673 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1678 {(yyval
.node
)=(yyvsp
[(1) - (3)].node
);
1679 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (3)].node
)),(yyvsp
[(3) - (3)].node
));}
1684 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1685 _asn1_set_value((yyval
.node
),(yyvsp
[(1) - (1)].str
),strlen((yyvsp
[(1) - (1)].str
))+1);}
1690 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1691 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
1692 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1697 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1702 {(yyval
.node
)=(yyvsp
[(1) - (2)].node
);
1703 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (2)].node
)),(yyvsp
[(2) - (2)].node
));}
1708 {(yyval
.constant
)=CONST_UNIVERSAL
;}
1713 {(yyval
.constant
)=CONST_PRIVATE
;}
1718 {(yyval
.constant
)=CONST_APPLICATION
;}
1723 {(yyval
.node
)=_asn1_add_node(TYPE_TAG
);
1724 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (3)].str
),strlen((yyvsp
[(2) - (3)].str
))+1);}
1729 {(yyval
.node
)=_asn1_add_node(TYPE_TAG
| (yyvsp
[(2) - (4)].constant
));
1730 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1735 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1740 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_EXPLICIT
);}
1745 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_IMPLICIT
);}
1750 {(yyval
.node
)=_asn1_add_node(TYPE_DEFAULT
);
1751 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (2)].str
),strlen((yyvsp
[(2) - (2)].str
))+1);}
1756 {(yyval
.node
)=_asn1_add_node(TYPE_DEFAULT
|CONST_TRUE
);}
1761 {(yyval
.node
)=_asn1_add_node(TYPE_DEFAULT
|CONST_FALSE
);}
1766 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
);}
1771 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
|CONST_LIST
);
1772 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
1777 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
);}
1782 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
|CONST_MIN_MAX
);
1783 _asn1_set_down((yyval
.node
),_asn1_add_node(TYPE_SIZE
));
1784 _asn1_set_value(_asn1_get_down((yyval
.node
)),(yyvsp
[(6) - (7)].str
),strlen((yyvsp
[(6) - (7)].str
))+1);
1785 _asn1_set_name(_asn1_get_down((yyval
.node
)),(yyvsp
[(3) - (7)].str
));}
1790 {(yyval
.node
)=_asn1_add_node(TYPE_BOOLEAN
);}
1795 {(yyval
.node
)=_asn1_add_node(TYPE_TIME
|CONST_UTC
);}
1800 {(yyval
.node
)=_asn1_add_node(TYPE_TIME
|CONST_GENERALIZED
);}
1805 {(yyval
.node
)=_asn1_add_node(TYPE_SIZE
|CONST_1_PARAM
);
1806 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1811 {(yyval
.node
)=_asn1_add_node(TYPE_SIZE
|CONST_MIN_MAX
);
1812 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (7)].str
),strlen((yyvsp
[(3) - (7)].str
))+1);
1813 _asn1_set_name((yyval
.node
),(yyvsp
[(6) - (7)].str
));}
1818 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1823 {(yyval
.node
)=(yyvsp
[(2) - (3)].node
);}
1828 {(yyval
.node
)=_asn1_add_node(TYPE_GENERALSTRING
);}
1833 {(yyval
.node
)=_asn1_add_node(TYPE_GENERALSTRING
|CONST_SIZE
);
1834 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (2)].node
));}
1839 {(yyval
.node
)=_asn1_add_node(TYPE_OCTET_STRING
);}
1844 {(yyval
.node
)=_asn1_add_node(TYPE_OCTET_STRING
|CONST_SIZE
);
1845 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (3)].node
));}
1850 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1851 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
1852 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1857 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1862 {(yyval
.node
)=(yyvsp
[(1) - (3)].node
);
1863 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (3)].node
)),(yyvsp
[(3) - (3)].node
));}
1868 {(yyval
.node
)=_asn1_add_node(TYPE_BIT_STRING
);}
1873 {(yyval
.node
)=_asn1_add_node(TYPE_BIT_STRING
|CONST_SIZE
);}
1878 {(yyval
.node
)=_asn1_add_node(TYPE_BIT_STRING
|CONST_LIST
);
1879 _asn1_set_down((yyval
.node
),(yyvsp
[(4) - (5)].node
));}
1884 {(yyval
.node
)=_asn1_add_node(TYPE_ENUMERATED
|CONST_LIST
);
1885 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
1890 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
);}
1895 {(yyval
.node
)=_asn1_add_node(TYPE_IDENTIFIER
);
1896 _asn1_set_value((yyval
.node
),(yyvsp
[(1) - (1)].str
),strlen((yyvsp
[(1) - (1)].str
))+1);}
1901 {(yyval
.node
)=_asn1_add_node(TYPE_IDENTIFIER
|CONST_SIZE
);
1902 _asn1_set_value((yyval
.node
),(yyvsp
[(1) - (2)].str
),strlen((yyvsp
[(1) - (2)].str
))+1);
1903 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (2)].node
));}
1908 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1913 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1918 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1923 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1928 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1933 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1938 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1943 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1948 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1953 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1958 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1963 {(yyval
.node
)=_asn1_add_node(TYPE_NULL
);}
1968 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1973 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(2) - (2)].node
),CONST_TAG
);
1974 _asn1_set_right((yyvsp
[(1) - (2)].node
),_asn1_get_down((yyval
.node
)));
1975 _asn1_set_down((yyval
.node
),(yyvsp
[(1) - (2)].node
));}
1980 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1985 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_DEFAULT
);
1986 _asn1_set_right((yyvsp
[(2) - (2)].node
),_asn1_get_down((yyval
.node
)));
1987 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (2)].node
));}
1992 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_OPTION
);}
1997 {(yyval
.node
)=_asn1_set_name((yyvsp
[(2) - (2)].node
),(yyvsp
[(1) - (2)].str
));}
2002 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2007 {(yyval
.node
)=(yyvsp
[(1) - (3)].node
);
2008 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (3)].node
)),(yyvsp
[(3) - (3)].node
));}
2013 {(yyval
.node
)=_asn1_add_node(TYPE_SEQUENCE
);
2014 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
2019 {(yyval
.node
)=_asn1_add_node(TYPE_SEQUENCE_OF
);
2020 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (3)].node
));}
2025 {(yyval
.node
)=_asn1_add_node(TYPE_SEQUENCE_OF
|CONST_SIZE
);
2026 _asn1_set_right((yyvsp
[(2) - (4)].node
),(yyvsp
[(4) - (4)].node
));
2027 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (4)].node
));}
2032 {(yyval
.node
)=_asn1_add_node(TYPE_SET
);
2033 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
2038 {(yyval
.node
)=_asn1_add_node(TYPE_SET_OF
);
2039 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (3)].node
));}
2044 {(yyval
.node
)=_asn1_add_node(TYPE_SET_OF
|CONST_SIZE
);
2045 _asn1_set_right((yyvsp
[(2) - (4)].node
),(yyvsp
[(4) - (4)].node
));
2046 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (4)].node
));}
2051 {(yyval
.node
)=_asn1_add_node(TYPE_CHOICE
);
2052 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
2057 {(yyval
.node
)=_asn1_add_node(TYPE_ANY
);}
2062 {(yyval
.node
)=_asn1_add_node(TYPE_ANY
|CONST_DEFINED_BY
);
2063 _asn1_set_down((yyval
.node
),_asn1_add_node(TYPE_CONSTANT
));
2064 _asn1_set_name(_asn1_get_down((yyval
.node
)),(yyvsp
[(4) - (4)].str
));}
2069 {(yyval
.node
)=_asn1_set_name((yyvsp
[(3) - (3)].node
),(yyvsp
[(1) - (3)].str
));}
2074 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
|CONST_ASSIGN
);
2075 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (7)].str
));
2076 _asn1_set_down((yyval
.node
),(yyvsp
[(6) - (7)].node
));}
2081 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
|CONST_ASSIGN
|CONST_1_PARAM
);
2082 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (6)].str
));
2083 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (6)].str
),strlen((yyvsp
[(2) - (6)].str
))+1);
2084 _asn1_set_down((yyval
.node
),(yyvsp
[(5) - (6)].node
));}
2089 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
|CONST_ASSIGN
);
2090 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
2091 _asn1_set_value((yyval
.node
),(yyvsp
[(4) - (4)].str
),strlen((yyvsp
[(4) - (4)].str
))+1);}
2096 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2101 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2106 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2111 {(yyval
.node
)=(yyvsp
[(1) - (2)].node
);
2112 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (2)].node
)),(yyvsp
[(2) - (2)].node
));}
2117 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
);
2118 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));
2119 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));}
2124 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
);
2125 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (3)].str
));}
2130 {(yyval
.constant
)=CONST_EXPLICIT
;}
2135 {(yyval
.constant
)=CONST_IMPLICIT
;}
2139 /* Line 1267 of yacc.c. */
2143 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2147 YY_STACK_PRINT (yyss
, yyssp
);
2152 /* Now `shift' the result of the reduction. Determine what state
2153 that goes to, based on the state we popped back to and the rule
2154 number reduced by. */
2158 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2159 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2160 yystate
= yytable
[yystate
];
2162 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2167 /*------------------------------------.
2168 | yyerrlab -- here on detecting error |
2169 `------------------------------------*/
2171 /* If not already recovering from an error, report this error. */
2175 #if ! YYERROR_VERBOSE
2176 yyerror (YY_("syntax error"));
2179 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2180 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2182 YYSIZE_T yyalloc
= 2 * yysize
;
2183 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2184 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2185 if (yymsg
!= yymsgbuf
)
2186 YYSTACK_FREE (yymsg
);
2187 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2189 yymsg_alloc
= yyalloc
;
2193 yymsg_alloc
= sizeof yymsgbuf
;
2197 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2199 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2204 yyerror (YY_("syntax error"));
2206 goto yyexhaustedlab
;
2214 if (yyerrstatus
== 3)
2216 /* If just tried and failed to reuse look-ahead token after an
2217 error, discard it. */
2219 if (yychar
<= YYEOF
)
2221 /* Return failure if at end of input. */
2222 if (yychar
== YYEOF
)
2227 yydestruct ("Error: discarding",
2233 /* Else will try to reuse look-ahead token after shifting the error
2238 /*---------------------------------------------------.
2239 | yyerrorlab -- error raised explicitly by YYERROR. |
2240 `---------------------------------------------------*/
2243 /* Pacify compilers like GCC when the user code never invokes
2244 YYERROR and the label yyerrorlab therefore never appears in user
2246 if (/*CONSTCOND*/ 0)
2249 /* Do not reclaim the symbols of the rule which action triggered
2253 YY_STACK_PRINT (yyss
, yyssp
);
2258 /*-------------------------------------------------------------.
2259 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2260 `-------------------------------------------------------------*/
2262 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2266 yyn
= yypact
[yystate
];
2267 if (yyn
!= YYPACT_NINF
)
2270 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2278 /* Pop the current state because it cannot handle the error token. */
2283 yydestruct ("Error: popping",
2284 yystos
[yystate
], yyvsp
);
2287 YY_STACK_PRINT (yyss
, yyssp
);
2296 /* Shift the error token. */
2297 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2303 /*-------------------------------------.
2304 | yyacceptlab -- YYACCEPT comes here. |
2305 `-------------------------------------*/
2310 /*-----------------------------------.
2311 | yyabortlab -- YYABORT comes here. |
2312 `-----------------------------------*/
2318 /*-------------------------------------------------.
2319 | yyexhaustedlab -- memory exhaustion comes here. |
2320 `-------------------------------------------------*/
2322 yyerror (YY_("memory exhausted"));
2328 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2329 yydestruct ("Cleanup: discarding lookahead",
2331 /* Do not reclaim the symbols of the rule which action triggered
2332 this YYABORT or YYACCEPT. */
2334 YY_STACK_PRINT (yyss
, yyssp
);
2335 while (yyssp
!= yyss
)
2337 yydestruct ("Cleanup: popping",
2338 yystos
[*yyssp
], yyvsp
);
2343 YYSTACK_FREE (yyss
);
2346 if (yymsg
!= yymsgbuf
)
2347 YYSTACK_FREE (yymsg
);
2349 /* Make sure YYID is used. */
2350 return YYID (yyresult
);
2359 const char *key_word
[]={"::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING"
2360 ,"SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL"
2361 ,"DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER"
2362 ,"BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED"
2363 ,"SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS"
2364 ,"BEGIN","END","UTCTime","GeneralizedTime"
2365 ,"GeneralString","FROM","IMPORTS","NULL","ENUMERATED"};
2366 const int key_word_token
[]={ASSIG
,OPTIONAL
,INTEGER
,SIZE
,OCTET
,STRING
2367 ,SEQUENCE
,BIT
,UNIVERSAL
,PRIVATE
,OPTIONAL
2368 ,DEFAULT
,CHOICE
,OF
,OBJECT
,STR_IDENTIFIER
2369 ,BOOLEAN
,TRUE
,FALSE
,APPLICATION
,ANY
,DEFINED
2370 ,SET
,BY
,EXPLICIT
,IMPLICIT
,DEFINITIONS
,TAGS
2371 ,BEGIN
,END
,UTCTime
,GeneralizedTime
2372 ,GeneralString
,FROM
,IMPORTS
,TOKEN_NULL
,ENUMERATED
};
2374 /*************************************************************/
2375 /* Function: _asn1_yylex */
2376 /* Description: looks for tokens in file_asn1 pointer file. */
2378 /* Token identifier or ASCII code or 0(zero: End Of File) */
2379 /*************************************************************/
2383 int c
,counter
=0,k
,lastc
;
2384 char string
[MAX_NAME_SIZE
+1]; /* will contain the next token */
2388 while((c
=fgetc(file_asn1
))==' ' || c
=='\t' || c
=='\n')
2389 if(c
=='\n') lineNumber
++;
2392 strcpy(lastToken
,"End Of File");
2396 if(c
=='(' || c
==')' || c
=='[' || c
==']' ||
2397 c
=='{' || c
=='}' || c
==',' || c
=='.' ||
2399 lastToken
[0]=c
;lastToken
[1]=0;
2402 if(c
=='-'){ /* Maybe the first '-' of a comment */
2403 if((c
=fgetc(file_asn1
))!='-'){
2404 ungetc(c
,file_asn1
);
2405 lastToken
[0]='-';lastToken
[1]=0;
2408 else{ /* Comments */
2411 /* A comment finishes at the next double hypen or the end of line */
2412 while((c
=fgetc(file_asn1
))!=EOF
&& c
!='\n' &&
2413 (lastc
!='-' || (lastc
=='-' && c
!='-')))
2416 strcpy(lastToken
,"End Of File");
2420 if(c
=='\n') lineNumber
++;
2421 continue; /* next char, please! (repeat the search) */
2425 string
[counter
++]=c
;
2426 /* Till the end of the token */
2427 while(!((c
=fgetc(file_asn1
))==EOF
|| c
==' '|| c
=='\t' || c
=='\n' ||
2428 c
=='(' || c
==')' || c
=='[' || c
==']' ||
2429 c
=='{' || c
=='}' || c
==',' || c
=='.'))
2431 if(counter
>=MAX_NAME_SIZE
){
2432 result_parse
=ASN1_NAME_TOO_LONG
;
2435 string
[counter
++]=c
;
2437 ungetc(c
,file_asn1
);
2439 strcpy(lastToken
,string
);
2441 /* Is STRING a number? */
2442 for(k
=0;k
<counter
;k
++)
2443 if(!isdigit(string
[k
])) break;
2446 strcpy(yylval
.str
,string
);
2447 return NUM
; /* return the number */
2450 /* Is STRING a keyword? */
2451 for(k
=0;k
<(sizeof(key_word
)/sizeof(char*));k
++)
2452 if(!strcmp(string
,key_word
[k
])) return key_word_token
[k
];
2454 /* STRING is an IDENTIFIER */
2455 strcpy(yylval
.str
,string
);
2461 /*************************************************************/
2462 /* Function: _asn1_create_errorDescription */
2463 /* Description: creates a string with the description of the*/
2466 /* error : error to describe. */
2467 /* errorDescription: string that will contain the */
2469 /*************************************************************/
2471 _asn1_create_errorDescription(int error
,char *errorDescription
)
2474 case ASN1_SUCCESS
: case ASN1_FILE_NOT_FOUND
:
2475 if (errorDescription
!=NULL
) errorDescription
[0]=0;
2477 case ASN1_SYNTAX_ERROR
:
2478 if (errorDescription
!=NULL
) {
2479 strcpy(errorDescription
,fileName
);
2480 strcat(errorDescription
,":");
2481 _asn1_ltostr(lineNumber
,errorDescription
+strlen(fileName
)+1);
2482 strcat(errorDescription
,": parse error near '");
2483 strcat(errorDescription
,lastToken
);
2484 strcat(errorDescription
,"'");
2487 case ASN1_NAME_TOO_LONG
:
2488 if (errorDescription
!=NULL
) {
2489 strcpy(errorDescription
,fileName
);
2490 strcat(errorDescription
,":");
2491 _asn1_ltostr(lineNumber
,errorDescription
+strlen(fileName
)+1);
2492 strcat(errorDescription
,": name too long (more than ");
2493 _asn1_ltostr(MAX_NAME_SIZE
,errorDescription
+strlen(errorDescription
));
2494 strcat(errorDescription
," characters)");
2497 case ASN1_IDENTIFIER_NOT_FOUND
:
2498 if (errorDescription
!=NULL
) {
2499 strcpy(errorDescription
,fileName
);
2500 strcat(errorDescription
,":");
2501 strcat(errorDescription
,": identifier '");
2502 strcat(errorDescription
,_asn1_identifierMissing
);
2503 strcat(errorDescription
,"' not found");
2507 if (errorDescription
!=NULL
) errorDescription
[0]=0;
2515 * asn1_parser2tree - function used to start the parse algorithm.
2516 * @file_name: specify the path and the name of file that contains
2517 * ASN.1 declarations.
2518 * @definitions: return the pointer to the structure created from
2519 * "file_name" ASN.1 declarations.
2520 * @errorDescription: return the error description or an empty
2521 * string if success.
2523 * Creates the structures needed to manage the definitions included
2524 * in *FILE_NAME file.
2528 * ASN1_SUCCESS: The file has a correct syntax and every identifier
2531 * ASN1_ELEMENT_NOT_EMPTY: *POINTER not ASN1_TYPE_EMPTY.
2533 * ASN1_FILE_NOT_FOUND: An error occured while opening FILE_NAME.
2535 * ASN1_SYNTAX_ERROR: The syntax is not correct.
2537 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
2540 * ASN1_NAME_TOO_LONG: In the file there is an identifier whith more
2541 * than MAX_NAME_SIZE characters.
2544 asn1_parser2tree(const char *file_name
, ASN1_TYPE
*definitions
,
2545 char *errorDescription
){
2547 p_tree
=ASN1_TYPE_EMPTY
;
2549 if(*definitions
!= ASN1_TYPE_EMPTY
)
2550 return ASN1_ELEMENT_NOT_EMPTY
;
2552 *definitions
=ASN1_TYPE_EMPTY
;
2554 fileName
= file_name
;
2556 /* open the file to parse */
2557 file_asn1
=fopen(file_name
,"r");
2559 if(file_asn1
==NULL
){
2560 result_parse
=ASN1_FILE_NOT_FOUND
;
2563 result_parse
=ASN1_SUCCESS
;
2570 if(result_parse
==ASN1_SUCCESS
){ /* syntax OK */
2571 /* set IMPLICIT or EXPLICIT property */
2572 _asn1_set_default_tag(p_tree
);
2573 /* set CONST_SET and CONST_NOT_USED */
2574 _asn1_type_set_config(p_tree
);
2575 /* check the identifier definitions */
2576 result_parse
=_asn1_check_identifier(p_tree
);
2577 if(result_parse
==ASN1_SUCCESS
){ /* all identifier defined */
2578 /* Delete the list and keep the ASN1 structure */
2579 _asn1_delete_list();
2580 /* Convert into DER coding the value assign to INTEGER constants */
2581 _asn1_change_integer_value(p_tree
);
2582 /* Expand the IDs of OBJECT IDENTIFIER constants */
2583 _asn1_expand_object_id(p_tree
);
2585 *definitions
=p_tree
;
2587 else /* some identifiers not defined */
2588 /* Delete the list and the ASN1 structure */
2589 _asn1_delete_list_and_nodes();
2591 else /* syntax error */
2592 /* Delete the list and the ASN1 structure */
2593 _asn1_delete_list_and_nodes();
2596 if (errorDescription
!=NULL
)
2597 _asn1_create_errorDescription(result_parse
,errorDescription
);
2599 return result_parse
;
2604 * asn1_parser2array - function that generates a C structure from an ASN1 file
2605 * @inputFileName: specify the path and the name of file that
2606 * contains ASN.1 declarations.
2607 * @outputFileName: specify the path and the name of file that will
2608 * contain the C vector definition.
2609 * @vectorName: specify the name of the C vector.
2610 * @errorDescription : return the error description or an empty
2611 * string if success.
2613 * Creates a file containing a C vector to use to manage the
2614 * definitions included in *INPUTFILENAME file. If *INPUTFILENAME is
2615 * "/aa/bb/xx.yy" and OUTPUTFILENAME is NULL, the file created is
2616 * "/aa/bb/xx_asn1_tab.c". If VECTORNAME is NULL the vector name
2617 * will be "xx_asn1_tab".
2621 * ASN1_SUCCESS: The file has a correct syntax and every identifier
2624 * ASN1_FILE_NOT_FOUND: An error occured while opening FILE_NAME.
2626 * ASN1_SYNTAX_ERROR: The syntax is not correct.
2628 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
2631 * ASN1_NAME_TOO_LONG: In the file there is an identifier whith more
2632 * than MAX_NAME_SIZE characters.
2634 int asn1_parser2array(const char *inputFileName
,const char *outputFileName
,
2635 const char *vectorName
,char *errorDescription
){
2636 char *file_out_name
=NULL
;
2637 char *vector_name
=NULL
;
2638 const char *char_p
,*slash_p
,*dot_p
;
2642 fileName
= inputFileName
;
2644 /* open the file to parse */
2645 file_asn1
=fopen(inputFileName
,"r");
2648 result_parse
=ASN1_FILE_NOT_FOUND
;
2650 result_parse
=ASN1_SUCCESS
;
2657 if(result_parse
==ASN1_SUCCESS
){ /* syntax OK */
2658 /* set IMPLICIT or EXPLICIT property */
2659 _asn1_set_default_tag(p_tree
);
2660 /* set CONST_SET and CONST_NOT_USED */
2661 _asn1_type_set_config(p_tree
);
2662 /* check the identifier definitions */
2663 result_parse
=_asn1_check_identifier(p_tree
);
2665 if(result_parse
==ASN1_SUCCESS
){ /* all identifier defined */
2667 /* searching the last '/' and '.' in inputFileName */
2668 char_p
=inputFileName
;
2669 slash_p
=inputFileName
;
2670 while((char_p
=strchr(char_p
,'/'))){
2676 dot_p
=inputFileName
+strlen(inputFileName
);
2678 while((char_p
=strchr(char_p
,'.'))){
2683 if(outputFileName
== NULL
){
2684 /* file_out_name = inputFileName + _asn1_tab.c */
2685 file_out_name
=(char *)malloc(dot_p
-inputFileName
+1+
2686 strlen("_asn1_tab.c"));
2687 memcpy(file_out_name
,inputFileName
,dot_p
-inputFileName
);
2688 file_out_name
[dot_p
-inputFileName
]=0;
2689 strcat(file_out_name
,"_asn1_tab.c");
2692 /* file_out_name = inputFileName */
2693 file_out_name
=(char *)malloc(strlen(outputFileName
)+1);
2694 strcpy(file_out_name
,outputFileName
);
2697 if(vectorName
== NULL
){
2698 /* vector_name = file name + _asn1_tab */
2699 vector_name
=(char *)malloc(dot_p
-slash_p
+1+
2700 strlen("_asn1_tab"));
2701 memcpy(vector_name
,slash_p
,dot_p
-slash_p
);
2702 vector_name
[dot_p
-slash_p
]=0;
2703 strcat(vector_name
,"_asn1_tab");
2706 /* vector_name = vectorName */
2707 vector_name
=(char *)malloc(strlen(vectorName
)+1);
2708 strcpy(vector_name
,vectorName
);
2711 /* Save structure in a file */
2712 _asn1_create_static_structure(p_tree
,
2713 file_out_name
,vector_name
);
2715 free(file_out_name
);
2717 } /* result == OK */
2718 } /* result == OK */
2720 /* Delete the list and the ASN1 structure */
2721 _asn1_delete_list_and_nodes();
2722 } /* inputFile exist */
2724 if (errorDescription
!=NULL
)
2725 _asn1_create_errorDescription(result_parse
,errorDescription
);
2727 return result_parse
;
2731 /*************************************************************/
2732 /* Function: _asn1_yyerror */
2733 /* Description: function called when there are syntax errors*/
2735 /* char *s : error description */
2738 /*************************************************************/
2739 int _asn1_yyerror (char *s
)
2741 /* Sends the error description to the std_out */
2743 #ifdef LIBTASN1_DEBUG_PARSER
2744 _libtasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName
,
2745 lineNumber
,s
,lastToken
);
2748 if(result_parse
!=ASN1_NAME_TOO_LONG
)
2749 result_parse
=ASN1_SYNTAX_ERROR
;