Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.0.2. */
2 :
3 : /* Bison implementation for Yacc-like parsers in C
4 :
5 : Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6 :
7 : This program is free software: you can redistribute it and/or modify
8 : it under the terms of the GNU General Public License as published by
9 : the Free Software Foundation, either version 3 of the License, or
10 : (at your option) any later version.
11 :
12 : This program is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU General Public License for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 :
20 : /* As a special exception, you may create a larger work that contains
21 : part or all of the Bison parser skeleton and distribute that work
22 : under terms of your choice, so long as that work isn't itself a
23 : parser generator using the skeleton or a modified version thereof
24 : as a parser skeleton. Alternatively, if you modify or redistribute
25 : the parser skeleton itself, you may (at your option) remove this
26 : special exception, which will cause the skeleton and the resulting
27 : Bison output files to be licensed under the GNU General Public
28 : License without this special exception.
29 :
30 : This special exception was added by the Free Software Foundation in
31 : version 2.2 of Bison. */
32 :
33 : /* C LALR(1) parser skeleton written by Richard Stallman, by
34 : simplifying the original so-called "semantic" parser. */
35 :
36 : /* All symbols defined below should begin with yy or YY, to avoid
37 : infringing on user name space. This should be done even for local
38 : variables, as they might otherwise be expanded by user macros.
39 : There are some unavoidable exceptions within include files to
40 : define necessary library symbols; they are noted "INFRINGES ON
41 : USER NAME SPACE" below. */
42 :
43 : /* Identify Bison output. */
44 : #define YYBISON 1
45 :
46 : /* Bison version. */
47 : #define YYBISON_VERSION "3.0.2"
48 :
49 : /* Skeleton name. */
50 : #define YYSKELETON_NAME "yacc.c"
51 :
52 : /* Pure parsers. */
53 : #define YYPURE 2
54 :
55 : /* Push parsers. */
56 : #define YYPUSH 0
57 :
58 : /* Pull parsers. */
59 : #define YYPULL 1
60 :
61 :
62 :
63 :
64 : /* Copy the first part of user declarations. */
65 : #line 42 "../../src/asn1-parse.y" /* yacc.c:339 */
66 :
67 : #ifndef BUILD_GENTOOLS
68 : # include <config.h>
69 : #endif
70 : #include <stdlib.h>
71 : #include <stdio.h>
72 : #include <string.h>
73 : #include <assert.h>
74 : #include <ctype.h>
75 : #include <errno.h>
76 :
77 : #ifdef BUILD_GENTOOLS
78 : # include "gen-help.h"
79 : #else
80 : # include "util.h"
81 : # include "ksba.h"
82 : #endif
83 :
84 : #include "asn1-func.h"
85 :
86 : /* It would be better to make yyparse static but there is no way to do
87 : this. Let's hope that this macros works. */
88 : #define yyparse _ksba_asn1_yyparse
89 :
90 : /* #define YYDEBUG 1 */
91 : #define MAX_STRING_LENGTH 129
92 :
93 : /* Dummy print so that yytoknum will be defined. */
94 : #define YYPRINT(F, N, L) do { } while (0);
95 :
96 :
97 : /* constants used in the grammar */
98 : enum {
99 : CONST_EXPLICIT = 1,
100 : CONST_IMPLICIT
101 : };
102 :
103 : struct parser_control_s {
104 : FILE *fp;
105 : int lineno;
106 : int debug;
107 : int result_parse;
108 : AsnNode parse_tree;
109 : AsnNode all_nodes;
110 : };
111 : #define PARSECTL ((struct parser_control_s *)parm)
112 :
113 :
114 : #line 115 "asn1-parse.c" /* yacc.c:339 */
115 :
116 : # ifndef YY_NULLPTR
117 : # if defined __cplusplus && 201103L <= __cplusplus
118 : # define YY_NULLPTR nullptr
119 : # else
120 : # define YY_NULLPTR 0
121 : # endif
122 : # endif
123 :
124 : /* Enabling verbose error messages. */
125 : #ifdef YYERROR_VERBOSE
126 : # undef YYERROR_VERBOSE
127 : # define YYERROR_VERBOSE 1
128 : #else
129 : # define YYERROR_VERBOSE 1
130 : #endif
131 :
132 :
133 : /* Debug traces. */
134 : #ifndef YYDEBUG
135 : # define YYDEBUG 0
136 : #endif
137 : #if YYDEBUG
138 : extern int yydebug;
139 : #endif
140 :
141 : /* Token type. */
142 : #ifndef YYTOKENTYPE
143 : # define YYTOKENTYPE
144 : enum yytokentype
145 : {
146 : ASSIG = 258,
147 : NUM = 259,
148 : IDENTIFIER = 260,
149 : OPTIONAL = 261,
150 : INTEGER = 262,
151 : SIZE = 263,
152 : OCTET = 264,
153 : STRING = 265,
154 : SEQUENCE = 266,
155 : BIT = 267,
156 : UNIVERSAL = 268,
157 : PRIVATE = 269,
158 : DEFAULT = 270,
159 : CHOICE = 271,
160 : OF = 272,
161 : OBJECT = 273,
162 : STR_IDENTIFIER = 274,
163 : ksba_BOOLEAN = 275,
164 : ksba_TRUE = 276,
165 : ksba_FALSE = 277,
166 : APPLICATION = 278,
167 : ANY = 279,
168 : DEFINED = 280,
169 : SET = 281,
170 : BY = 282,
171 : EXPLICIT = 283,
172 : IMPLICIT = 284,
173 : DEFINITIONS = 285,
174 : TAGS = 286,
175 : ksba_BEGIN = 287,
176 : ksba_END = 288,
177 : UTCTime = 289,
178 : GeneralizedTime = 290,
179 : FROM = 291,
180 : IMPORTS = 292,
181 : TOKEN_NULL = 293,
182 : ENUMERATED = 294,
183 : UTF8STRING = 295,
184 : NUMERICSTRING = 296,
185 : PRINTABLESTRING = 297,
186 : TELETEXSTRING = 298,
187 : IA5STRING = 299,
188 : UNIVERSALSTRING = 300,
189 : BMPSTRING = 301
190 : };
191 : #endif
192 : /* Tokens. */
193 : #define ASSIG 258
194 : #define NUM 259
195 : #define IDENTIFIER 260
196 : #define OPTIONAL 261
197 : #define INTEGER 262
198 : #define SIZE 263
199 : #define OCTET 264
200 : #define STRING 265
201 : #define SEQUENCE 266
202 : #define BIT 267
203 : #define UNIVERSAL 268
204 : #define PRIVATE 269
205 : #define DEFAULT 270
206 : #define CHOICE 271
207 : #define OF 272
208 : #define OBJECT 273
209 : #define STR_IDENTIFIER 274
210 : #define ksba_BOOLEAN 275
211 : #define ksba_TRUE 276
212 : #define ksba_FALSE 277
213 : #define APPLICATION 278
214 : #define ANY 279
215 : #define DEFINED 280
216 : #define SET 281
217 : #define BY 282
218 : #define EXPLICIT 283
219 : #define IMPLICIT 284
220 : #define DEFINITIONS 285
221 : #define TAGS 286
222 : #define ksba_BEGIN 287
223 : #define ksba_END 288
224 : #define UTCTime 289
225 : #define GeneralizedTime 290
226 : #define FROM 291
227 : #define IMPORTS 292
228 : #define TOKEN_NULL 293
229 : #define ENUMERATED 294
230 : #define UTF8STRING 295
231 : #define NUMERICSTRING 296
232 : #define PRINTABLESTRING 297
233 : #define TELETEXSTRING 298
234 : #define IA5STRING 299
235 : #define UNIVERSALSTRING 300
236 : #define BMPSTRING 301
237 :
238 : /* Value type. */
239 : #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
240 : typedef union YYSTYPE YYSTYPE;
241 : union YYSTYPE
242 : {
243 : #line 97 "../../src/asn1-parse.y" /* yacc.c:355 */
244 :
245 : unsigned int constant;
246 : char str[MAX_STRING_LENGTH];
247 : AsnNode node;
248 :
249 : #line 250 "asn1-parse.c" /* yacc.c:355 */
250 : };
251 : # define YYSTYPE_IS_TRIVIAL 1
252 : # define YYSTYPE_IS_DECLARED 1
253 : #endif
254 :
255 :
256 :
257 : int yyparse (void *parm);
258 :
259 :
260 :
261 : /* Copy the second part of user declarations. */
262 : #line 103 "../../src/asn1-parse.y" /* yacc.c:358 */
263 :
264 : static AsnNode new_node (struct parser_control_s *parsectl, node_type_t type);
265 : #define NEW_NODE(a) (new_node (PARSECTL, (a)))
266 : static void set_name (AsnNode node, const char *name);
267 : static void set_str_value (AsnNode node, const char *text);
268 : static void set_ulong_value (AsnNode node, const char *text);
269 : static void set_right (AsnNode node, AsnNode right);
270 : static void append_right (AsnNode node, AsnNode right);
271 : static void set_down (AsnNode node, AsnNode down);
272 :
273 :
274 : static int yylex (YYSTYPE *lvalp, void *parm);
275 : static void yyerror (void *parm, const char *s);
276 :
277 : #line 278 "asn1-parse.c" /* yacc.c:358 */
278 :
279 : #ifdef short
280 : # undef short
281 : #endif
282 :
283 : #ifdef YYTYPE_UINT8
284 : typedef YYTYPE_UINT8 yytype_uint8;
285 : #else
286 : typedef unsigned char yytype_uint8;
287 : #endif
288 :
289 : #ifdef YYTYPE_INT8
290 : typedef YYTYPE_INT8 yytype_int8;
291 : #else
292 : typedef signed char yytype_int8;
293 : #endif
294 :
295 : #ifdef YYTYPE_UINT16
296 : typedef YYTYPE_UINT16 yytype_uint16;
297 : #else
298 : typedef unsigned short int yytype_uint16;
299 : #endif
300 :
301 : #ifdef YYTYPE_INT16
302 : typedef YYTYPE_INT16 yytype_int16;
303 : #else
304 : typedef short int yytype_int16;
305 : #endif
306 :
307 : #ifndef YYSIZE_T
308 : # ifdef __SIZE_TYPE__
309 : # define YYSIZE_T __SIZE_TYPE__
310 : # elif defined size_t
311 : # define YYSIZE_T size_t
312 : # elif ! defined YYSIZE_T
313 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
314 : # define YYSIZE_T size_t
315 : # else
316 : # define YYSIZE_T unsigned int
317 : # endif
318 : #endif
319 :
320 : #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
321 :
322 : #ifndef YY_
323 : # if defined YYENABLE_NLS && YYENABLE_NLS
324 : # if ENABLE_NLS
325 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
326 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
327 : # endif
328 : # endif
329 : # ifndef YY_
330 : # define YY_(Msgid) Msgid
331 : # endif
332 : #endif
333 :
334 : #ifndef YY_ATTRIBUTE
335 : # if (defined __GNUC__ \
336 : && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
337 : || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
338 : # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
339 : # else
340 : # define YY_ATTRIBUTE(Spec) /* empty */
341 : # endif
342 : #endif
343 :
344 : #ifndef YY_ATTRIBUTE_PURE
345 : # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
346 : #endif
347 :
348 : #ifndef YY_ATTRIBUTE_UNUSED
349 : # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
350 : #endif
351 :
352 : #if !defined _Noreturn \
353 : && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
354 : # if defined _MSC_VER && 1200 <= _MSC_VER
355 : # define _Noreturn __declspec (noreturn)
356 : # else
357 : # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
358 : # endif
359 : #endif
360 :
361 : /* Suppress unused-variable warnings by "using" E. */
362 : #if ! defined lint || defined __GNUC__
363 : # define YYUSE(E) ((void) (E))
364 : #else
365 : # define YYUSE(E) /* empty */
366 : #endif
367 :
368 : #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
369 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
370 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
371 : _Pragma ("GCC diagnostic push") \
372 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
373 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
374 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
375 : _Pragma ("GCC diagnostic pop")
376 : #else
377 : # define YY_INITIAL_VALUE(Value) Value
378 : #endif
379 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
380 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
381 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
382 : #endif
383 : #ifndef YY_INITIAL_VALUE
384 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
385 : #endif
386 :
387 :
388 : #if ! defined yyoverflow || YYERROR_VERBOSE
389 :
390 : /* The parser invokes alloca or malloc; define the necessary symbols. */
391 :
392 : # ifdef YYSTACK_USE_ALLOCA
393 : # if YYSTACK_USE_ALLOCA
394 : # ifdef __GNUC__
395 : # define YYSTACK_ALLOC __builtin_alloca
396 : # elif defined __BUILTIN_VA_ARG_INCR
397 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
398 : # elif defined _AIX
399 : # define YYSTACK_ALLOC __alloca
400 : # elif defined _MSC_VER
401 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
402 : # define alloca _alloca
403 : # else
404 : # define YYSTACK_ALLOC alloca
405 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
406 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
407 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
408 : # ifndef EXIT_SUCCESS
409 : # define EXIT_SUCCESS 0
410 : # endif
411 : # endif
412 : # endif
413 : # endif
414 : # endif
415 :
416 : # ifdef YYSTACK_ALLOC
417 : /* Pacify GCC's 'empty if-body' warning. */
418 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
419 : # ifndef YYSTACK_ALLOC_MAXIMUM
420 : /* The OS might guarantee only one guard page at the bottom of the stack,
421 : and a page size can be as small as 4096 bytes. So we cannot safely
422 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
423 : to allow for a few compiler-allocated temporary stack slots. */
424 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
425 : # endif
426 : # else
427 : # define YYSTACK_ALLOC YYMALLOC
428 : # define YYSTACK_FREE YYFREE
429 : # ifndef YYSTACK_ALLOC_MAXIMUM
430 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
431 : # endif
432 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
433 : && ! ((defined YYMALLOC || defined malloc) \
434 : && (defined YYFREE || defined free)))
435 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
436 : # ifndef EXIT_SUCCESS
437 : # define EXIT_SUCCESS 0
438 : # endif
439 : # endif
440 : # ifndef YYMALLOC
441 : # define YYMALLOC malloc
442 : # if ! defined malloc && ! defined EXIT_SUCCESS
443 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
444 : # endif
445 : # endif
446 : # ifndef YYFREE
447 : # define YYFREE free
448 : # if ! defined free && ! defined EXIT_SUCCESS
449 : void free (void *); /* INFRINGES ON USER NAME SPACE */
450 : # endif
451 : # endif
452 : # endif
453 : #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
454 :
455 :
456 : #if (! defined yyoverflow \
457 : && (! defined __cplusplus \
458 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
459 :
460 : /* A type that is properly aligned for any stack member. */
461 : union yyalloc
462 : {
463 : yytype_int16 yyss_alloc;
464 : YYSTYPE yyvs_alloc;
465 : };
466 :
467 : /* The size of the maximum gap between one aligned stack and the next. */
468 : # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
469 :
470 : /* The size of an array large to enough to hold all stacks, each with
471 : N elements. */
472 : # define YYSTACK_BYTES(N) \
473 : ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
474 : + YYSTACK_GAP_MAXIMUM)
475 :
476 : # define YYCOPY_NEEDED 1
477 :
478 : /* Relocate STACK from its old location to the new one. The
479 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
480 : elements in the stack, and YYPTR gives the new location of the
481 : stack. Advance YYPTR to a properly aligned location for the next
482 : stack. */
483 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
484 : do \
485 : { \
486 : YYSIZE_T yynewbytes; \
487 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
488 : Stack = &yyptr->Stack_alloc; \
489 : yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
490 : yyptr += yynewbytes / sizeof (*yyptr); \
491 : } \
492 : while (0)
493 :
494 : #endif
495 :
496 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
497 : /* Copy COUNT objects from SRC to DST. The source and destination do
498 : not overlap. */
499 : # ifndef YYCOPY
500 : # if defined __GNUC__ && 1 < __GNUC__
501 : # define YYCOPY(Dst, Src, Count) \
502 : __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
503 : # else
504 : # define YYCOPY(Dst, Src, Count) \
505 : do \
506 : { \
507 : YYSIZE_T yyi; \
508 : for (yyi = 0; yyi < (Count); yyi++) \
509 : (Dst)[yyi] = (Src)[yyi]; \
510 : } \
511 : while (0)
512 : # endif
513 : # endif
514 : #endif /* !YYCOPY_NEEDED */
515 :
516 : /* YYFINAL -- State number of the termination state. */
517 : #define YYFINAL 2
518 : /* YYLAST -- Last index in YYTABLE. */
519 : #define YYLAST 202
520 :
521 : /* YYNTOKENS -- Number of terminals. */
522 : #define YYNTOKENS 57
523 : /* YYNNTS -- Number of nonterminals. */
524 : #define YYNNTS 52
525 : /* YYNRULES -- Number of rules. */
526 : #define YYNRULES 119
527 : /* YYNSTATES -- Number of states. */
528 : #define YYNSTATES 210
529 :
530 : /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
531 : by yylex, with out-of-bounds checking. */
532 : #define YYUNDEFTOK 2
533 : #define YYMAXUTOK 301
534 :
535 : #define YYTRANSLATE(YYX) \
536 : ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
537 :
538 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
539 : as returned by yylex, without out-of-bounds checking. */
540 : static const yytype_uint8 yytranslate[] =
541 : {
542 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 : 49, 50, 2, 47, 51, 48, 56, 2, 2, 2,
547 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 : 2, 52, 2, 53, 2, 2, 2, 2, 2, 2,
552 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 : 2, 2, 2, 54, 2, 55, 2, 2, 2, 2,
555 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
568 : 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
569 : 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
570 : 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
571 : 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
572 : 45, 46
573 : };
574 :
575 : #if YYDEBUG
576 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
577 : static const yytype_uint16 yyrline[] =
578 : {
579 : 0, 184, 184, 185, 188, 189, 192, 199, 200, 203,
580 : 204, 207, 208, 211, 216, 224, 225, 232, 237, 248,
581 : 253, 261, 263, 270, 271, 272, 275, 281, 289, 291,
582 : 296, 303, 308, 313, 320, 324, 330, 341, 347, 351,
583 : 357, 363, 372, 376, 382, 386, 394, 395, 402, 403,
584 : 410, 412, 419, 421, 428, 429, 436, 438, 445, 446,
585 : 455, 456, 457, 458, 459, 460, 461, 467, 475, 479,
586 : 486, 490, 498, 506, 512, 517, 524, 525, 526, 527,
587 : 528, 529, 530, 531, 532, 533, 534, 535, 536, 542,
588 : 546, 557, 561, 568, 575, 582, 584, 591, 596, 601,
589 : 610, 615, 620, 629, 636, 640, 652, 659, 666, 675,
590 : 684, 685, 688, 690, 697, 706, 707, 720, 721, 724
591 : };
592 : #endif
593 :
594 : #if YYDEBUG || YYERROR_VERBOSE || 1
595 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
596 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
597 : static const char *const yytname[] =
598 : {
599 : "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER",
600 : "\"OPTIONAL\"", "\"INTEGER\"", "\"SIZE\"", "\"OCTET\"", "\"STRING\"",
601 : "\"SEQUENCE\"", "\"BIT\"", "\"UNIVERSAL\"", "\"PRIVATE\"", "\"DEFAULT\"",
602 : "\"CHOICE\"", "\"OF\"", "\"OBJECT\"", "\"IDENTIFIER\"", "\"BOOLEAN\"",
603 : "\"TRUE\"", "\"FALSE\"", "\"APPLICATION\"", "\"ANY\"", "\"DEFINED\"",
604 : "\"SET\"", "\"BY\"", "\"EXPLICIT\"", "\"IMPLICIT\"", "\"DEFINITIONS\"",
605 : "\"TAGS\"", "\"BEGIN\"", "\"END\"", "\"UTCTime\"", "\"GeneralizedTime\"",
606 : "\"FROM\"", "\"IMPORTS\"", "\"NULL\"", "\"ENUMERATED\"",
607 : "\"UTF8String\"", "\"NumericString\"", "\"PrintableString\"",
608 : "\"TeletexString\"", "\"IA5String\"", "\"UniversalString\"",
609 : "\"BMPString\"", "'+'", "'-'", "'('", "')'", "','", "'['", "']'", "'{'",
610 : "'}'", "'.'", "$accept", "input", "pos_num", "neg_num", "pos_neg_num",
611 : "num_identifier", "pos_neg_identifier", "constant", "constant_list",
612 : "identifier_list", "obj_constant", "obj_constant_list", "class",
613 : "tag_type", "tag", "default", "integer_def", "boolean_def", "Time",
614 : "size_def2", "size_def", "octet_string_def", "utf8_string_def",
615 : "numeric_string_def", "printable_string_def", "teletex_string_def",
616 : "ia5_string_def", "universal_string_def", "bmp_string_def", "string_def",
617 : "bit_element", "bit_element_list", "bit_string_def", "enumerated_def",
618 : "object_def", "type_assig_right", "type_assig_right_tag",
619 : "type_assig_right_tag_default", "type_assig", "type_assig_list",
620 : "sequence_def", "set_def", "choise_def", "any_def", "type_def",
621 : "constant_def", "type_constant", "type_constant_list", "definitions_id",
622 : "imports_def", "explicit_implicit", "definitions", YY_NULLPTR
623 : };
624 : #endif
625 :
626 : # ifdef YYPRINT
627 : /* YYTOKNUM[NUM] -- (External) token number corresponding to the
628 : (internal) symbol number NUM (which must be that of a token). */
629 : static const yytype_uint16 yytoknum[] =
630 : {
631 : 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
632 : 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
633 : 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
634 : 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
635 : 295, 296, 297, 298, 299, 300, 301, 43, 45, 40,
636 : 41, 44, 91, 93, 123, 125, 46
637 : };
638 : # endif
639 :
640 : #define YYPACT_NINF -120
641 :
642 : #define yypact_value_is_default(Yystate) \
643 : (!!((Yystate) == (-120)))
644 :
645 : #define YYTABLE_NINF -1
646 :
647 : #define yytable_value_is_error(Yytable_value) \
648 : 0
649 :
650 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
651 : STATE-NUM. */
652 : static const yytype_int16 yypact[] =
653 : {
654 : -120, 26, -120, -31, 7, -120, 42, 67, -120, 31,
655 : -120, -120, 1, -120, -120, 54, 105, -120, -120, 49,
656 : 70, 93, -120, 90, 124, 126, -120, 22, 100, -120,
657 : -120, -120, 38, -120, 130, 48, 134, 136, 125, -120,
658 : -120, 42, 24, 89, 135, 13, 138, 95, 140, -120,
659 : 137, 16, -120, -120, -120, 106, 24, 24, 24, 24,
660 : 24, 24, 24, 25, 83, 112, 114, -120, -120, -120,
661 : -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
662 : -120, -120, -120, -120, -120, -120, -120, 107, 160, 162,
663 : 42, 117, 159, -120, -120, 20, 24, 112, 163, 153,
664 : 118, 163, -120, 144, 112, 163, 156, 169, -120, -120,
665 : -120, -120, -120, -120, -120, 122, -120, -120, -120, 172,
666 : -120, -120, -120, 129, 42, -120, 123, 129, 128, 131,
667 : 3, -120, -15, -120, -120, 48, -120, -6, 112, 169,
668 : 46, 174, -120, 51, 112, 132, -120, 53, -120, 133,
669 : -120, 127, 6, 42, -28, -120, 3, -120, 178, 180,
670 : -120, -120, 139, 20, -120, 29, -120, 163, -120, -120,
671 : 59, -120, -120, -120, -120, 181, 169, -120, -120, 141,
672 : -120, 8, -120, 142, 143, -120, -120, -120, -120, -120,
673 : 94, -120, -120, -120, 145, -120, 129, -120, 129, -120,
674 : -120, -120, -120, -120, -120, -120, 146, 149, -120, -120
675 : };
676 :
677 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
678 : Performed when YYTABLE does not specify something else to do. Zero
679 : means the default is an error. */
680 : static const yytype_uint8 yydefact[] =
681 : {
682 : 2, 0, 1, 0, 0, 3, 0, 0, 9, 10,
683 : 19, 21, 0, 117, 118, 0, 0, 114, 22, 0,
684 : 0, 0, 20, 115, 0, 0, 17, 0, 0, 110,
685 : 111, 112, 0, 18, 0, 0, 0, 0, 0, 119,
686 : 113, 0, 74, 34, 0, 0, 0, 0, 0, 37,
687 : 104, 0, 38, 39, 88, 0, 46, 48, 50, 52,
688 : 54, 56, 58, 0, 28, 0, 76, 78, 80, 81,
689 : 60, 61, 62, 63, 64, 65, 66, 79, 82, 77,
690 : 84, 89, 106, 83, 87, 85, 86, 0, 0, 0,
691 : 0, 0, 0, 42, 75, 0, 44, 0, 0, 0,
692 : 70, 0, 73, 0, 0, 0, 0, 0, 47, 49,
693 : 51, 53, 55, 57, 59, 0, 23, 24, 25, 0,
694 : 29, 30, 90, 0, 0, 109, 0, 0, 0, 0,
695 : 0, 15, 0, 45, 98, 0, 95, 0, 0, 0,
696 : 0, 0, 101, 0, 0, 0, 68, 0, 26, 0,
697 : 10, 0, 0, 0, 0, 43, 0, 4, 0, 0,
698 : 7, 8, 0, 0, 35, 91, 94, 0, 97, 99,
699 : 0, 103, 105, 100, 102, 0, 0, 72, 27, 0,
700 : 108, 0, 40, 0, 0, 5, 6, 13, 16, 93,
701 : 0, 92, 96, 71, 0, 69, 0, 107, 0, 14,
702 : 12, 32, 33, 11, 31, 67, 0, 0, 36, 41
703 : };
704 :
705 : /* YYPGOTO[NTERM-NUM]. */
706 : static const yytype_int16 yypgoto[] =
707 : {
708 : -120, -120, -120, -120, -114, -119, -120, 27, -120, -120,
709 : -12, -40, -120, -120, -120, -120, -120, -120, -120, 96,
710 : -42, -120, -120, -120, -120, -120, -120, -120, -120, -120,
711 : 11, 52, -120, -120, -120, -63, 57, -120, 33, 21,
712 : -120, -120, -120, -120, -120, -120, 170, -120, -120, -120,
713 : -120, -120
714 : };
715 :
716 : /* YYDEFGOTO[NTERM-NUM]. */
717 : static const yytype_int16 yydefgoto[] =
718 : {
719 : -1, 1, 160, 161, 162, 10, 204, 131, 132, 27,
720 : 11, 12, 119, 64, 65, 191, 66, 67, 68, 93,
721 : 94, 69, 70, 71, 72, 73, 74, 75, 76, 77,
722 : 146, 147, 78, 79, 80, 81, 82, 166, 136, 137,
723 : 83, 84, 85, 86, 29, 30, 31, 32, 4, 25,
724 : 15, 5
725 : };
726 :
727 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
728 : positive, shift that token. If negative, reduce the rule whose
729 : number is the opposite. If YYTABLE_NINF, syntax error. */
730 : static const yytype_uint8 yytable[] =
731 : {
732 : 18, 90, 122, 99, 151, 8, 9, 157, 154, 106,
733 : 8, 9, 8, 9, 108, 109, 110, 111, 112, 113,
734 : 114, 91, 182, 6, 91, 129, 2, 33, 183, 115,
735 : 97, 3, 91, 104, 134, 189, 163, 7, 116, 117,
736 : 164, 142, 184, 28, 190, 167, 8, 9, 118, 168,
737 : 158, 159, 21, 42, 133, 43, 17, 44, 34, 45,
738 : 46, 180, 92, 197, 47, 92, 48, 98, 49, 130,
739 : 105, 39, 50, 92, 51, 169, 203, 206, 18, 207,
740 : 16, 174, 52, 53, 152, 19, 54, 55, 56, 57,
741 : 58, 59, 60, 61, 62, 13, 14, 167, 157, 200,
742 : 63, 171, 167, 35, 176, 36, 173, 37, 177, 20,
743 : 176, 120, 121, 181, 193, 201, 202, 42, 38, 43,
744 : 22, 44, 140, 45, 46, 23, 143, 24, 47, 26,
745 : 48, 28, 49, 8, 150, 41, 50, 87, 51, 88,
746 : 18, 158, 159, 95, 89, 96, 52, 53, 100, 101,
747 : 54, 55, 56, 57, 58, 59, 60, 61, 62, 102,
748 : 107, 124, 103, 123, 125, 126, 127, 91, 135, 18,
749 : 138, 141, 139, 144, 145, 148, 149, 153, 155, 172,
750 : 156, 175, 185, 179, 186, 194, 178, 195, 128, 187,
751 : 188, 170, 165, 199, 0, 205, 208, 196, 198, 209,
752 : 192, 0, 40
753 : };
754 :
755 : static const yytype_int16 yycheck[] =
756 : {
757 : 12, 41, 65, 45, 123, 4, 5, 4, 127, 51,
758 : 4, 5, 4, 5, 56, 57, 58, 59, 60, 61,
759 : 62, 8, 50, 54, 8, 5, 0, 5, 56, 4,
760 : 17, 5, 8, 17, 97, 6, 51, 30, 13, 14,
761 : 55, 104, 156, 5, 15, 51, 4, 5, 23, 55,
762 : 47, 48, 3, 5, 96, 7, 55, 9, 36, 11,
763 : 12, 55, 49, 55, 16, 49, 18, 54, 20, 49,
764 : 54, 33, 24, 49, 26, 138, 190, 196, 90, 198,
765 : 49, 144, 34, 35, 124, 31, 38, 39, 40, 41,
766 : 42, 43, 44, 45, 46, 28, 29, 51, 4, 5,
767 : 52, 55, 51, 3, 51, 5, 55, 7, 55, 4,
768 : 51, 28, 29, 153, 55, 21, 22, 5, 18, 7,
769 : 50, 9, 101, 11, 12, 32, 105, 37, 16, 5,
770 : 18, 5, 20, 4, 5, 5, 24, 3, 26, 3,
771 : 152, 47, 48, 54, 19, 10, 34, 35, 10, 54,
772 : 38, 39, 40, 41, 42, 43, 44, 45, 46, 19,
773 : 54, 54, 25, 49, 4, 3, 49, 8, 5, 181,
774 : 17, 27, 54, 17, 5, 53, 4, 54, 50, 5,
775 : 49, 49, 4, 56, 4, 4, 53, 176, 92, 50,
776 : 163, 139, 135, 50, -1, 50, 50, 56, 56, 50,
777 : 167, -1, 32
778 : };
779 :
780 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
781 : symbol of state STATE-NUM. */
782 : static const yytype_uint8 yystos[] =
783 : {
784 : 0, 58, 0, 5, 105, 108, 54, 30, 4, 5,
785 : 62, 67, 68, 28, 29, 107, 49, 55, 67, 31,
786 : 4, 3, 50, 32, 37, 106, 5, 66, 5, 101,
787 : 102, 103, 104, 5, 36, 3, 5, 7, 18, 33,
788 : 103, 5, 5, 7, 9, 11, 12, 16, 18, 20,
789 : 24, 26, 34, 35, 38, 39, 40, 41, 42, 43,
790 : 44, 45, 46, 52, 70, 71, 73, 74, 75, 78,
791 : 79, 80, 81, 82, 83, 84, 85, 86, 89, 90,
792 : 91, 92, 93, 97, 98, 99, 100, 3, 3, 19,
793 : 68, 8, 49, 76, 77, 54, 10, 17, 54, 77,
794 : 10, 54, 19, 25, 17, 54, 77, 54, 77, 77,
795 : 77, 77, 77, 77, 77, 4, 13, 14, 23, 69,
796 : 28, 29, 92, 49, 54, 4, 3, 49, 76, 5,
797 : 49, 64, 65, 77, 92, 5, 95, 96, 17, 54,
798 : 96, 27, 92, 96, 17, 5, 87, 88, 53, 4,
799 : 5, 62, 68, 54, 62, 50, 49, 4, 47, 48,
800 : 59, 60, 61, 51, 55, 93, 94, 51, 55, 92,
801 : 88, 55, 5, 55, 92, 49, 51, 55, 53, 56,
802 : 55, 68, 50, 56, 61, 4, 4, 50, 64, 6,
803 : 15, 72, 95, 55, 4, 87, 56, 55, 56, 50,
804 : 5, 21, 22, 61, 63, 50, 62, 62, 50, 50
805 : };
806 :
807 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
808 : static const yytype_uint8 yyr1[] =
809 : {
810 : 0, 57, 58, 58, 59, 59, 60, 61, 61, 62,
811 : 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
812 : 67, 68, 68, 69, 69, 69, 70, 70, 71, 71,
813 : 71, 72, 72, 72, 73, 73, 73, 74, 75, 75,
814 : 76, 76, 77, 77, 78, 78, 79, 79, 80, 80,
815 : 81, 81, 82, 82, 83, 83, 84, 84, 85, 85,
816 : 86, 86, 86, 86, 86, 86, 86, 87, 88, 88,
817 : 89, 89, 90, 91, 92, 92, 92, 92, 92, 92,
818 : 92, 92, 92, 92, 92, 92, 92, 92, 92, 93,
819 : 93, 94, 94, 94, 95, 96, 96, 97, 97, 97,
820 : 98, 98, 98, 99, 100, 100, 101, 102, 102, 102,
821 : 103, 103, 104, 104, 105, 106, 106, 107, 107, 108
822 : };
823 :
824 : /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
825 : static const yytype_uint8 yyr2[] =
826 : {
827 : 0, 2, 0, 2, 1, 2, 2, 1, 1, 1,
828 : 1, 1, 1, 3, 4, 1, 3, 1, 2, 1,
829 : 4, 1, 2, 1, 1, 1, 3, 4, 1, 2,
830 : 2, 2, 2, 2, 1, 4, 7, 1, 1, 1,
831 : 4, 7, 1, 3, 2, 3, 1, 2, 1, 2,
832 : 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
833 : 1, 1, 1, 1, 1, 1, 1, 4, 1, 3,
834 : 2, 5, 4, 2, 1, 2, 1, 1, 1, 1,
835 : 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
836 : 2, 1, 2, 2, 2, 1, 3, 4, 3, 4,
837 : 4, 3, 4, 4, 1, 4, 3, 7, 6, 4,
838 : 1, 1, 1, 2, 4, 0, 5, 1, 1, 9
839 : };
840 :
841 :
842 : #define yyerrok (yyerrstatus = 0)
843 : #define yyclearin (yychar = YYEMPTY)
844 : #define YYEMPTY (-2)
845 : #define YYEOF 0
846 :
847 : #define YYACCEPT goto yyacceptlab
848 : #define YYABORT goto yyabortlab
849 : #define YYERROR goto yyerrorlab
850 :
851 :
852 : #define YYRECOVERING() (!!yyerrstatus)
853 :
854 : #define YYBACKUP(Token, Value) \
855 : do \
856 : if (yychar == YYEMPTY) \
857 : { \
858 : yychar = (Token); \
859 : yylval = (Value); \
860 : YYPOPSTACK (yylen); \
861 : yystate = *yyssp; \
862 : goto yybackup; \
863 : } \
864 : else \
865 : { \
866 : yyerror (parm, YY_("syntax error: cannot back up")); \
867 : YYERROR; \
868 : } \
869 : while (0)
870 :
871 : /* Error token number */
872 : #define YYTERROR 1
873 : #define YYERRCODE 256
874 :
875 :
876 :
877 : /* Enable debugging if requested. */
878 : #if YYDEBUG
879 :
880 : # ifndef YYFPRINTF
881 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
882 : # define YYFPRINTF fprintf
883 : # endif
884 :
885 : # define YYDPRINTF(Args) \
886 : do { \
887 : if (yydebug) \
888 : YYFPRINTF Args; \
889 : } while (0)
890 :
891 : /* This macro is provided for backward compatibility. */
892 : #ifndef YY_LOCATION_PRINT
893 : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
894 : #endif
895 :
896 :
897 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
898 : do { \
899 : if (yydebug) \
900 : { \
901 : YYFPRINTF (stderr, "%s ", Title); \
902 : yy_symbol_print (stderr, \
903 : Type, Value, parm); \
904 : YYFPRINTF (stderr, "\n"); \
905 : } \
906 : } while (0)
907 :
908 :
909 : /*----------------------------------------.
910 : | Print this symbol's value on YYOUTPUT. |
911 : `----------------------------------------*/
912 :
913 : static void
914 : yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *parm)
915 : {
916 : FILE *yyo = yyoutput;
917 : YYUSE (yyo);
918 : YYUSE (parm);
919 : if (!yyvaluep)
920 : return;
921 : # ifdef YYPRINT
922 : if (yytype < YYNTOKENS)
923 : YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
924 : # endif
925 : YYUSE (yytype);
926 : }
927 :
928 :
929 : /*--------------------------------.
930 : | Print this symbol on YYOUTPUT. |
931 : `--------------------------------*/
932 :
933 : static void
934 : yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *parm)
935 : {
936 : YYFPRINTF (yyoutput, "%s %s (",
937 : yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
938 :
939 : yy_symbol_value_print (yyoutput, yytype, yyvaluep, parm);
940 : YYFPRINTF (yyoutput, ")");
941 : }
942 :
943 : /*------------------------------------------------------------------.
944 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
945 : | TOP (included). |
946 : `------------------------------------------------------------------*/
947 :
948 : static void
949 : yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
950 : {
951 : YYFPRINTF (stderr, "Stack now");
952 : for (; yybottom <= yytop; yybottom++)
953 : {
954 : int yybot = *yybottom;
955 : YYFPRINTF (stderr, " %d", yybot);
956 : }
957 : YYFPRINTF (stderr, "\n");
958 : }
959 :
960 : # define YY_STACK_PRINT(Bottom, Top) \
961 : do { \
962 : if (yydebug) \
963 : yy_stack_print ((Bottom), (Top)); \
964 : } while (0)
965 :
966 :
967 : /*------------------------------------------------.
968 : | Report that the YYRULE is going to be reduced. |
969 : `------------------------------------------------*/
970 :
971 : static void
972 : yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *parm)
973 : {
974 : unsigned long int yylno = yyrline[yyrule];
975 : int yynrhs = yyr2[yyrule];
976 : int yyi;
977 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
978 : yyrule - 1, yylno);
979 : /* The symbols being reduced. */
980 : for (yyi = 0; yyi < yynrhs; yyi++)
981 : {
982 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
983 : yy_symbol_print (stderr,
984 : yystos[yyssp[yyi + 1 - yynrhs]],
985 : &(yyvsp[(yyi + 1) - (yynrhs)])
986 : , parm);
987 : YYFPRINTF (stderr, "\n");
988 : }
989 : }
990 :
991 : # define YY_REDUCE_PRINT(Rule) \
992 : do { \
993 : if (yydebug) \
994 : yy_reduce_print (yyssp, yyvsp, Rule, parm); \
995 : } while (0)
996 :
997 : /* Nonzero means print parse trace. It is left uninitialized so that
998 : multiple parsers can coexist. */
999 : int yydebug;
1000 : #else /* !YYDEBUG */
1001 : # define YYDPRINTF(Args)
1002 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1003 : # define YY_STACK_PRINT(Bottom, Top)
1004 : # define YY_REDUCE_PRINT(Rule)
1005 : #endif /* !YYDEBUG */
1006 :
1007 :
1008 : /* YYINITDEPTH -- initial size of the parser's stacks. */
1009 : #ifndef YYINITDEPTH
1010 : # define YYINITDEPTH 200
1011 : #endif
1012 :
1013 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1014 : if the built-in stack extension method is used).
1015 :
1016 : Do not make this value too large; the results are undefined if
1017 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1018 : evaluated with infinite-precision integer arithmetic. */
1019 :
1020 : #ifndef YYMAXDEPTH
1021 : # define YYMAXDEPTH 10000
1022 : #endif
1023 :
1024 :
1025 : #if YYERROR_VERBOSE
1026 :
1027 : # ifndef yystrlen
1028 : # if defined __GLIBC__ && defined _STRING_H
1029 : # define yystrlen strlen
1030 : # else
1031 : /* Return the length of YYSTR. */
1032 : static YYSIZE_T
1033 : yystrlen (const char *yystr)
1034 : {
1035 : YYSIZE_T yylen;
1036 : for (yylen = 0; yystr[yylen]; yylen++)
1037 : continue;
1038 : return yylen;
1039 : }
1040 : # endif
1041 : # endif
1042 :
1043 : # ifndef yystpcpy
1044 : # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1045 : # define yystpcpy stpcpy
1046 : # else
1047 : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1048 : YYDEST. */
1049 : static char *
1050 : yystpcpy (char *yydest, const char *yysrc)
1051 : {
1052 : char *yyd = yydest;
1053 : const char *yys = yysrc;
1054 :
1055 : while ((*yyd++ = *yys++) != '\0')
1056 : continue;
1057 :
1058 : return yyd - 1;
1059 : }
1060 : # endif
1061 : # endif
1062 :
1063 : # ifndef yytnamerr
1064 : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1065 : quotes and backslashes, so that it's suitable for yyerror. The
1066 : heuristic is that double-quoting is unnecessary unless the string
1067 : contains an apostrophe, a comma, or backslash (other than
1068 : backslash-backslash). YYSTR is taken from yytname. If YYRES is
1069 : null, do not copy; instead, return the length of what the result
1070 : would have been. */
1071 : static YYSIZE_T
1072 0 : yytnamerr (char *yyres, const char *yystr)
1073 : {
1074 0 : if (*yystr == '"')
1075 : {
1076 0 : YYSIZE_T yyn = 0;
1077 0 : char const *yyp = yystr;
1078 :
1079 : for (;;)
1080 0 : switch (*++yyp)
1081 : {
1082 : case '\'':
1083 : case ',':
1084 0 : goto do_not_strip_quotes;
1085 :
1086 : case '\\':
1087 0 : if (*++yyp != '\\')
1088 0 : goto do_not_strip_quotes;
1089 : /* Fall through. */
1090 : default:
1091 0 : if (yyres)
1092 0 : yyres[yyn] = *yyp;
1093 0 : yyn++;
1094 0 : break;
1095 :
1096 : case '"':
1097 0 : if (yyres)
1098 0 : yyres[yyn] = '\0';
1099 0 : return yyn;
1100 : }
1101 0 : do_not_strip_quotes: ;
1102 : }
1103 :
1104 0 : if (! yyres)
1105 0 : return yystrlen (yystr);
1106 :
1107 0 : return yystpcpy (yyres, yystr) - yyres;
1108 : }
1109 : # endif
1110 :
1111 : /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1112 : about the unexpected token YYTOKEN for the state stack whose top is
1113 : YYSSP.
1114 :
1115 : Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1116 : not large enough to hold the message. In that case, also set
1117 : *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1118 : required number of bytes is too large to store. */
1119 : static int
1120 0 : yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1121 : yytype_int16 *yyssp, int yytoken)
1122 : {
1123 0 : YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1124 0 : YYSIZE_T yysize = yysize0;
1125 : enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1126 : /* Internationalized format string. */
1127 0 : const char *yyformat = YY_NULLPTR;
1128 : /* Arguments of yyformat. */
1129 : char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1130 : /* Number of reported tokens (one for the "unexpected", one per
1131 : "expected"). */
1132 0 : int yycount = 0;
1133 :
1134 : /* There are many possibilities here to consider:
1135 : - If this state is a consistent state with a default action, then
1136 : the only way this function was invoked is if the default action
1137 : is an error action. In that case, don't check for expected
1138 : tokens because there are none.
1139 : - The only way there can be no lookahead present (in yychar) is if
1140 : this state is a consistent state with a default action. Thus,
1141 : detecting the absence of a lookahead is sufficient to determine
1142 : that there is no unexpected or expected token to report. In that
1143 : case, just report a simple "syntax error".
1144 : - Don't assume there isn't a lookahead just because this state is a
1145 : consistent state with a default action. There might have been a
1146 : previous inconsistent state, consistent state with a non-default
1147 : action, or user semantic action that manipulated yychar.
1148 : - Of course, the expected token list depends on states to have
1149 : correct lookahead information, and it depends on the parser not
1150 : to perform extra reductions after fetching a lookahead from the
1151 : scanner and before detecting a syntax error. Thus, state merging
1152 : (from LALR or IELR) and default reductions corrupt the expected
1153 : token list. However, the list is correct for canonical LR with
1154 : one exception: it will still contain any token that will not be
1155 : accepted due to an error action in a later state.
1156 : */
1157 0 : if (yytoken != YYEMPTY)
1158 : {
1159 0 : int yyn = yypact[*yyssp];
1160 0 : yyarg[yycount++] = yytname[yytoken];
1161 0 : if (!yypact_value_is_default (yyn))
1162 : {
1163 : /* Start YYX at -YYN if negative to avoid negative indexes in
1164 : YYCHECK. In other words, skip the first -YYN actions for
1165 : this state because they are default actions. */
1166 0 : int yyxbegin = yyn < 0 ? -yyn : 0;
1167 : /* Stay within bounds of both yycheck and yytname. */
1168 0 : int yychecklim = YYLAST - yyn + 1;
1169 0 : int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1170 : int yyx;
1171 :
1172 0 : for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1173 0 : if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1174 0 : && !yytable_value_is_error (yytable[yyx + yyn]))
1175 : {
1176 0 : if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1177 : {
1178 0 : yycount = 1;
1179 0 : yysize = yysize0;
1180 0 : break;
1181 : }
1182 0 : yyarg[yycount++] = yytname[yyx];
1183 : {
1184 0 : YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1185 0 : if (! (yysize <= yysize1
1186 : && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1187 0 : return 2;
1188 0 : yysize = yysize1;
1189 : }
1190 : }
1191 : }
1192 : }
1193 :
1194 0 : switch (yycount)
1195 : {
1196 : # define YYCASE_(N, S) \
1197 : case N: \
1198 : yyformat = S; \
1199 : break
1200 0 : YYCASE_(0, YY_("syntax error"));
1201 0 : YYCASE_(1, YY_("syntax error, unexpected %s"));
1202 0 : YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1203 0 : YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1204 0 : YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1205 0 : YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1206 : # undef YYCASE_
1207 : }
1208 :
1209 : {
1210 0 : YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1211 0 : if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1212 0 : return 2;
1213 0 : yysize = yysize1;
1214 : }
1215 :
1216 0 : if (*yymsg_alloc < yysize)
1217 : {
1218 0 : *yymsg_alloc = 2 * yysize;
1219 0 : if (! (yysize <= *yymsg_alloc
1220 : && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1221 0 : *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1222 0 : return 1;
1223 : }
1224 :
1225 : /* Avoid sprintf, as that infringes on the user's name space.
1226 : Don't have undefined behavior even if the translation
1227 : produced a string with the wrong number of "%s"s. */
1228 : {
1229 0 : char *yyp = *yymsg;
1230 0 : int yyi = 0;
1231 0 : while ((*yyp = *yyformat) != '\0')
1232 0 : if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1233 : {
1234 0 : yyp += yytnamerr (yyp, yyarg[yyi++]);
1235 0 : yyformat += 2;
1236 : }
1237 : else
1238 : {
1239 0 : yyp++;
1240 0 : yyformat++;
1241 : }
1242 : }
1243 0 : return 0;
1244 : }
1245 : #endif /* YYERROR_VERBOSE */
1246 :
1247 : /*-----------------------------------------------.
1248 : | Release the memory associated to this symbol. |
1249 : `-----------------------------------------------*/
1250 :
1251 : static void
1252 0 : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *parm)
1253 : {
1254 : YYUSE (yyvaluep);
1255 : YYUSE (parm);
1256 0 : if (!yymsg)
1257 0 : yymsg = "Deleting";
1258 : YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1259 :
1260 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1261 : YYUSE (yytype);
1262 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1263 0 : }
1264 :
1265 :
1266 :
1267 :
1268 : /*----------.
1269 : | yyparse. |
1270 : `----------*/
1271 :
1272 : int
1273 0 : yyparse (void *parm)
1274 : {
1275 : /* The lookahead symbol. */
1276 : int yychar;
1277 :
1278 :
1279 : /* The semantic value of the lookahead symbol. */
1280 : /* Default value used for initialization, for pacifying older GCCs
1281 : or non-GCC compilers. */
1282 : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1283 : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1284 :
1285 : /* Number of syntax errors so far. */
1286 : int yynerrs;
1287 :
1288 : int yystate;
1289 : /* Number of tokens to shift before error messages enabled. */
1290 : int yyerrstatus;
1291 :
1292 : /* The stacks and their tools:
1293 : 'yyss': related to states.
1294 : 'yyvs': related to semantic values.
1295 :
1296 : Refer to the stacks through separate pointers, to allow yyoverflow
1297 : to reallocate them elsewhere. */
1298 :
1299 : /* The state stack. */
1300 : yytype_int16 yyssa[YYINITDEPTH];
1301 : yytype_int16 *yyss;
1302 : yytype_int16 *yyssp;
1303 :
1304 : /* The semantic value stack. */
1305 : YYSTYPE yyvsa[YYINITDEPTH];
1306 : YYSTYPE *yyvs;
1307 : YYSTYPE *yyvsp;
1308 :
1309 : YYSIZE_T yystacksize;
1310 :
1311 : int yyn;
1312 : int yyresult;
1313 : /* Lookahead token as an internal (translated) token number. */
1314 0 : int yytoken = 0;
1315 : /* The variables used to return semantic value and location from the
1316 : action routines. */
1317 : YYSTYPE yyval;
1318 :
1319 : #if YYERROR_VERBOSE
1320 : /* Buffer for error messages, and its allocated size. */
1321 : char yymsgbuf[128];
1322 0 : char *yymsg = yymsgbuf;
1323 0 : YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1324 : #endif
1325 :
1326 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1327 :
1328 : /* The number of symbols on the RHS of the reduced rule.
1329 : Keep to zero when no symbol should be popped. */
1330 0 : int yylen = 0;
1331 :
1332 0 : yyssp = yyss = yyssa;
1333 0 : yyvsp = yyvs = yyvsa;
1334 0 : yystacksize = YYINITDEPTH;
1335 :
1336 : YYDPRINTF ((stderr, "Starting parse\n"));
1337 :
1338 0 : yystate = 0;
1339 0 : yyerrstatus = 0;
1340 0 : yynerrs = 0;
1341 0 : yychar = YYEMPTY; /* Cause a token to be read. */
1342 0 : goto yysetstate;
1343 :
1344 : /*------------------------------------------------------------.
1345 : | yynewstate -- Push a new state, which is found in yystate. |
1346 : `------------------------------------------------------------*/
1347 : yynewstate:
1348 : /* In all cases, when you get here, the value and location stacks
1349 : have just been pushed. So pushing a state here evens the stacks. */
1350 0 : yyssp++;
1351 :
1352 : yysetstate:
1353 0 : *yyssp = yystate;
1354 :
1355 0 : if (yyss + yystacksize - 1 <= yyssp)
1356 : {
1357 : /* Get the current used size of the three stacks, in elements. */
1358 0 : YYSIZE_T yysize = yyssp - yyss + 1;
1359 :
1360 : #ifdef yyoverflow
1361 : {
1362 : /* Give user a chance to reallocate the stack. Use copies of
1363 : these so that the &'s don't force the real ones into
1364 : memory. */
1365 : YYSTYPE *yyvs1 = yyvs;
1366 : yytype_int16 *yyss1 = yyss;
1367 :
1368 : /* Each stack pointer address is followed by the size of the
1369 : data in use in that stack, in bytes. This used to be a
1370 : conditional around just the two extra args, but that might
1371 : be undefined if yyoverflow is a macro. */
1372 : yyoverflow (YY_("memory exhausted"),
1373 : &yyss1, yysize * sizeof (*yyssp),
1374 : &yyvs1, yysize * sizeof (*yyvsp),
1375 : &yystacksize);
1376 :
1377 : yyss = yyss1;
1378 : yyvs = yyvs1;
1379 : }
1380 : #else /* no yyoverflow */
1381 : # ifndef YYSTACK_RELOCATE
1382 : goto yyexhaustedlab;
1383 : # else
1384 : /* Extend the stack our own way. */
1385 0 : if (YYMAXDEPTH <= yystacksize)
1386 0 : goto yyexhaustedlab;
1387 0 : yystacksize *= 2;
1388 0 : if (YYMAXDEPTH < yystacksize)
1389 0 : yystacksize = YYMAXDEPTH;
1390 :
1391 : {
1392 0 : yytype_int16 *yyss1 = yyss;
1393 0 : union yyalloc *yyptr =
1394 0 : (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1395 0 : if (! yyptr)
1396 0 : goto yyexhaustedlab;
1397 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1398 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1399 : # undef YYSTACK_RELOCATE
1400 0 : if (yyss1 != yyssa)
1401 0 : YYSTACK_FREE (yyss1);
1402 : }
1403 : # endif
1404 : #endif /* no yyoverflow */
1405 :
1406 0 : yyssp = yyss + yysize - 1;
1407 0 : yyvsp = yyvs + yysize - 1;
1408 :
1409 : YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1410 : (unsigned long int) yystacksize));
1411 :
1412 0 : if (yyss + yystacksize - 1 <= yyssp)
1413 0 : YYABORT;
1414 : }
1415 :
1416 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1417 :
1418 0 : if (yystate == YYFINAL)
1419 0 : YYACCEPT;
1420 :
1421 0 : goto yybackup;
1422 :
1423 : /*-----------.
1424 : | yybackup. |
1425 : `-----------*/
1426 : yybackup:
1427 :
1428 : /* Do appropriate processing given the current state. Read a
1429 : lookahead token if we need one and don't already have one. */
1430 :
1431 : /* First try to decide what to do without reference to lookahead token. */
1432 0 : yyn = yypact[yystate];
1433 0 : if (yypact_value_is_default (yyn))
1434 0 : goto yydefault;
1435 :
1436 : /* Not known => get a lookahead token if don't already have one. */
1437 :
1438 : /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1439 0 : if (yychar == YYEMPTY)
1440 : {
1441 : YYDPRINTF ((stderr, "Reading a token: "));
1442 0 : yychar = yylex (&yylval, parm);
1443 : }
1444 :
1445 0 : if (yychar <= YYEOF)
1446 : {
1447 0 : yychar = yytoken = YYEOF;
1448 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1449 : }
1450 : else
1451 : {
1452 0 : yytoken = YYTRANSLATE (yychar);
1453 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1454 : }
1455 :
1456 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1457 : detect an error, take that action. */
1458 0 : yyn += yytoken;
1459 0 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1460 : goto yydefault;
1461 0 : yyn = yytable[yyn];
1462 0 : if (yyn <= 0)
1463 : {
1464 : if (yytable_value_is_error (yyn))
1465 : goto yyerrlab;
1466 0 : yyn = -yyn;
1467 0 : goto yyreduce;
1468 : }
1469 :
1470 : /* Count tokens shifted since error; after three, turn off error
1471 : status. */
1472 0 : if (yyerrstatus)
1473 0 : yyerrstatus--;
1474 :
1475 : /* Shift the lookahead token. */
1476 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1477 :
1478 : /* Discard the shifted token. */
1479 0 : yychar = YYEMPTY;
1480 :
1481 0 : yystate = yyn;
1482 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1483 0 : *++yyvsp = yylval;
1484 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1485 :
1486 0 : goto yynewstate;
1487 :
1488 :
1489 : /*-----------------------------------------------------------.
1490 : | yydefault -- do the default action for the current state. |
1491 : `-----------------------------------------------------------*/
1492 : yydefault:
1493 0 : yyn = yydefact[yystate];
1494 0 : if (yyn == 0)
1495 0 : goto yyerrlab;
1496 0 : goto yyreduce;
1497 :
1498 :
1499 : /*-----------------------------.
1500 : | yyreduce -- Do a reduction. |
1501 : `-----------------------------*/
1502 : yyreduce:
1503 : /* yyn is the number of a rule to reduce with. */
1504 0 : yylen = yyr2[yyn];
1505 :
1506 : /* If YYLEN is nonzero, implement the default value of the action:
1507 : '$$ = $1'.
1508 :
1509 : Otherwise, the following line sets YYVAL to garbage.
1510 : This behavior is undocumented and Bison
1511 : users should not rely upon it. Assigning to YYVAL
1512 : unconditionally makes the parser a bit smaller, and it avoids a
1513 : GCC warning that YYVAL may be used uninitialized. */
1514 0 : yyval = yyvsp[1-yylen];
1515 :
1516 :
1517 : YY_REDUCE_PRINT (yyn);
1518 0 : switch (yyn)
1519 : {
1520 : case 4:
1521 : #line 188 "../../src/asn1-parse.y" /* yacc.c:1646 */
1522 : { strcpy((yyval.str),(yyvsp[0].str)); }
1523 : #line 1524 "asn1-parse.c" /* yacc.c:1646 */
1524 0 : break;
1525 :
1526 : case 5:
1527 : #line 189 "../../src/asn1-parse.y" /* yacc.c:1646 */
1528 : { strcpy((yyval.str),(yyvsp[0].str)); }
1529 : #line 1530 "asn1-parse.c" /* yacc.c:1646 */
1530 0 : break;
1531 :
1532 : case 6:
1533 : #line 193 "../../src/asn1-parse.y" /* yacc.c:1646 */
1534 : {
1535 : strcpy((yyval.str),"-");
1536 : strcat((yyval.str),(yyvsp[0].str));
1537 : }
1538 : #line 1539 "asn1-parse.c" /* yacc.c:1646 */
1539 0 : break;
1540 :
1541 : case 7:
1542 : #line 199 "../../src/asn1-parse.y" /* yacc.c:1646 */
1543 : { strcpy((yyval.str),(yyvsp[0].str)); }
1544 : #line 1545 "asn1-parse.c" /* yacc.c:1646 */
1545 0 : break;
1546 :
1547 : case 8:
1548 : #line 200 "../../src/asn1-parse.y" /* yacc.c:1646 */
1549 : { strcpy((yyval.str),(yyvsp[0].str)); }
1550 : #line 1551 "asn1-parse.c" /* yacc.c:1646 */
1551 0 : break;
1552 :
1553 : case 9:
1554 : #line 203 "../../src/asn1-parse.y" /* yacc.c:1646 */
1555 : {strcpy((yyval.str),(yyvsp[0].str));}
1556 : #line 1557 "asn1-parse.c" /* yacc.c:1646 */
1557 0 : break;
1558 :
1559 : case 10:
1560 : #line 204 "../../src/asn1-parse.y" /* yacc.c:1646 */
1561 : {strcpy((yyval.str),(yyvsp[0].str));}
1562 : #line 1563 "asn1-parse.c" /* yacc.c:1646 */
1563 0 : break;
1564 :
1565 : case 11:
1566 : #line 207 "../../src/asn1-parse.y" /* yacc.c:1646 */
1567 : {strcpy((yyval.str),(yyvsp[0].str));}
1568 : #line 1569 "asn1-parse.c" /* yacc.c:1646 */
1569 0 : break;
1570 :
1571 : case 12:
1572 : #line 208 "../../src/asn1-parse.y" /* yacc.c:1646 */
1573 : {strcpy((yyval.str),(yyvsp[0].str));}
1574 : #line 1575 "asn1-parse.c" /* yacc.c:1646 */
1575 0 : break;
1576 :
1577 : case 13:
1578 : #line 212 "../../src/asn1-parse.y" /* yacc.c:1646 */
1579 : {
1580 : (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1581 : set_str_value ((yyval.node), (yyvsp[-1].str));
1582 : }
1583 : #line 1584 "asn1-parse.c" /* yacc.c:1646 */
1584 0 : break;
1585 :
1586 : case 14:
1587 : #line 217 "../../src/asn1-parse.y" /* yacc.c:1646 */
1588 : {
1589 : (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1590 : set_name ((yyval.node), (yyvsp[-3].str));
1591 : set_str_value ((yyval.node), (yyvsp[-1].str));
1592 : }
1593 : #line 1594 "asn1-parse.c" /* yacc.c:1646 */
1594 0 : break;
1595 :
1596 : case 15:
1597 : #line 224 "../../src/asn1-parse.y" /* yacc.c:1646 */
1598 : { (yyval.node)=(yyvsp[0].node); }
1599 : #line 1600 "asn1-parse.c" /* yacc.c:1646 */
1600 0 : break;
1601 :
1602 : case 16:
1603 : #line 226 "../../src/asn1-parse.y" /* yacc.c:1646 */
1604 : {
1605 : (yyval.node) = (yyvsp[-2].node);
1606 : append_right ((yyvsp[-2].node), (yyvsp[0].node));
1607 : }
1608 : #line 1609 "asn1-parse.c" /* yacc.c:1646 */
1609 0 : break;
1610 :
1611 : case 17:
1612 : #line 233 "../../src/asn1-parse.y" /* yacc.c:1646 */
1613 : {
1614 : (yyval.node) = NEW_NODE (TYPE_IDENTIFIER);
1615 : set_name((yyval.node),(yyvsp[0].str));
1616 : }
1617 : #line 1618 "asn1-parse.c" /* yacc.c:1646 */
1618 0 : break;
1619 :
1620 : case 18:
1621 : #line 238 "../../src/asn1-parse.y" /* yacc.c:1646 */
1622 : {
1623 : AsnNode node;
1624 :
1625 : (yyval.node)=(yyvsp[-1].node);
1626 : node = NEW_NODE (TYPE_IDENTIFIER);
1627 : set_name (node, (yyvsp[0].str));
1628 : append_right ((yyval.node), node);
1629 : }
1630 : #line 1631 "asn1-parse.c" /* yacc.c:1646 */
1631 0 : break;
1632 :
1633 : case 19:
1634 : #line 249 "../../src/asn1-parse.y" /* yacc.c:1646 */
1635 : {
1636 : (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1637 : set_str_value ((yyval.node), (yyvsp[0].str));
1638 : }
1639 : #line 1640 "asn1-parse.c" /* yacc.c:1646 */
1640 0 : break;
1641 :
1642 : case 20:
1643 : #line 254 "../../src/asn1-parse.y" /* yacc.c:1646 */
1644 : {
1645 : (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1646 : set_name ((yyval.node), (yyvsp[-3].str));
1647 : set_str_value ((yyval.node), (yyvsp[-1].str));
1648 : }
1649 : #line 1650 "asn1-parse.c" /* yacc.c:1646 */
1650 0 : break;
1651 :
1652 : case 21:
1653 : #line 262 "../../src/asn1-parse.y" /* yacc.c:1646 */
1654 : { (yyval.node)=(yyvsp[0].node);}
1655 : #line 1656 "asn1-parse.c" /* yacc.c:1646 */
1656 0 : break;
1657 :
1658 : case 22:
1659 : #line 264 "../../src/asn1-parse.y" /* yacc.c:1646 */
1660 : {
1661 : (yyval.node)=(yyvsp[-1].node);
1662 : append_right ((yyval.node), (yyvsp[0].node));
1663 : }
1664 : #line 1665 "asn1-parse.c" /* yacc.c:1646 */
1665 0 : break;
1666 :
1667 : case 23:
1668 : #line 270 "../../src/asn1-parse.y" /* yacc.c:1646 */
1669 : { (yyval.constant) = CLASS_UNIVERSAL; }
1670 : #line 1671 "asn1-parse.c" /* yacc.c:1646 */
1671 0 : break;
1672 :
1673 : case 24:
1674 : #line 271 "../../src/asn1-parse.y" /* yacc.c:1646 */
1675 : { (yyval.constant) = CLASS_PRIVATE; }
1676 : #line 1677 "asn1-parse.c" /* yacc.c:1646 */
1677 0 : break;
1678 :
1679 : case 25:
1680 : #line 272 "../../src/asn1-parse.y" /* yacc.c:1646 */
1681 : { (yyval.constant) = CLASS_APPLICATION; }
1682 : #line 1683 "asn1-parse.c" /* yacc.c:1646 */
1683 0 : break;
1684 :
1685 : case 26:
1686 : #line 276 "../../src/asn1-parse.y" /* yacc.c:1646 */
1687 : {
1688 : (yyval.node) = NEW_NODE (TYPE_TAG);
1689 : (yyval.node)->flags.class = CLASS_CONTEXT;
1690 : set_ulong_value ((yyval.node), (yyvsp[-1].str));
1691 : }
1692 : #line 1693 "asn1-parse.c" /* yacc.c:1646 */
1693 0 : break;
1694 :
1695 : case 27:
1696 : #line 282 "../../src/asn1-parse.y" /* yacc.c:1646 */
1697 : {
1698 : (yyval.node) = NEW_NODE (TYPE_TAG);
1699 : (yyval.node)->flags.class = (yyvsp[-2].constant);
1700 : set_ulong_value ((yyval.node), (yyvsp[-1].str));
1701 : }
1702 : #line 1703 "asn1-parse.c" /* yacc.c:1646 */
1703 0 : break;
1704 :
1705 : case 28:
1706 : #line 290 "../../src/asn1-parse.y" /* yacc.c:1646 */
1707 : { (yyval.node) = (yyvsp[0].node); }
1708 : #line 1709 "asn1-parse.c" /* yacc.c:1646 */
1709 0 : break;
1710 :
1711 : case 29:
1712 : #line 292 "../../src/asn1-parse.y" /* yacc.c:1646 */
1713 : {
1714 : (yyval.node) = (yyvsp[-1].node);
1715 : (yyval.node)->flags.explicit = 1;
1716 : }
1717 : #line 1718 "asn1-parse.c" /* yacc.c:1646 */
1718 0 : break;
1719 :
1720 : case 30:
1721 : #line 297 "../../src/asn1-parse.y" /* yacc.c:1646 */
1722 : {
1723 : (yyval.node) = (yyvsp[-1].node);
1724 : (yyval.node)->flags.implicit = 1;
1725 : }
1726 : #line 1727 "asn1-parse.c" /* yacc.c:1646 */
1727 0 : break;
1728 :
1729 : case 31:
1730 : #line 304 "../../src/asn1-parse.y" /* yacc.c:1646 */
1731 : {
1732 : (yyval.node) = NEW_NODE (TYPE_DEFAULT);
1733 : set_str_value ((yyval.node), (yyvsp[0].str));
1734 : }
1735 : #line 1736 "asn1-parse.c" /* yacc.c:1646 */
1736 0 : break;
1737 :
1738 : case 32:
1739 : #line 309 "../../src/asn1-parse.y" /* yacc.c:1646 */
1740 : {
1741 : (yyval.node) = NEW_NODE (TYPE_DEFAULT);
1742 : (yyval.node)->flags.is_true = 1;
1743 : }
1744 : #line 1745 "asn1-parse.c" /* yacc.c:1646 */
1745 0 : break;
1746 :
1747 : case 33:
1748 : #line 314 "../../src/asn1-parse.y" /* yacc.c:1646 */
1749 : {
1750 : (yyval.node) = NEW_NODE (TYPE_DEFAULT);
1751 : (yyval.node)->flags.is_false = 1;
1752 : }
1753 : #line 1754 "asn1-parse.c" /* yacc.c:1646 */
1754 0 : break;
1755 :
1756 : case 34:
1757 : #line 321 "../../src/asn1-parse.y" /* yacc.c:1646 */
1758 : {
1759 : (yyval.node) = NEW_NODE (TYPE_INTEGER);
1760 : }
1761 : #line 1762 "asn1-parse.c" /* yacc.c:1646 */
1762 0 : break;
1763 :
1764 : case 35:
1765 : #line 325 "../../src/asn1-parse.y" /* yacc.c:1646 */
1766 : {
1767 : (yyval.node) = NEW_NODE (TYPE_INTEGER);
1768 : (yyval.node)->flags.has_list = 1;
1769 : set_down ((yyval.node), (yyvsp[-1].node));
1770 : }
1771 : #line 1772 "asn1-parse.c" /* yacc.c:1646 */
1772 0 : break;
1773 :
1774 : case 36:
1775 : #line 331 "../../src/asn1-parse.y" /* yacc.c:1646 */
1776 : {
1777 : (yyval.node) = NEW_NODE (TYPE_INTEGER);
1778 : (yyval.node)->flags.has_min_max = 1;
1779 : /* the following is wrong. Better use a union for the value*/
1780 : set_down ((yyval.node), NEW_NODE (TYPE_SIZE) );
1781 : set_str_value ((yyval.node)->down, (yyvsp[-1].str));
1782 : set_name ((yyval.node)->down, (yyvsp[-4].str));
1783 : }
1784 : #line 1785 "asn1-parse.c" /* yacc.c:1646 */
1785 0 : break;
1786 :
1787 : case 37:
1788 : #line 342 "../../src/asn1-parse.y" /* yacc.c:1646 */
1789 : {
1790 : (yyval.node) = NEW_NODE (TYPE_BOOLEAN);
1791 : }
1792 : #line 1793 "asn1-parse.c" /* yacc.c:1646 */
1793 0 : break;
1794 :
1795 : case 38:
1796 : #line 348 "../../src/asn1-parse.y" /* yacc.c:1646 */
1797 : {
1798 : (yyval.node) = NEW_NODE (TYPE_UTC_TIME);
1799 : }
1800 : #line 1801 "asn1-parse.c" /* yacc.c:1646 */
1801 0 : break;
1802 :
1803 : case 39:
1804 : #line 352 "../../src/asn1-parse.y" /* yacc.c:1646 */
1805 : {
1806 : (yyval.node) = NEW_NODE (TYPE_GENERALIZED_TIME);
1807 : }
1808 : #line 1809 "asn1-parse.c" /* yacc.c:1646 */
1809 0 : break;
1810 :
1811 : case 40:
1812 : #line 358 "../../src/asn1-parse.y" /* yacc.c:1646 */
1813 : {
1814 : (yyval.node) = NEW_NODE (TYPE_SIZE);
1815 : (yyval.node)->flags.one_param = 1;
1816 : set_str_value ((yyval.node), (yyvsp[-1].str));
1817 : }
1818 : #line 1819 "asn1-parse.c" /* yacc.c:1646 */
1819 0 : break;
1820 :
1821 : case 41:
1822 : #line 364 "../../src/asn1-parse.y" /* yacc.c:1646 */
1823 : {
1824 : (yyval.node) = NEW_NODE (TYPE_SIZE);
1825 : (yyval.node)->flags.has_min_max = 1;
1826 : set_str_value ((yyval.node), (yyvsp[-4].str));
1827 : set_name ((yyval.node), (yyvsp[-1].str));
1828 : }
1829 : #line 1830 "asn1-parse.c" /* yacc.c:1646 */
1830 0 : break;
1831 :
1832 : case 42:
1833 : #line 373 "../../src/asn1-parse.y" /* yacc.c:1646 */
1834 : {
1835 : (yyval.node)=(yyvsp[0].node);
1836 : }
1837 : #line 1838 "asn1-parse.c" /* yacc.c:1646 */
1838 0 : break;
1839 :
1840 : case 43:
1841 : #line 377 "../../src/asn1-parse.y" /* yacc.c:1646 */
1842 : {
1843 : (yyval.node)=(yyvsp[-1].node);
1844 : }
1845 : #line 1846 "asn1-parse.c" /* yacc.c:1646 */
1846 0 : break;
1847 :
1848 : case 44:
1849 : #line 383 "../../src/asn1-parse.y" /* yacc.c:1646 */
1850 : {
1851 : (yyval.node) = NEW_NODE (TYPE_OCTET_STRING);
1852 : }
1853 : #line 1854 "asn1-parse.c" /* yacc.c:1646 */
1854 0 : break;
1855 :
1856 : case 45:
1857 : #line 387 "../../src/asn1-parse.y" /* yacc.c:1646 */
1858 : {
1859 : (yyval.node) = NEW_NODE (TYPE_OCTET_STRING);
1860 : (yyval.node)->flags.has_size = 1;
1861 : set_down ((yyval.node),(yyvsp[0].node));
1862 : }
1863 : #line 1864 "asn1-parse.c" /* yacc.c:1646 */
1864 0 : break;
1865 :
1866 : case 46:
1867 : #line 394 "../../src/asn1-parse.y" /* yacc.c:1646 */
1868 : { (yyval.node) = NEW_NODE (TYPE_UTF8_STRING); }
1869 : #line 1870 "asn1-parse.c" /* yacc.c:1646 */
1870 0 : break;
1871 :
1872 : case 47:
1873 : #line 396 "../../src/asn1-parse.y" /* yacc.c:1646 */
1874 : {
1875 : (yyval.node) = NEW_NODE (TYPE_UTF8_STRING);
1876 : (yyval.node)->flags.has_size = 1;
1877 : set_down ((yyval.node),(yyvsp[0].node));
1878 : }
1879 : #line 1880 "asn1-parse.c" /* yacc.c:1646 */
1880 0 : break;
1881 :
1882 : case 48:
1883 : #line 402 "../../src/asn1-parse.y" /* yacc.c:1646 */
1884 : { (yyval.node) = NEW_NODE (TYPE_NUMERIC_STRING); }
1885 : #line 1886 "asn1-parse.c" /* yacc.c:1646 */
1886 0 : break;
1887 :
1888 : case 49:
1889 : #line 404 "../../src/asn1-parse.y" /* yacc.c:1646 */
1890 : {
1891 : (yyval.node) = NEW_NODE (TYPE_NUMERIC_STRING);
1892 : (yyval.node)->flags.has_size = 1;
1893 : set_down ((yyval.node),(yyvsp[0].node));
1894 : }
1895 : #line 1896 "asn1-parse.c" /* yacc.c:1646 */
1896 0 : break;
1897 :
1898 : case 50:
1899 : #line 411 "../../src/asn1-parse.y" /* yacc.c:1646 */
1900 : { (yyval.node) = NEW_NODE (TYPE_PRINTABLE_STRING); }
1901 : #line 1902 "asn1-parse.c" /* yacc.c:1646 */
1902 0 : break;
1903 :
1904 : case 51:
1905 : #line 413 "../../src/asn1-parse.y" /* yacc.c:1646 */
1906 : {
1907 : (yyval.node) = NEW_NODE (TYPE_PRINTABLE_STRING);
1908 : (yyval.node)->flags.has_size = 1;
1909 : set_down ((yyval.node),(yyvsp[0].node));
1910 : }
1911 : #line 1912 "asn1-parse.c" /* yacc.c:1646 */
1912 0 : break;
1913 :
1914 : case 52:
1915 : #line 420 "../../src/asn1-parse.y" /* yacc.c:1646 */
1916 : { (yyval.node) = NEW_NODE (TYPE_TELETEX_STRING); }
1917 : #line 1918 "asn1-parse.c" /* yacc.c:1646 */
1918 0 : break;
1919 :
1920 : case 53:
1921 : #line 422 "../../src/asn1-parse.y" /* yacc.c:1646 */
1922 : {
1923 : (yyval.node) = NEW_NODE (TYPE_TELETEX_STRING);
1924 : (yyval.node)->flags.has_size = 1;
1925 : set_down ((yyval.node),(yyvsp[0].node));
1926 : }
1927 : #line 1928 "asn1-parse.c" /* yacc.c:1646 */
1928 0 : break;
1929 :
1930 : case 54:
1931 : #line 428 "../../src/asn1-parse.y" /* yacc.c:1646 */
1932 : { (yyval.node) = NEW_NODE (TYPE_IA5_STRING); }
1933 : #line 1934 "asn1-parse.c" /* yacc.c:1646 */
1934 0 : break;
1935 :
1936 : case 55:
1937 : #line 430 "../../src/asn1-parse.y" /* yacc.c:1646 */
1938 : {
1939 : (yyval.node) = NEW_NODE (TYPE_IA5_STRING);
1940 : (yyval.node)->flags.has_size = 1;
1941 : set_down ((yyval.node),(yyvsp[0].node));
1942 : }
1943 : #line 1944 "asn1-parse.c" /* yacc.c:1646 */
1944 0 : break;
1945 :
1946 : case 56:
1947 : #line 437 "../../src/asn1-parse.y" /* yacc.c:1646 */
1948 : { (yyval.node) = NEW_NODE (TYPE_UNIVERSAL_STRING); }
1949 : #line 1950 "asn1-parse.c" /* yacc.c:1646 */
1950 0 : break;
1951 :
1952 : case 57:
1953 : #line 439 "../../src/asn1-parse.y" /* yacc.c:1646 */
1954 : {
1955 : (yyval.node) = NEW_NODE (TYPE_UNIVERSAL_STRING);
1956 : (yyval.node)->flags.has_size = 1;
1957 : set_down ((yyval.node),(yyvsp[0].node));
1958 : }
1959 : #line 1960 "asn1-parse.c" /* yacc.c:1646 */
1960 0 : break;
1961 :
1962 : case 58:
1963 : #line 445 "../../src/asn1-parse.y" /* yacc.c:1646 */
1964 : { (yyval.node) = NEW_NODE (TYPE_BMP_STRING); }
1965 : #line 1966 "asn1-parse.c" /* yacc.c:1646 */
1966 0 : break;
1967 :
1968 : case 59:
1969 : #line 447 "../../src/asn1-parse.y" /* yacc.c:1646 */
1970 : {
1971 : (yyval.node) = NEW_NODE (TYPE_BMP_STRING);
1972 : (yyval.node)->flags.has_size = 1;
1973 : set_down ((yyval.node),(yyvsp[0].node));
1974 : }
1975 : #line 1976 "asn1-parse.c" /* yacc.c:1646 */
1976 0 : break;
1977 :
1978 : case 67:
1979 : #line 468 "../../src/asn1-parse.y" /* yacc.c:1646 */
1980 : {
1981 : (yyval.node) = NEW_NODE (TYPE_CONSTANT);
1982 : set_name ((yyval.node), (yyvsp[-3].str));
1983 : set_str_value ((yyval.node), (yyvsp[-1].str));
1984 : }
1985 : #line 1986 "asn1-parse.c" /* yacc.c:1646 */
1986 0 : break;
1987 :
1988 : case 68:
1989 : #line 476 "../../src/asn1-parse.y" /* yacc.c:1646 */
1990 : {
1991 : (yyval.node)=(yyvsp[0].node);
1992 : }
1993 : #line 1994 "asn1-parse.c" /* yacc.c:1646 */
1994 0 : break;
1995 :
1996 : case 69:
1997 : #line 480 "../../src/asn1-parse.y" /* yacc.c:1646 */
1998 : {
1999 : (yyval.node)=(yyvsp[-2].node);
2000 : append_right ((yyval.node), (yyvsp[0].node));
2001 : }
2002 : #line 2003 "asn1-parse.c" /* yacc.c:1646 */
2003 0 : break;
2004 :
2005 : case 70:
2006 : #line 487 "../../src/asn1-parse.y" /* yacc.c:1646 */
2007 : {
2008 : (yyval.node) = NEW_NODE (TYPE_BIT_STRING);
2009 : }
2010 : #line 2011 "asn1-parse.c" /* yacc.c:1646 */
2011 0 : break;
2012 :
2013 : case 71:
2014 : #line 491 "../../src/asn1-parse.y" /* yacc.c:1646 */
2015 : {
2016 : (yyval.node) = NEW_NODE (TYPE_BIT_STRING);
2017 : (yyval.node)->flags.has_list = 1;
2018 : set_down ((yyval.node), (yyvsp[-1].node));
2019 : }
2020 : #line 2021 "asn1-parse.c" /* yacc.c:1646 */
2021 0 : break;
2022 :
2023 : case 72:
2024 : #line 499 "../../src/asn1-parse.y" /* yacc.c:1646 */
2025 : {
2026 : (yyval.node) = NEW_NODE (TYPE_ENUMERATED);
2027 : (yyval.node)->flags.has_list = 1;
2028 : set_down ((yyval.node), (yyvsp[-1].node));
2029 : }
2030 : #line 2031 "asn1-parse.c" /* yacc.c:1646 */
2031 0 : break;
2032 :
2033 : case 73:
2034 : #line 507 "../../src/asn1-parse.y" /* yacc.c:1646 */
2035 : {
2036 : (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2037 : }
2038 : #line 2039 "asn1-parse.c" /* yacc.c:1646 */
2039 0 : break;
2040 :
2041 : case 74:
2042 : #line 513 "../../src/asn1-parse.y" /* yacc.c:1646 */
2043 : {
2044 : (yyval.node) = NEW_NODE (TYPE_IDENTIFIER);
2045 : set_str_value ((yyval.node), (yyvsp[0].str));
2046 : }
2047 : #line 2048 "asn1-parse.c" /* yacc.c:1646 */
2048 0 : break;
2049 :
2050 : case 75:
2051 : #line 518 "../../src/asn1-parse.y" /* yacc.c:1646 */
2052 : {
2053 : (yyval.node) = NEW_NODE (TYPE_IDENTIFIER);
2054 : (yyval.node)->flags.has_size = 1;
2055 : set_str_value ((yyval.node), (yyvsp[-1].str));
2056 : set_down ((yyval.node), (yyvsp[0].node));
2057 : }
2058 : #line 2059 "asn1-parse.c" /* yacc.c:1646 */
2059 0 : break;
2060 :
2061 : case 76:
2062 : #line 524 "../../src/asn1-parse.y" /* yacc.c:1646 */
2063 : {(yyval.node)=(yyvsp[0].node);}
2064 : #line 2065 "asn1-parse.c" /* yacc.c:1646 */
2065 0 : break;
2066 :
2067 : case 77:
2068 : #line 525 "../../src/asn1-parse.y" /* yacc.c:1646 */
2069 : {(yyval.node)=(yyvsp[0].node);}
2070 : #line 2071 "asn1-parse.c" /* yacc.c:1646 */
2071 0 : break;
2072 :
2073 : case 78:
2074 : #line 526 "../../src/asn1-parse.y" /* yacc.c:1646 */
2075 : {(yyval.node)=(yyvsp[0].node);}
2076 : #line 2077 "asn1-parse.c" /* yacc.c:1646 */
2077 0 : break;
2078 :
2079 : case 79:
2080 : #line 527 "../../src/asn1-parse.y" /* yacc.c:1646 */
2081 : {(yyval.node)=(yyvsp[0].node);}
2082 : #line 2083 "asn1-parse.c" /* yacc.c:1646 */
2083 0 : break;
2084 :
2085 : case 81:
2086 : #line 529 "../../src/asn1-parse.y" /* yacc.c:1646 */
2087 : {(yyval.node)=(yyvsp[0].node);}
2088 : #line 2089 "asn1-parse.c" /* yacc.c:1646 */
2089 0 : break;
2090 :
2091 : case 82:
2092 : #line 530 "../../src/asn1-parse.y" /* yacc.c:1646 */
2093 : {(yyval.node)=(yyvsp[0].node);}
2094 : #line 2095 "asn1-parse.c" /* yacc.c:1646 */
2095 0 : break;
2096 :
2097 : case 83:
2098 : #line 531 "../../src/asn1-parse.y" /* yacc.c:1646 */
2099 : {(yyval.node)=(yyvsp[0].node);}
2100 : #line 2101 "asn1-parse.c" /* yacc.c:1646 */
2101 0 : break;
2102 :
2103 : case 84:
2104 : #line 532 "../../src/asn1-parse.y" /* yacc.c:1646 */
2105 : {(yyval.node)=(yyvsp[0].node);}
2106 : #line 2107 "asn1-parse.c" /* yacc.c:1646 */
2107 0 : break;
2108 :
2109 : case 85:
2110 : #line 533 "../../src/asn1-parse.y" /* yacc.c:1646 */
2111 : {(yyval.node)=(yyvsp[0].node);}
2112 : #line 2113 "asn1-parse.c" /* yacc.c:1646 */
2113 0 : break;
2114 :
2115 : case 86:
2116 : #line 534 "../../src/asn1-parse.y" /* yacc.c:1646 */
2117 : {(yyval.node)=(yyvsp[0].node);}
2118 : #line 2119 "asn1-parse.c" /* yacc.c:1646 */
2119 0 : break;
2120 :
2121 : case 87:
2122 : #line 535 "../../src/asn1-parse.y" /* yacc.c:1646 */
2123 : {(yyval.node)=(yyvsp[0].node);}
2124 : #line 2125 "asn1-parse.c" /* yacc.c:1646 */
2125 0 : break;
2126 :
2127 : case 88:
2128 : #line 537 "../../src/asn1-parse.y" /* yacc.c:1646 */
2129 : {
2130 : (yyval.node) = NEW_NODE(TYPE_NULL);
2131 : }
2132 : #line 2133 "asn1-parse.c" /* yacc.c:1646 */
2133 0 : break;
2134 :
2135 : case 89:
2136 : #line 543 "../../src/asn1-parse.y" /* yacc.c:1646 */
2137 : {
2138 : (yyval.node) = (yyvsp[0].node);
2139 : }
2140 : #line 2141 "asn1-parse.c" /* yacc.c:1646 */
2141 0 : break;
2142 :
2143 : case 90:
2144 : #line 547 "../../src/asn1-parse.y" /* yacc.c:1646 */
2145 : {
2146 : /* $2->flags.has_tag = 1; */
2147 : /* $$ = $2; */
2148 : /* set_right ($1, $$->down ); */
2149 : /* set_down ($$, $1); */
2150 : (yyval.node) = (yyvsp[-1].node);
2151 : set_down ((yyval.node), (yyvsp[0].node));
2152 : }
2153 : #line 2154 "asn1-parse.c" /* yacc.c:1646 */
2154 0 : break;
2155 :
2156 : case 91:
2157 : #line 558 "../../src/asn1-parse.y" /* yacc.c:1646 */
2158 : {
2159 : (yyval.node) = (yyvsp[0].node);
2160 : }
2161 : #line 2162 "asn1-parse.c" /* yacc.c:1646 */
2162 0 : break;
2163 :
2164 : case 92:
2165 : #line 562 "../../src/asn1-parse.y" /* yacc.c:1646 */
2166 : {
2167 : (yyvsp[-1].node)->flags.has_default = 1;
2168 : (yyval.node) = (yyvsp[-1].node);
2169 : set_right ((yyvsp[0].node), (yyval.node)->down);
2170 : set_down ((yyval.node), (yyvsp[0].node));
2171 : }
2172 : #line 2173 "asn1-parse.c" /* yacc.c:1646 */
2173 0 : break;
2174 :
2175 : case 93:
2176 : #line 569 "../../src/asn1-parse.y" /* yacc.c:1646 */
2177 : {
2178 : (yyvsp[-1].node)->flags.is_optional = 1;
2179 : (yyval.node) = (yyvsp[-1].node);
2180 : }
2181 : #line 2182 "asn1-parse.c" /* yacc.c:1646 */
2182 0 : break;
2183 :
2184 : case 94:
2185 : #line 576 "../../src/asn1-parse.y" /* yacc.c:1646 */
2186 : {
2187 : set_name ((yyvsp[0].node), (yyvsp[-1].str));
2188 : (yyval.node) = (yyvsp[0].node);
2189 : }
2190 : #line 2191 "asn1-parse.c" /* yacc.c:1646 */
2191 0 : break;
2192 :
2193 : case 95:
2194 : #line 583 "../../src/asn1-parse.y" /* yacc.c:1646 */
2195 : { (yyval.node)=(yyvsp[0].node); }
2196 : #line 2197 "asn1-parse.c" /* yacc.c:1646 */
2197 0 : break;
2198 :
2199 : case 96:
2200 : #line 585 "../../src/asn1-parse.y" /* yacc.c:1646 */
2201 : {
2202 : (yyval.node)=(yyvsp[-2].node);
2203 : append_right ((yyval.node), (yyvsp[0].node));
2204 : }
2205 : #line 2206 "asn1-parse.c" /* yacc.c:1646 */
2206 0 : break;
2207 :
2208 : case 97:
2209 : #line 592 "../../src/asn1-parse.y" /* yacc.c:1646 */
2210 : {
2211 : (yyval.node) = NEW_NODE (TYPE_SEQUENCE);
2212 : set_down ((yyval.node), (yyvsp[-1].node));
2213 : }
2214 : #line 2215 "asn1-parse.c" /* yacc.c:1646 */
2215 0 : break;
2216 :
2217 : case 98:
2218 : #line 597 "../../src/asn1-parse.y" /* yacc.c:1646 */
2219 : {
2220 : (yyval.node) = NEW_NODE (TYPE_SEQUENCE_OF);
2221 : set_down ((yyval.node), (yyvsp[0].node));
2222 : }
2223 : #line 2224 "asn1-parse.c" /* yacc.c:1646 */
2224 0 : break;
2225 :
2226 : case 99:
2227 : #line 602 "../../src/asn1-parse.y" /* yacc.c:1646 */
2228 : {
2229 : (yyval.node) = NEW_NODE (TYPE_SEQUENCE_OF);
2230 : (yyval.node)->flags.has_size = 1;
2231 : set_right ((yyvsp[-2].node),(yyvsp[0].node));
2232 : set_down ((yyval.node),(yyvsp[-2].node));
2233 : }
2234 : #line 2235 "asn1-parse.c" /* yacc.c:1646 */
2235 0 : break;
2236 :
2237 : case 100:
2238 : #line 611 "../../src/asn1-parse.y" /* yacc.c:1646 */
2239 : {
2240 : (yyval.node) = NEW_NODE (TYPE_SET);
2241 : set_down ((yyval.node), (yyvsp[-1].node));
2242 : }
2243 : #line 2244 "asn1-parse.c" /* yacc.c:1646 */
2244 0 : break;
2245 :
2246 : case 101:
2247 : #line 616 "../../src/asn1-parse.y" /* yacc.c:1646 */
2248 : {
2249 : (yyval.node) = NEW_NODE (TYPE_SET_OF);
2250 : set_down ((yyval.node), (yyvsp[0].node));
2251 : }
2252 : #line 2253 "asn1-parse.c" /* yacc.c:1646 */
2253 0 : break;
2254 :
2255 : case 102:
2256 : #line 621 "../../src/asn1-parse.y" /* yacc.c:1646 */
2257 : {
2258 : (yyval.node) = NEW_NODE (TYPE_SET_OF);
2259 : (yyval.node)->flags.has_size = 1;
2260 : set_right ((yyvsp[-2].node), (yyvsp[0].node));
2261 : set_down ((yyval.node), (yyvsp[-2].node));
2262 : }
2263 : #line 2264 "asn1-parse.c" /* yacc.c:1646 */
2264 0 : break;
2265 :
2266 : case 103:
2267 : #line 630 "../../src/asn1-parse.y" /* yacc.c:1646 */
2268 : {
2269 : (yyval.node) = NEW_NODE (TYPE_CHOICE);
2270 : set_down ((yyval.node), (yyvsp[-1].node));
2271 : }
2272 : #line 2273 "asn1-parse.c" /* yacc.c:1646 */
2273 0 : break;
2274 :
2275 : case 104:
2276 : #line 637 "../../src/asn1-parse.y" /* yacc.c:1646 */
2277 : {
2278 : (yyval.node) = NEW_NODE (TYPE_ANY);
2279 : }
2280 : #line 2281 "asn1-parse.c" /* yacc.c:1646 */
2281 0 : break;
2282 :
2283 : case 105:
2284 : #line 641 "../../src/asn1-parse.y" /* yacc.c:1646 */
2285 : {
2286 : AsnNode node;
2287 :
2288 : (yyval.node) = NEW_NODE (TYPE_ANY);
2289 : (yyval.node)->flags.has_defined_by = 1;
2290 : node = NEW_NODE (TYPE_CONSTANT);
2291 : set_name (node, (yyvsp[0].str));
2292 : set_down((yyval.node), node);
2293 : }
2294 : #line 2295 "asn1-parse.c" /* yacc.c:1646 */
2295 0 : break;
2296 :
2297 : case 106:
2298 : #line 653 "../../src/asn1-parse.y" /* yacc.c:1646 */
2299 : {
2300 : set_name ((yyvsp[0].node), (yyvsp[-2].str));
2301 : (yyval.node) = (yyvsp[0].node);
2302 : }
2303 : #line 2304 "asn1-parse.c" /* yacc.c:1646 */
2304 0 : break;
2305 :
2306 : case 107:
2307 : #line 660 "../../src/asn1-parse.y" /* yacc.c:1646 */
2308 : {
2309 : (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2310 : (yyval.node)->flags.assignment = 1;
2311 : set_name ((yyval.node), (yyvsp[-6].str));
2312 : set_down ((yyval.node), (yyvsp[-1].node));
2313 : }
2314 : #line 2315 "asn1-parse.c" /* yacc.c:1646 */
2315 0 : break;
2316 :
2317 : case 108:
2318 : #line 667 "../../src/asn1-parse.y" /* yacc.c:1646 */
2319 : {
2320 : (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2321 : (yyval.node)->flags.assignment = 1;
2322 : (yyval.node)->flags.one_param = 1;
2323 : set_name ((yyval.node), (yyvsp[-5].str));
2324 : set_str_value ((yyval.node), (yyvsp[-4].str));
2325 : set_down ((yyval.node), (yyvsp[-1].node));
2326 : }
2327 : #line 2328 "asn1-parse.c" /* yacc.c:1646 */
2328 0 : break;
2329 :
2330 : case 109:
2331 : #line 676 "../../src/asn1-parse.y" /* yacc.c:1646 */
2332 : {
2333 : (yyval.node) = NEW_NODE (TYPE_INTEGER);
2334 : (yyval.node)->flags.assignment = 1;
2335 : set_name ((yyval.node), (yyvsp[-3].str));
2336 : set_str_value ((yyval.node), (yyvsp[0].str));
2337 : }
2338 : #line 2339 "asn1-parse.c" /* yacc.c:1646 */
2339 0 : break;
2340 :
2341 : case 110:
2342 : #line 684 "../../src/asn1-parse.y" /* yacc.c:1646 */
2343 : { (yyval.node) = (yyvsp[0].node); }
2344 : #line 2345 "asn1-parse.c" /* yacc.c:1646 */
2345 0 : break;
2346 :
2347 : case 111:
2348 : #line 685 "../../src/asn1-parse.y" /* yacc.c:1646 */
2349 : { (yyval.node) = (yyvsp[0].node); }
2350 : #line 2351 "asn1-parse.c" /* yacc.c:1646 */
2351 0 : break;
2352 :
2353 : case 112:
2354 : #line 689 "../../src/asn1-parse.y" /* yacc.c:1646 */
2355 : { (yyval.node) = (yyvsp[0].node); }
2356 : #line 2357 "asn1-parse.c" /* yacc.c:1646 */
2357 0 : break;
2358 :
2359 : case 113:
2360 : #line 691 "../../src/asn1-parse.y" /* yacc.c:1646 */
2361 : {
2362 : (yyval.node) = (yyvsp[-1].node);
2363 : append_right ((yyval.node), (yyvsp[0].node));
2364 : }
2365 : #line 2366 "asn1-parse.c" /* yacc.c:1646 */
2366 0 : break;
2367 :
2368 : case 114:
2369 : #line 698 "../../src/asn1-parse.y" /* yacc.c:1646 */
2370 : {
2371 : (yyval.node) = NEW_NODE (TYPE_OBJECT_ID);
2372 : set_down ((yyval.node), (yyvsp[-1].node));
2373 : set_name ((yyval.node), (yyvsp[-3].str));
2374 : }
2375 : #line 2376 "asn1-parse.c" /* yacc.c:1646 */
2376 0 : break;
2377 :
2378 : case 115:
2379 : #line 706 "../../src/asn1-parse.y" /* yacc.c:1646 */
2380 : { (yyval.node)=NULL;}
2381 : #line 2382 "asn1-parse.c" /* yacc.c:1646 */
2382 0 : break;
2383 :
2384 : case 116:
2385 : #line 708 "../../src/asn1-parse.y" /* yacc.c:1646 */
2386 : {
2387 : AsnNode node;
2388 :
2389 : (yyval.node) = NEW_NODE (TYPE_IMPORTS);
2390 : node = NEW_NODE (TYPE_OBJECT_ID);
2391 : set_name (node, (yyvsp[-1].str));
2392 : set_down (node, (yyvsp[0].node));
2393 : set_down ((yyval.node), node);
2394 : set_right ((yyval.node), (yyvsp[-3].node));
2395 : }
2396 : #line 2397 "asn1-parse.c" /* yacc.c:1646 */
2397 0 : break;
2398 :
2399 : case 117:
2400 : #line 720 "../../src/asn1-parse.y" /* yacc.c:1646 */
2401 : { (yyval.constant) = CONST_EXPLICIT; }
2402 : #line 2403 "asn1-parse.c" /* yacc.c:1646 */
2403 0 : break;
2404 :
2405 : case 118:
2406 : #line 721 "../../src/asn1-parse.y" /* yacc.c:1646 */
2407 : { (yyval.constant) = CONST_IMPLICIT; }
2408 : #line 2409 "asn1-parse.c" /* yacc.c:1646 */
2409 0 : break;
2410 :
2411 : case 119:
2412 : #line 727 "../../src/asn1-parse.y" /* yacc.c:1646 */
2413 : {
2414 : AsnNode node;
2415 :
2416 : (yyval.node) = node = NEW_NODE (TYPE_DEFINITIONS);
2417 :
2418 : if ((yyvsp[-6].constant) == CONST_EXPLICIT)
2419 : node->flags.explicit = 1;
2420 : else if ((yyvsp[-6].constant) == CONST_IMPLICIT)
2421 : node->flags.implicit = 1;
2422 :
2423 : if ((yyvsp[-2].node))
2424 : node->flags.has_imports = 1;
2425 :
2426 : set_name ((yyval.node), (yyvsp[-8].node)->name);
2427 : set_name ((yyvsp[-8].node), "");
2428 :
2429 : if (!node->flags.has_imports)
2430 : set_right ((yyvsp[-8].node),(yyvsp[-1].node));
2431 : else
2432 : {
2433 : set_right ((yyvsp[-2].node),(yyvsp[-1].node));
2434 : set_right ((yyvsp[-8].node),(yyvsp[-2].node));
2435 : }
2436 :
2437 : set_down ((yyval.node), (yyvsp[-8].node));
2438 :
2439 : _ksba_asn_set_default_tag ((yyval.node));
2440 : _ksba_asn_type_set_config ((yyval.node));
2441 : PARSECTL->result_parse = _ksba_asn_check_identifier((yyval.node));
2442 : PARSECTL->parse_tree=(yyval.node);
2443 : }
2444 : #line 2445 "asn1-parse.c" /* yacc.c:1646 */
2445 0 : break;
2446 :
2447 :
2448 : #line 2449 "asn1-parse.c" /* yacc.c:1646 */
2449 0 : default: break;
2450 : }
2451 : /* User semantic actions sometimes alter yychar, and that requires
2452 : that yytoken be updated with the new translation. We take the
2453 : approach of translating immediately before every use of yytoken.
2454 : One alternative is translating here after every semantic action,
2455 : but that translation would be missed if the semantic action invokes
2456 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2457 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2458 : incorrect destructor might then be invoked immediately. In the
2459 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
2460 : to an incorrect destructor call or verbose syntax error message
2461 : before the lookahead is translated. */
2462 : YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2463 :
2464 0 : YYPOPSTACK (yylen);
2465 0 : yylen = 0;
2466 : YY_STACK_PRINT (yyss, yyssp);
2467 :
2468 0 : *++yyvsp = yyval;
2469 :
2470 : /* Now 'shift' the result of the reduction. Determine what state
2471 : that goes to, based on the state we popped back to and the rule
2472 : number reduced by. */
2473 :
2474 0 : yyn = yyr1[yyn];
2475 :
2476 0 : yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2477 0 : if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2478 0 : yystate = yytable[yystate];
2479 : else
2480 0 : yystate = yydefgoto[yyn - YYNTOKENS];
2481 :
2482 0 : goto yynewstate;
2483 :
2484 :
2485 : /*--------------------------------------.
2486 : | yyerrlab -- here on detecting error. |
2487 : `--------------------------------------*/
2488 : yyerrlab:
2489 : /* Make sure we have latest lookahead translation. See comments at
2490 : user semantic actions for why this is necessary. */
2491 0 : yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2492 :
2493 : /* If not already recovering from an error, report this error. */
2494 0 : if (!yyerrstatus)
2495 : {
2496 0 : ++yynerrs;
2497 : #if ! YYERROR_VERBOSE
2498 : yyerror (parm, YY_("syntax error"));
2499 : #else
2500 : # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2501 : yyssp, yytoken)
2502 : {
2503 0 : char const *yymsgp = YY_("syntax error");
2504 : int yysyntax_error_status;
2505 0 : yysyntax_error_status = YYSYNTAX_ERROR;
2506 0 : if (yysyntax_error_status == 0)
2507 0 : yymsgp = yymsg;
2508 0 : else if (yysyntax_error_status == 1)
2509 : {
2510 0 : if (yymsg != yymsgbuf)
2511 0 : YYSTACK_FREE (yymsg);
2512 0 : yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2513 0 : if (!yymsg)
2514 : {
2515 0 : yymsg = yymsgbuf;
2516 0 : yymsg_alloc = sizeof yymsgbuf;
2517 0 : yysyntax_error_status = 2;
2518 : }
2519 : else
2520 : {
2521 0 : yysyntax_error_status = YYSYNTAX_ERROR;
2522 0 : yymsgp = yymsg;
2523 : }
2524 : }
2525 0 : yyerror (parm, yymsgp);
2526 0 : if (yysyntax_error_status == 2)
2527 0 : goto yyexhaustedlab;
2528 : }
2529 : # undef YYSYNTAX_ERROR
2530 : #endif
2531 : }
2532 :
2533 :
2534 :
2535 0 : if (yyerrstatus == 3)
2536 : {
2537 : /* If just tried and failed to reuse lookahead token after an
2538 : error, discard it. */
2539 :
2540 0 : if (yychar <= YYEOF)
2541 : {
2542 : /* Return failure if at end of input. */
2543 0 : if (yychar == YYEOF)
2544 0 : YYABORT;
2545 : }
2546 : else
2547 : {
2548 0 : yydestruct ("Error: discarding",
2549 : yytoken, &yylval, parm);
2550 0 : yychar = YYEMPTY;
2551 : }
2552 : }
2553 :
2554 : /* Else will try to reuse lookahead token after shifting the error
2555 : token. */
2556 0 : goto yyerrlab1;
2557 :
2558 :
2559 : /*---------------------------------------------------.
2560 : | yyerrorlab -- error raised explicitly by YYERROR. |
2561 : `---------------------------------------------------*/
2562 : yyerrorlab:
2563 :
2564 : /* Pacify compilers like GCC when the user code never invokes
2565 : YYERROR and the label yyerrorlab therefore never appears in user
2566 : code. */
2567 : if (/*CONSTCOND*/ 0)
2568 : goto yyerrorlab;
2569 :
2570 : /* Do not reclaim the symbols of the rule whose action triggered
2571 : this YYERROR. */
2572 : YYPOPSTACK (yylen);
2573 : yylen = 0;
2574 : YY_STACK_PRINT (yyss, yyssp);
2575 : yystate = *yyssp;
2576 : goto yyerrlab1;
2577 :
2578 :
2579 : /*-------------------------------------------------------------.
2580 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
2581 : `-------------------------------------------------------------*/
2582 : yyerrlab1:
2583 0 : yyerrstatus = 3; /* Each real token shifted decrements this. */
2584 :
2585 : for (;;)
2586 : {
2587 0 : yyn = yypact[yystate];
2588 0 : if (!yypact_value_is_default (yyn))
2589 : {
2590 0 : yyn += YYTERROR;
2591 0 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2592 : {
2593 0 : yyn = yytable[yyn];
2594 0 : if (0 < yyn)
2595 0 : break;
2596 : }
2597 : }
2598 :
2599 : /* Pop the current state because it cannot handle the error token. */
2600 0 : if (yyssp == yyss)
2601 0 : YYABORT;
2602 :
2603 :
2604 0 : yydestruct ("Error: popping",
2605 0 : yystos[yystate], yyvsp, parm);
2606 0 : YYPOPSTACK (1);
2607 0 : yystate = *yyssp;
2608 : YY_STACK_PRINT (yyss, yyssp);
2609 0 : }
2610 :
2611 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2612 0 : *++yyvsp = yylval;
2613 : YY_IGNORE_MAYBE_UNINITIALIZED_END
2614 :
2615 :
2616 : /* Shift the error token. */
2617 : YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2618 :
2619 0 : yystate = yyn;
2620 0 : goto yynewstate;
2621 :
2622 :
2623 : /*-------------------------------------.
2624 : | yyacceptlab -- YYACCEPT comes here. |
2625 : `-------------------------------------*/
2626 : yyacceptlab:
2627 0 : yyresult = 0;
2628 0 : goto yyreturn;
2629 :
2630 : /*-----------------------------------.
2631 : | yyabortlab -- YYABORT comes here. |
2632 : `-----------------------------------*/
2633 : yyabortlab:
2634 0 : yyresult = 1;
2635 0 : goto yyreturn;
2636 :
2637 : #if !defined yyoverflow || YYERROR_VERBOSE
2638 : /*-------------------------------------------------.
2639 : | yyexhaustedlab -- memory exhaustion comes here. |
2640 : `-------------------------------------------------*/
2641 : yyexhaustedlab:
2642 0 : yyerror (parm, YY_("memory exhausted"));
2643 0 : yyresult = 2;
2644 : /* Fall through. */
2645 : #endif
2646 :
2647 : yyreturn:
2648 0 : if (yychar != YYEMPTY)
2649 : {
2650 : /* Make sure we have latest lookahead translation. See comments at
2651 : user semantic actions for why this is necessary. */
2652 0 : yytoken = YYTRANSLATE (yychar);
2653 0 : yydestruct ("Cleanup: discarding lookahead",
2654 : yytoken, &yylval, parm);
2655 : }
2656 : /* Do not reclaim the symbols of the rule whose action triggered
2657 : this YYABORT or YYACCEPT. */
2658 0 : YYPOPSTACK (yylen);
2659 : YY_STACK_PRINT (yyss, yyssp);
2660 0 : while (yyssp != yyss)
2661 : {
2662 0 : yydestruct ("Cleanup: popping",
2663 0 : yystos[*yyssp], yyvsp, parm);
2664 0 : YYPOPSTACK (1);
2665 : }
2666 : #ifndef yyoverflow
2667 0 : if (yyss != yyssa)
2668 0 : YYSTACK_FREE (yyss);
2669 : #endif
2670 : #if YYERROR_VERBOSE
2671 0 : if (yymsg != yymsgbuf)
2672 0 : YYSTACK_FREE (yymsg);
2673 : #endif
2674 0 : return yyresult;
2675 : }
2676 : #line 760 "../../src/asn1-parse.y" /* yacc.c:1906 */
2677 :
2678 :
2679 :
2680 : /*************************************************************/
2681 : /* Function: yylex */
2682 : /* Description: looks for tokens in file_asn1 pointer file. */
2683 : /* Return: int */
2684 : /* Token identifier or ASCII code or 0(zero: End Of File) */
2685 : /*************************************************************/
2686 : static int
2687 : yylex (YYSTYPE *lvalp, void *parm)
2688 : {
2689 : int c,counter=0,k;
2690 : char string[MAX_STRING_LENGTH];
2691 : size_t len;
2692 : FILE *fp = PARSECTL->fp;
2693 :
2694 : if (!PARSECTL->lineno)
2695 : PARSECTL->lineno++; /* start with line one */
2696 :
2697 : while (1)
2698 : {
2699 : while ( (c=fgetc (fp))==' ' || c=='\t')
2700 : ;
2701 : if (c =='\n')
2702 : {
2703 : PARSECTL->lineno++;
2704 : continue;
2705 : }
2706 : if(c==EOF)
2707 : return 0;
2708 :
2709 : if ( c=='(' || c==')' || c=='[' || c==']'
2710 : || c=='{' || c=='}' || c==',' || c=='.' || c=='+')
2711 : return c;
2712 :
2713 : if (c=='-')
2714 : {
2715 : if ( (c=fgetc(fp))!='-')
2716 : {
2717 : ungetc(c,fp);
2718 : return '-';
2719 : }
2720 : else
2721 : {
2722 : /* A comment finishes at the end of line */
2723 : counter=0;
2724 : while ( (c=fgetc(fp))!=EOF && c != '\n' )
2725 : ;
2726 : if (c==EOF)
2727 : return 0;
2728 : else
2729 : continue; /* repeat the search */
2730 : }
2731 : }
2732 :
2733 : do
2734 : {
2735 : if (counter >= DIM (string)-1 )
2736 : {
2737 : fprintf (stderr,"%s:%d: token too long\n", "myfile:",
2738 : PARSECTL->lineno);
2739 : return 0; /* EOF */
2740 : }
2741 : string[counter++]=c;
2742 : }
2743 : while ( !((c=fgetc(fp))==EOF
2744 : || c==' '|| c=='\t' || c=='\n'
2745 : || c=='(' || c==')' || c=='[' || c==']'
2746 : || c=='{' || c=='}' || c==',' || c=='.'));
2747 :
2748 : ungetc (c,fp);
2749 : string[counter]=0;
2750 : /*fprintf (stderr, "yylex token `%s'\n", string);*/
2751 :
2752 : /* Is STRING a number? */
2753 : for (k=0; k<counter; k++)
2754 : {
2755 : if(!isdigit(string[k]))
2756 : break;
2757 : }
2758 : if (k>=counter)
2759 : {
2760 : strcpy (lvalp->str,string);
2761 : if (PARSECTL->debug)
2762 : fprintf (stderr,"%d: yylex found number `%s'\n",
2763 : PARSECTL->lineno, string);
2764 : return NUM;
2765 : }
2766 :
2767 : /* Is STRING a keyword? */
2768 : len = strlen (string);
2769 : for (k = 0; k < YYNTOKENS; k++)
2770 : {
2771 : if (yytname[k] && yytname[k][0] == '\"'
2772 : && !strncmp (yytname[k] + 1, string, len)
2773 : && yytname[k][len + 1] == '\"' && !yytname[k][len + 2])
2774 : return yytoknum[k];
2775 : }
2776 :
2777 : /* STRING is an IDENTIFIER */
2778 : strcpy(lvalp->str,string);
2779 : if (PARSECTL->debug)
2780 : fprintf (stderr,"%d: yylex found identifier `%s'\n",
2781 : PARSECTL->lineno, string);
2782 : return IDENTIFIER;
2783 : }
2784 : }
2785 :
2786 : static void
2787 : yyerror (void *parm, const char *s)
2788 : {
2789 : (void)parm;
2790 : /* Sends the error description to stderr */
2791 : fprintf (stderr, "%s\n", s);
2792 : /* Why doesn't bison provide a way to pass the parm to yyerror?
2793 : Update: Newer bison versions allow for this. We need to see how
2794 : we can make use of it. */
2795 : }
2796 :
2797 :
2798 :
2799 : static AsnNode
2800 : new_node (struct parser_control_s *parsectl, node_type_t type)
2801 : {
2802 : AsnNode node;
2803 :
2804 : node = xcalloc (1, sizeof *node);
2805 : node->type = type;
2806 : node->off = -1;
2807 : node->link_next = parsectl->all_nodes;
2808 : parsectl->all_nodes = node;
2809 :
2810 : return node;
2811 : }
2812 :
2813 : static void
2814 : release_all_nodes (AsnNode node)
2815 : {
2816 : AsnNode node2;
2817 :
2818 : for (; node; node = node2)
2819 : {
2820 : node2 = node->link_next;
2821 : xfree (node->name);
2822 :
2823 : if (node->valuetype == VALTYPE_CSTR)
2824 : xfree (node->value.v_cstr);
2825 : else if (node->valuetype == VALTYPE_MEM)
2826 : xfree (node->value.v_mem.buf);
2827 :
2828 : xfree (node);
2829 : }
2830 : }
2831 :
2832 : static void
2833 : set_name (AsnNode node, const char *name)
2834 : {
2835 : _ksba_asn_set_name (node, name);
2836 : }
2837 :
2838 : static void
2839 : set_str_value (AsnNode node, const char *text)
2840 : {
2841 : if (text && *text)
2842 : _ksba_asn_set_value (node, VALTYPE_CSTR, text, 0);
2843 : else
2844 : _ksba_asn_set_value (node, VALTYPE_NULL, NULL, 0);
2845 : }
2846 :
2847 : static void
2848 : set_ulong_value (AsnNode node, const char *text)
2849 : {
2850 : unsigned long val;
2851 :
2852 : if (text && *text)
2853 : val = strtoul (text, NULL, 10);
2854 : else
2855 : val = 0;
2856 : _ksba_asn_set_value (node, VALTYPE_ULONG, &val, sizeof(val));
2857 : }
2858 :
2859 : static void
2860 : set_right (AsnNode node, AsnNode right)
2861 : {
2862 : return_if_fail (node);
2863 :
2864 : node->right = right;
2865 : if (right)
2866 : right->left = node;
2867 : }
2868 :
2869 : static void
2870 : append_right (AsnNode node, AsnNode right)
2871 : {
2872 : return_if_fail (node);
2873 :
2874 : while (node->right)
2875 : node = node->right;
2876 :
2877 : node->right = right;
2878 : if (right)
2879 : right->left = node;
2880 : }
2881 :
2882 :
2883 : static void
2884 : set_down (AsnNode node, AsnNode down)
2885 : {
2886 : return_if_fail (node);
2887 :
2888 : node->down = down;
2889 : if (down)
2890 : down->left = node;
2891 : }
2892 :
2893 :
2894 : /**
2895 : * ksba_asn_parse_file:
2896 : * @file_name: Filename with the ASN module
2897 : * @pointer: Returns the syntax tree
2898 : * @debug: Enable debug output
2899 : *
2900 : * Parse an ASN.1 file and return an syntax tree.
2901 : *
2902 : * Return value: 0 for okay or an ASN_xx error code
2903 : **/
2904 : int
2905 : ksba_asn_parse_file (const char *file_name, ksba_asn_tree_t *result, int debug)
2906 : {
2907 : struct parser_control_s parsectl;
2908 :
2909 : *result = NULL;
2910 :
2911 : parsectl.fp = file_name? fopen (file_name, "r") : NULL;
2912 : if ( !parsectl.fp )
2913 : return gpg_error_from_syserror ();
2914 :
2915 : parsectl.lineno = 0;
2916 : parsectl.debug = debug;
2917 : parsectl.result_parse = gpg_error (GPG_ERR_SYNTAX);
2918 : parsectl.parse_tree = NULL;
2919 : parsectl.all_nodes = NULL;
2920 : /* yydebug = 1; */
2921 : if ( yyparse ((void*)&parsectl) || parsectl.result_parse )
2922 : { /* error */
2923 : fprintf (stderr, "%s:%d: parse error\n",
2924 : file_name?file_name:"-", parsectl.lineno );
2925 : release_all_nodes (parsectl.all_nodes);
2926 : parsectl.all_nodes = NULL;
2927 : }
2928 : else
2929 : { /* okay */
2930 : ksba_asn_tree_t tree;
2931 :
2932 : _ksba_asn_change_integer_value (parsectl.parse_tree);
2933 : _ksba_asn_expand_object_id (parsectl.parse_tree);
2934 : tree = xmalloc ( sizeof *tree + (file_name? strlen (file_name):1) );
2935 : tree->parse_tree = parsectl.parse_tree;
2936 : tree->node_list = parsectl.all_nodes;
2937 : strcpy (tree->filename, file_name? file_name:"-");
2938 : *result = tree;
2939 : }
2940 :
2941 : if (file_name)
2942 : fclose (parsectl.fp);
2943 : return parsectl.result_parse;
2944 : }
2945 :
2946 : void
2947 : ksba_asn_tree_release (ksba_asn_tree_t tree)
2948 : {
2949 : if (!tree)
2950 : return;
2951 : release_all_nodes (tree->node_list);
2952 : tree->node_list = NULL;
2953 : xfree (tree);
2954 : }
2955 :
2956 :
2957 : void
2958 : _ksba_asn_release_nodes (AsnNode node)
2959 : {
2960 : /* FIXME: it does not work yet because the allocation function in
2961 : asn1-func.c does not link all nodes together */
2962 : release_all_nodes (node);
2963 : }
|