1 /* A Bison parser, made by GNU Bison 2.1b. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* C LALR(1) parser skeleton written by Richard Stallman, by
27 simplifying the original so-called "semantic" parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYBISON_VERSION "2.1b"
43 #define YYSKELETON_NAME "yacc.c"
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
51 /* Substitute the variable and function names. */
52 #define yyparse _asn1_yyparse
53 #define yylex _asn1_yylex
54 #define yyerror _asn1_yyerror
55 #define yylval _asn1_yylval
56 #define yychar _asn1_yychar
57 #define yydebug _asn1_yydebug
58 #define yynerrs _asn1_yynerrs
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
100 GeneralizedTime
= 291,
110 #define IDENTIFIER 260
118 #define UNIVERSAL 268
120 #define APPLICATION 270
125 #define STR_IDENTIFIER 275
129 #define TOKEN_NULL 279
136 #define DEFINITIONS 286
141 #define GeneralizedTime 291
142 #define GeneralString 292
145 #define ENUMERATED 295
150 /* Copy the first part of user declarations. */
155 #include <parser_aux.h>
156 #include <structure.h>
159 static FILE *file_asn1
; /* Pointer to file to parse */
160 static asn1_retCode result_parse
; /* result of the parser
162 static node_asn
*p_tree
; /* pointer to the root of the
163 structure created by the
165 static unsigned long lineNumber
; /* line number describing the
166 parser position inside the
168 static char lastToken
[MAX_NAME_SIZE
+1]; /* last token find in the file
169 to parse before the 'parse
171 extern char _asn1_identifierMissing
[];
172 static const char *fileName
; /* file to parse */
174 int _asn1_yyerror (char *);
175 int _asn1_yylex(void);
179 /* Enabling traces. */
184 /* Enabling verbose error messages. */
185 #ifdef YYERROR_VERBOSE
186 # undef YYERROR_VERBOSE
187 # define YYERROR_VERBOSE 1
189 # define YYERROR_VERBOSE 0
192 /* Enabling the token table. */
193 #ifndef YYTOKEN_TABLE
194 # define YYTOKEN_TABLE 0
197 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
198 typedef union YYSTYPE
201 unsigned int constant
;
202 char str
[MAX_NAME_SIZE
+1];
205 /* Line 198 of yacc.c. */
208 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
209 # define YYSTYPE_IS_DECLARED 1
210 # define YYSTYPE_IS_TRIVIAL 1
215 /* Copy the second part of user declarations. */
218 /* Line 221 of yacc.c. */
226 typedef YYTYPE_UINT8 yytype_uint8
;
228 typedef unsigned char yytype_uint8
;
232 typedef YYTYPE_INT8 yytype_int8
;
233 #elif (defined __STDC__ || defined __C99__FUNC__ \
234 || defined __cplusplus || defined _MSC_VER)
235 typedef signed char yytype_int8
;
237 typedef short int yytype_int8
;
241 typedef YYTYPE_UINT16 yytype_uint16
;
243 typedef unsigned short int yytype_uint16
;
247 typedef YYTYPE_INT16 yytype_int16
;
249 typedef short int yytype_int16
;
253 # ifdef __SIZE_TYPE__
254 # define YYSIZE_T __SIZE_TYPE__
255 # elif defined size_t
256 # define YYSIZE_T size_t
257 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
258 || defined __cplusplus || defined _MSC_VER)
259 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
260 # define YYSIZE_T size_t
262 # define YYSIZE_T unsigned int
266 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
271 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
272 # define YY_(msgid) dgettext ("bison-runtime", msgid)
276 # define YY_(msgid) msgid
280 /* Suppress unused-variable warnings by "using" E. */
281 #if ! defined lint || defined __GNUC__
282 # define YYUSE(e) ((void) (e))
284 # define YYUSE(e) /* empty */
287 /* Identity function, used to suppress warnings about constant conditions. */
291 #if (defined __STDC__ || defined __C99__FUNC__ \
292 || defined __cplusplus || defined _MSC_VER)
305 #if ! defined yyoverflow || YYERROR_VERBOSE
307 /* The parser invokes alloca or malloc; define the necessary symbols. */
309 # ifdef YYSTACK_USE_ALLOCA
310 # if YYSTACK_USE_ALLOCA
312 # define YYSTACK_ALLOC __builtin_alloca
313 # elif defined __BUILTIN_VA_ARG_INCR
314 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
316 # define YYSTACK_ALLOC __alloca
317 # elif defined _MSC_VER
318 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
319 # define alloca _alloca
321 # define YYSTACK_ALLOC alloca
322 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
323 || defined __cplusplus || defined _MSC_VER)
324 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
333 # ifdef YYSTACK_ALLOC
334 /* Pacify GCC's `empty if-body' warning. */
335 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
336 # ifndef YYSTACK_ALLOC_MAXIMUM
337 /* The OS might guarantee only one guard page at the bottom of the stack,
338 and a page size can be as small as 4096 bytes. So we cannot safely
339 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
340 to allow for a few compiler-allocated temporary stack slots. */
341 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
344 # define YYSTACK_ALLOC YYMALLOC
345 # define YYSTACK_FREE YYFREE
346 # ifndef YYSTACK_ALLOC_MAXIMUM
347 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
349 # if (defined __cplusplus && ! defined _STDLIB_H \
350 && ! ((defined YYMALLOC || defined malloc) \
351 && (defined YYFREE || defined free)))
352 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
358 # define YYMALLOC malloc
359 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
360 || defined __cplusplus || defined _MSC_VER)
361 void *malloc (YYSIZE_T
); /* INFRINGES ON USER NAME SPACE */
366 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
367 || defined __cplusplus || defined _MSC_VER)
368 void free (void *); /* INFRINGES ON USER NAME SPACE */
372 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
375 #if (! defined yyoverflow \
376 && (! defined __cplusplus \
377 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
379 /* A type that is properly aligned for any stack member. */
386 /* The size of the maximum gap between one aligned stack and the next. */
387 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
389 /* The size of an array large to enough to hold all stacks, each with
391 # define YYSTACK_BYTES(N) \
392 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
393 + YYSTACK_GAP_MAXIMUM)
395 /* Copy COUNT objects from FROM to TO. The source and destination do
398 # if defined __GNUC__ && 1 < __GNUC__
399 # define YYCOPY(To, From, Count) \
400 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
402 # define YYCOPY(To, From, Count) \
406 for (yyi = 0; yyi < (Count); yyi++) \
407 (To)[yyi] = (From)[yyi]; \
413 /* Relocate STACK from its old location to the new one. The
414 local variables YYSIZE and YYSTACKSIZE give the old and new number of
415 elements in the stack, and YYPTR gives the new location of the
416 stack. Advance YYPTR to a properly aligned location for the next
418 # define YYSTACK_RELOCATE(Stack) \
421 YYSIZE_T yynewbytes; \
422 YYCOPY (&yyptr->Stack, Stack, yysize); \
423 Stack = &yyptr->Stack; \
424 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
425 yyptr += yynewbytes / sizeof (*yyptr); \
431 /* YYFINAL -- State number of the termination state. */
433 /* YYLAST -- Last index in YYTABLE. */
436 /* YYNTOKENS -- Number of terminals. */
438 /* YYNNTS -- Number of nonterminals. */
440 /* YYNRULES -- Number of rules. */
442 /* YYNRULES -- Number of states. */
443 #define YYNSTATES 190
445 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
447 #define YYMAXUTOK 295
449 #define YYTRANSLATE(YYX) \
450 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
452 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
453 static const yytype_uint8 yytranslate
[] =
455 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 43, 44, 2, 41, 45, 42, 51, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 46, 2, 47, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 49, 48, 50, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 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, 2, 2, 2, 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, 1, 2, 3, 4,
481 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
482 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
483 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
484 35, 36, 37, 38, 39, 40
488 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
490 static const yytype_uint16 yyprhs
[] =
492 0, 0, 3, 12, 14, 17, 20, 22, 24, 26,
493 28, 30, 32, 36, 41, 43, 47, 49, 54, 56,
494 59, 61, 63, 65, 69, 74, 76, 79, 82, 85,
495 88, 91, 93, 97, 99, 104, 109, 117, 119, 121,
496 123, 128, 136, 138, 142, 144, 147, 150, 154, 159,
497 161, 165, 168, 172, 178, 183, 186, 188, 191, 193,
498 195, 197, 199, 201, 203, 205, 207, 209, 211, 213,
499 215, 217, 219, 222, 224, 227, 230, 233, 235, 239,
500 244, 248, 253, 258, 262, 267, 272, 274, 279, 283,
501 291, 298, 303, 305, 307, 309, 312, 317, 321, 323
504 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
505 static const yytype_int8 yyrhs
[] =
507 53, 0, -1, 93, 31, 94, 32, 3, 33, 92,
508 34, -1, 4, -1, 41, 4, -1, 42, 4, -1,
509 54, -1, 55, -1, 4, -1, 5, -1, 56, -1,
510 5, -1, 43, 56, 44, -1, 5, 43, 56, 44,
511 -1, 59, -1, 60, 45, 59, -1, 57, -1, 5,
512 43, 4, 44, -1, 61, -1, 62, 61, -1, 13,
513 -1, 14, -1, 15, -1, 46, 4, 47, -1, 46,
514 63, 4, 47, -1, 64, -1, 64, 29, -1, 64,
515 30, -1, 16, 58, -1, 16, 22, -1, 16, 23,
516 -1, 56, -1, 67, 48, 56, -1, 7, -1, 7,
517 49, 60, 50, -1, 7, 43, 67, 44, -1, 7,
518 43, 57, 51, 51, 57, 44, -1, 21, -1, 35,
519 -1, 36, -1, 8, 43, 57, 44, -1, 8, 43,
520 57, 51, 51, 57, 44, -1, 71, -1, 43, 71,
521 44, -1, 37, -1, 37, 72, -1, 9, 10, -1,
522 9, 10, 72, -1, 5, 43, 4, 44, -1, 75,
523 -1, 76, 45, 75, -1, 12, 10, -1, 12, 10,
524 72, -1, 12, 10, 49, 76, 50, -1, 40, 49,
525 76, 50, -1, 19, 20, -1, 5, -1, 5, 72,
526 -1, 68, -1, 78, -1, 69, -1, 70, -1, 74,
527 -1, 77, -1, 73, -1, 85, -1, 79, -1, 87,
528 -1, 88, -1, 86, -1, 24, -1, 80, -1, 65,
529 80, -1, 81, -1, 81, 66, -1, 81, 6, -1,
530 5, 82, -1, 83, -1, 84, 45, 83, -1, 11,
531 49, 84, 50, -1, 11, 18, 80, -1, 11, 72,
532 18, 80, -1, 28, 49, 84, 50, -1, 28, 18,
533 80, -1, 28, 72, 18, 80, -1, 17, 49, 84,
534 50, -1, 25, -1, 25, 26, 27, 5, -1, 5,
535 3, 81, -1, 5, 19, 20, 3, 49, 62, 50,
536 -1, 5, 5, 3, 49, 62, 50, -1, 5, 7,
537 3, 56, -1, 89, -1, 90, -1, 91, -1, 92,
538 91, -1, 5, 49, 62, 50, -1, 5, 49, 50,
542 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
543 static const yytype_uint16 yyrline
[] =
545 0, 124, 124, 137, 138, 141, 145, 146, 149, 150,
546 153, 154, 157, 159, 164, 165, 169, 171, 176, 177,
547 181, 182, 183, 186, 188, 192, 193, 194, 197, 199,
548 200, 204, 205, 209, 210, 212, 213, 220, 223, 224,
549 227, 229, 235, 236, 239, 240, 244, 245, 249, 254,
550 255, 259, 260, 261, 266, 272, 275, 277, 280, 281,
551 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
552 292, 295, 296, 301, 302, 305, 308, 311, 312, 316,
553 318, 320, 325, 327, 329, 334, 338, 339, 344, 347,
554 351, 356, 362, 363, 366, 367, 371, 374, 398, 399
558 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
559 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
560 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
561 static const char *const yytname
[] =
563 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER",
564 "OPTIONAL", "INTEGER", "SIZE", "OCTET", "STRING", "SEQUENCE", "BIT",
565 "UNIVERSAL", "PRIVATE", "APPLICATION", "DEFAULT", "CHOICE", "OF",
566 "OBJECT", "STR_IDENTIFIER", "BOOLEAN", "TRUE", "FALSE", "TOKEN_NULL",
567 "ANY", "DEFINED", "BY", "SET", "EXPLICIT", "IMPLICIT", "DEFINITIONS",
568 "TAGS", "BEGIN", "END", "UTCTime", "GeneralizedTime", "GeneralString",
569 "FROM", "IMPORTS", "ENUMERATED", "'+'", "'-'", "'('", "')'", "','",
570 "'['", "']'", "'|'", "'{'", "'}'", "'.'", "$accept", "definitions",
571 "pos_num", "neg_num", "pos_neg_num", "num_identifier",
572 "pos_neg_identifier", "constant", "constant_list", "obj_constant",
573 "obj_constant_list", "class", "tag_type", "tag", "default",
574 "pos_neg_list", "integer_def", "boolean_def", "Time", "size_def2",
575 "size_def", "generalstring_def", "octet_string_def", "bit_element",
576 "bit_element_list", "bit_string_def", "enumerated_def", "object_def",
577 "type_assig_right", "type_assig_right_tag",
578 "type_assig_right_tag_default", "type_assig", "type_assig_list",
579 "sequence_def", "set_def", "choise_def", "any_def", "type_def",
580 "constant_def", "type_constant", "type_constant_list", "definitions_id",
581 "explicit_implicit", 0
586 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
588 static const yytype_uint16 yytoknum
[] =
590 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
591 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
592 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
593 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
594 295, 43, 45, 40, 41, 44, 91, 93, 124, 123,
599 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
600 static const yytype_uint8 yyr1
[] =
602 0, 52, 53, 54, 54, 55, 56, 56, 57, 57,
603 58, 58, 59, 59, 60, 60, 61, 61, 62, 62,
604 63, 63, 63, 64, 64, 65, 65, 65, 66, 66,
605 66, 67, 67, 68, 68, 68, 68, 69, 70, 70,
606 71, 71, 72, 72, 73, 73, 74, 74, 75, 76,
607 76, 77, 77, 77, 78, 79, 80, 80, 80, 80,
608 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
609 80, 81, 81, 82, 82, 82, 83, 84, 84, 85,
610 85, 85, 86, 86, 86, 87, 88, 88, 89, 90,
611 90, 90, 91, 91, 92, 92, 93, 93, 94, 94
614 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
615 static const yytype_uint8 yyr2
[] =
617 0, 2, 8, 1, 2, 2, 1, 1, 1, 1,
618 1, 1, 3, 4, 1, 3, 1, 4, 1, 2,
619 1, 1, 1, 3, 4, 1, 2, 2, 2, 2,
620 2, 1, 3, 1, 4, 4, 7, 1, 1, 1,
621 4, 7, 1, 3, 1, 2, 2, 3, 4, 1,
622 3, 2, 3, 5, 4, 2, 1, 2, 1, 1,
623 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
624 1, 1, 2, 1, 2, 2, 2, 1, 3, 4,
625 3, 4, 4, 3, 4, 4, 1, 4, 3, 7,
626 6, 4, 1, 1, 1, 2, 4, 3, 1, 1
629 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
630 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
631 means the default is an error. */
632 static const yytype_uint8 yydefact
[] =
634 0, 0, 0, 0, 0, 1, 0, 8, 9, 97,
635 16, 18, 0, 98, 99, 0, 0, 96, 19, 0,
636 0, 0, 17, 0, 0, 92, 93, 94, 0, 0,
637 0, 0, 0, 2, 95, 56, 33, 0, 0, 0,
638 0, 0, 37, 70, 86, 0, 38, 39, 44, 0,
639 0, 25, 0, 58, 60, 61, 64, 62, 63, 59,
640 66, 71, 88, 65, 69, 67, 68, 0, 0, 0,
641 0, 0, 42, 57, 0, 0, 46, 0, 0, 0,
642 51, 0, 55, 0, 0, 0, 0, 45, 0, 0,
643 20, 21, 22, 0, 26, 27, 72, 0, 3, 0,
644 0, 6, 7, 91, 0, 0, 0, 3, 9, 31,
645 0, 0, 0, 0, 14, 0, 47, 80, 0, 77,
646 0, 0, 0, 52, 0, 0, 83, 0, 0, 0,
647 49, 0, 23, 0, 0, 4, 5, 0, 0, 43,
648 0, 35, 0, 0, 0, 0, 34, 73, 76, 0,
649 79, 81, 0, 85, 87, 82, 84, 0, 0, 54,
650 24, 90, 0, 40, 0, 0, 32, 0, 12, 15,
651 75, 0, 74, 78, 53, 0, 50, 89, 0, 0,
652 13, 11, 29, 30, 10, 28, 48, 0, 36, 41
655 /* YYDEFGOTO[NTERM-NUM]. */
656 static const yytype_int16 yydefgoto
[] =
658 -1, 2, 101, 102, 103, 10, 185, 114, 115, 11,
659 12, 93, 51, 52, 172, 111, 53, 54, 55, 72,
660 73, 56, 57, 130, 131, 58, 59, 60, 61, 62,
661 148, 119, 120, 63, 64, 65, 66, 25, 26, 27,
665 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
667 #define YYPACT_NINF -80
668 static const yytype_int16 yypact
[] =
670 9, -19, 33, 54, 0, -80, 44, -80, 40, -80,
671 -80, -80, 2, -80, -80, 55, 45, -80, -80, 86,
672 51, 75, -80, 106, 59, -80, -80, -80, 11, 79,
673 117, 130, 115, -80, -80, 17, -1, 127, 16, 129,
674 96, 126, -80, -80, 122, 18, -80, -80, 17, 100,
675 25, 80, 119, -80, -80, -80, -80, -80, -80, -80,
676 -80, -80, -80, -80, -80, -80, -80, 102, 27, 149,
677 110, 150, -80, -80, 39, 10, 17, 119, 152, 142,
678 14, 152, -80, 134, 119, 152, 144, -80, 158, 118,
679 -80, -80, -80, 160, -80, -80, -80, 42, -80, 162,
680 163, -80, -80, -80, 120, 137, 124, 121, -80, -80,
681 123, -27, 128, 27, -80, 32, -80, -80, 79, -80,
682 52, 119, 158, -80, 56, 165, -80, 73, 119, 132,
683 -80, 82, -80, 131, 4, -80, -80, 42, -32, -80,
684 125, -80, 27, 27, 133, 10, -80, 21, -80, 152,
685 -80, -80, 84, -80, -80, -80, -80, 169, 158, -80,
686 -80, -80, 6, -80, 135, 137, -80, 136, -80, -80,
687 -80, 71, -80, -80, -80, 138, -80, -80, 137, 139,
688 -80, -80, -80, -80, -80, -80, -80, 140, -80, -80
691 /* YYPGOTO[NTERM-NUM]. */
692 static const yytype_int16 yypgoto
[] =
694 -80, -80, -80, -80, -72, -73, -80, 34, -80, -12,
695 -79, -80, -80, -80, -80, -80, -80, -80, -80, 114,
696 -25, -80, -80, 23, 65, -80, -80, -80, -49, 70,
697 -80, 41, 36, -80, -80, -80, -80, -80, -80, 161,
701 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
702 positive, shift that token. If negative, reduce the rule which
703 number is the opposite. If zero, do what YYDEFACT says.
704 If YYTABLE_NINF, syntax error. */
705 #define YYTABLE_NINF -9
706 static const yytype_int16 yytable
[] =
708 18, 110, 109, 96, 7, 8, 7, 8, 7, 8,
709 7, 8, 163, 79, 1, 112, 24, 141, 134, 164,
710 86, 142, 70, 87, 70, 70, 70, 170, 117, 89,
711 4, 98, 138, 5, 77, 126, 84, 171, 90, 91,
712 92, 144, 74, 107, 108, 33, 7, 8, 75, 20,
713 9, 116, 17, 113, 161, 123, 177, 71, 162, 71,
714 71, 71, 29, 122, 30, 78, 31, 85, 99, 100,
715 166, 167, 151, 13, 14, 98, 181, 145, 32, 156,
716 99, 100, 146, 16, 35, 6, 36, 19, 37, 21,
717 38, 39, 179, 182, 183, 22, 40, 149, 41, 184,
718 42, 149, 150, 43, 44, 187, 153, 45, 23, 94,
719 95, 24, 99, 100, 46, 47, 48, 124, 149, 49,
720 67, 127, 18, 155, 35, 50, 36, 158, 37, 158,
721 38, 39, 159, 68, 174, 69, 40, 76, 41, 80,
722 42, 7, 108, 43, 44, 81, 82, 45, 83, 88,
723 18, 97, 104, 105, 46, 47, 48, 118, 70, 49,
724 121, 125, 128, 129, 133, 132, 135, 136, 139, 137,
725 154, 143, -8, 175, 140, 157, 165, 168, 160, 169,
726 180, 176, 186, 188, 189, 106, 178, 152, 147, 34,
730 static const yytype_uint8 yycheck
[] =
732 12, 74, 74, 52, 4, 5, 4, 5, 4, 5,
733 4, 5, 44, 38, 5, 5, 5, 44, 97, 51,
734 45, 48, 8, 48, 8, 8, 8, 6, 77, 4,
735 49, 4, 105, 0, 18, 84, 18, 16, 13, 14,
736 15, 113, 43, 4, 5, 34, 4, 5, 49, 4,
737 50, 76, 50, 43, 50, 80, 50, 43, 137, 43,
738 43, 43, 3, 49, 5, 49, 7, 49, 41, 42,
739 142, 143, 121, 29, 30, 4, 5, 45, 19, 128,
740 41, 42, 50, 43, 5, 31, 7, 32, 9, 3,
741 11, 12, 165, 22, 23, 44, 17, 45, 19, 171,
742 21, 45, 50, 24, 25, 178, 50, 28, 33, 29,
743 30, 5, 41, 42, 35, 36, 37, 81, 45, 40,
744 3, 85, 134, 50, 5, 46, 7, 45, 9, 45,
745 11, 12, 50, 3, 50, 20, 17, 10, 19, 10,
746 21, 4, 5, 24, 25, 49, 20, 28, 26, 49,
747 162, 49, 3, 43, 35, 36, 37, 5, 8, 40,
748 18, 27, 18, 5, 4, 47, 4, 4, 44, 49,
749 5, 43, 51, 4, 51, 43, 51, 44, 47, 145,
750 44, 158, 44, 44, 44, 71, 51, 122, 118, 28,
754 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
755 symbol of state STATE-NUM. */
756 static const yytype_uint8 yystos
[] =
758 0, 5, 53, 93, 49, 0, 31, 4, 5, 50,
759 57, 61, 62, 29, 30, 94, 43, 50, 61, 32,
760 4, 3, 44, 33, 5, 89, 90, 91, 92, 3,
761 5, 7, 19, 34, 91, 5, 7, 9, 11, 12,
762 17, 19, 21, 24, 25, 28, 35, 36, 37, 40,
763 46, 64, 65, 68, 69, 70, 73, 74, 77, 78,
764 79, 80, 81, 85, 86, 87, 88, 3, 3, 20,
765 8, 43, 71, 72, 43, 49, 10, 18, 49, 72,
766 10, 49, 20, 26, 18, 49, 72, 72, 49, 4,
767 13, 14, 15, 63, 29, 30, 80, 49, 4, 41,
768 42, 54, 55, 56, 3, 43, 71, 4, 5, 56,
769 57, 67, 5, 43, 59, 60, 72, 80, 5, 83,
770 84, 18, 49, 72, 84, 27, 80, 84, 18, 5,
771 75, 76, 47, 4, 62, 4, 4, 49, 57, 44,
772 51, 44, 48, 43, 56, 45, 50, 81, 82, 45,
773 50, 80, 76, 50, 5, 50, 80, 43, 45, 50,
774 47, 50, 62, 44, 51, 51, 56, 56, 44, 59,
775 6, 16, 66, 83, 50, 4, 75, 50, 51, 57,
776 44, 5, 22, 23, 56, 58, 44, 57, 44, 44
779 #define yyerrok (yyerrstatus = 0)
780 #define yyclearin (yychar = YYEMPTY)
784 #define YYACCEPT goto yyacceptlab
785 #define YYABORT goto yyabortlab
786 #define YYERROR goto yyerrorlab
789 /* Like YYERROR except do call yyerror. This remains here temporarily
790 to ease the transition to the new meaning of YYERROR, for GCC.
791 Once GCC version 2 has supplanted version 1, this can go. */
793 #define YYFAIL goto yyerrlab
795 #define YYRECOVERING() (!!yyerrstatus)
797 #define YYBACKUP(Token, Value) \
799 if (yychar == YYEMPTY && yylen == 1) \
803 yytoken = YYTRANSLATE (yychar); \
809 yyerror (YY_("syntax error: cannot back up")); \
816 #define YYERRCODE 256
819 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
820 If N is 0, then set CURRENT to the empty location which ends
821 the previous symbol: RHS[0] (always defined). */
823 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
824 #ifndef YYLLOC_DEFAULT
825 # define YYLLOC_DEFAULT(Current, Rhs, N) \
829 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
830 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
831 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
832 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
836 (Current).first_line = (Current).last_line = \
837 YYRHSLOC (Rhs, 0).last_line; \
838 (Current).first_column = (Current).last_column = \
839 YYRHSLOC (Rhs, 0).last_column; \
845 /* YY_LOCATION_PRINT -- Print the location on the stream.
846 This macro was not mandated originally: define only if we know
847 we won't break user code: when these are the locations we know. */
849 #ifndef YY_LOCATION_PRINT
850 # if YYLTYPE_IS_TRIVIAL
851 # define YY_LOCATION_PRINT(File, Loc) \
852 fprintf (File, "%d.%d-%d.%d", \
853 (Loc).first_line, (Loc).first_column, \
854 (Loc).last_line, (Loc).last_column)
856 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
861 /* YYLEX -- calling `yylex' with the right arguments. */
864 # define YYLEX yylex (YYLEX_PARAM)
866 # define YYLEX yylex ()
869 /* Enable debugging if requested. */
873 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
874 # define YYFPRINTF fprintf
877 # define YYDPRINTF(Args) \
883 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
887 YYFPRINTF (stderr, "%s ", Title); \
888 yy_symbol_print (stderr, \
890 YYFPRINTF (stderr, "\n"); \
895 /*--------------------------------.
896 | Print this symbol on YYOUTPUT. |
897 `--------------------------------*/
900 #if (defined __STDC__ || defined __C99__FUNC__ \
901 || defined __cplusplus || defined _MSC_VER)
903 yy_symbol_value_print (FILE *yyoutput
, int yytype
, const YYSTYPE
* const yyvaluep
)
906 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
)
909 const YYSTYPE
* const yyvaluep
;
915 if (yytype
< YYNTOKENS
)
916 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
928 /*--------------------------------.
929 | Print this symbol on YYOUTPUT. |
930 `--------------------------------*/
932 #if (defined __STDC__ || defined __C99__FUNC__ \
933 || defined __cplusplus || defined _MSC_VER)
935 yy_symbol_print (FILE *yyoutput
, int yytype
, const YYSTYPE
* const yyvaluep
)
938 yy_symbol_print (yyoutput
, yytype
, yyvaluep
)
941 const YYSTYPE
* const yyvaluep
;
944 if (yytype
< YYNTOKENS
)
945 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
947 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
949 yy_symbol_value_print (yyoutput
, yytype
, yyvaluep
);
950 YYFPRINTF (yyoutput
, ")");
953 /*------------------------------------------------------------------.
954 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
956 `------------------------------------------------------------------*/
958 #if (defined __STDC__ || defined __C99__FUNC__ \
959 || defined __cplusplus || defined _MSC_VER)
961 yy_stack_print (yytype_int16
*bottom
, yytype_int16
*top
)
964 yy_stack_print (bottom
, top
)
965 yytype_int16
*bottom
;
969 YYFPRINTF (stderr
, "Stack now");
970 for (; bottom
<= top
; ++bottom
)
971 YYFPRINTF (stderr
, " %d", *bottom
);
972 YYFPRINTF (stderr
, "\n");
975 # define YY_STACK_PRINT(Bottom, Top) \
978 yy_stack_print ((Bottom), (Top)); \
982 /*------------------------------------------------.
983 | Report that the YYRULE is going to be reduced. |
984 `------------------------------------------------*/
986 #if (defined __STDC__ || defined __C99__FUNC__ \
987 || defined __cplusplus || defined _MSC_VER)
989 yy_reduce_print (YYSTYPE
*yyvsp
,
993 yy_reduce_print (yyvsp
, yyrule
1000 int yynrhs
= yyr2
[yyrule
];
1002 unsigned long int yylno
= yyrline
[yyrule
];
1003 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %lu):\n",
1005 /* The symbols being reduced. */
1006 for (yyi
= 0; yyi
< yynrhs
; yyi
++)
1008 fprintf (stderr
, " $%d = ", yyi
+ 1);
1009 yy_symbol_print (stderr
, yyrhs
[yyprhs
[yyrule
] + yyi
],
1010 &(yyvsp
[(yyi
+ 1) - (yynrhs
)])
1012 fprintf (stderr
, "\n");
1016 # define YY_REDUCE_PRINT(Rule) \
1019 yy_reduce_print (yyvsp, Rule); \
1022 /* Nonzero means print parse trace. It is left uninitialized so that
1023 multiple parsers can coexist. */
1025 #else /* !YYDEBUG */
1026 # define YYDPRINTF(Args)
1027 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1028 # define YY_STACK_PRINT(Bottom, Top)
1029 # define YY_REDUCE_PRINT(Rule)
1030 #endif /* !YYDEBUG */
1033 /* YYINITDEPTH -- initial size of the parser's stacks. */
1035 # define YYINITDEPTH 200
1038 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1039 if the built-in stack extension method is used).
1041 Do not make this value too large; the results are undefined if
1042 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1043 evaluated with infinite-precision integer arithmetic. */
1046 # define YYMAXDEPTH 10000
1054 # if defined __GLIBC__ && defined _STRING_H
1055 # define yystrlen strlen
1057 /* Return the length of YYSTR. */
1058 #if (defined __STDC__ || defined __C99__FUNC__ \
1059 || defined __cplusplus || defined _MSC_VER)
1061 yystrlen (const char *yystr
)
1069 for (yylen
= 0; yystr
[yylen
]; yylen
++)
1077 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1078 # define yystpcpy stpcpy
1080 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1082 #if (defined __STDC__ || defined __C99__FUNC__ \
1083 || defined __cplusplus || defined _MSC_VER)
1085 yystpcpy (char *yydest
, const char *yysrc
)
1088 yystpcpy (yydest
, yysrc
)
1094 const char *yys
= yysrc
;
1096 while ((*yyd
++ = *yys
++) != '\0')
1105 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1106 quotes and backslashes, so that it's suitable for yyerror. The
1107 heuristic is that double-quoting is unnecessary unless the string
1108 contains an apostrophe, a comma, or backslash (other than
1109 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1110 null, do not copy; instead, return the length of what the result
1113 yytnamerr (char *yyres
, const char *yystr
)
1118 char const *yyp
= yystr
;
1125 goto do_not_strip_quotes
;
1129 goto do_not_strip_quotes
;
1142 do_not_strip_quotes
: ;
1146 return yystrlen (yystr
);
1148 return yystpcpy (yyres
, yystr
) - yyres
;
1152 /* Copy into YYRESULT an error message about the unexpected token
1153 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1154 including the terminating null byte. If YYRESULT is null, do not
1155 copy anything; just return the number of bytes that would be
1156 copied. As a special case, return 0 if an ordinary "syntax error"
1157 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1158 size calculation. */
1160 yysyntax_error (char *yyresult
, int yystate
, int yychar
)
1162 int yyn
= yypact
[yystate
];
1164 if (! (YYPACT_NINF
< yyn
&& yyn
< YYLAST
))
1168 int yytype
= YYTRANSLATE (yychar
);
1169 YYSIZE_T yysize0
= yytnamerr (0, yytname
[yytype
]);
1170 YYSIZE_T yysize
= yysize0
;
1172 int yysize_overflow
= 0;
1173 enum { YYERROR_VERBOSE_ARGS_MAXIMUM
= 5 };
1174 char const *yyarg
[YYERROR_VERBOSE_ARGS_MAXIMUM
];
1178 /* This is so xgettext sees the translatable formats that are
1179 constructed on the fly. */
1180 YY_("syntax error, unexpected %s");
1181 YY_("syntax error, unexpected %s, expecting %s");
1182 YY_("syntax error, unexpected %s, expecting %s or %s");
1183 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1184 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1188 static char const yyunexpected
[] = "syntax error, unexpected %s";
1189 static char const yyexpecting
[] = ", expecting %s";
1190 static char const yyor
[] = " or %s";
1191 char yyformat
[sizeof yyunexpected
1192 + sizeof yyexpecting
- 1
1193 + ((YYERROR_VERBOSE_ARGS_MAXIMUM
- 2)
1194 * (sizeof yyor
- 1))];
1195 char const *yyprefix
= yyexpecting
;
1197 /* Start YYX at -YYN if negative to avoid negative indexes in
1199 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1201 /* Stay within bounds of both yycheck and yytname. */
1202 int yychecklim
= YYLAST
- yyn
;
1203 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1206 yyarg
[0] = yytname
[yytype
];
1207 yyfmt
= yystpcpy (yyformat
, yyunexpected
);
1209 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1210 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1212 if (yycount
== YYERROR_VERBOSE_ARGS_MAXIMUM
)
1216 yyformat
[sizeof yyunexpected
- 1] = '\0';
1219 yyarg
[yycount
++] = yytname
[yyx
];
1220 yysize1
= yysize
+ yytnamerr (0, yytname
[yyx
]);
1221 yysize_overflow
|= (yysize1
< yysize
);
1223 yyfmt
= yystpcpy (yyfmt
, yyprefix
);
1227 yyf
= YY_(yyformat
);
1228 yysize1
= yysize
+ yystrlen (yyf
);
1229 yysize_overflow
|= (yysize1
< yysize
);
1232 if (yysize_overflow
)
1233 return YYSIZE_MAXIMUM
;
1237 /* Avoid sprintf, as that infringes on the user's name space.
1238 Don't have undefined behavior even if the translation
1239 produced a string with the wrong number of "%s"s. */
1240 char *yyp
= yyresult
;
1242 while ((*yyp
= *yyf
) != '\0')
1244 if (*yyp
== '%' && yyf
[1] == 's' && yyi
< yycount
)
1246 yyp
+= yytnamerr (yyp
, yyarg
[yyi
++]);
1259 #endif /* YYERROR_VERBOSE */
1262 /*-----------------------------------------------.
1263 | Release the memory associated to this symbol. |
1264 `-----------------------------------------------*/
1267 #if (defined __STDC__ || defined __C99__FUNC__ \
1268 || defined __cplusplus || defined _MSC_VER)
1270 yydestruct (const char *yymsg
, int yytype
, YYSTYPE
*yyvaluep
)
1273 yydestruct (yymsg
, yytype
, yyvaluep
)
1283 YY_SYMBOL_PRINT (yymsg
, yytype
, yyvaluep
, yylocationp
);
1294 /* Prevent warnings from -Wmissing-prototypes. */
1296 #ifdef YYPARSE_PARAM
1297 #if defined __STDC__ || defined __cplusplus
1298 int yyparse (void *YYPARSE_PARAM
);
1302 #else /* ! YYPARSE_PARAM */
1303 #if defined __STDC__ || defined __cplusplus
1308 #endif /* ! YYPARSE_PARAM */
1312 /* The look-ahead symbol. */
1315 /* The semantic value of the look-ahead symbol. */
1318 /* Number of syntax errors so far. */
1327 #ifdef YYPARSE_PARAM
1328 #if (defined __STDC__ || defined __C99__FUNC__ \
1329 || defined __cplusplus || defined _MSC_VER)
1331 yyparse (void *YYPARSE_PARAM
)
1334 yyparse (YYPARSE_PARAM
)
1335 void *YYPARSE_PARAM
;
1337 #else /* ! YYPARSE_PARAM */
1338 #if (defined __STDC__ || defined __C99__FUNC__ \
1339 || defined __cplusplus || defined _MSC_VER)
1353 /* Number of tokens to shift before error messages enabled. */
1355 /* Look-ahead token as an internal (translated) token number. */
1358 /* Buffer for error messages, and its allocated size. */
1360 char *yymsg
= yymsgbuf
;
1361 YYSIZE_T yymsg_alloc
= sizeof yymsgbuf
;
1364 /* Three stacks and their tools:
1365 `yyss': related to states,
1366 `yyvs': related to semantic values,
1367 `yyls': related to locations.
1369 Refer to the stacks thru separate pointers, to allow yyoverflow
1370 to reallocate them elsewhere. */
1372 /* The state stack. */
1373 yytype_int16 yyssa
[YYINITDEPTH
];
1374 yytype_int16
*yyss
= yyssa
;
1375 yytype_int16
*yyssp
;
1377 /* The semantic value stack. */
1378 YYSTYPE yyvsa
[YYINITDEPTH
];
1379 YYSTYPE
*yyvs
= yyvsa
;
1384 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1386 YYSIZE_T yystacksize
= YYINITDEPTH
;
1388 /* The variables used to return semantic value and location from the
1393 /* The number of symbols on the RHS of the reduced rule.
1394 Keep to zero when no symbol should be popped. */
1397 YYDPRINTF ((stderr
, "Starting parse\n"));
1402 yychar
= YYEMPTY
; /* Cause a token to be read. */
1404 /* Initialize stack pointers.
1405 Waste one element of value and location stack
1406 so that they stay on the same level as the state stack.
1407 The wasted elements are never initialized. */
1414 /*------------------------------------------------------------.
1415 | yynewstate -- Push a new state, which is found in yystate. |
1416 `------------------------------------------------------------*/
1418 /* In all cases, when you get here, the value and location stacks
1419 have just been pushed. So pushing a state here evens the stacks. */
1425 if (yyss
+ yystacksize
- 1 <= yyssp
)
1427 /* Get the current used size of the three stacks, in elements. */
1428 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1432 /* Give user a chance to reallocate the stack. Use copies of
1433 these so that the &'s don't force the real ones into
1435 YYSTYPE
*yyvs1
= yyvs
;
1436 yytype_int16
*yyss1
= yyss
;
1439 /* Each stack pointer address is followed by the size of the
1440 data in use in that stack, in bytes. This used to be a
1441 conditional around just the two extra args, but that might
1442 be undefined if yyoverflow is a macro. */
1443 yyoverflow (YY_("memory exhausted"),
1444 &yyss1
, yysize
* sizeof (*yyssp
),
1445 &yyvs1
, yysize
* sizeof (*yyvsp
),
1452 #else /* no yyoverflow */
1453 # ifndef YYSTACK_RELOCATE
1454 goto yyexhaustedlab
;
1456 /* Extend the stack our own way. */
1457 if (YYMAXDEPTH
<= yystacksize
)
1458 goto yyexhaustedlab
;
1460 if (YYMAXDEPTH
< yystacksize
)
1461 yystacksize
= YYMAXDEPTH
;
1464 yytype_int16
*yyss1
= yyss
;
1465 union yyalloc
*yyptr
=
1466 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1468 goto yyexhaustedlab
;
1469 YYSTACK_RELOCATE (yyss
);
1470 YYSTACK_RELOCATE (yyvs
);
1472 # undef YYSTACK_RELOCATE
1474 YYSTACK_FREE (yyss1
);
1477 #endif /* no yyoverflow */
1479 yyssp
= yyss
+ yysize
- 1;
1480 yyvsp
= yyvs
+ yysize
- 1;
1483 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1484 (unsigned long int) yystacksize
));
1486 if (yyss
+ yystacksize
- 1 <= yyssp
)
1490 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1499 /* Do appropriate processing given the current state. Read a
1500 look-ahead token if we need one and don't already have one. */
1502 /* First try to decide what to do without reference to look-ahead token. */
1503 yyn
= yypact
[yystate
];
1504 if (yyn
== YYPACT_NINF
)
1507 /* Not known => get a look-ahead token if don't already have one. */
1509 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1510 if (yychar
== YYEMPTY
)
1512 YYDPRINTF ((stderr
, "Reading a token: "));
1516 if (yychar
<= YYEOF
)
1518 yychar
= yytoken
= YYEOF
;
1519 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1523 yytoken
= YYTRANSLATE (yychar
);
1524 YY_SYMBOL_PRINT ("Next token is", yytoken
, &yylval
, &yylloc
);
1527 /* If the proper action on seeing token YYTOKEN is to reduce or to
1528 detect an error, take that action. */
1530 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1535 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1544 /* Count tokens shifted since error; after three, turn off error
1549 /* Shift the look-ahead token. */
1550 YY_SYMBOL_PRINT ("Shifting", yytoken
, &yylval
, &yylloc
);
1552 /* Discard the shifted token unless it is eof. */
1553 if (yychar
!= YYEOF
)
1562 /*-----------------------------------------------------------.
1563 | yydefault -- do the default action for the current state. |
1564 `-----------------------------------------------------------*/
1566 yyn
= yydefact
[yystate
];
1572 /*-----------------------------.
1573 | yyreduce -- Do a reduction. |
1574 `-----------------------------*/
1576 /* yyn is the number of a rule to reduce with. */
1579 /* If YYLEN is nonzero, implement the default value of the action:
1582 Otherwise, the following line sets YYVAL to garbage.
1583 This behavior is undocumented and Bison
1584 users should not rely upon it. Assigning to YYVAL
1585 unconditionally makes the parser a bit smaller, and it avoids a
1586 GCC warning that YYVAL may be used uninitialized. */
1587 yyval
= yyvsp
[1-yylen
];
1590 YY_REDUCE_PRINT (yyn
);
1595 {(yyval
.node
)=_asn1_add_node(TYPE_DEFINITIONS
|(yyvsp
[(3) - (8)].constant
));
1596 _asn1_set_name((yyval
.node
),_asn1_get_name((yyvsp
[(1) - (8)].node
)));
1597 _asn1_set_name((yyvsp
[(1) - (8)].node
),"");
1598 _asn1_set_right((yyvsp
[(1) - (8)].node
),(yyvsp
[(7) - (8)].node
));
1599 _asn1_set_down((yyval
.node
),(yyvsp
[(1) - (8)].node
));
1601 p_tree
=(yyval
.node
);
1607 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1612 {strcpy((yyval
.str
),(yyvsp
[(2) - (2)].str
));}
1617 {strcpy((yyval
.str
),"-");
1618 strcat((yyval
.str
),(yyvsp
[(2) - (2)].str
));}
1623 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1628 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1633 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1638 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1643 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1648 {strcpy((yyval
.str
),(yyvsp
[(1) - (1)].str
));}
1653 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1654 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (3)].str
),strlen((yyvsp
[(2) - (3)].str
))+1);}
1659 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1660 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
1661 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1666 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1671 {(yyval
.node
)=(yyvsp
[(1) - (3)].node
);
1672 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (3)].node
)),(yyvsp
[(3) - (3)].node
));}
1677 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1678 _asn1_set_value((yyval
.node
),(yyvsp
[(1) - (1)].str
),strlen((yyvsp
[(1) - (1)].str
))+1);}
1683 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1684 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
1685 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1690 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1695 {(yyval
.node
)=(yyvsp
[(1) - (2)].node
);
1696 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (2)].node
)),(yyvsp
[(2) - (2)].node
));}
1701 {(yyval
.constant
)=CONST_UNIVERSAL
;}
1706 {(yyval
.constant
)=CONST_PRIVATE
;}
1711 {(yyval
.constant
)=CONST_APPLICATION
;}
1716 {(yyval
.node
)=_asn1_add_node(TYPE_TAG
);
1717 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (3)].str
),strlen((yyvsp
[(2) - (3)].str
))+1);}
1722 {(yyval
.node
)=_asn1_add_node(TYPE_TAG
| (yyvsp
[(2) - (4)].constant
));
1723 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1728 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1733 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_EXPLICIT
);}
1738 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_IMPLICIT
);}
1743 {(yyval
.node
)=_asn1_add_node(TYPE_DEFAULT
);
1744 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (2)].str
),strlen((yyvsp
[(2) - (2)].str
))+1);}
1749 {(yyval
.node
)=_asn1_add_node(TYPE_DEFAULT
|CONST_TRUE
);}
1754 {(yyval
.node
)=_asn1_add_node(TYPE_DEFAULT
|CONST_FALSE
);}
1759 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
);}
1764 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
|CONST_LIST
);
1765 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
1770 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
);}
1775 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
|CONST_MIN_MAX
);
1776 _asn1_set_down((yyval
.node
),_asn1_add_node(TYPE_SIZE
));
1777 _asn1_set_value(_asn1_get_down((yyval
.node
)),(yyvsp
[(6) - (7)].str
),strlen((yyvsp
[(6) - (7)].str
))+1);
1778 _asn1_set_name(_asn1_get_down((yyval
.node
)),(yyvsp
[(3) - (7)].str
));}
1783 {(yyval
.node
)=_asn1_add_node(TYPE_BOOLEAN
);}
1788 {(yyval
.node
)=_asn1_add_node(TYPE_TIME
|CONST_UTC
);}
1793 {(yyval
.node
)=_asn1_add_node(TYPE_TIME
|CONST_GENERALIZED
);}
1798 {(yyval
.node
)=_asn1_add_node(TYPE_SIZE
|CONST_1_PARAM
);
1799 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1804 {(yyval
.node
)=_asn1_add_node(TYPE_SIZE
|CONST_MIN_MAX
);
1805 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (7)].str
),strlen((yyvsp
[(3) - (7)].str
))+1);
1806 _asn1_set_name((yyval
.node
),(yyvsp
[(6) - (7)].str
));}
1811 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1816 {(yyval
.node
)=(yyvsp
[(2) - (3)].node
);}
1821 {(yyval
.node
)=_asn1_add_node(TYPE_GENERALSTRING
);}
1826 {(yyval
.node
)=_asn1_add_node(TYPE_GENERALSTRING
|CONST_SIZE
);
1827 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (2)].node
));}
1832 {(yyval
.node
)=_asn1_add_node(TYPE_OCTET_STRING
);}
1837 {(yyval
.node
)=_asn1_add_node(TYPE_OCTET_STRING
|CONST_SIZE
);
1838 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (3)].node
));}
1843 {(yyval
.node
)=_asn1_add_node(TYPE_CONSTANT
);
1844 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
1845 _asn1_set_value((yyval
.node
),(yyvsp
[(3) - (4)].str
),strlen((yyvsp
[(3) - (4)].str
))+1);}
1850 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1855 {(yyval
.node
)=(yyvsp
[(1) - (3)].node
);
1856 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (3)].node
)),(yyvsp
[(3) - (3)].node
));}
1861 {(yyval
.node
)=_asn1_add_node(TYPE_BIT_STRING
);}
1866 {(yyval
.node
)=_asn1_add_node(TYPE_BIT_STRING
|CONST_SIZE
);}
1871 {(yyval
.node
)=_asn1_add_node(TYPE_BIT_STRING
|CONST_LIST
);
1872 _asn1_set_down((yyval
.node
),(yyvsp
[(4) - (5)].node
));}
1877 {(yyval
.node
)=_asn1_add_node(TYPE_ENUMERATED
|CONST_LIST
);
1878 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
1883 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
);}
1888 {(yyval
.node
)=_asn1_add_node(TYPE_IDENTIFIER
);
1889 _asn1_set_value((yyval
.node
),(yyvsp
[(1) - (1)].str
),strlen((yyvsp
[(1) - (1)].str
))+1);}
1894 {(yyval
.node
)=_asn1_add_node(TYPE_IDENTIFIER
|CONST_SIZE
);
1895 _asn1_set_value((yyval
.node
),(yyvsp
[(1) - (2)].str
),strlen((yyvsp
[(1) - (2)].str
))+1);
1896 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (2)].node
));}
1901 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1906 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1911 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1916 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1921 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1926 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1931 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1936 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1941 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1946 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1951 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1956 {(yyval
.node
)=_asn1_add_node(TYPE_NULL
);}
1961 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1966 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(2) - (2)].node
),CONST_TAG
);
1967 _asn1_set_right((yyvsp
[(1) - (2)].node
),_asn1_get_down((yyval
.node
)));
1968 _asn1_set_down((yyval
.node
),(yyvsp
[(1) - (2)].node
));}
1973 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
1978 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_DEFAULT
);
1979 _asn1_set_right((yyvsp
[(2) - (2)].node
),_asn1_get_down((yyval
.node
)));
1980 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (2)].node
));}
1985 {(yyval
.node
)=_asn1_mod_type((yyvsp
[(1) - (2)].node
),CONST_OPTION
);}
1990 {(yyval
.node
)=_asn1_set_name((yyvsp
[(2) - (2)].node
),(yyvsp
[(1) - (2)].str
));}
1995 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2000 {(yyval
.node
)=(yyvsp
[(1) - (3)].node
);
2001 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (3)].node
)),(yyvsp
[(3) - (3)].node
));}
2006 {(yyval
.node
)=_asn1_add_node(TYPE_SEQUENCE
);
2007 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
2012 {(yyval
.node
)=_asn1_add_node(TYPE_SEQUENCE_OF
);
2013 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (3)].node
));}
2018 {(yyval
.node
)=_asn1_add_node(TYPE_SEQUENCE_OF
|CONST_SIZE
);
2019 _asn1_set_right((yyvsp
[(2) - (4)].node
),(yyvsp
[(4) - (4)].node
));
2020 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (4)].node
));}
2025 {(yyval
.node
)=_asn1_add_node(TYPE_SET
);
2026 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
2031 {(yyval
.node
)=_asn1_add_node(TYPE_SET_OF
);
2032 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (3)].node
));}
2037 {(yyval
.node
)=_asn1_add_node(TYPE_SET_OF
|CONST_SIZE
);
2038 _asn1_set_right((yyvsp
[(2) - (4)].node
),(yyvsp
[(4) - (4)].node
));
2039 _asn1_set_down((yyval
.node
),(yyvsp
[(2) - (4)].node
));}
2044 {(yyval
.node
)=_asn1_add_node(TYPE_CHOICE
);
2045 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));}
2050 {(yyval
.node
)=_asn1_add_node(TYPE_ANY
);}
2055 {(yyval
.node
)=_asn1_add_node(TYPE_ANY
|CONST_DEFINED_BY
);
2056 _asn1_set_down((yyval
.node
),_asn1_add_node(TYPE_CONSTANT
));
2057 _asn1_set_name(_asn1_get_down((yyval
.node
)),(yyvsp
[(4) - (4)].str
));}
2062 {(yyval
.node
)=_asn1_set_name((yyvsp
[(3) - (3)].node
),(yyvsp
[(1) - (3)].str
));}
2067 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
|CONST_ASSIGN
);
2068 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (7)].str
));
2069 _asn1_set_down((yyval
.node
),(yyvsp
[(6) - (7)].node
));}
2074 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
|CONST_ASSIGN
|CONST_1_PARAM
);
2075 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (6)].str
));
2076 _asn1_set_value((yyval
.node
),(yyvsp
[(2) - (6)].str
),strlen((yyvsp
[(2) - (6)].str
))+1);
2077 _asn1_set_down((yyval
.node
),(yyvsp
[(5) - (6)].node
));}
2082 {(yyval
.node
)=_asn1_add_node(TYPE_INTEGER
|CONST_ASSIGN
);
2083 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));
2084 _asn1_set_value((yyval
.node
),(yyvsp
[(4) - (4)].str
),strlen((yyvsp
[(4) - (4)].str
))+1);}
2089 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2094 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2099 {(yyval
.node
)=(yyvsp
[(1) - (1)].node
);}
2104 {(yyval
.node
)=(yyvsp
[(1) - (2)].node
);
2105 _asn1_set_right(_asn1_get_last_right((yyvsp
[(1) - (2)].node
)),(yyvsp
[(2) - (2)].node
));}
2110 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
);
2111 _asn1_set_down((yyval
.node
),(yyvsp
[(3) - (4)].node
));
2112 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (4)].str
));}
2117 {(yyval
.node
)=_asn1_add_node(TYPE_OBJECT_ID
);
2118 _asn1_set_name((yyval
.node
),(yyvsp
[(1) - (3)].str
));}
2123 {(yyval
.constant
)=CONST_EXPLICIT
;}
2128 {(yyval
.constant
)=CONST_IMPLICIT
;}
2132 /* Line 1272 of yacc.c. */
2136 YY_SYMBOL_PRINT ("-> $$ =", yyr1
[yyn
], &yyval
, &yyloc
);
2140 YY_STACK_PRINT (yyss
, yyssp
);
2145 /* Now `shift' the result of the reduction. Determine what state
2146 that goes to, based on the state we popped back to and the rule
2147 number reduced by. */
2151 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2152 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2153 yystate
= yytable
[yystate
];
2155 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2160 /*------------------------------------.
2161 | yyerrlab -- here on detecting error |
2162 `------------------------------------*/
2164 /* If not already recovering from an error, report this error. */
2168 #if ! YYERROR_VERBOSE
2169 yyerror (YY_("syntax error"));
2172 YYSIZE_T yysize
= yysyntax_error (0, yystate
, yychar
);
2173 if (yymsg_alloc
< yysize
&& yymsg_alloc
< YYSTACK_ALLOC_MAXIMUM
)
2175 YYSIZE_T yyalloc
= 2 * yysize
;
2176 if (! (yysize
<= yyalloc
&& yyalloc
<= YYSTACK_ALLOC_MAXIMUM
))
2177 yyalloc
= YYSTACK_ALLOC_MAXIMUM
;
2178 if (yymsg
!= yymsgbuf
)
2179 YYSTACK_FREE (yymsg
);
2180 yymsg
= (char *) YYSTACK_ALLOC (yyalloc
);
2182 yymsg_alloc
= yyalloc
;
2186 yymsg_alloc
= sizeof yymsgbuf
;
2190 if (0 < yysize
&& yysize
<= yymsg_alloc
)
2192 (void) yysyntax_error (yymsg
, yystate
, yychar
);
2197 yyerror (YY_("syntax error"));
2199 goto yyexhaustedlab
;
2207 if (yyerrstatus
== 3)
2209 /* If just tried and failed to reuse look-ahead token after an
2210 error, discard it. */
2212 if (yychar
<= YYEOF
)
2214 /* Return failure if at end of input. */
2215 if (yychar
== YYEOF
)
2220 yydestruct ("Error: discarding",
2226 /* Else will try to reuse look-ahead token after shifting the error
2231 /*---------------------------------------------------.
2232 | yyerrorlab -- error raised explicitly by YYERROR. |
2233 `---------------------------------------------------*/
2236 /* Pacify compilers like GCC when the user code never invokes
2237 YYERROR and the label yyerrorlab therefore never appears in user
2239 if (/*CONSTCOND*/ 0)
2242 /* Do not reclaim the symbols of the rule which action triggered
2246 YY_STACK_PRINT (yyss
, yyssp
);
2251 /*-------------------------------------------------------------.
2252 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2253 `-------------------------------------------------------------*/
2255 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2259 yyn
= yypact
[yystate
];
2260 if (yyn
!= YYPACT_NINF
)
2263 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2271 /* Pop the current state because it cannot handle the error token. */
2276 yydestruct ("Error: popping",
2277 yystos
[yystate
], yyvsp
);
2280 YY_STACK_PRINT (yyss
, yyssp
);
2289 /* Shift the error token. */
2290 YY_SYMBOL_PRINT ("Shifting", yystos
[yyn
], yyvsp
, yylsp
);
2296 /*-------------------------------------.
2297 | yyacceptlab -- YYACCEPT comes here. |
2298 `-------------------------------------*/
2303 /*-----------------------------------.
2304 | yyabortlab -- YYABORT comes here. |
2305 `-----------------------------------*/
2311 /*-------------------------------------------------.
2312 | yyexhaustedlab -- memory exhaustion comes here. |
2313 `-------------------------------------------------*/
2315 yyerror (YY_("memory exhausted"));
2321 if (yychar
!= YYEOF
&& yychar
!= YYEMPTY
)
2322 yydestruct ("Cleanup: discarding lookahead",
2324 /* Do not reclaim the symbols of the rule which action triggered
2325 this YYABORT or YYACCEPT. */
2327 YY_STACK_PRINT (yyss
, yyssp
);
2328 while (yyssp
!= yyss
)
2330 yydestruct ("Cleanup: popping",
2331 yystos
[*yyssp
], yyvsp
);
2336 YYSTACK_FREE (yyss
);
2339 if (yymsg
!= yymsgbuf
)
2340 YYSTACK_FREE (yymsg
);
2351 const char *key_word
[]={"::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING"
2352 ,"SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL"
2353 ,"DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER"
2354 ,"BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED"
2355 ,"SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS"
2356 ,"BEGIN","END","UTCTime","GeneralizedTime"
2357 ,"GeneralString","FROM","IMPORTS","NULL","ENUMERATED"};
2358 const int key_word_token
[]={ASSIG
,OPTIONAL
,INTEGER
,SIZE
,OCTET
,STRING
2359 ,SEQUENCE
,BIT
,UNIVERSAL
,PRIVATE
,OPTIONAL
2360 ,DEFAULT
,CHOICE
,OF
,OBJECT
,STR_IDENTIFIER
2361 ,BOOLEAN
,TRUE
,FALSE
,APPLICATION
,ANY
,DEFINED
2362 ,SET
,BY
,EXPLICIT
,IMPLICIT
,DEFINITIONS
,TAGS
2363 ,BEGIN
,END
,UTCTime
,GeneralizedTime
2364 ,GeneralString
,FROM
,IMPORTS
,TOKEN_NULL
,ENUMERATED
};
2366 /*************************************************************/
2367 /* Function: _asn1_yylex */
2368 /* Description: looks for tokens in file_asn1 pointer file. */
2370 /* Token identifier or ASCII code or 0(zero: End Of File) */
2371 /*************************************************************/
2375 int c
,counter
=0,k
,lastc
;
2376 char string
[MAX_NAME_SIZE
+1]; /* will contain the next token */
2380 while((c
=fgetc(file_asn1
))==' ' || c
=='\t' || c
=='\n')
2381 if(c
=='\n') lineNumber
++;
2384 strcpy(lastToken
,"End Of File");
2388 if(c
=='(' || c
==')' || c
=='[' || c
==']' ||
2389 c
=='{' || c
=='}' || c
==',' || c
=='.' ||
2391 lastToken
[0]=c
;lastToken
[1]=0;
2394 if(c
=='-'){ /* Maybe the first '-' of a comment */
2395 if((c
=fgetc(file_asn1
))!='-'){
2396 ungetc(c
,file_asn1
);
2397 lastToken
[0]='-';lastToken
[1]=0;
2400 else{ /* Comments */
2403 /* A comment finishes at the next double hypen or the end of line */
2404 while((c
=fgetc(file_asn1
))!=EOF
&& c
!='\n' &&
2405 (lastc
!='-' || (lastc
=='-' && c
!='-')))
2408 strcpy(lastToken
,"End Of File");
2412 if(c
=='\n') lineNumber
++;
2413 continue; /* next char, please! (repeat the search) */
2417 string
[counter
++]=c
;
2418 /* Till the end of the token */
2419 while(!((c
=fgetc(file_asn1
))==EOF
|| c
==' '|| c
=='\t' || c
=='\n' ||
2420 c
=='(' || c
==')' || c
=='[' || c
==']' ||
2421 c
=='{' || c
=='}' || c
==',' || c
=='.'))
2423 if(counter
>=MAX_NAME_SIZE
){
2424 result_parse
=ASN1_NAME_TOO_LONG
;
2427 string
[counter
++]=c
;
2429 ungetc(c
,file_asn1
);
2431 strcpy(lastToken
,string
);
2433 /* Is STRING a number? */
2434 for(k
=0;k
<counter
;k
++)
2435 if(!isdigit(string
[k
])) break;
2438 strcpy(yylval
.str
,string
);
2439 return NUM
; /* return the number */
2442 /* Is STRING a keyword? */
2443 for(k
=0;k
<(sizeof(key_word
)/sizeof(char*));k
++)
2444 if(!strcmp(string
,key_word
[k
])) return key_word_token
[k
];
2446 /* STRING is an IDENTIFIER */
2447 strcpy(yylval
.str
,string
);
2453 /*************************************************************/
2454 /* Function: _asn1_create_errorDescription */
2455 /* Description: creates a string with the description of the*/
2458 /* error : error to describe. */
2459 /* errorDescription: string that will contain the */
2461 /*************************************************************/
2463 _asn1_create_errorDescription(int error
,char *errorDescription
)
2466 case ASN1_SUCCESS
: case ASN1_FILE_NOT_FOUND
:
2467 if (errorDescription
!=NULL
) errorDescription
[0]=0;
2469 case ASN1_SYNTAX_ERROR
:
2470 if (errorDescription
!=NULL
) {
2471 strcpy(errorDescription
,fileName
);
2472 strcat(errorDescription
,":");
2473 _asn1_ltostr(lineNumber
,errorDescription
+strlen(fileName
)+1);
2474 strcat(errorDescription
,": parse error near '");
2475 strcat(errorDescription
,lastToken
);
2476 strcat(errorDescription
,"'");
2479 case ASN1_NAME_TOO_LONG
:
2480 if (errorDescription
!=NULL
) {
2481 strcpy(errorDescription
,fileName
);
2482 strcat(errorDescription
,":");
2483 _asn1_ltostr(lineNumber
,errorDescription
+strlen(fileName
)+1);
2484 strcat(errorDescription
,": name too long (more than ");
2485 _asn1_ltostr(MAX_NAME_SIZE
,errorDescription
+strlen(errorDescription
));
2486 strcat(errorDescription
," characters)");
2489 case ASN1_IDENTIFIER_NOT_FOUND
:
2490 if (errorDescription
!=NULL
) {
2491 strcpy(errorDescription
,fileName
);
2492 strcat(errorDescription
,":");
2493 strcat(errorDescription
,": identifier '");
2494 strcat(errorDescription
,_asn1_identifierMissing
);
2495 strcat(errorDescription
,"' not found");
2499 if (errorDescription
!=NULL
) errorDescription
[0]=0;
2507 * asn1_parser2tree - function used to start the parse algorithm.
2508 * @file_name: specify the path and the name of file that contains
2509 * ASN.1 declarations.
2510 * @definitions: return the pointer to the structure created from
2511 * "file_name" ASN.1 declarations.
2512 * @errorDescription: return the error description or an empty
2513 * string if success.
2515 * Creates the structures needed to manage the definitions included
2516 * in *FILE_NAME file.
2520 * ASN1_SUCCESS: The file has a correct syntax and every identifier
2523 * ASN1_ELEMENT_NOT_EMPTY: *POINTER not ASN1_TYPE_EMPTY.
2525 * ASN1_FILE_NOT_FOUND: An error occured while opening FILE_NAME.
2527 * ASN1_SYNTAX_ERROR: The syntax is not correct.
2529 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
2532 * ASN1_NAME_TOO_LONG: In the file there is an identifier whith more
2533 * than MAX_NAME_SIZE characters.
2536 asn1_parser2tree(const char *file_name
, ASN1_TYPE
*definitions
,
2537 char *errorDescription
){
2539 p_tree
=ASN1_TYPE_EMPTY
;
2541 if(*definitions
!= ASN1_TYPE_EMPTY
)
2542 return ASN1_ELEMENT_NOT_EMPTY
;
2544 *definitions
=ASN1_TYPE_EMPTY
;
2546 fileName
= file_name
;
2548 /* open the file to parse */
2549 file_asn1
=fopen(file_name
,"r");
2551 if(file_asn1
==NULL
){
2552 result_parse
=ASN1_FILE_NOT_FOUND
;
2555 result_parse
=ASN1_SUCCESS
;
2562 if(result_parse
==ASN1_SUCCESS
){ /* syntax OK */
2563 /* set IMPLICIT or EXPLICIT property */
2564 _asn1_set_default_tag(p_tree
);
2565 /* set CONST_SET and CONST_NOT_USED */
2566 _asn1_type_set_config(p_tree
);
2567 /* check the identifier definitions */
2568 result_parse
=_asn1_check_identifier(p_tree
);
2569 if(result_parse
==ASN1_SUCCESS
){ /* all identifier defined */
2570 /* Delete the list and keep the ASN1 structure */
2571 _asn1_delete_list();
2572 /* Convert into DER coding the value assign to INTEGER constants */
2573 _asn1_change_integer_value(p_tree
);
2574 /* Expand the IDs of OBJECT IDENTIFIER constants */
2575 _asn1_expand_object_id(p_tree
);
2577 *definitions
=p_tree
;
2579 else /* some identifiers not defined */
2580 /* Delete the list and the ASN1 structure */
2581 _asn1_delete_list_and_nodes();
2583 else /* syntax error */
2584 /* Delete the list and the ASN1 structure */
2585 _asn1_delete_list_and_nodes();
2588 if (errorDescription
!=NULL
)
2589 _asn1_create_errorDescription(result_parse
,errorDescription
);
2591 return result_parse
;
2596 * asn1_parser2array - function that generates a C structure from an ASN1 file
2597 * @inputFileName: specify the path and the name of file that
2598 * contains ASN.1 declarations.
2599 * @outputFileName: specify the path and the name of file that will
2600 * contain the C vector definition.
2601 * @vectorName: specify the name of the C vector.
2602 * @errorDescription : return the error description or an empty
2603 * string if success.
2605 * Creates a file containing a C vector to use to manage the
2606 * definitions included in *INPUTFILENAME file. If *INPUTFILENAME is
2607 * "/aa/bb/xx.yy" and OUTPUTFILENAME is NULL, the file created is
2608 * "/aa/bb/xx_asn1_tab.c". If VECTORNAME is NULL the vector name
2609 * will be "xx_asn1_tab".
2613 * ASN1_SUCCESS: The file has a correct syntax and every identifier
2616 * ASN1_FILE_NOT_FOUND: An error occured while opening FILE_NAME.
2618 * ASN1_SYNTAX_ERROR: The syntax is not correct.
2620 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
2623 * ASN1_NAME_TOO_LONG: In the file there is an identifier whith more
2624 * than MAX_NAME_SIZE characters.
2626 int asn1_parser2array(const char *inputFileName
,const char *outputFileName
,
2627 const char *vectorName
,char *errorDescription
){
2628 char *file_out_name
=NULL
;
2629 char *vector_name
=NULL
;
2630 const char *char_p
,*slash_p
,*dot_p
;
2634 fileName
= inputFileName
;
2636 /* open the file to parse */
2637 file_asn1
=fopen(inputFileName
,"r");
2640 result_parse
=ASN1_FILE_NOT_FOUND
;
2642 result_parse
=ASN1_SUCCESS
;
2649 if(result_parse
==ASN1_SUCCESS
){ /* syntax OK */
2650 /* set IMPLICIT or EXPLICIT property */
2651 _asn1_set_default_tag(p_tree
);
2652 /* set CONST_SET and CONST_NOT_USED */
2653 _asn1_type_set_config(p_tree
);
2654 /* check the identifier definitions */
2655 result_parse
=_asn1_check_identifier(p_tree
);
2657 if(result_parse
==ASN1_SUCCESS
){ /* all identifier defined */
2659 /* searching the last '/' and '.' in inputFileName */
2660 char_p
=inputFileName
;
2661 slash_p
=inputFileName
;
2662 while((char_p
=strchr(char_p
,'/'))){
2668 dot_p
=inputFileName
+strlen(inputFileName
);
2670 while((char_p
=strchr(char_p
,'.'))){
2675 if(outputFileName
== NULL
){
2676 /* file_out_name = inputFileName + _asn1_tab.c */
2677 file_out_name
=(char *)malloc(dot_p
-inputFileName
+1+
2678 strlen("_asn1_tab.c"));
2679 memcpy(file_out_name
,inputFileName
,dot_p
-inputFileName
);
2680 file_out_name
[dot_p
-inputFileName
]=0;
2681 strcat(file_out_name
,"_asn1_tab.c");
2684 /* file_out_name = inputFileName */
2685 file_out_name
=(char *)malloc(strlen(outputFileName
)+1);
2686 strcpy(file_out_name
,outputFileName
);
2689 if(vectorName
== NULL
){
2690 /* vector_name = file name + _asn1_tab */
2691 vector_name
=(char *)malloc(dot_p
-slash_p
+1+
2692 strlen("_asn1_tab"));
2693 memcpy(vector_name
,slash_p
,dot_p
-slash_p
);
2694 vector_name
[dot_p
-slash_p
]=0;
2695 strcat(vector_name
,"_asn1_tab");
2698 /* vector_name = vectorName */
2699 vector_name
=(char *)malloc(strlen(vectorName
)+1);
2700 strcpy(vector_name
,vectorName
);
2703 /* Save structure in a file */
2704 _asn1_create_static_structure(p_tree
,
2705 file_out_name
,vector_name
);
2707 free(file_out_name
);
2709 } /* result == OK */
2710 } /* result == OK */
2712 /* Delete the list and the ASN1 structure */
2713 _asn1_delete_list_and_nodes();
2714 } /* inputFile exist */
2716 if (errorDescription
!=NULL
)
2717 _asn1_create_errorDescription(result_parse
,errorDescription
);
2719 return result_parse
;
2723 /*************************************************************/
2724 /* Function: _asn1_yyerror */
2725 /* Description: function called when there are syntax errors*/
2727 /* char *s : error description */
2730 /*************************************************************/
2731 int _asn1_yyerror (char *s
)
2733 /* Sends the error description to the std_out */
2735 #ifdef LIBTASN1_DEBUG_PARSER
2736 _libtasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName
,
2737 lineNumber
,s
,lastToken
);
2740 if(result_parse
!=ASN1_NAME_TOO_LONG
)
2741 result_parse
=ASN1_SYNTAX_ERROR
;