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