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