Line | Count | Source |
1 | | /* A Bison parser, made by GNU Bison 3.8.2. */ |
2 | | |
3 | | /* Bison implementation for Yacc-like parsers in C |
4 | | |
5 | | Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, |
6 | | Inc. |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
20 | | |
21 | | /* As a special exception, you may create a larger work that contains |
22 | | part or all of the Bison parser skeleton and distribute that work |
23 | | under terms of your choice, so long as that work isn't itself a |
24 | | parser generator using the skeleton or a modified version thereof |
25 | | as a parser skeleton. Alternatively, if you modify or redistribute |
26 | | the parser skeleton itself, you may (at your option) remove this |
27 | | special exception, which will cause the skeleton and the resulting |
28 | | Bison output files to be licensed under the GNU General Public |
29 | | License without this special exception. |
30 | | |
31 | | This special exception was added by the Free Software Foundation in |
32 | | version 2.2 of Bison. */ |
33 | | |
34 | | /* C LALR(1) parser skeleton written by Richard Stallman, by |
35 | | simplifying the original so-called "semantic" parser. */ |
36 | | |
37 | | /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
38 | | especially those whose name start with YY_ or yy_. They are |
39 | | private implementation details that can be changed or removed. */ |
40 | | |
41 | | /* All symbols defined below should begin with yy or YY, to avoid |
42 | | infringing on user name space. This should be done even for local |
43 | | variables, as they might otherwise be expanded by user macros. |
44 | | There are some unavoidable exceptions within include files to |
45 | | define necessary library symbols; they are noted "INFRINGES ON |
46 | | USER NAME SPACE" below. */ |
47 | | |
48 | | /* Identify Bison output, and Bison version. */ |
49 | | #define YYBISON 30802 |
50 | | |
51 | | /* Bison version string. */ |
52 | | #define YYBISON_VERSION "3.8.2" |
53 | | |
54 | | /* Skeleton name. */ |
55 | | #define YYSKELETON_NAME "yacc.c" |
56 | | |
57 | | /* Pure parsers. */ |
58 | | #define YYPURE 0 |
59 | | |
60 | | /* Push parsers. */ |
61 | | #define YYPUSH 0 |
62 | | |
63 | | /* Pull parsers. */ |
64 | | #define YYPULL 1 |
65 | | |
66 | | /* Substitute the type names. */ |
67 | 0 | #define YYSTYPE _ASN1_YYSTYPE |
68 | | /* Substitute the variable and function names. */ |
69 | 0 | #define yyparse _asn1_yyparse |
70 | 0 | #define yylex _asn1_yylex |
71 | 0 | #define yyerror _asn1_yyerror |
72 | | #define yydebug _asn1_yydebug |
73 | 0 | #define yynerrs _asn1_yynerrs |
74 | 0 | #define yylval _asn1_yylval |
75 | 0 | #define yychar _asn1_yychar |
76 | | |
77 | | /* First part of user prologue. */ |
78 | | #line 1 "ASN1.y" |
79 | | |
80 | | /* |
81 | | * Copyright (C) 2001-2026 Free Software Foundation, Inc. |
82 | | * |
83 | | * This file is part of LIBTASN1. |
84 | | * |
85 | | * The LIBTASN1 library is free software; you can redistribute it |
86 | | * and/or modify it under the terms of the GNU Lesser General Public |
87 | | * License as published by the Free Software Foundation; either |
88 | | * version 2.1 of the License, or (at your option) any later version. |
89 | | * |
90 | | * This library is distributed in the hope that it will be useful, but |
91 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
92 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
93 | | * Lesser General Public License for more details. |
94 | | * |
95 | | * You should have received a copy of the GNU Lesser General Public |
96 | | * License along with this library; if not, see |
97 | | * <https://www.gnu.org/licenses/>. |
98 | | */ |
99 | | |
100 | | #include <config.h> |
101 | | |
102 | | /*****************************************************/ |
103 | | /* File: x509_ASN.y */ |
104 | | /* Description: input file for 'bison' program. */ |
105 | | /* The output file is a parser (in C language) for */ |
106 | | /* ASN.1 syntax */ |
107 | | /*****************************************************/ |
108 | | |
109 | | #include "int.h" |
110 | | #include "parser_aux.h" |
111 | | #include "structure.h" |
112 | | #include <libtasn1.h> |
113 | | #include "c-ctype.h" |
114 | | |
115 | | static list_type *e_list = NULL; |
116 | | static FILE *file_asn1; /* Pointer to file to parse */ |
117 | | static int result_parse = 0; /* result of the parser |
118 | | algorithm */ |
119 | | static asn1_node p_tree; /* pointer to the root of the |
120 | | structure created by the |
121 | | parser*/ |
122 | | static unsigned int line_number; /* line number describing the |
123 | | parser position inside the |
124 | | file */ |
125 | | static char last_error[ASN1_MAX_ERROR_DESCRIPTION_SIZE] = ""; |
126 | | static char last_error_token[ASN1_MAX_ERROR_DESCRIPTION_SIZE+1] = ""; /* used when expected errors occur */ |
127 | | static char last_token[ASN1_MAX_NAME_SIZE+1] = ""; /* last token find in the file |
128 | | to parse before the 'parse |
129 | | error' */ |
130 | | extern char _asn1_identifierMissing[]; |
131 | | static const char *file_name; /* file to parse */ |
132 | | |
133 | | static void _asn1_yyerror (const char *); |
134 | | static int _asn1_yylex(void); |
135 | | |
136 | | #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION |
137 | 0 | #define SAFE_COPY(dst, dst_size, fmt, ...) { snprintf(dst, dst_size, fmt, __VA_ARGS__); } |
138 | | #else |
139 | | #define SAFE_COPY(dst, dst_size, fmt, ...) { \ |
140 | | int _ret = snprintf(dst, dst_size, fmt, __VA_ARGS__); \ |
141 | | if (_ret != (int)strlen(dst)) \ |
142 | | { \ |
143 | | fprintf(stderr, "%s:%u: Oversize value\n", \ |
144 | | file_name, line_number); \ |
145 | | exit(EXIT_FAILURE); \ |
146 | | } \ |
147 | | } |
148 | | #endif |
149 | | |
150 | | #line 151 "ASN1.c" |
151 | | |
152 | | # ifndef YY_CAST |
153 | | # ifdef __cplusplus |
154 | | # define YY_CAST(Type, Val) static_cast<Type> (Val) |
155 | | # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
156 | | # else |
157 | 0 | # define YY_CAST(Type, Val) ((Type) (Val)) |
158 | | # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
159 | | # endif |
160 | | # endif |
161 | | # ifndef YY_NULLPTR |
162 | | # if defined __cplusplus |
163 | | # if 201103L <= __cplusplus |
164 | | # define YY_NULLPTR nullptr |
165 | | # else |
166 | | # define YY_NULLPTR 0 |
167 | | # endif |
168 | | # else |
169 | 0 | # define YY_NULLPTR ((void*)0) |
170 | | # endif |
171 | | # endif |
172 | | |
173 | | |
174 | | /* Debug traces. */ |
175 | | #ifndef _ASN1_YYDEBUG |
176 | | # if defined YYDEBUG |
177 | | #if YYDEBUG |
178 | | # define _ASN1_YYDEBUG 1 |
179 | | # else |
180 | | # define _ASN1_YYDEBUG 0 |
181 | | # endif |
182 | | # else /* ! defined YYDEBUG */ |
183 | | # define _ASN1_YYDEBUG 0 |
184 | | # endif /* ! defined YYDEBUG */ |
185 | | #endif /* ! defined _ASN1_YYDEBUG */ |
186 | | #if _ASN1_YYDEBUG |
187 | | extern int _asn1_yydebug; |
188 | | #endif |
189 | | |
190 | | /* Token kinds. */ |
191 | | #ifndef _ASN1_YYTOKENTYPE |
192 | | # define _ASN1_YYTOKENTYPE |
193 | | enum _asn1_yytokentype |
194 | | { |
195 | | _ASN1_YYEMPTY = -2, |
196 | | _ASN1_YYEOF = 0, /* "end of file" */ |
197 | | _ASN1_YYerror = 256, /* error */ |
198 | | _ASN1_YYUNDEF = 257, /* "invalid token" */ |
199 | | ASSIG = 258, /* "::=" */ |
200 | | NUM = 259, /* NUM */ |
201 | | IDENTIFIER = 260, /* IDENTIFIER */ |
202 | | OPTIONAL = 261, /* OPTIONAL */ |
203 | | INTEGER = 262, /* INTEGER */ |
204 | | SIZE = 263, /* SIZE */ |
205 | | OCTET = 264, /* OCTET */ |
206 | | STRING = 265, /* STRING */ |
207 | | SEQUENCE = 266, /* SEQUENCE */ |
208 | | BIT = 267, /* BIT */ |
209 | | UNIVERSAL = 268, /* UNIVERSAL */ |
210 | | PRIVATE = 269, /* PRIVATE */ |
211 | | APPLICATION = 270, /* APPLICATION */ |
212 | | DEFAULT = 271, /* DEFAULT */ |
213 | | CHOICE = 272, /* CHOICE */ |
214 | | OF = 273, /* OF */ |
215 | | OBJECT = 274, /* OBJECT */ |
216 | | STR_IDENTIFIER = 275, /* STR_IDENTIFIER */ |
217 | | BOOLEAN = 276, /* BOOLEAN */ |
218 | | ASN1_TRUE = 277, /* ASN1_TRUE */ |
219 | | ASN1_FALSE = 278, /* ASN1_FALSE */ |
220 | | TOKEN_NULL = 279, /* TOKEN_NULL */ |
221 | | ANY = 280, /* ANY */ |
222 | | DEFINED = 281, /* DEFINED */ |
223 | | BY = 282, /* BY */ |
224 | | SET = 283, /* SET */ |
225 | | EXPLICIT = 284, /* EXPLICIT */ |
226 | | IMPLICIT = 285, /* IMPLICIT */ |
227 | | DEFINITIONS = 286, /* DEFINITIONS */ |
228 | | TAGS = 287, /* TAGS */ |
229 | | BEGIN = 288, /* BEGIN */ |
230 | | END = 289, /* END */ |
231 | | UTCTime = 290, /* UTCTime */ |
232 | | GeneralizedTime = 291, /* GeneralizedTime */ |
233 | | GeneralString = 292, /* GeneralString */ |
234 | | NumericString = 293, /* NumericString */ |
235 | | IA5String = 294, /* IA5String */ |
236 | | TeletexString = 295, /* TeletexString */ |
237 | | PrintableString = 296, /* PrintableString */ |
238 | | UniversalString = 297, /* UniversalString */ |
239 | | BMPString = 298, /* BMPString */ |
240 | | UTF8String = 299, /* UTF8String */ |
241 | | VisibleString = 300, /* VisibleString */ |
242 | | FROM = 301, /* FROM */ |
243 | | IMPORTS = 302, /* IMPORTS */ |
244 | | ENUMERATED = 303 /* ENUMERATED */ |
245 | | }; |
246 | | typedef enum _asn1_yytokentype _asn1_yytoken_kind_t; |
247 | | #endif |
248 | | /* Token kinds. */ |
249 | 0 | #define _ASN1_YYEMPTY -2 |
250 | 0 | #define _ASN1_YYEOF 0 |
251 | 0 | #define _ASN1_YYerror 256 |
252 | 0 | #define _ASN1_YYUNDEF 257 |
253 | | #define ASSIG 258 |
254 | 0 | #define NUM 259 |
255 | 0 | #define IDENTIFIER 260 |
256 | | #define OPTIONAL 261 |
257 | | #define INTEGER 262 |
258 | | #define SIZE 263 |
259 | | #define OCTET 264 |
260 | | #define STRING 265 |
261 | | #define SEQUENCE 266 |
262 | | #define BIT 267 |
263 | | #define UNIVERSAL 268 |
264 | | #define PRIVATE 269 |
265 | | #define APPLICATION 270 |
266 | | #define DEFAULT 271 |
267 | | #define CHOICE 272 |
268 | | #define OF 273 |
269 | | #define OBJECT 274 |
270 | | #define STR_IDENTIFIER 275 |
271 | | #define BOOLEAN 276 |
272 | | #define ASN1_TRUE 277 |
273 | | #define ASN1_FALSE 278 |
274 | | #define TOKEN_NULL 279 |
275 | | #define ANY 280 |
276 | | #define DEFINED 281 |
277 | | #define BY 282 |
278 | | #define SET 283 |
279 | | #define EXPLICIT 284 |
280 | | #define IMPLICIT 285 |
281 | | #define DEFINITIONS 286 |
282 | | #define TAGS 287 |
283 | | #define BEGIN 288 |
284 | | #define END 289 |
285 | | #define UTCTime 290 |
286 | | #define GeneralizedTime 291 |
287 | | #define GeneralString 292 |
288 | | #define NumericString 293 |
289 | | #define IA5String 294 |
290 | | #define TeletexString 295 |
291 | | #define PrintableString 296 |
292 | | #define UniversalString 297 |
293 | | #define BMPString 298 |
294 | | #define UTF8String 299 |
295 | | #define VisibleString 300 |
296 | | #define FROM 301 |
297 | | #define IMPORTS 302 |
298 | | #define ENUMERATED 303 |
299 | | |
300 | | /* Value type. */ |
301 | | #if ! defined _ASN1_YYSTYPE && ! defined _ASN1_YYSTYPE_IS_DECLARED |
302 | | union _ASN1_YYSTYPE |
303 | | { |
304 | | #line 78 "ASN1.y" |
305 | | |
306 | | unsigned int constant; |
307 | | char str[ASN1_MAX_NAME_SIZE+1]; |
308 | | asn1_node node; |
309 | | |
310 | | #line 311 "ASN1.c" |
311 | | |
312 | | }; |
313 | | typedef union _ASN1_YYSTYPE _ASN1_YYSTYPE; |
314 | | # define _ASN1_YYSTYPE_IS_TRIVIAL 1 |
315 | | # define _ASN1_YYSTYPE_IS_DECLARED 1 |
316 | | #endif |
317 | | |
318 | | |
319 | | extern _ASN1_YYSTYPE _asn1_yylval; |
320 | | |
321 | | |
322 | | int _asn1_yyparse (void); |
323 | | |
324 | | |
325 | | |
326 | | /* Symbol kind. */ |
327 | | enum yysymbol_kind_t |
328 | | { |
329 | | YYSYMBOL_YYEMPTY = -2, |
330 | | YYSYMBOL_YYEOF = 0, /* "end of file" */ |
331 | | YYSYMBOL_YYerror = 1, /* error */ |
332 | | YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ |
333 | | YYSYMBOL_ASSIG = 3, /* "::=" */ |
334 | | YYSYMBOL_NUM = 4, /* NUM */ |
335 | | YYSYMBOL_IDENTIFIER = 5, /* IDENTIFIER */ |
336 | | YYSYMBOL_OPTIONAL = 6, /* OPTIONAL */ |
337 | | YYSYMBOL_INTEGER = 7, /* INTEGER */ |
338 | | YYSYMBOL_SIZE = 8, /* SIZE */ |
339 | | YYSYMBOL_OCTET = 9, /* OCTET */ |
340 | | YYSYMBOL_STRING = 10, /* STRING */ |
341 | | YYSYMBOL_SEQUENCE = 11, /* SEQUENCE */ |
342 | | YYSYMBOL_BIT = 12, /* BIT */ |
343 | | YYSYMBOL_UNIVERSAL = 13, /* UNIVERSAL */ |
344 | | YYSYMBOL_PRIVATE = 14, /* PRIVATE */ |
345 | | YYSYMBOL_APPLICATION = 15, /* APPLICATION */ |
346 | | YYSYMBOL_DEFAULT = 16, /* DEFAULT */ |
347 | | YYSYMBOL_CHOICE = 17, /* CHOICE */ |
348 | | YYSYMBOL_OF = 18, /* OF */ |
349 | | YYSYMBOL_OBJECT = 19, /* OBJECT */ |
350 | | YYSYMBOL_STR_IDENTIFIER = 20, /* STR_IDENTIFIER */ |
351 | | YYSYMBOL_BOOLEAN = 21, /* BOOLEAN */ |
352 | | YYSYMBOL_ASN1_TRUE = 22, /* ASN1_TRUE */ |
353 | | YYSYMBOL_ASN1_FALSE = 23, /* ASN1_FALSE */ |
354 | | YYSYMBOL_TOKEN_NULL = 24, /* TOKEN_NULL */ |
355 | | YYSYMBOL_ANY = 25, /* ANY */ |
356 | | YYSYMBOL_DEFINED = 26, /* DEFINED */ |
357 | | YYSYMBOL_BY = 27, /* BY */ |
358 | | YYSYMBOL_SET = 28, /* SET */ |
359 | | YYSYMBOL_EXPLICIT = 29, /* EXPLICIT */ |
360 | | YYSYMBOL_IMPLICIT = 30, /* IMPLICIT */ |
361 | | YYSYMBOL_DEFINITIONS = 31, /* DEFINITIONS */ |
362 | | YYSYMBOL_TAGS = 32, /* TAGS */ |
363 | | YYSYMBOL_BEGIN = 33, /* BEGIN */ |
364 | | YYSYMBOL_END = 34, /* END */ |
365 | | YYSYMBOL_UTCTime = 35, /* UTCTime */ |
366 | | YYSYMBOL_GeneralizedTime = 36, /* GeneralizedTime */ |
367 | | YYSYMBOL_GeneralString = 37, /* GeneralString */ |
368 | | YYSYMBOL_NumericString = 38, /* NumericString */ |
369 | | YYSYMBOL_IA5String = 39, /* IA5String */ |
370 | | YYSYMBOL_TeletexString = 40, /* TeletexString */ |
371 | | YYSYMBOL_PrintableString = 41, /* PrintableString */ |
372 | | YYSYMBOL_UniversalString = 42, /* UniversalString */ |
373 | | YYSYMBOL_BMPString = 43, /* BMPString */ |
374 | | YYSYMBOL_UTF8String = 44, /* UTF8String */ |
375 | | YYSYMBOL_VisibleString = 45, /* VisibleString */ |
376 | | YYSYMBOL_FROM = 46, /* FROM */ |
377 | | YYSYMBOL_IMPORTS = 47, /* IMPORTS */ |
378 | | YYSYMBOL_ENUMERATED = 48, /* ENUMERATED */ |
379 | | YYSYMBOL_49_ = 49, /* '+' */ |
380 | | YYSYMBOL_50_ = 50, /* '-' */ |
381 | | YYSYMBOL_51_ = 51, /* '(' */ |
382 | | YYSYMBOL_52_ = 52, /* ')' */ |
383 | | YYSYMBOL_53_ = 53, /* ',' */ |
384 | | YYSYMBOL_54_ = 54, /* '[' */ |
385 | | YYSYMBOL_55_ = 55, /* ']' */ |
386 | | YYSYMBOL_56_ = 56, /* '|' */ |
387 | | YYSYMBOL_57_ = 57, /* '{' */ |
388 | | YYSYMBOL_58_ = 58, /* '}' */ |
389 | | YYSYMBOL_59_ = 59, /* '.' */ |
390 | | YYSYMBOL_YYACCEPT = 60, /* $accept */ |
391 | | YYSYMBOL_definitions = 61, /* definitions */ |
392 | | YYSYMBOL_pos_num = 62, /* pos_num */ |
393 | | YYSYMBOL_neg_num = 63, /* neg_num */ |
394 | | YYSYMBOL_pos_neg_num = 64, /* pos_neg_num */ |
395 | | YYSYMBOL_num_identifier = 65, /* num_identifier */ |
396 | | YYSYMBOL_int_identifier = 66, /* int_identifier */ |
397 | | YYSYMBOL_pos_neg_identifier = 67, /* pos_neg_identifier */ |
398 | | YYSYMBOL_constant = 68, /* constant */ |
399 | | YYSYMBOL_constant_list = 69, /* constant_list */ |
400 | | YYSYMBOL_obj_constant = 70, /* obj_constant */ |
401 | | YYSYMBOL_obj_constant_list = 71, /* obj_constant_list */ |
402 | | YYSYMBOL_class = 72, /* class */ |
403 | | YYSYMBOL_tag_type = 73, /* tag_type */ |
404 | | YYSYMBOL_tag = 74, /* tag */ |
405 | | YYSYMBOL_default = 75, /* default */ |
406 | | YYSYMBOL_pos_neg_list = 76, /* pos_neg_list */ |
407 | | YYSYMBOL_integer_def = 77, /* integer_def */ |
408 | | YYSYMBOL_boolean_def = 78, /* boolean_def */ |
409 | | YYSYMBOL_Time = 79, /* Time */ |
410 | | YYSYMBOL_size_def2 = 80, /* size_def2 */ |
411 | | YYSYMBOL_size_def = 81, /* size_def */ |
412 | | YYSYMBOL_generalstring_def = 82, /* generalstring_def */ |
413 | | YYSYMBOL_numericstring_def = 83, /* numericstring_def */ |
414 | | YYSYMBOL_ia5string_def = 84, /* ia5string_def */ |
415 | | YYSYMBOL_teletexstring_def = 85, /* teletexstring_def */ |
416 | | YYSYMBOL_printablestring_def = 86, /* printablestring_def */ |
417 | | YYSYMBOL_universalstring_def = 87, /* universalstring_def */ |
418 | | YYSYMBOL_bmpstring_def = 88, /* bmpstring_def */ |
419 | | YYSYMBOL_utf8string_def = 89, /* utf8string_def */ |
420 | | YYSYMBOL_visiblestring_def = 90, /* visiblestring_def */ |
421 | | YYSYMBOL_octet_string_def = 91, /* octet_string_def */ |
422 | | YYSYMBOL_bit_element = 92, /* bit_element */ |
423 | | YYSYMBOL_bit_element_list = 93, /* bit_element_list */ |
424 | | YYSYMBOL_bit_string_def = 94, /* bit_string_def */ |
425 | | YYSYMBOL_enumerated_def = 95, /* enumerated_def */ |
426 | | YYSYMBOL_object_def = 96, /* object_def */ |
427 | | YYSYMBOL_type_assig_right = 97, /* type_assig_right */ |
428 | | YYSYMBOL_type_assig_right_tag = 98, /* type_assig_right_tag */ |
429 | | YYSYMBOL_type_assig_right_tag_default = 99, /* type_assig_right_tag_default */ |
430 | | YYSYMBOL_type_assig = 100, /* type_assig */ |
431 | | YYSYMBOL_type_assig_list = 101, /* type_assig_list */ |
432 | | YYSYMBOL_sequence_def = 102, /* sequence_def */ |
433 | | YYSYMBOL_set_def = 103, /* set_def */ |
434 | | YYSYMBOL_choise_def = 104, /* choise_def */ |
435 | | YYSYMBOL_any_def = 105, /* any_def */ |
436 | | YYSYMBOL_known_string = 106, /* known_string */ |
437 | | YYSYMBOL_type_invalid = 107, /* type_invalid */ |
438 | | YYSYMBOL_type_def = 108, /* type_def */ |
439 | | YYSYMBOL_constant_def = 109, /* constant_def */ |
440 | | YYSYMBOL_type_constant = 110, /* type_constant */ |
441 | | YYSYMBOL_type_constant_list = 111, /* type_constant_list */ |
442 | | YYSYMBOL_definitions_id = 112, /* definitions_id */ |
443 | | YYSYMBOL_explicit_implicit = 113 /* explicit_implicit */ |
444 | | }; |
445 | | typedef enum yysymbol_kind_t yysymbol_kind_t; |
446 | | |
447 | | |
448 | | |
449 | | |
450 | | #ifdef short |
451 | | # undef short |
452 | | #endif |
453 | | |
454 | | /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
455 | | <limits.h> and (if available) <stdint.h> are included |
456 | | so that the code can choose integer types of a good width. */ |
457 | | |
458 | | #ifndef __PTRDIFF_MAX__ |
459 | | # include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
460 | | # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
461 | | # include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
462 | | # define YY_STDINT_H |
463 | | # endif |
464 | | #endif |
465 | | |
466 | | /* Narrow types that promote to a signed type and that can represent a |
467 | | signed or unsigned integer of at least N bits. In tables they can |
468 | | save space and decrease cache pressure. Promoting to a signed type |
469 | | helps avoid bugs in integer arithmetic. */ |
470 | | |
471 | | #ifdef __INT_LEAST8_MAX__ |
472 | | typedef __INT_LEAST8_TYPE__ yytype_int8; |
473 | | #elif defined YY_STDINT_H |
474 | | typedef int_least8_t yytype_int8; |
475 | | #else |
476 | | typedef signed char yytype_int8; |
477 | | #endif |
478 | | |
479 | | #ifdef __INT_LEAST16_MAX__ |
480 | | typedef __INT_LEAST16_TYPE__ yytype_int16; |
481 | | #elif defined YY_STDINT_H |
482 | | typedef int_least16_t yytype_int16; |
483 | | #else |
484 | | typedef short yytype_int16; |
485 | | #endif |
486 | | |
487 | | /* Work around bug in HP-UX 11.23, which defines these macros |
488 | | incorrectly for preprocessor constants. This workaround can likely |
489 | | be removed in 2023, as HPE has promised support for HP-UX 11.23 |
490 | | (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of |
491 | | <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ |
492 | | #ifdef __hpux |
493 | | # undef UINT_LEAST8_MAX |
494 | | # undef UINT_LEAST16_MAX |
495 | | # define UINT_LEAST8_MAX 255 |
496 | | # define UINT_LEAST16_MAX 65535 |
497 | | #endif |
498 | | |
499 | | #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
500 | | typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
501 | | #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
502 | | && UINT_LEAST8_MAX <= INT_MAX) |
503 | | typedef uint_least8_t yytype_uint8; |
504 | | #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
505 | | typedef unsigned char yytype_uint8; |
506 | | #else |
507 | | typedef short yytype_uint8; |
508 | | #endif |
509 | | |
510 | | #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
511 | | typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
512 | | #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
513 | | && UINT_LEAST16_MAX <= INT_MAX) |
514 | | typedef uint_least16_t yytype_uint16; |
515 | | #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
516 | | typedef unsigned short yytype_uint16; |
517 | | #else |
518 | | typedef int yytype_uint16; |
519 | | #endif |
520 | | |
521 | | #ifndef YYPTRDIFF_T |
522 | | # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
523 | 0 | # define YYPTRDIFF_T __PTRDIFF_TYPE__ |
524 | | # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
525 | | # elif defined PTRDIFF_MAX |
526 | | # ifndef ptrdiff_t |
527 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
528 | | # endif |
529 | | # define YYPTRDIFF_T ptrdiff_t |
530 | | # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
531 | | # else |
532 | | # define YYPTRDIFF_T long |
533 | | # define YYPTRDIFF_MAXIMUM LONG_MAX |
534 | | # endif |
535 | | #endif |
536 | | |
537 | | #ifndef YYSIZE_T |
538 | | # ifdef __SIZE_TYPE__ |
539 | | # define YYSIZE_T __SIZE_TYPE__ |
540 | | # elif defined size_t |
541 | | # define YYSIZE_T size_t |
542 | | # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
543 | | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
544 | | # define YYSIZE_T size_t |
545 | | # else |
546 | | # define YYSIZE_T unsigned |
547 | | # endif |
548 | | #endif |
549 | | |
550 | | #define YYSIZE_MAXIMUM \ |
551 | 0 | YY_CAST (YYPTRDIFF_T, \ |
552 | | (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
553 | | ? YYPTRDIFF_MAXIMUM \ |
554 | | : YY_CAST (YYSIZE_T, -1))) |
555 | | |
556 | 0 | #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
557 | | |
558 | | |
559 | | /* Stored state numbers (used for stacks). */ |
560 | | typedef yytype_uint8 yy_state_t; |
561 | | |
562 | | /* State numbers in computations. */ |
563 | | typedef int yy_state_fast_t; |
564 | | |
565 | | #ifndef YY_ |
566 | | # if defined YYENABLE_NLS && YYENABLE_NLS |
567 | | # if ENABLE_NLS |
568 | | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
569 | | # define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
570 | | # endif |
571 | | # endif |
572 | | # ifndef YY_ |
573 | 0 | # define YY_(Msgid) Msgid |
574 | | # endif |
575 | | #endif |
576 | | |
577 | | |
578 | | #ifndef YY_ATTRIBUTE_PURE |
579 | | # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
580 | | # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
581 | | # else |
582 | | # define YY_ATTRIBUTE_PURE |
583 | | # endif |
584 | | #endif |
585 | | |
586 | | #ifndef YY_ATTRIBUTE_UNUSED |
587 | | # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
588 | | # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
589 | | # else |
590 | | # define YY_ATTRIBUTE_UNUSED |
591 | | # endif |
592 | | #endif |
593 | | |
594 | | /* Suppress unused-variable warnings by "using" E. */ |
595 | | #if ! defined lint || defined __GNUC__ |
596 | 0 | # define YY_USE(E) ((void) (E)) |
597 | | #else |
598 | | # define YY_USE(E) /* empty */ |
599 | | #endif |
600 | | |
601 | | /* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
602 | | #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ |
603 | | # if __GNUC__ * 100 + __GNUC_MINOR__ < 407 |
604 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
605 | | _Pragma ("GCC diagnostic push") \ |
606 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") |
607 | | # else |
608 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
609 | | _Pragma ("GCC diagnostic push") \ |
610 | | _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
611 | | _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
612 | | # endif |
613 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
614 | | _Pragma ("GCC diagnostic pop") |
615 | | #else |
616 | | # define YY_INITIAL_VALUE(Value) Value |
617 | | #endif |
618 | | #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
619 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
620 | | # define YY_IGNORE_MAYBE_UNINITIALIZED_END |
621 | | #endif |
622 | | #ifndef YY_INITIAL_VALUE |
623 | | # define YY_INITIAL_VALUE(Value) /* Nothing. */ |
624 | | #endif |
625 | | |
626 | | #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
627 | | # define YY_IGNORE_USELESS_CAST_BEGIN \ |
628 | | _Pragma ("GCC diagnostic push") \ |
629 | | _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
630 | | # define YY_IGNORE_USELESS_CAST_END \ |
631 | | _Pragma ("GCC diagnostic pop") |
632 | | #endif |
633 | | #ifndef YY_IGNORE_USELESS_CAST_BEGIN |
634 | | # define YY_IGNORE_USELESS_CAST_BEGIN |
635 | | # define YY_IGNORE_USELESS_CAST_END |
636 | | #endif |
637 | | |
638 | | |
639 | 0 | #define YY_ASSERT(E) ((void) (0 && (E))) |
640 | | |
641 | | #if 1 |
642 | | |
643 | | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
644 | | |
645 | | # ifdef YYSTACK_USE_ALLOCA |
646 | | # if YYSTACK_USE_ALLOCA |
647 | | # ifdef __GNUC__ |
648 | | # define YYSTACK_ALLOC __builtin_alloca |
649 | | # elif defined __BUILTIN_VA_ARG_INCR |
650 | | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
651 | | # elif defined _AIX |
652 | | # define YYSTACK_ALLOC __alloca |
653 | | # elif defined _MSC_VER |
654 | | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
655 | | # define alloca _alloca |
656 | | # else |
657 | | # define YYSTACK_ALLOC alloca |
658 | | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
659 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
660 | | /* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
661 | | # ifndef EXIT_SUCCESS |
662 | | # define EXIT_SUCCESS 0 |
663 | | # endif |
664 | | # endif |
665 | | # endif |
666 | | # endif |
667 | | # endif |
668 | | |
669 | | # ifdef YYSTACK_ALLOC |
670 | | /* Pacify GCC's 'empty if-body' warning. */ |
671 | | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
672 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
673 | | /* The OS might guarantee only one guard page at the bottom of the stack, |
674 | | and a page size can be as small as 4096 bytes. So we cannot safely |
675 | | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
676 | | to allow for a few compiler-allocated temporary stack slots. */ |
677 | | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
678 | | # endif |
679 | | # else |
680 | | # define YYSTACK_ALLOC YYMALLOC |
681 | 0 | # define YYSTACK_FREE YYFREE |
682 | | # ifndef YYSTACK_ALLOC_MAXIMUM |
683 | 0 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
684 | | # endif |
685 | | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
686 | | && ! ((defined YYMALLOC || defined malloc) \ |
687 | | && (defined YYFREE || defined free))) |
688 | | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
689 | | # ifndef EXIT_SUCCESS |
690 | | # define EXIT_SUCCESS 0 |
691 | | # endif |
692 | | # endif |
693 | | # ifndef YYMALLOC |
694 | | # define YYMALLOC malloc |
695 | | # if ! defined malloc && ! defined EXIT_SUCCESS |
696 | | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
697 | | # endif |
698 | | # endif |
699 | | # ifndef YYFREE |
700 | 0 | # define YYFREE free |
701 | | # if ! defined free && ! defined EXIT_SUCCESS |
702 | | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
703 | | # endif |
704 | | # endif |
705 | | # endif |
706 | | #endif /* 1 */ |
707 | | |
708 | | #if (! defined yyoverflow \ |
709 | | && (! defined __cplusplus \ |
710 | | || (defined _ASN1_YYSTYPE_IS_TRIVIAL && _ASN1_YYSTYPE_IS_TRIVIAL))) |
711 | | |
712 | | /* A type that is properly aligned for any stack member. */ |
713 | | union yyalloc |
714 | | { |
715 | | yy_state_t yyss_alloc; |
716 | | YYSTYPE yyvs_alloc; |
717 | | }; |
718 | | |
719 | | /* The size of the maximum gap between one aligned stack and the next. */ |
720 | 0 | # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
721 | | |
722 | | /* The size of an array large to enough to hold all stacks, each with |
723 | | N elements. */ |
724 | | # define YYSTACK_BYTES(N) \ |
725 | | ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
726 | | + YYSTACK_GAP_MAXIMUM) |
727 | | |
728 | | # define YYCOPY_NEEDED 1 |
729 | | |
730 | | /* Relocate STACK from its old location to the new one. The |
731 | | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
732 | | elements in the stack, and YYPTR gives the new location of the |
733 | | stack. Advance YYPTR to a properly aligned location for the next |
734 | | stack. */ |
735 | | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
736 | 0 | do \ |
737 | 0 | { \ |
738 | 0 | YYPTRDIFF_T yynewbytes; \ |
739 | 0 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
740 | 0 | Stack = &yyptr->Stack_alloc; \ |
741 | 0 | yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
742 | 0 | yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
743 | 0 | } \ |
744 | 0 | while (0) |
745 | | |
746 | | #endif |
747 | | |
748 | | #if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
749 | | /* Copy COUNT objects from SRC to DST. The source and destination do |
750 | | not overlap. */ |
751 | | # ifndef YYCOPY |
752 | | # if defined __GNUC__ && 1 < __GNUC__ |
753 | | # define YYCOPY(Dst, Src, Count) \ |
754 | 0 | __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
755 | | # else |
756 | | # define YYCOPY(Dst, Src, Count) \ |
757 | | do \ |
758 | | { \ |
759 | | YYPTRDIFF_T yyi; \ |
760 | | for (yyi = 0; yyi < (Count); yyi++) \ |
761 | | (Dst)[yyi] = (Src)[yyi]; \ |
762 | | } \ |
763 | | while (0) |
764 | | # endif |
765 | | # endif |
766 | | #endif /* !YYCOPY_NEEDED */ |
767 | | |
768 | | /* YYFINAL -- State number of the termination state. */ |
769 | 0 | #define YYFINAL 5 |
770 | | /* YYLAST -- Last index in YYTABLE. */ |
771 | 0 | #define YYLAST 248 |
772 | | |
773 | | /* YYNTOKENS -- Number of terminals. */ |
774 | 0 | #define YYNTOKENS 60 |
775 | | /* YYNNTS -- Number of nonterminals. */ |
776 | | #define YYNNTS 54 |
777 | | /* YYNRULES -- Number of rules. */ |
778 | | #define YYNRULES 137 |
779 | | /* YYNSTATES -- Number of states. */ |
780 | | #define YYNSTATES 238 |
781 | | |
782 | | /* YYMAXUTOK -- Last valid token kind. */ |
783 | 0 | #define YYMAXUTOK 303 |
784 | | |
785 | | |
786 | | /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
787 | | as returned by yylex, with out-of-bounds checking. */ |
788 | | #define YYTRANSLATE(YYX) \ |
789 | 0 | (0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
790 | 0 | ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
791 | 0 | : YYSYMBOL_YYUNDEF) |
792 | | |
793 | | /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
794 | | as returned by yylex. */ |
795 | | static const yytype_int8 yytranslate[] = |
796 | | { |
797 | | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
798 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
799 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
800 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
801 | | 51, 52, 2, 49, 53, 50, 59, 2, 2, 2, |
802 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
803 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
804 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
805 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
806 | | 2, 54, 2, 55, 2, 2, 2, 2, 2, 2, |
807 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
808 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
809 | | 2, 2, 2, 57, 56, 58, 2, 2, 2, 2, |
810 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
811 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
812 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
813 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
814 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
815 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
816 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
817 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
818 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
819 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
820 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
821 | | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
822 | | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
823 | | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
824 | | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
825 | | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
826 | | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
827 | | 45, 46, 47, 48 |
828 | | }; |
829 | | |
830 | | #if _ASN1_YYDEBUG |
831 | | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
832 | | static const yytype_int16 yyrline[] = |
833 | | { |
834 | | 0, 152, 152, 165, 166, 169, 172, 173, 176, 177, |
835 | | 180, 181, 182, 185, 186, 189, 191, 196, 197, 201, |
836 | | 203, 208, 209, 213, 214, 215, 218, 220, 224, 225, |
837 | | 226, 229, 231, 232, 236, 237, 241, 242, 244, 245, |
838 | | 249, 252, 253, 256, 258, 264, 265, 268, 269, 273, |
839 | | 274, 278, 279, 283, 284, 288, 289, 293, 294, 298, |
840 | | 299, 303, 304, 308, 309, 313, 314, 318, 323, 324, |
841 | | 328, 329, 331, 336, 342, 345, 347, 350, 351, 352, |
842 | | 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, |
843 | | 363, 364, 365, 366, 367, 368, 369, 370, 373, 374, |
844 | | 379, 380, 383, 386, 389, 390, 394, 396, 398, 403, |
845 | | 405, 407, 412, 416, 417, 422, 423, 424, 425, 426, |
846 | | 427, 428, 429, 432, 439, 442, 446, 451, 457, 458, |
847 | | 459, 462, 463, 474, 477, 479, 503, 504 |
848 | | }; |
849 | | #endif |
850 | | |
851 | | /** Accessing symbol of state STATE. */ |
852 | 0 | #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
853 | | |
854 | | #if 1 |
855 | | /* The user-facing name of the symbol whose (internal) number is |
856 | | YYSYMBOL. No bounds checking. */ |
857 | | static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; |
858 | | |
859 | | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
860 | | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
861 | | static const char *const yytname[] = |
862 | | { |
863 | | "\"end of file\"", "error", "\"invalid token\"", "\"::=\"", "NUM", |
864 | | "IDENTIFIER", "OPTIONAL", "INTEGER", "SIZE", "OCTET", "STRING", |
865 | | "SEQUENCE", "BIT", "UNIVERSAL", "PRIVATE", "APPLICATION", "DEFAULT", |
866 | | "CHOICE", "OF", "OBJECT", "STR_IDENTIFIER", "BOOLEAN", "ASN1_TRUE", |
867 | | "ASN1_FALSE", "TOKEN_NULL", "ANY", "DEFINED", "BY", "SET", "EXPLICIT", |
868 | | "IMPLICIT", "DEFINITIONS", "TAGS", "BEGIN", "END", "UTCTime", |
869 | | "GeneralizedTime", "GeneralString", "NumericString", "IA5String", |
870 | | "TeletexString", "PrintableString", "UniversalString", "BMPString", |
871 | | "UTF8String", "VisibleString", "FROM", "IMPORTS", "ENUMERATED", "'+'", |
872 | | "'-'", "'('", "')'", "','", "'['", "']'", "'|'", "'{'", "'}'", "'.'", |
873 | | "$accept", "definitions", "pos_num", "neg_num", "pos_neg_num", |
874 | | "num_identifier", "int_identifier", "pos_neg_identifier", "constant", |
875 | | "constant_list", "obj_constant", "obj_constant_list", "class", |
876 | | "tag_type", "tag", "default", "pos_neg_list", "integer_def", |
877 | | "boolean_def", "Time", "size_def2", "size_def", "generalstring_def", |
878 | | "numericstring_def", "ia5string_def", "teletexstring_def", |
879 | | "printablestring_def", "universalstring_def", "bmpstring_def", |
880 | | "utf8string_def", "visiblestring_def", "octet_string_def", "bit_element", |
881 | | "bit_element_list", "bit_string_def", "enumerated_def", "object_def", |
882 | | "type_assig_right", "type_assig_right_tag", |
883 | | "type_assig_right_tag_default", "type_assig", "type_assig_list", |
884 | | "sequence_def", "set_def", "choise_def", "any_def", "known_string", |
885 | | "type_invalid", "type_def", "constant_def", "type_constant", |
886 | | "type_constant_list", "definitions_id", "explicit_implicit", YY_NULLPTR |
887 | | }; |
888 | | |
889 | | static const char * |
890 | | yysymbol_name (yysymbol_kind_t yysymbol) |
891 | 0 | { |
892 | 0 | return yytname[yysymbol]; |
893 | 0 | } |
894 | | #endif |
895 | | |
896 | 0 | #define YYPACT_NINF (-140) |
897 | | |
898 | | #define yypact_value_is_default(Yyn) \ |
899 | 0 | ((Yyn) == YYPACT_NINF) |
900 | | |
901 | | #define YYTABLE_NINF (-12) |
902 | | |
903 | | #define yytable_value_is_error(Yyn) \ |
904 | 0 | 0 |
905 | | |
906 | | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
907 | | STATE-NUM. */ |
908 | | static const yytype_int16 yypact[] = |
909 | | { |
910 | | 41, -27, 32, 17, 0, -140, 90, -140, 19, -140, |
911 | | -140, -140, 3, -140, -140, 24, 126, -140, -140, 98, |
912 | | 80, 105, -140, 141, 30, -140, -140, -140, -140, -140, |
913 | | -140, -140, -140, 131, -140, -140, -140, -140, 84, 67, |
914 | | 148, 155, 170, 107, -140, -140, 6, 91, 184, 18, |
915 | | 185, 139, 177, -140, -140, 172, 36, -140, -140, 6, |
916 | | 6, 6, 6, 6, 6, 6, 6, 6, 142, 25, |
917 | | 145, 128, 149, -140, -140, -140, -140, -140, -140, -140, |
918 | | -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, |
919 | | -140, -140, -140, -140, 144, 64, 199, 174, 152, 196, |
920 | | -140, -140, 26, 6, 128, 200, 189, 43, 200, -140, |
921 | | 179, 128, 200, 190, -140, -140, -140, -140, -140, -140, |
922 | | -140, -140, -140, 204, 156, -140, -140, -140, 206, -140, |
923 | | -140, -140, 92, 173, -140, 208, 209, -140, -140, -140, |
924 | | 157, 211, 188, 164, 166, 64, -140, -11, -140, -140, |
925 | | 67, -140, 27, 128, 204, -140, 78, 213, -140, 97, |
926 | | 128, 168, -140, 101, -140, 165, 162, -140, 218, -140, |
927 | | 167, 10, 5, -140, -140, 173, 169, -140, -7, -140, |
928 | | 64, 171, 26, -140, 37, -140, 200, -140, -140, 104, |
929 | | -140, -140, -140, -140, 221, 204, -140, -140, 175, 176, |
930 | | -140, 64, -140, 7, 197, -140, 178, 180, -140, -140, |
931 | | -140, 94, -140, -140, -140, 181, -140, 23, -140, -140, |
932 | | 219, 188, -140, -140, -140, -140, -140, -140, -140, -140, |
933 | | 225, 186, 220, 187, -140, -140, -140, -140 |
934 | | }; |
935 | | |
936 | | /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
937 | | Performed when YYTABLE does not specify something else to do. Zero |
938 | | means the default is an error. */ |
939 | | static const yytype_uint8 yydefact[] = |
940 | | { |
941 | | 0, 135, 0, 0, 0, 1, 0, 8, 9, 134, |
942 | | 19, 21, 0, 136, 137, 0, 0, 133, 22, 0, |
943 | | 0, 0, 20, 0, 0, 120, 119, 121, 117, 118, |
944 | | 122, 115, 116, 0, 129, 128, 130, 131, 0, 0, |
945 | | 0, 0, 0, 0, 2, 132, 75, 36, 0, 0, |
946 | | 0, 0, 0, 40, 97, 113, 0, 41, 42, 47, |
947 | | 49, 51, 53, 55, 57, 59, 61, 63, 0, 0, |
948 | | 28, 0, 77, 79, 80, 83, 84, 85, 86, 87, |
949 | | 88, 89, 90, 91, 81, 82, 78, 93, 98, 124, |
950 | | 92, 96, 94, 95, 0, 0, 0, 0, 0, 0, |
951 | | 45, 76, 0, 65, 0, 0, 0, 70, 0, 74, |
952 | | 0, 0, 0, 0, 48, 50, 52, 54, 56, 58, |
953 | | 60, 62, 64, 0, 0, 23, 24, 25, 0, 29, |
954 | | 30, 99, 0, 0, 3, 0, 0, 6, 7, 127, |
955 | | 0, 0, 0, 0, 0, 0, 17, 0, 66, 107, |
956 | | 0, 104, 0, 0, 0, 71, 0, 0, 110, 0, |
957 | | 0, 0, 68, 0, 26, 0, 3, 12, 0, 34, |
958 | | 0, 0, 0, 4, 5, 0, 0, 9, 0, 46, |
959 | | 0, 0, 0, 37, 100, 103, 0, 106, 108, 0, |
960 | | 112, 114, 109, 111, 0, 0, 73, 27, 5, 0, |
961 | | 38, 0, 126, 0, 0, 43, 0, 0, 15, 18, |
962 | | 102, 0, 101, 105, 72, 0, 69, 0, 35, 125, |
963 | | 0, 0, 16, 14, 32, 33, 13, 31, 67, 10, |
964 | | 0, 0, 0, 0, 11, 39, 123, 44 |
965 | | }; |
966 | | |
967 | | /* YYPGOTO[NTERM-NUM]. */ |
968 | | static const yytype_int16 yypgoto[] = |
969 | | { |
970 | | -140, -140, -140, -140, -130, -139, 14, -140, 54, -140, |
971 | | -12, -108, 143, -140, -140, -140, -140, -140, -140, -140, |
972 | | 146, -43, -140, -140, -140, -140, -140, -140, -140, -140, |
973 | | -140, -140, 46, 88, -140, -140, -140, -70, 93, -140, |
974 | | 58, -53, -140, -140, -140, -140, -140, -140, -140, -140, |
975 | | 210, -140, -140, -140 |
976 | | }; |
977 | | |
978 | | /* YYDEFGOTO[NTERM-NUM]. */ |
979 | | static const yytype_uint8 yydefgoto[] = |
980 | | { |
981 | | 0, 2, 137, 138, 139, 10, 170, 227, 146, 147, |
982 | | 11, 12, 128, 70, 71, 212, 171, 72, 73, 74, |
983 | | 100, 101, 75, 76, 77, 78, 79, 80, 81, 82, |
984 | | 83, 84, 162, 163, 85, 86, 87, 88, 89, 185, |
985 | | 151, 152, 90, 91, 92, 93, 33, 34, 35, 36, |
986 | | 37, 38, 3, 15 |
987 | | }; |
988 | | |
989 | | /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
990 | | positive, shift that token. If negative, reduce the rule whose |
991 | | number is the opposite. If YYTABLE_NINF, syntax error. */ |
992 | | static const yytype_int16 yytable[] = |
993 | | { |
994 | | 18, 131, 169, 178, 7, 8, 106, 7, 8, 7, |
995 | | 8, 7, 8, 113, 98, 181, 114, 115, 116, 117, |
996 | | 118, 119, 120, 121, 122, 172, 98, 229, 167, 124, |
997 | | 4, 144, 5, 39, 149, 40, 104, 41, 125, 126, |
998 | | 127, 158, 182, 210, 98, 205, 1, 183, 6, 42, |
999 | | 207, 98, 206, 211, 111, 156, 19, 99, 9, 159, |
1000 | | 148, 17, 200, 202, 155, 219, 201, 203, 134, 99, |
1001 | | 16, 218, 46, 230, 47, 105, 48, 145, 49, 50, |
1002 | | 186, 226, 233, 188, 51, 187, 52, 99, 53, 24, |
1003 | | 193, 54, 55, 112, 99, 56, 166, 167, 134, 223, |
1004 | | 154, 21, 57, 58, 59, 60, 61, 62, 63, 64, |
1005 | | 65, 66, 67, 135, 136, 68, 224, 225, 44, 13, |
1006 | | 14, 69, 25, 26, 27, 28, 29, 30, 31, 32, |
1007 | | 20, 186, 22, 46, 43, 47, 190, 48, 23, 49, |
1008 | | 50, 135, 168, 135, 136, 51, 24, 52, 102, 53, |
1009 | | 186, 94, 54, 55, 195, 192, 56, 195, 95, 196, |
1010 | | 18, 97, 214, 57, 58, 59, 60, 61, 62, 63, |
1011 | | 64, 65, 66, 67, 129, 130, 68, 7, 8, 25, |
1012 | | 26, 27, 28, 29, 30, 31, 32, 125, 126, 127, |
1013 | | 96, 18, 7, 177, 103, 107, 108, 109, 110, 123, |
1014 | | 132, 133, 140, 142, 98, 150, 157, 153, 160, 161, |
1015 | | 165, 164, 173, 174, 175, 176, 179, 180, 191, 194, |
1016 | | 197, -10, 198, 208, 204, 215, 199, 220, 232, 234, |
1017 | | 236, 231, 222, 228, -11, 217, 209, 221, 235, 237, |
1018 | | 141, 216, 189, 184, 213, 143, 0, 0, 45 |
1019 | | }; |
1020 | | |
1021 | | static const yytype_int16 yycheck[] = |
1022 | | { |
1023 | | 12, 71, 132, 142, 4, 5, 49, 4, 5, 4, |
1024 | | 5, 4, 5, 56, 8, 145, 59, 60, 61, 62, |
1025 | | 63, 64, 65, 66, 67, 133, 8, 4, 5, 4, |
1026 | | 57, 5, 0, 3, 104, 5, 18, 7, 13, 14, |
1027 | | 15, 111, 53, 6, 8, 52, 5, 58, 31, 19, |
1028 | | 180, 8, 59, 16, 18, 108, 32, 51, 58, 112, |
1029 | | 103, 58, 52, 58, 107, 58, 56, 175, 4, 51, |
1030 | | 51, 201, 5, 50, 7, 57, 9, 51, 11, 12, |
1031 | | 53, 211, 221, 153, 17, 58, 19, 51, 21, 5, |
1032 | | 160, 24, 25, 57, 51, 28, 4, 5, 4, 5, |
1033 | | 57, 3, 35, 36, 37, 38, 39, 40, 41, 42, |
1034 | | 43, 44, 45, 49, 50, 48, 22, 23, 34, 29, |
1035 | | 30, 54, 38, 39, 40, 41, 42, 43, 44, 45, |
1036 | | 4, 53, 52, 5, 3, 7, 58, 9, 33, 11, |
1037 | | 12, 49, 50, 49, 50, 17, 5, 19, 57, 21, |
1038 | | 53, 3, 24, 25, 53, 58, 28, 53, 3, 58, |
1039 | | 172, 54, 58, 35, 36, 37, 38, 39, 40, 41, |
1040 | | 42, 43, 44, 45, 29, 30, 48, 4, 5, 38, |
1041 | | 39, 40, 41, 42, 43, 44, 45, 13, 14, 15, |
1042 | | 20, 203, 4, 5, 10, 10, 57, 20, 26, 57, |
1043 | | 51, 57, 3, 51, 8, 5, 27, 18, 18, 5, |
1044 | | 4, 55, 4, 4, 57, 4, 52, 51, 5, 51, |
1045 | | 55, 59, 4, 52, 55, 4, 59, 30, 9, 4, |
1046 | | 10, 217, 52, 52, 59, 59, 182, 59, 52, 52, |
1047 | | 97, 195, 154, 150, 186, 99, -1, -1, 38 |
1048 | | }; |
1049 | | |
1050 | | /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
1051 | | state STATE-NUM. */ |
1052 | | static const yytype_int8 yystos[] = |
1053 | | { |
1054 | | 0, 5, 61, 112, 57, 0, 31, 4, 5, 58, |
1055 | | 65, 70, 71, 29, 30, 113, 51, 58, 70, 32, |
1056 | | 4, 3, 52, 33, 5, 38, 39, 40, 41, 42, |
1057 | | 43, 44, 45, 106, 107, 108, 109, 110, 111, 3, |
1058 | | 5, 7, 19, 3, 34, 110, 5, 7, 9, 11, |
1059 | | 12, 17, 19, 21, 24, 25, 28, 35, 36, 37, |
1060 | | 38, 39, 40, 41, 42, 43, 44, 45, 48, 54, |
1061 | | 73, 74, 77, 78, 79, 82, 83, 84, 85, 86, |
1062 | | 87, 88, 89, 90, 91, 94, 95, 96, 97, 98, |
1063 | | 102, 103, 104, 105, 3, 3, 20, 54, 8, 51, |
1064 | | 80, 81, 57, 10, 18, 57, 81, 10, 57, 20, |
1065 | | 26, 18, 57, 81, 81, 81, 81, 81, 81, 81, |
1066 | | 81, 81, 81, 57, 4, 13, 14, 15, 72, 29, |
1067 | | 30, 97, 51, 57, 4, 49, 50, 62, 63, 64, |
1068 | | 3, 72, 51, 80, 5, 51, 68, 69, 81, 97, |
1069 | | 5, 100, 101, 18, 57, 81, 101, 27, 97, 101, |
1070 | | 18, 5, 92, 93, 55, 4, 4, 5, 50, 64, |
1071 | | 66, 76, 71, 4, 4, 57, 4, 5, 65, 52, |
1072 | | 51, 64, 53, 58, 98, 99, 53, 58, 97, 93, |
1073 | | 58, 5, 58, 97, 51, 53, 58, 55, 4, 59, |
1074 | | 52, 56, 58, 71, 55, 52, 59, 64, 52, 68, |
1075 | | 6, 16, 75, 100, 58, 4, 92, 59, 64, 58, |
1076 | | 30, 59, 52, 5, 22, 23, 64, 67, 52, 4, |
1077 | | 50, 66, 9, 65, 4, 52, 10, 52 |
1078 | | }; |
1079 | | |
1080 | | /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
1081 | | static const yytype_int8 yyr1[] = |
1082 | | { |
1083 | | 0, 60, 61, 62, 62, 63, 64, 64, 65, 65, |
1084 | | 66, 66, 66, 67, 67, 68, 68, 69, 69, 70, |
1085 | | 70, 71, 71, 72, 72, 72, 73, 73, 74, 74, |
1086 | | 74, 75, 75, 75, 76, 76, 77, 77, 77, 77, |
1087 | | 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, |
1088 | | 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, |
1089 | | 88, 89, 89, 90, 90, 91, 91, 92, 93, 93, |
1090 | | 94, 94, 94, 95, 96, 97, 97, 97, 97, 97, |
1091 | | 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, |
1092 | | 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, |
1093 | | 99, 99, 99, 100, 101, 101, 102, 102, 102, 103, |
1094 | | 103, 103, 104, 105, 105, 106, 106, 106, 106, 106, |
1095 | | 106, 106, 106, 107, 108, 109, 109, 109, 110, 110, |
1096 | | 110, 111, 111, 112, 112, 112, 113, 113 |
1097 | | }; |
1098 | | |
1099 | | /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
1100 | | static const yytype_int8 yyr2[] = |
1101 | | { |
1102 | | 0, 2, 8, 1, 2, 2, 1, 1, 1, 1, |
1103 | | 1, 2, 1, 1, 1, 3, 4, 1, 3, 1, |
1104 | | 4, 1, 2, 1, 1, 1, 3, 4, 1, 2, |
1105 | | 2, 2, 2, 2, 1, 3, 1, 4, 4, 7, |
1106 | | 1, 1, 1, 4, 7, 1, 3, 1, 2, 1, |
1107 | | 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, |
1108 | | 2, 1, 2, 1, 2, 2, 3, 4, 1, 3, |
1109 | | 2, 3, 5, 4, 2, 1, 2, 1, 1, 1, |
1110 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
1111 | | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, |
1112 | | 1, 2, 2, 2, 1, 3, 4, 3, 4, 4, |
1113 | | 3, 4, 4, 1, 4, 1, 1, 1, 1, 1, |
1114 | | 1, 1, 1, 9, 3, 7, 6, 4, 1, 1, |
1115 | | 1, 1, 2, 4, 3, 1, 1, 1 |
1116 | | }; |
1117 | | |
1118 | | |
1119 | | enum { YYENOMEM = -2 }; |
1120 | | |
1121 | | #define yyerrok (yyerrstatus = 0) |
1122 | | #define yyclearin (yychar = _ASN1_YYEMPTY) |
1123 | | |
1124 | 0 | #define YYACCEPT goto yyacceptlab |
1125 | 0 | #define YYABORT goto yyabortlab |
1126 | 0 | #define YYERROR goto yyerrorlab |
1127 | 0 | #define YYNOMEM goto yyexhaustedlab |
1128 | | |
1129 | | |
1130 | | #define YYRECOVERING() (!!yyerrstatus) |
1131 | | |
1132 | | #define YYBACKUP(Token, Value) \ |
1133 | | do \ |
1134 | | if (yychar == _ASN1_YYEMPTY) \ |
1135 | | { \ |
1136 | | yychar = (Token); \ |
1137 | | yylval = (Value); \ |
1138 | | YYPOPSTACK (yylen); \ |
1139 | | yystate = *yyssp; \ |
1140 | | goto yybackup; \ |
1141 | | } \ |
1142 | | else \ |
1143 | | { \ |
1144 | | yyerror (YY_("syntax error: cannot back up")); \ |
1145 | | YYERROR; \ |
1146 | | } \ |
1147 | | while (0) |
1148 | | |
1149 | | /* Backward compatibility with an undocumented macro. |
1150 | | Use _ASN1_YYerror or _ASN1_YYUNDEF. */ |
1151 | | #define YYERRCODE _ASN1_YYUNDEF |
1152 | | |
1153 | | |
1154 | | /* Enable debugging if requested. */ |
1155 | | #if _ASN1_YYDEBUG |
1156 | | |
1157 | | # ifndef YYFPRINTF |
1158 | | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
1159 | | # define YYFPRINTF fprintf |
1160 | | # endif |
1161 | | |
1162 | | # define YYDPRINTF(Args) \ |
1163 | | do { \ |
1164 | | if (yydebug) \ |
1165 | | YYFPRINTF Args; \ |
1166 | | } while (0) |
1167 | | |
1168 | | |
1169 | | |
1170 | | |
1171 | | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
1172 | | do { \ |
1173 | | if (yydebug) \ |
1174 | | { \ |
1175 | | YYFPRINTF (stderr, "%s ", Title); \ |
1176 | | yy_symbol_print (stderr, \ |
1177 | | Kind, Value); \ |
1178 | | YYFPRINTF (stderr, "\n"); \ |
1179 | | } \ |
1180 | | } while (0) |
1181 | | |
1182 | | |
1183 | | /*-----------------------------------. |
1184 | | | Print this symbol's value on YYO. | |
1185 | | `-----------------------------------*/ |
1186 | | |
1187 | | static void |
1188 | | yy_symbol_value_print (FILE *yyo, |
1189 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) |
1190 | | { |
1191 | | FILE *yyoutput = yyo; |
1192 | | YY_USE (yyoutput); |
1193 | | if (!yyvaluep) |
1194 | | return; |
1195 | | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1196 | | YY_USE (yykind); |
1197 | | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1198 | | } |
1199 | | |
1200 | | |
1201 | | /*---------------------------. |
1202 | | | Print this symbol on YYO. | |
1203 | | `---------------------------*/ |
1204 | | |
1205 | | static void |
1206 | | yy_symbol_print (FILE *yyo, |
1207 | | yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) |
1208 | | { |
1209 | | YYFPRINTF (yyo, "%s %s (", |
1210 | | yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
1211 | | |
1212 | | yy_symbol_value_print (yyo, yykind, yyvaluep); |
1213 | | YYFPRINTF (yyo, ")"); |
1214 | | } |
1215 | | |
1216 | | /*------------------------------------------------------------------. |
1217 | | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
1218 | | | TOP (included). | |
1219 | | `------------------------------------------------------------------*/ |
1220 | | |
1221 | | static void |
1222 | | yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
1223 | | { |
1224 | | YYFPRINTF (stderr, "Stack now"); |
1225 | | for (; yybottom <= yytop; yybottom++) |
1226 | | { |
1227 | | int yybot = *yybottom; |
1228 | | YYFPRINTF (stderr, " %d", yybot); |
1229 | | } |
1230 | | YYFPRINTF (stderr, "\n"); |
1231 | | } |
1232 | | |
1233 | | # define YY_STACK_PRINT(Bottom, Top) \ |
1234 | | do { \ |
1235 | | if (yydebug) \ |
1236 | | yy_stack_print ((Bottom), (Top)); \ |
1237 | | } while (0) |
1238 | | |
1239 | | |
1240 | | /*------------------------------------------------. |
1241 | | | Report that the YYRULE is going to be reduced. | |
1242 | | `------------------------------------------------*/ |
1243 | | |
1244 | | static void |
1245 | | yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
1246 | | int yyrule) |
1247 | | { |
1248 | | int yylno = yyrline[yyrule]; |
1249 | | int yynrhs = yyr2[yyrule]; |
1250 | | int yyi; |
1251 | | YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
1252 | | yyrule - 1, yylno); |
1253 | | /* The symbols being reduced. */ |
1254 | | for (yyi = 0; yyi < yynrhs; yyi++) |
1255 | | { |
1256 | | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
1257 | | yy_symbol_print (stderr, |
1258 | | YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
1259 | | &yyvsp[(yyi + 1) - (yynrhs)]); |
1260 | | YYFPRINTF (stderr, "\n"); |
1261 | | } |
1262 | | } |
1263 | | |
1264 | | # define YY_REDUCE_PRINT(Rule) \ |
1265 | | do { \ |
1266 | | if (yydebug) \ |
1267 | | yy_reduce_print (yyssp, yyvsp, Rule); \ |
1268 | | } while (0) |
1269 | | |
1270 | | /* Nonzero means print parse trace. It is left uninitialized so that |
1271 | | multiple parsers can coexist. */ |
1272 | | int yydebug; |
1273 | | #else /* !_ASN1_YYDEBUG */ |
1274 | 0 | # define YYDPRINTF(Args) ((void) 0) |
1275 | | # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
1276 | | # define YY_STACK_PRINT(Bottom, Top) |
1277 | | # define YY_REDUCE_PRINT(Rule) |
1278 | | #endif /* !_ASN1_YYDEBUG */ |
1279 | | |
1280 | | |
1281 | | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
1282 | | #ifndef YYINITDEPTH |
1283 | 0 | # define YYINITDEPTH 200 |
1284 | | #endif |
1285 | | |
1286 | | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
1287 | | if the built-in stack extension method is used). |
1288 | | |
1289 | | Do not make this value too large; the results are undefined if |
1290 | | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
1291 | | evaluated with infinite-precision integer arithmetic. */ |
1292 | | |
1293 | | #ifndef YYMAXDEPTH |
1294 | 0 | # define YYMAXDEPTH 10000 |
1295 | | #endif |
1296 | | |
1297 | | |
1298 | | /* Context of a parse error. */ |
1299 | | typedef struct |
1300 | | { |
1301 | | yy_state_t *yyssp; |
1302 | | yysymbol_kind_t yytoken; |
1303 | | } yypcontext_t; |
1304 | | |
1305 | | /* Put in YYARG at most YYARGN of the expected tokens given the |
1306 | | current YYCTX, and return the number of tokens stored in YYARG. If |
1307 | | YYARG is null, return the number of expected tokens (guaranteed to |
1308 | | be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. |
1309 | | Return 0 if there are more than YYARGN expected tokens, yet fill |
1310 | | YYARG up to YYARGN. */ |
1311 | | static int |
1312 | | yypcontext_expected_tokens (const yypcontext_t *yyctx, |
1313 | | yysymbol_kind_t yyarg[], int yyargn) |
1314 | 0 | { |
1315 | | /* Actual size of YYARG. */ |
1316 | 0 | int yycount = 0; |
1317 | 0 | int yyn = yypact[+*yyctx->yyssp]; |
1318 | 0 | if (!yypact_value_is_default (yyn)) |
1319 | 0 | { |
1320 | | /* Start YYX at -YYN if negative to avoid negative indexes in |
1321 | | YYCHECK. In other words, skip the first -YYN actions for |
1322 | | this state because they are default actions. */ |
1323 | 0 | int yyxbegin = yyn < 0 ? -yyn : 0; |
1324 | | /* Stay within bounds of both yycheck and yytname. */ |
1325 | 0 | int yychecklim = YYLAST - yyn + 1; |
1326 | 0 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
1327 | 0 | int yyx; |
1328 | 0 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1329 | 0 | if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror |
1330 | 0 | && !yytable_value_is_error (yytable[yyx + yyn])) |
1331 | 0 | { |
1332 | 0 | if (!yyarg) |
1333 | 0 | ++yycount; |
1334 | 0 | else if (yycount == yyargn) |
1335 | 0 | return 0; |
1336 | 0 | else |
1337 | 0 | yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); |
1338 | 0 | } |
1339 | 0 | } |
1340 | 0 | if (yyarg && yycount == 0 && 0 < yyargn) |
1341 | 0 | yyarg[0] = YYSYMBOL_YYEMPTY; |
1342 | 0 | return yycount; |
1343 | 0 | } |
1344 | | |
1345 | | |
1346 | | |
1347 | | |
1348 | | #ifndef yystrlen |
1349 | | # if defined __GLIBC__ && defined _STRING_H |
1350 | 0 | # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) |
1351 | | # else |
1352 | | /* Return the length of YYSTR. */ |
1353 | | static YYPTRDIFF_T |
1354 | | yystrlen (const char *yystr) |
1355 | | { |
1356 | | YYPTRDIFF_T yylen; |
1357 | | for (yylen = 0; yystr[yylen]; yylen++) |
1358 | | continue; |
1359 | | return yylen; |
1360 | | } |
1361 | | # endif |
1362 | | #endif |
1363 | | |
1364 | | #ifndef yystpcpy |
1365 | | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
1366 | 0 | # define yystpcpy stpcpy |
1367 | | # else |
1368 | | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
1369 | | YYDEST. */ |
1370 | | static char * |
1371 | | yystpcpy (char *yydest, const char *yysrc) |
1372 | | { |
1373 | | char *yyd = yydest; |
1374 | | const char *yys = yysrc; |
1375 | | |
1376 | | while ((*yyd++ = *yys++) != '\0') |
1377 | | continue; |
1378 | | |
1379 | | return yyd - 1; |
1380 | | } |
1381 | | # endif |
1382 | | #endif |
1383 | | |
1384 | | #ifndef yytnamerr |
1385 | | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
1386 | | quotes and backslashes, so that it's suitable for yyerror. The |
1387 | | heuristic is that double-quoting is unnecessary unless the string |
1388 | | contains an apostrophe, a comma, or backslash (other than |
1389 | | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
1390 | | null, do not copy; instead, return the length of what the result |
1391 | | would have been. */ |
1392 | | static YYPTRDIFF_T |
1393 | | yytnamerr (char *yyres, const char *yystr) |
1394 | 0 | { |
1395 | 0 | if (*yystr == '"') |
1396 | 0 | { |
1397 | 0 | YYPTRDIFF_T yyn = 0; |
1398 | 0 | char const *yyp = yystr; |
1399 | 0 | for (;;) |
1400 | 0 | switch (*++yyp) |
1401 | 0 | { |
1402 | 0 | case '\'': |
1403 | 0 | case ',': |
1404 | 0 | goto do_not_strip_quotes; |
1405 | | |
1406 | 0 | case '\\': |
1407 | 0 | if (*++yyp != '\\') |
1408 | 0 | goto do_not_strip_quotes; |
1409 | 0 | else |
1410 | 0 | goto append; |
1411 | | |
1412 | 0 | append: |
1413 | 0 | default: |
1414 | 0 | if (yyres) |
1415 | 0 | yyres[yyn] = *yyp; |
1416 | 0 | yyn++; |
1417 | 0 | break; |
1418 | | |
1419 | 0 | case '"': |
1420 | 0 | if (yyres) |
1421 | 0 | yyres[yyn] = '\0'; |
1422 | 0 | return yyn; |
1423 | 0 | } |
1424 | 0 | do_not_strip_quotes: ; |
1425 | 0 | } |
1426 | | |
1427 | 0 | if (yyres) |
1428 | 0 | return yystpcpy (yyres, yystr) - yyres; |
1429 | 0 | else |
1430 | 0 | return yystrlen (yystr); |
1431 | 0 | } |
1432 | | #endif |
1433 | | |
1434 | | |
1435 | | static int |
1436 | | yy_syntax_error_arguments (const yypcontext_t *yyctx, |
1437 | | yysymbol_kind_t yyarg[], int yyargn) |
1438 | 0 | { |
1439 | | /* Actual size of YYARG. */ |
1440 | 0 | int yycount = 0; |
1441 | | /* There are many possibilities here to consider: |
1442 | | - If this state is a consistent state with a default action, then |
1443 | | the only way this function was invoked is if the default action |
1444 | | is an error action. In that case, don't check for expected |
1445 | | tokens because there are none. |
1446 | | - The only way there can be no lookahead present (in yychar) is if |
1447 | | this state is a consistent state with a default action. Thus, |
1448 | | detecting the absence of a lookahead is sufficient to determine |
1449 | | that there is no unexpected or expected token to report. In that |
1450 | | case, just report a simple "syntax error". |
1451 | | - Don't assume there isn't a lookahead just because this state is a |
1452 | | consistent state with a default action. There might have been a |
1453 | | previous inconsistent state, consistent state with a non-default |
1454 | | action, or user semantic action that manipulated yychar. |
1455 | | - Of course, the expected token list depends on states to have |
1456 | | correct lookahead information, and it depends on the parser not |
1457 | | to perform extra reductions after fetching a lookahead from the |
1458 | | scanner and before detecting a syntax error. Thus, state merging |
1459 | | (from LALR or IELR) and default reductions corrupt the expected |
1460 | | token list. However, the list is correct for canonical LR with |
1461 | | one exception: it will still contain any token that will not be |
1462 | | accepted due to an error action in a later state. |
1463 | | */ |
1464 | 0 | if (yyctx->yytoken != YYSYMBOL_YYEMPTY) |
1465 | 0 | { |
1466 | 0 | int yyn; |
1467 | 0 | if (yyarg) |
1468 | 0 | yyarg[yycount] = yyctx->yytoken; |
1469 | 0 | ++yycount; |
1470 | 0 | yyn = yypcontext_expected_tokens (yyctx, |
1471 | 0 | yyarg ? yyarg + 1 : yyarg, yyargn - 1); |
1472 | 0 | if (yyn == YYENOMEM) |
1473 | 0 | return YYENOMEM; |
1474 | 0 | else |
1475 | 0 | yycount += yyn; |
1476 | 0 | } |
1477 | 0 | return yycount; |
1478 | 0 | } |
1479 | | |
1480 | | /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
1481 | | about the unexpected token YYTOKEN for the state stack whose top is |
1482 | | YYSSP. |
1483 | | |
1484 | | Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is |
1485 | | not large enough to hold the message. In that case, also set |
1486 | | *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the |
1487 | | required number of bytes is too large to store. */ |
1488 | | static int |
1489 | | yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, |
1490 | | const yypcontext_t *yyctx) |
1491 | 0 | { |
1492 | 0 | enum { YYARGS_MAX = 5 }; |
1493 | | /* Internationalized format string. */ |
1494 | 0 | const char *yyformat = YY_NULLPTR; |
1495 | | /* Arguments of yyformat: reported tokens (one for the "unexpected", |
1496 | | one per "expected"). */ |
1497 | 0 | yysymbol_kind_t yyarg[YYARGS_MAX]; |
1498 | | /* Cumulated lengths of YYARG. */ |
1499 | 0 | YYPTRDIFF_T yysize = 0; |
1500 | | |
1501 | | /* Actual size of YYARG. */ |
1502 | 0 | int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); |
1503 | 0 | if (yycount == YYENOMEM) |
1504 | 0 | return YYENOMEM; |
1505 | | |
1506 | 0 | switch (yycount) |
1507 | 0 | { |
1508 | 0 | #define YYCASE_(N, S) \ |
1509 | 0 | case N: \ |
1510 | 0 | yyformat = S; \ |
1511 | 0 | break |
1512 | 0 | default: /* Avoid compiler warnings. */ |
1513 | 0 | YYCASE_(0, YY_("syntax error")); |
1514 | 0 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
1515 | 0 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
1516 | 0 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
1517 | 0 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
1518 | 0 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
1519 | 0 | #undef YYCASE_ |
1520 | 0 | } |
1521 | | |
1522 | | /* Compute error message size. Don't count the "%s"s, but reserve |
1523 | | room for the terminator. */ |
1524 | 0 | yysize = yystrlen (yyformat) - 2 * yycount + 1; |
1525 | 0 | { |
1526 | 0 | int yyi; |
1527 | 0 | for (yyi = 0; yyi < yycount; ++yyi) |
1528 | 0 | { |
1529 | 0 | YYPTRDIFF_T yysize1 |
1530 | 0 | = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); |
1531 | 0 | if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
1532 | 0 | yysize = yysize1; |
1533 | 0 | else |
1534 | 0 | return YYENOMEM; |
1535 | 0 | } |
1536 | 0 | } |
1537 | | |
1538 | 0 | if (*yymsg_alloc < yysize) |
1539 | 0 | { |
1540 | 0 | *yymsg_alloc = 2 * yysize; |
1541 | 0 | if (! (yysize <= *yymsg_alloc |
1542 | 0 | && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
1543 | 0 | *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
1544 | 0 | return -1; |
1545 | 0 | } |
1546 | | |
1547 | | /* Avoid sprintf, as that infringes on the user's name space. |
1548 | | Don't have undefined behavior even if the translation |
1549 | | produced a string with the wrong number of "%s"s. */ |
1550 | 0 | { |
1551 | 0 | char *yyp = *yymsg; |
1552 | 0 | int yyi = 0; |
1553 | 0 | while ((*yyp = *yyformat) != '\0') |
1554 | 0 | if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
1555 | 0 | { |
1556 | 0 | yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); |
1557 | 0 | yyformat += 2; |
1558 | 0 | } |
1559 | 0 | else |
1560 | 0 | { |
1561 | 0 | ++yyp; |
1562 | 0 | ++yyformat; |
1563 | 0 | } |
1564 | 0 | } |
1565 | 0 | return 0; |
1566 | 0 | } |
1567 | | |
1568 | | |
1569 | | /*-----------------------------------------------. |
1570 | | | Release the memory associated to this symbol. | |
1571 | | `-----------------------------------------------*/ |
1572 | | |
1573 | | static void |
1574 | | yydestruct (const char *yymsg, |
1575 | | yysymbol_kind_t yykind, YYSTYPE *yyvaluep) |
1576 | 0 | { |
1577 | 0 | YY_USE (yyvaluep); |
1578 | 0 | if (!yymsg) |
1579 | 0 | yymsg = "Deleting"; |
1580 | 0 | YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
1581 | |
|
1582 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1583 | 0 | YY_USE (yykind); |
1584 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1585 | 0 | } |
1586 | | |
1587 | | |
1588 | | /* Lookahead token kind. */ |
1589 | | int yychar; |
1590 | | |
1591 | | /* The semantic value of the lookahead symbol. */ |
1592 | | YYSTYPE yylval; |
1593 | | /* Number of syntax errors so far. */ |
1594 | | int yynerrs; |
1595 | | |
1596 | | |
1597 | | |
1598 | | |
1599 | | /*----------. |
1600 | | | yyparse. | |
1601 | | `----------*/ |
1602 | | |
1603 | | int |
1604 | | yyparse (void) |
1605 | 0 | { |
1606 | 0 | yy_state_fast_t yystate = 0; |
1607 | | /* Number of tokens to shift before error messages enabled. */ |
1608 | 0 | int yyerrstatus = 0; |
1609 | | |
1610 | | /* Refer to the stacks through separate pointers, to allow yyoverflow |
1611 | | to reallocate them elsewhere. */ |
1612 | | |
1613 | | /* Their size. */ |
1614 | 0 | YYPTRDIFF_T yystacksize = YYINITDEPTH; |
1615 | | |
1616 | | /* The state stack: array, bottom, top. */ |
1617 | 0 | yy_state_t yyssa[YYINITDEPTH]; |
1618 | 0 | yy_state_t *yyss = yyssa; |
1619 | 0 | yy_state_t *yyssp = yyss; |
1620 | | |
1621 | | /* The semantic value stack: array, bottom, top. */ |
1622 | 0 | YYSTYPE yyvsa[YYINITDEPTH]; |
1623 | 0 | YYSTYPE *yyvs = yyvsa; |
1624 | 0 | YYSTYPE *yyvsp = yyvs; |
1625 | |
|
1626 | 0 | int yyn; |
1627 | | /* The return value of yyparse. */ |
1628 | 0 | int yyresult; |
1629 | | /* Lookahead symbol kind. */ |
1630 | 0 | yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
1631 | | /* The variables used to return semantic value and location from the |
1632 | | action routines. */ |
1633 | 0 | YYSTYPE yyval; |
1634 | | |
1635 | | /* Buffer for error messages, and its allocated size. */ |
1636 | 0 | char yymsgbuf[128]; |
1637 | 0 | char *yymsg = yymsgbuf; |
1638 | 0 | YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; |
1639 | |
|
1640 | 0 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
1641 | | |
1642 | | /* The number of symbols on the RHS of the reduced rule. |
1643 | | Keep to zero when no symbol should be popped. */ |
1644 | 0 | int yylen = 0; |
1645 | |
|
1646 | 0 | YYDPRINTF ((stderr, "Starting parse\n")); |
1647 | |
|
1648 | 0 | yychar = _ASN1_YYEMPTY; /* Cause a token to be read. */ |
1649 | |
|
1650 | 0 | goto yysetstate; |
1651 | | |
1652 | | |
1653 | | /*------------------------------------------------------------. |
1654 | | | yynewstate -- push a new state, which is found in yystate. | |
1655 | | `------------------------------------------------------------*/ |
1656 | 0 | yynewstate: |
1657 | | /* In all cases, when you get here, the value and location stacks |
1658 | | have just been pushed. So pushing a state here evens the stacks. */ |
1659 | 0 | yyssp++; |
1660 | | |
1661 | | |
1662 | | /*--------------------------------------------------------------------. |
1663 | | | yysetstate -- set current state (the top of the stack) to yystate. | |
1664 | | `--------------------------------------------------------------------*/ |
1665 | 0 | yysetstate: |
1666 | 0 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1667 | 0 | YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
1668 | 0 | YY_IGNORE_USELESS_CAST_BEGIN |
1669 | 0 | *yyssp = YY_CAST (yy_state_t, yystate); |
1670 | 0 | YY_IGNORE_USELESS_CAST_END |
1671 | 0 | YY_STACK_PRINT (yyss, yyssp); |
1672 | |
|
1673 | 0 | if (yyss + yystacksize - 1 <= yyssp) |
1674 | | #if !defined yyoverflow && !defined YYSTACK_RELOCATE |
1675 | | YYNOMEM; |
1676 | | #else |
1677 | 0 | { |
1678 | | /* Get the current used size of the three stacks, in elements. */ |
1679 | 0 | YYPTRDIFF_T yysize = yyssp - yyss + 1; |
1680 | |
|
1681 | | # if defined yyoverflow |
1682 | | { |
1683 | | /* Give user a chance to reallocate the stack. Use copies of |
1684 | | these so that the &'s don't force the real ones into |
1685 | | memory. */ |
1686 | | yy_state_t *yyss1 = yyss; |
1687 | | YYSTYPE *yyvs1 = yyvs; |
1688 | | |
1689 | | /* Each stack pointer address is followed by the size of the |
1690 | | data in use in that stack, in bytes. This used to be a |
1691 | | conditional around just the two extra args, but that might |
1692 | | be undefined if yyoverflow is a macro. */ |
1693 | | yyoverflow (YY_("memory exhausted"), |
1694 | | &yyss1, yysize * YYSIZEOF (*yyssp), |
1695 | | &yyvs1, yysize * YYSIZEOF (*yyvsp), |
1696 | | &yystacksize); |
1697 | | yyss = yyss1; |
1698 | | yyvs = yyvs1; |
1699 | | } |
1700 | | # else /* defined YYSTACK_RELOCATE */ |
1701 | | /* Extend the stack our own way. */ |
1702 | 0 | if (YYMAXDEPTH <= yystacksize) |
1703 | 0 | YYNOMEM; |
1704 | 0 | yystacksize *= 2; |
1705 | 0 | if (YYMAXDEPTH < yystacksize) |
1706 | 0 | yystacksize = YYMAXDEPTH; |
1707 | |
|
1708 | 0 | { |
1709 | 0 | yy_state_t *yyss1 = yyss; |
1710 | 0 | union yyalloc *yyptr = |
1711 | 0 | YY_CAST (union yyalloc *, |
1712 | 0 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
1713 | 0 | if (! yyptr) |
1714 | 0 | YYNOMEM; |
1715 | 0 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1716 | 0 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1717 | 0 | # undef YYSTACK_RELOCATE |
1718 | 0 | if (yyss1 != yyssa) |
1719 | 0 | YYSTACK_FREE (yyss1); |
1720 | 0 | } |
1721 | 0 | # endif |
1722 | | |
1723 | 0 | yyssp = yyss + yysize - 1; |
1724 | 0 | yyvsp = yyvs + yysize - 1; |
1725 | |
|
1726 | 0 | YY_IGNORE_USELESS_CAST_BEGIN |
1727 | 0 | YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
1728 | 0 | YY_CAST (long, yystacksize))); |
1729 | 0 | YY_IGNORE_USELESS_CAST_END |
1730 | |
|
1731 | 0 | if (yyss + yystacksize - 1 <= yyssp) |
1732 | 0 | YYABORT; |
1733 | 0 | } |
1734 | 0 | #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
1735 | | |
1736 | | |
1737 | 0 | if (yystate == YYFINAL) |
1738 | 0 | YYACCEPT; |
1739 | | |
1740 | 0 | goto yybackup; |
1741 | | |
1742 | | |
1743 | | /*-----------. |
1744 | | | yybackup. | |
1745 | | `-----------*/ |
1746 | 0 | yybackup: |
1747 | | /* Do appropriate processing given the current state. Read a |
1748 | | lookahead token if we need one and don't already have one. */ |
1749 | | |
1750 | | /* First try to decide what to do without reference to lookahead token. */ |
1751 | 0 | yyn = yypact[yystate]; |
1752 | 0 | if (yypact_value_is_default (yyn)) |
1753 | 0 | goto yydefault; |
1754 | | |
1755 | | /* Not known => get a lookahead token if don't already have one. */ |
1756 | | |
1757 | | /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
1758 | 0 | if (yychar == _ASN1_YYEMPTY) |
1759 | 0 | { |
1760 | 0 | YYDPRINTF ((stderr, "Reading a token\n")); |
1761 | 0 | yychar = yylex (); |
1762 | 0 | } |
1763 | |
|
1764 | 0 | if (yychar <= _ASN1_YYEOF) |
1765 | 0 | { |
1766 | 0 | yychar = _ASN1_YYEOF; |
1767 | 0 | yytoken = YYSYMBOL_YYEOF; |
1768 | 0 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
1769 | 0 | } |
1770 | 0 | else if (yychar == _ASN1_YYerror) |
1771 | 0 | { |
1772 | | /* The scanner already issued an error message, process directly |
1773 | | to error recovery. But do not keep the error token as |
1774 | | lookahead, it is too special and may lead us to an endless |
1775 | | loop in error recovery. */ |
1776 | 0 | yychar = _ASN1_YYUNDEF; |
1777 | 0 | yytoken = YYSYMBOL_YYerror; |
1778 | 0 | goto yyerrlab1; |
1779 | 0 | } |
1780 | 0 | else |
1781 | 0 | { |
1782 | 0 | yytoken = YYTRANSLATE (yychar); |
1783 | 0 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
1784 | 0 | } |
1785 | | |
1786 | | /* If the proper action on seeing token YYTOKEN is to reduce or to |
1787 | | detect an error, take that action. */ |
1788 | 0 | yyn += yytoken; |
1789 | 0 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
1790 | 0 | goto yydefault; |
1791 | 0 | yyn = yytable[yyn]; |
1792 | 0 | if (yyn <= 0) |
1793 | 0 | { |
1794 | 0 | if (yytable_value_is_error (yyn)) |
1795 | 0 | goto yyerrlab; |
1796 | 0 | yyn = -yyn; |
1797 | 0 | goto yyreduce; |
1798 | 0 | } |
1799 | | |
1800 | | /* Count tokens shifted since error; after three, turn off error |
1801 | | status. */ |
1802 | 0 | if (yyerrstatus) |
1803 | 0 | yyerrstatus--; |
1804 | | |
1805 | | /* Shift the lookahead token. */ |
1806 | 0 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1807 | 0 | yystate = yyn; |
1808 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
1809 | 0 | *++yyvsp = yylval; |
1810 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
1811 | | |
1812 | | /* Discard the shifted token. */ |
1813 | 0 | yychar = _ASN1_YYEMPTY; |
1814 | 0 | goto yynewstate; |
1815 | | |
1816 | | |
1817 | | /*-----------------------------------------------------------. |
1818 | | | yydefault -- do the default action for the current state. | |
1819 | | `-----------------------------------------------------------*/ |
1820 | 0 | yydefault: |
1821 | 0 | yyn = yydefact[yystate]; |
1822 | 0 | if (yyn == 0) |
1823 | 0 | goto yyerrlab; |
1824 | 0 | goto yyreduce; |
1825 | | |
1826 | | |
1827 | | /*-----------------------------. |
1828 | | | yyreduce -- do a reduction. | |
1829 | | `-----------------------------*/ |
1830 | 0 | yyreduce: |
1831 | | /* yyn is the number of a rule to reduce with. */ |
1832 | 0 | yylen = yyr2[yyn]; |
1833 | | |
1834 | | /* If YYLEN is nonzero, implement the default value of the action: |
1835 | | '$$ = $1'. |
1836 | | |
1837 | | Otherwise, the following line sets YYVAL to garbage. |
1838 | | This behavior is undocumented and Bison |
1839 | | users should not rely upon it. Assigning to YYVAL |
1840 | | unconditionally makes the parser a bit smaller, and it avoids a |
1841 | | GCC warning that YYVAL may be used uninitialized. */ |
1842 | 0 | yyval = yyvsp[1-yylen]; |
1843 | | |
1844 | |
|
1845 | 0 | YY_REDUCE_PRINT (yyn); |
1846 | 0 | switch (yyn) |
1847 | 0 | { |
1848 | 0 | case 2: /* definitions: definitions_id DEFINITIONS explicit_implicit TAGS "::=" BEGIN type_constant_list END */ |
1849 | 0 | #line 155 "ASN1.y" |
1850 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_DEFINITIONS|(yyvsp[-5].constant)); |
1851 | 0 | _asn1_set_name((yyval.node),_asn1_get_name((yyvsp[-7].node))); |
1852 | 0 | _asn1_set_name((yyvsp[-7].node),""); |
1853 | 0 | _asn1_set_right((yyvsp[-7].node),(yyvsp[-1].node)); |
1854 | 0 | _asn1_set_down((yyval.node),(yyvsp[-7].node)); |
1855 | |
|
1856 | 0 | p_tree=(yyval.node); |
1857 | 0 | } |
1858 | 0 | #line 1859 "ASN1.c" |
1859 | 0 | break; |
1860 | | |
1861 | 0 | case 3: /* pos_num: NUM */ |
1862 | 0 | #line 165 "ASN1.y" |
1863 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1864 | 0 | #line 1865 "ASN1.c" |
1865 | 0 | break; |
1866 | | |
1867 | 0 | case 4: /* pos_num: '+' NUM */ |
1868 | 0 | #line 166 "ASN1.y" |
1869 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1870 | 0 | #line 1871 "ASN1.c" |
1871 | 0 | break; |
1872 | | |
1873 | 0 | case 5: /* neg_num: '-' NUM */ |
1874 | 0 | #line 169 "ASN1.y" |
1875 | 0 | {SAFE_COPY((yyval.str),sizeof((yyval.str)),"-%s",(yyvsp[0].str));} |
1876 | 0 | #line 1877 "ASN1.c" |
1877 | 0 | break; |
1878 | | |
1879 | 0 | case 6: /* pos_neg_num: pos_num */ |
1880 | 0 | #line 172 "ASN1.y" |
1881 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1882 | 0 | #line 1883 "ASN1.c" |
1883 | 0 | break; |
1884 | | |
1885 | 0 | case 7: /* pos_neg_num: neg_num */ |
1886 | 0 | #line 173 "ASN1.y" |
1887 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1888 | 0 | #line 1889 "ASN1.c" |
1889 | 0 | break; |
1890 | | |
1891 | 0 | case 8: /* num_identifier: NUM */ |
1892 | 0 | #line 176 "ASN1.y" |
1893 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1894 | 0 | #line 1895 "ASN1.c" |
1895 | 0 | break; |
1896 | | |
1897 | 0 | case 9: /* num_identifier: IDENTIFIER */ |
1898 | 0 | #line 177 "ASN1.y" |
1899 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1900 | 0 | #line 1901 "ASN1.c" |
1901 | 0 | break; |
1902 | | |
1903 | 0 | case 10: /* int_identifier: NUM */ |
1904 | 0 | #line 180 "ASN1.y" |
1905 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1906 | 0 | #line 1907 "ASN1.c" |
1907 | 0 | break; |
1908 | | |
1909 | 0 | case 11: /* int_identifier: '-' NUM */ |
1910 | 0 | #line 181 "ASN1.y" |
1911 | 0 | {SAFE_COPY((yyval.str),sizeof((yyval.str)),"-%s",(yyvsp[0].str));} |
1912 | 0 | #line 1913 "ASN1.c" |
1913 | 0 | break; |
1914 | | |
1915 | 0 | case 12: /* int_identifier: IDENTIFIER */ |
1916 | 0 | #line 182 "ASN1.y" |
1917 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1918 | 0 | #line 1919 "ASN1.c" |
1919 | 0 | break; |
1920 | | |
1921 | 0 | case 13: /* pos_neg_identifier: pos_neg_num */ |
1922 | 0 | #line 185 "ASN1.y" |
1923 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1924 | 0 | #line 1925 "ASN1.c" |
1925 | 0 | break; |
1926 | | |
1927 | 0 | case 14: /* pos_neg_identifier: IDENTIFIER */ |
1928 | 0 | #line 186 "ASN1.y" |
1929 | 0 | {snprintf((yyval.str),sizeof((yyval.str)),"%s",(yyvsp[0].str));} |
1930 | 0 | #line 1931 "ASN1.c" |
1931 | 0 | break; |
1932 | | |
1933 | 0 | case 15: /* constant: '(' pos_neg_num ')' */ |
1934 | 0 | #line 189 "ASN1.y" |
1935 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_CONSTANT); |
1936 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
1937 | 0 | #line 1938 "ASN1.c" |
1938 | 0 | break; |
1939 | | |
1940 | 0 | case 16: /* constant: IDENTIFIER '(' pos_neg_num ')' */ |
1941 | 0 | #line 191 "ASN1.y" |
1942 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_CONSTANT); |
1943 | 0 | _asn1_set_name((yyval.node),(yyvsp[-3].str)); |
1944 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
1945 | 0 | #line 1946 "ASN1.c" |
1946 | 0 | break; |
1947 | | |
1948 | 0 | case 17: /* constant_list: constant */ |
1949 | 0 | #line 196 "ASN1.y" |
1950 | 0 | {(yyval.node)=(yyvsp[0].node);} |
1951 | 0 | #line 1952 "ASN1.c" |
1952 | 0 | break; |
1953 | | |
1954 | 0 | case 18: /* constant_list: constant_list ',' constant */ |
1955 | 0 | #line 197 "ASN1.y" |
1956 | 0 | {(yyval.node)=(yyvsp[-2].node); |
1957 | 0 | _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));} |
1958 | 0 | #line 1959 "ASN1.c" |
1959 | 0 | break; |
1960 | | |
1961 | 0 | case 19: /* obj_constant: num_identifier */ |
1962 | 0 | #line 201 "ASN1.y" |
1963 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_CONSTANT); |
1964 | 0 | _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} |
1965 | 0 | #line 1966 "ASN1.c" |
1966 | 0 | break; |
1967 | | |
1968 | 0 | case 20: /* obj_constant: IDENTIFIER '(' NUM ')' */ |
1969 | 0 | #line 203 "ASN1.y" |
1970 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_CONSTANT); |
1971 | 0 | _asn1_set_name((yyval.node),(yyvsp[-3].str)); |
1972 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
1973 | 0 | #line 1974 "ASN1.c" |
1974 | 0 | break; |
1975 | | |
1976 | 0 | case 21: /* obj_constant_list: obj_constant */ |
1977 | 0 | #line 208 "ASN1.y" |
1978 | 0 | {(yyval.node)=(yyvsp[0].node);} |
1979 | 0 | #line 1980 "ASN1.c" |
1980 | 0 | break; |
1981 | | |
1982 | 0 | case 22: /* obj_constant_list: obj_constant_list obj_constant */ |
1983 | 0 | #line 209 "ASN1.y" |
1984 | 0 | {(yyval.node)=(yyvsp[-1].node); |
1985 | 0 | _asn1_set_right(_asn1_get_last_right((yyvsp[-1].node)),(yyvsp[0].node));} |
1986 | 0 | #line 1987 "ASN1.c" |
1987 | 0 | break; |
1988 | | |
1989 | 0 | case 23: /* class: UNIVERSAL */ |
1990 | 0 | #line 213 "ASN1.y" |
1991 | 0 | {(yyval.constant)=CONST_UNIVERSAL;} |
1992 | 0 | #line 1993 "ASN1.c" |
1993 | 0 | break; |
1994 | | |
1995 | 0 | case 24: /* class: PRIVATE */ |
1996 | 0 | #line 214 "ASN1.y" |
1997 | 0 | {(yyval.constant)=CONST_PRIVATE;} |
1998 | 0 | #line 1999 "ASN1.c" |
1999 | 0 | break; |
2000 | | |
2001 | 0 | case 25: /* class: APPLICATION */ |
2002 | 0 | #line 215 "ASN1.y" |
2003 | 0 | {(yyval.constant)=CONST_APPLICATION;} |
2004 | 0 | #line 2005 "ASN1.c" |
2005 | 0 | break; |
2006 | | |
2007 | 0 | case 26: /* tag_type: '[' NUM ']' */ |
2008 | 0 | #line 218 "ASN1.y" |
2009 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_TAG); |
2010 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
2011 | 0 | #line 2012 "ASN1.c" |
2012 | 0 | break; |
2013 | | |
2014 | 0 | case 27: /* tag_type: '[' class NUM ']' */ |
2015 | 0 | #line 220 "ASN1.y" |
2016 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_TAG | (yyvsp[-2].constant)); |
2017 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
2018 | 0 | #line 2019 "ASN1.c" |
2019 | 0 | break; |
2020 | | |
2021 | 0 | case 28: /* tag: tag_type */ |
2022 | 0 | #line 224 "ASN1.y" |
2023 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2024 | 0 | #line 2025 "ASN1.c" |
2025 | 0 | break; |
2026 | | |
2027 | 0 | case 29: /* tag: tag_type EXPLICIT */ |
2028 | 0 | #line 225 "ASN1.y" |
2029 | 0 | {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_EXPLICIT);} |
2030 | 0 | #line 2031 "ASN1.c" |
2031 | 0 | break; |
2032 | | |
2033 | 0 | case 30: /* tag: tag_type IMPLICIT */ |
2034 | 0 | #line 226 "ASN1.y" |
2035 | 0 | {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_IMPLICIT);} |
2036 | 0 | #line 2037 "ASN1.c" |
2037 | 0 | break; |
2038 | | |
2039 | 0 | case 31: /* default: DEFAULT pos_neg_identifier */ |
2040 | 0 | #line 229 "ASN1.y" |
2041 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_DEFAULT); |
2042 | 0 | _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} |
2043 | 0 | #line 2044 "ASN1.c" |
2044 | 0 | break; |
2045 | | |
2046 | 0 | case 32: /* default: DEFAULT ASN1_TRUE */ |
2047 | 0 | #line 231 "ASN1.y" |
2048 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_DEFAULT|CONST_TRUE);} |
2049 | 0 | #line 2050 "ASN1.c" |
2050 | 0 | break; |
2051 | | |
2052 | 0 | case 33: /* default: DEFAULT ASN1_FALSE */ |
2053 | 0 | #line 232 "ASN1.y" |
2054 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_DEFAULT|CONST_FALSE);} |
2055 | 0 | #line 2056 "ASN1.c" |
2056 | 0 | break; |
2057 | | |
2058 | 0 | case 36: /* integer_def: INTEGER */ |
2059 | 0 | #line 241 "ASN1.y" |
2060 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_INTEGER);} |
2061 | 0 | #line 2062 "ASN1.c" |
2062 | 0 | break; |
2063 | | |
2064 | 0 | case 37: /* integer_def: INTEGER '{' constant_list '}' */ |
2065 | 0 | #line 242 "ASN1.y" |
2066 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_INTEGER|CONST_LIST); |
2067 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2068 | 0 | #line 2069 "ASN1.c" |
2069 | 0 | break; |
2070 | | |
2071 | 0 | case 38: /* integer_def: integer_def '(' pos_neg_list ')' */ |
2072 | 0 | #line 244 "ASN1.y" |
2073 | 0 | {(yyval.node)=(yyvsp[-3].node);} |
2074 | 0 | #line 2075 "ASN1.c" |
2075 | 0 | break; |
2076 | | |
2077 | 0 | case 39: /* integer_def: integer_def '(' int_identifier '.' '.' int_identifier ')' */ |
2078 | 0 | #line 246 "ASN1.y" |
2079 | 0 | {(yyval.node)=(yyvsp[-6].node);} |
2080 | 0 | #line 2081 "ASN1.c" |
2081 | 0 | break; |
2082 | | |
2083 | 0 | case 40: /* boolean_def: BOOLEAN */ |
2084 | 0 | #line 249 "ASN1.y" |
2085 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_BOOLEAN);} |
2086 | 0 | #line 2087 "ASN1.c" |
2087 | 0 | break; |
2088 | | |
2089 | 0 | case 41: /* Time: UTCTime */ |
2090 | 0 | #line 252 "ASN1.y" |
2091 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_UTC_TIME);} |
2092 | 0 | #line 2093 "ASN1.c" |
2093 | 0 | break; |
2094 | | |
2095 | 0 | case 42: /* Time: GeneralizedTime */ |
2096 | 0 | #line 253 "ASN1.y" |
2097 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_GENERALIZED_TIME);} |
2098 | 0 | #line 2099 "ASN1.c" |
2099 | 0 | break; |
2100 | | |
2101 | 0 | case 43: /* size_def2: SIZE '(' num_identifier ')' */ |
2102 | 0 | #line 256 "ASN1.y" |
2103 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SIZE|CONST_1_PARAM); |
2104 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
2105 | 0 | #line 2106 "ASN1.c" |
2106 | 0 | break; |
2107 | | |
2108 | 0 | case 44: /* size_def2: SIZE '(' num_identifier '.' '.' num_identifier ')' */ |
2109 | 0 | #line 259 "ASN1.y" |
2110 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SIZE|CONST_MIN_MAX); |
2111 | 0 | _asn1_set_value((yyval.node),(yyvsp[-4].str),strlen((yyvsp[-4].str))+1); |
2112 | 0 | _asn1_set_name((yyval.node),(yyvsp[-1].str));} |
2113 | 0 | #line 2114 "ASN1.c" |
2114 | 0 | break; |
2115 | | |
2116 | 0 | case 45: /* size_def: size_def2 */ |
2117 | 0 | #line 264 "ASN1.y" |
2118 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2119 | 0 | #line 2120 "ASN1.c" |
2120 | 0 | break; |
2121 | | |
2122 | 0 | case 46: /* size_def: '(' size_def2 ')' */ |
2123 | 0 | #line 265 "ASN1.y" |
2124 | 0 | {(yyval.node)=(yyvsp[-1].node);} |
2125 | 0 | #line 2126 "ASN1.c" |
2126 | 0 | break; |
2127 | | |
2128 | 0 | case 47: /* generalstring_def: GeneralString */ |
2129 | 0 | #line 268 "ASN1.y" |
2130 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_GENERALSTRING);} |
2131 | 0 | #line 2132 "ASN1.c" |
2132 | 0 | break; |
2133 | | |
2134 | 0 | case 48: /* generalstring_def: GeneralString size_def */ |
2135 | 0 | #line 269 "ASN1.y" |
2136 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_GENERALSTRING|CONST_SIZE); |
2137 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2138 | 0 | #line 2139 "ASN1.c" |
2139 | 0 | break; |
2140 | | |
2141 | 0 | case 49: /* numericstring_def: NumericString */ |
2142 | 0 | #line 273 "ASN1.y" |
2143 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_NUMERIC_STRING|CONST_UNIVERSAL);} |
2144 | 0 | #line 2145 "ASN1.c" |
2145 | 0 | break; |
2146 | | |
2147 | 0 | case 50: /* numericstring_def: NumericString size_def */ |
2148 | 0 | #line 274 "ASN1.y" |
2149 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_NUMERIC_STRING|CONST_SIZE); |
2150 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2151 | 0 | #line 2152 "ASN1.c" |
2152 | 0 | break; |
2153 | | |
2154 | 0 | case 51: /* ia5string_def: IA5String */ |
2155 | 0 | #line 278 "ASN1.y" |
2156 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_IA5_STRING);} |
2157 | 0 | #line 2158 "ASN1.c" |
2158 | 0 | break; |
2159 | | |
2160 | 0 | case 52: /* ia5string_def: IA5String size_def */ |
2161 | 0 | #line 279 "ASN1.y" |
2162 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_IA5_STRING|CONST_SIZE); |
2163 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2164 | 0 | #line 2165 "ASN1.c" |
2165 | 0 | break; |
2166 | | |
2167 | 0 | case 53: /* teletexstring_def: TeletexString */ |
2168 | 0 | #line 283 "ASN1.y" |
2169 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_TELETEX_STRING);} |
2170 | 0 | #line 2171 "ASN1.c" |
2171 | 0 | break; |
2172 | | |
2173 | 0 | case 54: /* teletexstring_def: TeletexString size_def */ |
2174 | 0 | #line 284 "ASN1.y" |
2175 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_TELETEX_STRING|CONST_SIZE); |
2176 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2177 | 0 | #line 2178 "ASN1.c" |
2178 | 0 | break; |
2179 | | |
2180 | 0 | case 55: /* printablestring_def: PrintableString */ |
2181 | 0 | #line 288 "ASN1.y" |
2182 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_PRINTABLE_STRING);} |
2183 | 0 | #line 2184 "ASN1.c" |
2184 | 0 | break; |
2185 | | |
2186 | 0 | case 56: /* printablestring_def: PrintableString size_def */ |
2187 | 0 | #line 289 "ASN1.y" |
2188 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_PRINTABLE_STRING|CONST_SIZE); |
2189 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2190 | 0 | #line 2191 "ASN1.c" |
2191 | 0 | break; |
2192 | | |
2193 | 0 | case 57: /* universalstring_def: UniversalString */ |
2194 | 0 | #line 293 "ASN1.y" |
2195 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_UNIVERSAL_STRING);} |
2196 | 0 | #line 2197 "ASN1.c" |
2197 | 0 | break; |
2198 | | |
2199 | 0 | case 58: /* universalstring_def: UniversalString size_def */ |
2200 | 0 | #line 294 "ASN1.y" |
2201 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_UNIVERSAL_STRING|CONST_SIZE); |
2202 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2203 | 0 | #line 2204 "ASN1.c" |
2204 | 0 | break; |
2205 | | |
2206 | 0 | case 59: /* bmpstring_def: BMPString */ |
2207 | 0 | #line 298 "ASN1.y" |
2208 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_BMP_STRING);} |
2209 | 0 | #line 2210 "ASN1.c" |
2210 | 0 | break; |
2211 | | |
2212 | 0 | case 60: /* bmpstring_def: BMPString size_def */ |
2213 | 0 | #line 299 "ASN1.y" |
2214 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_BMP_STRING|CONST_SIZE); |
2215 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2216 | 0 | #line 2217 "ASN1.c" |
2217 | 0 | break; |
2218 | | |
2219 | 0 | case 61: /* utf8string_def: UTF8String */ |
2220 | 0 | #line 303 "ASN1.y" |
2221 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_UTF8_STRING);} |
2222 | 0 | #line 2223 "ASN1.c" |
2223 | 0 | break; |
2224 | | |
2225 | 0 | case 62: /* utf8string_def: UTF8String size_def */ |
2226 | 0 | #line 304 "ASN1.y" |
2227 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_UTF8_STRING|CONST_SIZE); |
2228 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2229 | 0 | #line 2230 "ASN1.c" |
2230 | 0 | break; |
2231 | | |
2232 | 0 | case 63: /* visiblestring_def: VisibleString */ |
2233 | 0 | #line 308 "ASN1.y" |
2234 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_VISIBLE_STRING);} |
2235 | 0 | #line 2236 "ASN1.c" |
2236 | 0 | break; |
2237 | | |
2238 | 0 | case 64: /* visiblestring_def: VisibleString size_def */ |
2239 | 0 | #line 309 "ASN1.y" |
2240 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_VISIBLE_STRING|CONST_SIZE); |
2241 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2242 | 0 | #line 2243 "ASN1.c" |
2243 | 0 | break; |
2244 | | |
2245 | 0 | case 65: /* octet_string_def: OCTET STRING */ |
2246 | 0 | #line 313 "ASN1.y" |
2247 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OCTET_STRING);} |
2248 | 0 | #line 2249 "ASN1.c" |
2249 | 0 | break; |
2250 | | |
2251 | 0 | case 66: /* octet_string_def: OCTET STRING size_def */ |
2252 | 0 | #line 314 "ASN1.y" |
2253 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OCTET_STRING|CONST_SIZE); |
2254 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2255 | 0 | #line 2256 "ASN1.c" |
2256 | 0 | break; |
2257 | | |
2258 | 0 | case 67: /* bit_element: IDENTIFIER '(' NUM ')' */ |
2259 | 0 | #line 318 "ASN1.y" |
2260 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_CONSTANT); |
2261 | 0 | _asn1_set_name((yyval.node),(yyvsp[-3].str)); |
2262 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1);} |
2263 | 0 | #line 2264 "ASN1.c" |
2264 | 0 | break; |
2265 | | |
2266 | 0 | case 68: /* bit_element_list: bit_element */ |
2267 | 0 | #line 323 "ASN1.y" |
2268 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2269 | 0 | #line 2270 "ASN1.c" |
2270 | 0 | break; |
2271 | | |
2272 | 0 | case 69: /* bit_element_list: bit_element_list ',' bit_element */ |
2273 | 0 | #line 324 "ASN1.y" |
2274 | 0 | {(yyval.node)=(yyvsp[-2].node); |
2275 | 0 | _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));} |
2276 | 0 | #line 2277 "ASN1.c" |
2277 | 0 | break; |
2278 | | |
2279 | 0 | case 70: /* bit_string_def: BIT STRING */ |
2280 | 0 | #line 328 "ASN1.y" |
2281 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_BIT_STRING);} |
2282 | 0 | #line 2283 "ASN1.c" |
2283 | 0 | break; |
2284 | | |
2285 | 0 | case 71: /* bit_string_def: BIT STRING size_def */ |
2286 | 0 | #line 329 "ASN1.y" |
2287 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_BIT_STRING|CONST_SIZE); |
2288 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2289 | 0 | #line 2290 "ASN1.c" |
2290 | 0 | break; |
2291 | | |
2292 | 0 | case 72: /* bit_string_def: BIT STRING '{' bit_element_list '}' */ |
2293 | 0 | #line 332 "ASN1.y" |
2294 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_BIT_STRING|CONST_LIST); |
2295 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2296 | 0 | #line 2297 "ASN1.c" |
2297 | 0 | break; |
2298 | | |
2299 | 0 | case 73: /* enumerated_def: ENUMERATED '{' bit_element_list '}' */ |
2300 | 0 | #line 337 "ASN1.y" |
2301 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_ENUMERATED|CONST_LIST); |
2302 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2303 | 0 | #line 2304 "ASN1.c" |
2304 | 0 | break; |
2305 | | |
2306 | 0 | case 74: /* object_def: OBJECT STR_IDENTIFIER */ |
2307 | 0 | #line 342 "ASN1.y" |
2308 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OBJECT_ID);} |
2309 | 0 | #line 2310 "ASN1.c" |
2310 | 0 | break; |
2311 | | |
2312 | 0 | case 75: /* type_assig_right: IDENTIFIER */ |
2313 | 0 | #line 345 "ASN1.y" |
2314 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_IDENTIFIER); |
2315 | 0 | _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} |
2316 | 0 | #line 2317 "ASN1.c" |
2317 | 0 | break; |
2318 | | |
2319 | 0 | case 76: /* type_assig_right: IDENTIFIER size_def */ |
2320 | 0 | #line 347 "ASN1.y" |
2321 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_IDENTIFIER|CONST_SIZE); |
2322 | 0 | _asn1_set_value((yyval.node),(yyvsp[-1].str),strlen((yyvsp[-1].str))+1); |
2323 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2324 | 0 | #line 2325 "ASN1.c" |
2325 | 0 | break; |
2326 | | |
2327 | 0 | case 77: /* type_assig_right: integer_def */ |
2328 | 0 | #line 350 "ASN1.y" |
2329 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2330 | 0 | #line 2331 "ASN1.c" |
2331 | 0 | break; |
2332 | | |
2333 | 0 | case 78: /* type_assig_right: enumerated_def */ |
2334 | 0 | #line 351 "ASN1.y" |
2335 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2336 | 0 | #line 2337 "ASN1.c" |
2337 | 0 | break; |
2338 | | |
2339 | 0 | case 79: /* type_assig_right: boolean_def */ |
2340 | 0 | #line 352 "ASN1.y" |
2341 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2342 | 0 | #line 2343 "ASN1.c" |
2343 | 0 | break; |
2344 | | |
2345 | 0 | case 81: /* type_assig_right: octet_string_def */ |
2346 | 0 | #line 354 "ASN1.y" |
2347 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2348 | 0 | #line 2349 "ASN1.c" |
2349 | 0 | break; |
2350 | | |
2351 | 0 | case 82: /* type_assig_right: bit_string_def */ |
2352 | 0 | #line 355 "ASN1.y" |
2353 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2354 | 0 | #line 2355 "ASN1.c" |
2355 | 0 | break; |
2356 | | |
2357 | 0 | case 83: /* type_assig_right: generalstring_def */ |
2358 | 0 | #line 356 "ASN1.y" |
2359 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2360 | 0 | #line 2361 "ASN1.c" |
2361 | 0 | break; |
2362 | | |
2363 | 0 | case 84: /* type_assig_right: numericstring_def */ |
2364 | 0 | #line 357 "ASN1.y" |
2365 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2366 | 0 | #line 2367 "ASN1.c" |
2367 | 0 | break; |
2368 | | |
2369 | 0 | case 85: /* type_assig_right: ia5string_def */ |
2370 | 0 | #line 358 "ASN1.y" |
2371 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2372 | 0 | #line 2373 "ASN1.c" |
2373 | 0 | break; |
2374 | | |
2375 | 0 | case 86: /* type_assig_right: teletexstring_def */ |
2376 | 0 | #line 359 "ASN1.y" |
2377 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2378 | 0 | #line 2379 "ASN1.c" |
2379 | 0 | break; |
2380 | | |
2381 | 0 | case 87: /* type_assig_right: printablestring_def */ |
2382 | 0 | #line 360 "ASN1.y" |
2383 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2384 | 0 | #line 2385 "ASN1.c" |
2385 | 0 | break; |
2386 | | |
2387 | 0 | case 88: /* type_assig_right: universalstring_def */ |
2388 | 0 | #line 361 "ASN1.y" |
2389 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2390 | 0 | #line 2391 "ASN1.c" |
2391 | 0 | break; |
2392 | | |
2393 | 0 | case 89: /* type_assig_right: bmpstring_def */ |
2394 | 0 | #line 362 "ASN1.y" |
2395 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2396 | 0 | #line 2397 "ASN1.c" |
2397 | 0 | break; |
2398 | | |
2399 | 0 | case 90: /* type_assig_right: utf8string_def */ |
2400 | 0 | #line 363 "ASN1.y" |
2401 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2402 | 0 | #line 2403 "ASN1.c" |
2403 | 0 | break; |
2404 | | |
2405 | 0 | case 91: /* type_assig_right: visiblestring_def */ |
2406 | 0 | #line 364 "ASN1.y" |
2407 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2408 | 0 | #line 2409 "ASN1.c" |
2409 | 0 | break; |
2410 | | |
2411 | 0 | case 92: /* type_assig_right: sequence_def */ |
2412 | 0 | #line 365 "ASN1.y" |
2413 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2414 | 0 | #line 2415 "ASN1.c" |
2415 | 0 | break; |
2416 | | |
2417 | 0 | case 93: /* type_assig_right: object_def */ |
2418 | 0 | #line 366 "ASN1.y" |
2419 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2420 | 0 | #line 2421 "ASN1.c" |
2421 | 0 | break; |
2422 | | |
2423 | 0 | case 94: /* type_assig_right: choise_def */ |
2424 | 0 | #line 367 "ASN1.y" |
2425 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2426 | 0 | #line 2427 "ASN1.c" |
2427 | 0 | break; |
2428 | | |
2429 | 0 | case 95: /* type_assig_right: any_def */ |
2430 | 0 | #line 368 "ASN1.y" |
2431 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2432 | 0 | #line 2433 "ASN1.c" |
2433 | 0 | break; |
2434 | | |
2435 | 0 | case 96: /* type_assig_right: set_def */ |
2436 | 0 | #line 369 "ASN1.y" |
2437 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2438 | 0 | #line 2439 "ASN1.c" |
2439 | 0 | break; |
2440 | | |
2441 | 0 | case 97: /* type_assig_right: TOKEN_NULL */ |
2442 | 0 | #line 370 "ASN1.y" |
2443 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_NULL);} |
2444 | 0 | #line 2445 "ASN1.c" |
2445 | 0 | break; |
2446 | | |
2447 | 0 | case 98: /* type_assig_right_tag: type_assig_right */ |
2448 | 0 | #line 373 "ASN1.y" |
2449 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2450 | 0 | #line 2451 "ASN1.c" |
2451 | 0 | break; |
2452 | | |
2453 | 0 | case 99: /* type_assig_right_tag: tag type_assig_right */ |
2454 | 0 | #line 374 "ASN1.y" |
2455 | 0 | {(yyval.node)=_asn1_mod_type((yyvsp[0].node),CONST_TAG); |
2456 | 0 | _asn1_set_right((yyvsp[-1].node),_asn1_get_down((yyval.node))); |
2457 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2458 | 0 | #line 2459 "ASN1.c" |
2459 | 0 | break; |
2460 | | |
2461 | 0 | case 100: /* type_assig_right_tag_default: type_assig_right_tag */ |
2462 | 0 | #line 379 "ASN1.y" |
2463 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2464 | 0 | #line 2465 "ASN1.c" |
2465 | 0 | break; |
2466 | | |
2467 | 0 | case 101: /* type_assig_right_tag_default: type_assig_right_tag default */ |
2468 | 0 | #line 380 "ASN1.y" |
2469 | 0 | {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_DEFAULT); |
2470 | 0 | _asn1_set_right((yyvsp[0].node),_asn1_get_down((yyval.node))); |
2471 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2472 | 0 | #line 2473 "ASN1.c" |
2473 | 0 | break; |
2474 | | |
2475 | 0 | case 102: /* type_assig_right_tag_default: type_assig_right_tag OPTIONAL */ |
2476 | 0 | #line 383 "ASN1.y" |
2477 | 0 | {(yyval.node)=_asn1_mod_type((yyvsp[-1].node),CONST_OPTION);} |
2478 | 0 | #line 2479 "ASN1.c" |
2479 | 0 | break; |
2480 | | |
2481 | 0 | case 103: /* type_assig: IDENTIFIER type_assig_right_tag_default */ |
2482 | 0 | #line 386 "ASN1.y" |
2483 | 0 | {(yyval.node)=_asn1_set_name((yyvsp[0].node),(yyvsp[-1].str));} |
2484 | 0 | #line 2485 "ASN1.c" |
2485 | 0 | break; |
2486 | | |
2487 | 0 | case 104: /* type_assig_list: type_assig */ |
2488 | 0 | #line 389 "ASN1.y" |
2489 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2490 | 0 | #line 2491 "ASN1.c" |
2491 | 0 | break; |
2492 | | |
2493 | 0 | case 105: /* type_assig_list: type_assig_list ',' type_assig */ |
2494 | 0 | #line 390 "ASN1.y" |
2495 | 0 | {(yyval.node)=(yyvsp[-2].node); |
2496 | 0 | _asn1_set_right(_asn1_get_last_right((yyvsp[-2].node)),(yyvsp[0].node));} |
2497 | 0 | #line 2498 "ASN1.c" |
2498 | 0 | break; |
2499 | | |
2500 | 0 | case 106: /* sequence_def: SEQUENCE '{' type_assig_list '}' */ |
2501 | 0 | #line 394 "ASN1.y" |
2502 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SEQUENCE); |
2503 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2504 | 0 | #line 2505 "ASN1.c" |
2505 | 0 | break; |
2506 | | |
2507 | 0 | case 107: /* sequence_def: SEQUENCE OF type_assig_right */ |
2508 | 0 | #line 396 "ASN1.y" |
2509 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SEQUENCE_OF); |
2510 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2511 | 0 | #line 2512 "ASN1.c" |
2512 | 0 | break; |
2513 | | |
2514 | 0 | case 108: /* sequence_def: SEQUENCE size_def OF type_assig_right */ |
2515 | 0 | #line 398 "ASN1.y" |
2516 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SEQUENCE_OF|CONST_SIZE); |
2517 | 0 | _asn1_set_right((yyvsp[-2].node),(yyvsp[0].node)); |
2518 | 0 | _asn1_set_down((yyval.node),(yyvsp[-2].node));} |
2519 | 0 | #line 2520 "ASN1.c" |
2520 | 0 | break; |
2521 | | |
2522 | 0 | case 109: /* set_def: SET '{' type_assig_list '}' */ |
2523 | 0 | #line 403 "ASN1.y" |
2524 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SET); |
2525 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2526 | 0 | #line 2527 "ASN1.c" |
2527 | 0 | break; |
2528 | | |
2529 | 0 | case 110: /* set_def: SET OF type_assig_right */ |
2530 | 0 | #line 405 "ASN1.y" |
2531 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SET_OF); |
2532 | 0 | _asn1_set_down((yyval.node),(yyvsp[0].node));} |
2533 | 0 | #line 2534 "ASN1.c" |
2534 | 0 | break; |
2535 | | |
2536 | 0 | case 111: /* set_def: SET size_def OF type_assig_right */ |
2537 | 0 | #line 407 "ASN1.y" |
2538 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_SET_OF|CONST_SIZE); |
2539 | 0 | _asn1_set_right((yyvsp[-2].node),(yyvsp[0].node)); |
2540 | 0 | _asn1_set_down((yyval.node),(yyvsp[-2].node));} |
2541 | 0 | #line 2542 "ASN1.c" |
2542 | 0 | break; |
2543 | | |
2544 | 0 | case 112: /* choise_def: CHOICE '{' type_assig_list '}' */ |
2545 | 0 | #line 412 "ASN1.y" |
2546 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_CHOICE); |
2547 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2548 | 0 | #line 2549 "ASN1.c" |
2549 | 0 | break; |
2550 | | |
2551 | 0 | case 113: /* any_def: ANY */ |
2552 | 0 | #line 416 "ASN1.y" |
2553 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_ANY);} |
2554 | 0 | #line 2555 "ASN1.c" |
2555 | 0 | break; |
2556 | | |
2557 | 0 | case 114: /* any_def: ANY DEFINED BY IDENTIFIER */ |
2558 | 0 | #line 417 "ASN1.y" |
2559 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_ANY|CONST_DEFINED_BY); |
2560 | 0 | _asn1_set_down((yyval.node),_asn1_add_static_node(&e_list, ASN1_ETYPE_CONSTANT)); |
2561 | 0 | _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[0].str));} |
2562 | 0 | #line 2563 "ASN1.c" |
2563 | 0 | break; |
2564 | | |
2565 | 0 | case 115: /* known_string: UTF8String */ |
2566 | 0 | #line 422 "ASN1.y" |
2567 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2568 | 0 | #line 2569 "ASN1.c" |
2569 | 0 | break; |
2570 | | |
2571 | 0 | case 116: /* known_string: VisibleString */ |
2572 | 0 | #line 423 "ASN1.y" |
2573 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2574 | 0 | #line 2575 "ASN1.c" |
2575 | 0 | break; |
2576 | | |
2577 | 0 | case 117: /* known_string: PrintableString */ |
2578 | 0 | #line 424 "ASN1.y" |
2579 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2580 | 0 | #line 2581 "ASN1.c" |
2581 | 0 | break; |
2582 | | |
2583 | 0 | case 118: /* known_string: UniversalString */ |
2584 | 0 | #line 425 "ASN1.y" |
2585 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2586 | 0 | #line 2587 "ASN1.c" |
2587 | 0 | break; |
2588 | | |
2589 | 0 | case 119: /* known_string: IA5String */ |
2590 | 0 | #line 426 "ASN1.y" |
2591 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2592 | 0 | #line 2593 "ASN1.c" |
2593 | 0 | break; |
2594 | | |
2595 | 0 | case 120: /* known_string: NumericString */ |
2596 | 0 | #line 427 "ASN1.y" |
2597 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2598 | 0 | #line 2599 "ASN1.c" |
2599 | 0 | break; |
2600 | | |
2601 | 0 | case 121: /* known_string: TeletexString */ |
2602 | 0 | #line 428 "ASN1.y" |
2603 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2604 | 0 | #line 2605 "ASN1.c" |
2605 | 0 | break; |
2606 | | |
2607 | 0 | case 122: /* known_string: BMPString */ |
2608 | 0 | #line 429 "ASN1.y" |
2609 | 0 | { SAFE_COPY((yyval.str),sizeof((yyval.str)),"%s",last_token); } |
2610 | 0 | #line 2611 "ASN1.c" |
2611 | 0 | break; |
2612 | | |
2613 | 0 | case 123: /* type_invalid: known_string "::=" '[' class NUM ']' IMPLICIT OCTET STRING */ |
2614 | 0 | #line 432 "ASN1.y" |
2615 | 0 | { |
2616 | | #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION |
2617 | | fprintf(stderr, "%s:%u: Warning: %s is a built-in ASN.1 type.\n", file_name, line_number, (yyvsp[-8].str)); |
2618 | | #endif |
2619 | 0 | } |
2620 | 0 | #line 2621 "ASN1.c" |
2621 | 0 | break; |
2622 | | |
2623 | 0 | case 124: /* type_def: IDENTIFIER "::=" type_assig_right_tag */ |
2624 | 0 | #line 439 "ASN1.y" |
2625 | 0 | { (yyval.node)=_asn1_set_name((yyvsp[0].node),(yyvsp[-2].str));} |
2626 | 0 | #line 2627 "ASN1.c" |
2627 | 0 | break; |
2628 | | |
2629 | 0 | case 125: /* constant_def: IDENTIFIER OBJECT STR_IDENTIFIER "::=" '{' obj_constant_list '}' */ |
2630 | 0 | #line 443 "ASN1.y" |
2631 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN); |
2632 | 0 | _asn1_set_name((yyval.node),(yyvsp[-6].str)); |
2633 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2634 | 0 | #line 2635 "ASN1.c" |
2635 | 0 | break; |
2636 | | |
2637 | 0 | case 126: /* constant_def: IDENTIFIER IDENTIFIER "::=" '{' obj_constant_list '}' */ |
2638 | 0 | #line 447 "ASN1.y" |
2639 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM); |
2640 | 0 | _asn1_set_name((yyval.node),(yyvsp[-5].str)); |
2641 | 0 | _asn1_set_value((yyval.node),(yyvsp[-4].str),strlen((yyvsp[-4].str))+1); |
2642 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node));} |
2643 | 0 | #line 2644 "ASN1.c" |
2644 | 0 | break; |
2645 | | |
2646 | 0 | case 127: /* constant_def: IDENTIFIER INTEGER "::=" pos_neg_num */ |
2647 | 0 | #line 452 "ASN1.y" |
2648 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_INTEGER|CONST_ASSIGN); |
2649 | 0 | _asn1_set_name((yyval.node),(yyvsp[-3].str)); |
2650 | 0 | _asn1_set_value((yyval.node),(yyvsp[0].str),strlen((yyvsp[0].str))+1);} |
2651 | 0 | #line 2652 "ASN1.c" |
2652 | 0 | break; |
2653 | | |
2654 | 0 | case 128: /* type_constant: type_def */ |
2655 | 0 | #line 457 "ASN1.y" |
2656 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2657 | 0 | #line 2658 "ASN1.c" |
2658 | 0 | break; |
2659 | | |
2660 | 0 | case 129: /* type_constant: type_invalid */ |
2661 | 0 | #line 458 "ASN1.y" |
2662 | 0 | {(yyval.node)=NULL;} |
2663 | 0 | #line 2664 "ASN1.c" |
2664 | 0 | break; |
2665 | | |
2666 | 0 | case 130: /* type_constant: constant_def */ |
2667 | 0 | #line 459 "ASN1.y" |
2668 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2669 | 0 | #line 2670 "ASN1.c" |
2670 | 0 | break; |
2671 | | |
2672 | 0 | case 131: /* type_constant_list: type_constant */ |
2673 | 0 | #line 462 "ASN1.y" |
2674 | 0 | {(yyval.node)=(yyvsp[0].node);} |
2675 | 0 | #line 2676 "ASN1.c" |
2676 | 0 | break; |
2677 | | |
2678 | 0 | case 132: /* type_constant_list: type_constant_list type_constant */ |
2679 | 0 | #line 463 "ASN1.y" |
2680 | 0 | {if (!(yyvsp[-1].node)) |
2681 | 0 | { |
2682 | 0 | (yyval.node) = (yyvsp[0].node); |
2683 | 0 | } |
2684 | 0 | else |
2685 | 0 | { |
2686 | 0 | (yyval.node)=(yyvsp[-1].node); |
2687 | 0 | if ((yyvsp[0].node)) _asn1_set_right(_asn1_get_last_right((yyvsp[-1].node)),(yyvsp[0].node)); |
2688 | 0 | }} |
2689 | 0 | #line 2690 "ASN1.c" |
2690 | 0 | break; |
2691 | | |
2692 | 0 | case 133: /* definitions_id: IDENTIFIER '{' obj_constant_list '}' */ |
2693 | 0 | #line 474 "ASN1.y" |
2694 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OBJECT_ID); |
2695 | 0 | _asn1_set_down((yyval.node),(yyvsp[-1].node)); |
2696 | 0 | _asn1_set_name((yyval.node),(yyvsp[-3].str));} |
2697 | 0 | #line 2698 "ASN1.c" |
2698 | 0 | break; |
2699 | | |
2700 | 0 | case 134: /* definitions_id: IDENTIFIER '{' '}' */ |
2701 | 0 | #line 477 "ASN1.y" |
2702 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OBJECT_ID); |
2703 | 0 | _asn1_set_name((yyval.node),(yyvsp[-2].str));} |
2704 | 0 | #line 2705 "ASN1.c" |
2705 | 0 | break; |
2706 | | |
2707 | 0 | case 135: /* definitions_id: IDENTIFIER */ |
2708 | 0 | #line 479 "ASN1.y" |
2709 | 0 | {(yyval.node)=_asn1_add_static_node(&e_list, ASN1_ETYPE_OBJECT_ID); |
2710 | 0 | _asn1_set_name((yyval.node),(yyvsp[0].str));} |
2711 | 0 | #line 2712 "ASN1.c" |
2712 | 0 | break; |
2713 | | |
2714 | 0 | case 136: /* explicit_implicit: EXPLICIT */ |
2715 | 0 | #line 503 "ASN1.y" |
2716 | 0 | {(yyval.constant)=CONST_EXPLICIT;} |
2717 | 0 | #line 2718 "ASN1.c" |
2718 | 0 | break; |
2719 | | |
2720 | 0 | case 137: /* explicit_implicit: IMPLICIT */ |
2721 | 0 | #line 504 "ASN1.y" |
2722 | 0 | {(yyval.constant)=CONST_IMPLICIT;} |
2723 | 0 | #line 2724 "ASN1.c" |
2724 | 0 | break; |
2725 | | |
2726 | | |
2727 | 0 | #line 2728 "ASN1.c" |
2728 | | |
2729 | 0 | default: break; |
2730 | 0 | } |
2731 | | /* User semantic actions sometimes alter yychar, and that requires |
2732 | | that yytoken be updated with the new translation. We take the |
2733 | | approach of translating immediately before every use of yytoken. |
2734 | | One alternative is translating here after every semantic action, |
2735 | | but that translation would be missed if the semantic action invokes |
2736 | | YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
2737 | | if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
2738 | | incorrect destructor might then be invoked immediately. In the |
2739 | | case of YYERROR or YYBACKUP, subsequent parser actions might lead |
2740 | | to an incorrect destructor call or verbose syntax error message |
2741 | | before the lookahead is translated. */ |
2742 | 0 | YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
2743 | |
|
2744 | 0 | YYPOPSTACK (yylen); |
2745 | 0 | yylen = 0; |
2746 | |
|
2747 | 0 | *++yyvsp = yyval; |
2748 | | |
2749 | | /* Now 'shift' the result of the reduction. Determine what state |
2750 | | that goes to, based on the state we popped back to and the rule |
2751 | | number reduced by. */ |
2752 | 0 | { |
2753 | 0 | const int yylhs = yyr1[yyn] - YYNTOKENS; |
2754 | 0 | const int yyi = yypgoto[yylhs] + *yyssp; |
2755 | 0 | yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
2756 | 0 | ? yytable[yyi] |
2757 | 0 | : yydefgoto[yylhs]); |
2758 | 0 | } |
2759 | |
|
2760 | 0 | goto yynewstate; |
2761 | | |
2762 | | |
2763 | | /*--------------------------------------. |
2764 | | | yyerrlab -- here on detecting error. | |
2765 | | `--------------------------------------*/ |
2766 | 0 | yyerrlab: |
2767 | | /* Make sure we have latest lookahead translation. See comments at |
2768 | | user semantic actions for why this is necessary. */ |
2769 | 0 | yytoken = yychar == _ASN1_YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
2770 | | /* If not already recovering from an error, report this error. */ |
2771 | 0 | if (!yyerrstatus) |
2772 | 0 | { |
2773 | 0 | ++yynerrs; |
2774 | 0 | { |
2775 | 0 | yypcontext_t yyctx |
2776 | 0 | = {yyssp, yytoken}; |
2777 | 0 | char const *yymsgp = YY_("syntax error"); |
2778 | 0 | int yysyntax_error_status; |
2779 | 0 | yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
2780 | 0 | if (yysyntax_error_status == 0) |
2781 | 0 | yymsgp = yymsg; |
2782 | 0 | else if (yysyntax_error_status == -1) |
2783 | 0 | { |
2784 | 0 | if (yymsg != yymsgbuf) |
2785 | 0 | YYSTACK_FREE (yymsg); |
2786 | 0 | yymsg = YY_CAST (char *, |
2787 | 0 | YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); |
2788 | 0 | if (yymsg) |
2789 | 0 | { |
2790 | 0 | yysyntax_error_status |
2791 | 0 | = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
2792 | 0 | yymsgp = yymsg; |
2793 | 0 | } |
2794 | 0 | else |
2795 | 0 | { |
2796 | 0 | yymsg = yymsgbuf; |
2797 | 0 | yymsg_alloc = sizeof yymsgbuf; |
2798 | 0 | yysyntax_error_status = YYENOMEM; |
2799 | 0 | } |
2800 | 0 | } |
2801 | 0 | yyerror (yymsgp); |
2802 | 0 | if (yysyntax_error_status == YYENOMEM) |
2803 | 0 | YYNOMEM; |
2804 | 0 | } |
2805 | 0 | } |
2806 | | |
2807 | 0 | if (yyerrstatus == 3) |
2808 | 0 | { |
2809 | | /* If just tried and failed to reuse lookahead token after an |
2810 | | error, discard it. */ |
2811 | |
|
2812 | 0 | if (yychar <= _ASN1_YYEOF) |
2813 | 0 | { |
2814 | | /* Return failure if at end of input. */ |
2815 | 0 | if (yychar == _ASN1_YYEOF) |
2816 | 0 | YYABORT; |
2817 | 0 | } |
2818 | 0 | else |
2819 | 0 | { |
2820 | 0 | yydestruct ("Error: discarding", |
2821 | 0 | yytoken, &yylval); |
2822 | 0 | yychar = _ASN1_YYEMPTY; |
2823 | 0 | } |
2824 | 0 | } |
2825 | | |
2826 | | /* Else will try to reuse lookahead token after shifting the error |
2827 | | token. */ |
2828 | 0 | goto yyerrlab1; |
2829 | | |
2830 | | |
2831 | | /*---------------------------------------------------. |
2832 | | | yyerrorlab -- error raised explicitly by YYERROR. | |
2833 | | `---------------------------------------------------*/ |
2834 | 0 | yyerrorlab: |
2835 | | /* Pacify compilers when the user code never invokes YYERROR and the |
2836 | | label yyerrorlab therefore never appears in user code. */ |
2837 | 0 | if (0) |
2838 | 0 | YYERROR; |
2839 | 0 | ++yynerrs; |
2840 | | |
2841 | | /* Do not reclaim the symbols of the rule whose action triggered |
2842 | | this YYERROR. */ |
2843 | 0 | YYPOPSTACK (yylen); |
2844 | 0 | yylen = 0; |
2845 | 0 | YY_STACK_PRINT (yyss, yyssp); |
2846 | 0 | yystate = *yyssp; |
2847 | 0 | goto yyerrlab1; |
2848 | | |
2849 | | |
2850 | | /*-------------------------------------------------------------. |
2851 | | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
2852 | | `-------------------------------------------------------------*/ |
2853 | 0 | yyerrlab1: |
2854 | 0 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
2855 | | |
2856 | | /* Pop stack until we find a state that shifts the error token. */ |
2857 | 0 | for (;;) |
2858 | 0 | { |
2859 | 0 | yyn = yypact[yystate]; |
2860 | 0 | if (!yypact_value_is_default (yyn)) |
2861 | 0 | { |
2862 | 0 | yyn += YYSYMBOL_YYerror; |
2863 | 0 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
2864 | 0 | { |
2865 | 0 | yyn = yytable[yyn]; |
2866 | 0 | if (0 < yyn) |
2867 | 0 | break; |
2868 | 0 | } |
2869 | 0 | } |
2870 | | |
2871 | | /* Pop the current state because it cannot handle the error token. */ |
2872 | 0 | if (yyssp == yyss) |
2873 | 0 | YYABORT; |
2874 | | |
2875 | | |
2876 | 0 | yydestruct ("Error: popping", |
2877 | 0 | YY_ACCESSING_SYMBOL (yystate), yyvsp); |
2878 | 0 | YYPOPSTACK (1); |
2879 | 0 | yystate = *yyssp; |
2880 | 0 | YY_STACK_PRINT (yyss, yyssp); |
2881 | 0 | } |
2882 | | |
2883 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
2884 | 0 | *++yyvsp = yylval; |
2885 | 0 | YY_IGNORE_MAYBE_UNINITIALIZED_END |
2886 | | |
2887 | | |
2888 | | /* Shift the error token. */ |
2889 | 0 | YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
2890 | |
|
2891 | 0 | yystate = yyn; |
2892 | 0 | goto yynewstate; |
2893 | | |
2894 | | |
2895 | | /*-------------------------------------. |
2896 | | | yyacceptlab -- YYACCEPT comes here. | |
2897 | | `-------------------------------------*/ |
2898 | 0 | yyacceptlab: |
2899 | 0 | yyresult = 0; |
2900 | 0 | goto yyreturnlab; |
2901 | | |
2902 | | |
2903 | | /*-----------------------------------. |
2904 | | | yyabortlab -- YYABORT comes here. | |
2905 | | `-----------------------------------*/ |
2906 | 0 | yyabortlab: |
2907 | 0 | yyresult = 1; |
2908 | 0 | goto yyreturnlab; |
2909 | | |
2910 | | |
2911 | | /*-----------------------------------------------------------. |
2912 | | | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
2913 | | `-----------------------------------------------------------*/ |
2914 | 0 | yyexhaustedlab: |
2915 | 0 | yyerror (YY_("memory exhausted")); |
2916 | 0 | yyresult = 2; |
2917 | 0 | goto yyreturnlab; |
2918 | | |
2919 | | |
2920 | | /*----------------------------------------------------------. |
2921 | | | yyreturnlab -- parsing is finished, clean up and return. | |
2922 | | `----------------------------------------------------------*/ |
2923 | 0 | yyreturnlab: |
2924 | 0 | if (yychar != _ASN1_YYEMPTY) |
2925 | 0 | { |
2926 | | /* Make sure we have latest lookahead translation. See comments at |
2927 | | user semantic actions for why this is necessary. */ |
2928 | 0 | yytoken = YYTRANSLATE (yychar); |
2929 | 0 | yydestruct ("Cleanup: discarding lookahead", |
2930 | 0 | yytoken, &yylval); |
2931 | 0 | } |
2932 | | /* Do not reclaim the symbols of the rule whose action triggered |
2933 | | this YYABORT or YYACCEPT. */ |
2934 | 0 | YYPOPSTACK (yylen); |
2935 | 0 | YY_STACK_PRINT (yyss, yyssp); |
2936 | 0 | while (yyssp != yyss) |
2937 | 0 | { |
2938 | 0 | yydestruct ("Cleanup: popping", |
2939 | 0 | YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); |
2940 | 0 | YYPOPSTACK (1); |
2941 | 0 | } |
2942 | 0 | #ifndef yyoverflow |
2943 | 0 | if (yyss != yyssa) |
2944 | 0 | YYSTACK_FREE (yyss); |
2945 | 0 | #endif |
2946 | 0 | if (yymsg != yymsgbuf) |
2947 | 0 | YYSTACK_FREE (yymsg); |
2948 | 0 | return yyresult; |
2949 | 0 | } |
2950 | | |
2951 | | #line 508 "ASN1.y" |
2952 | | |
2953 | | |
2954 | | |
2955 | | |
2956 | | static const char *key_word[] = { |
2957 | | "::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING", |
2958 | | "SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL", |
2959 | | "DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER", |
2960 | | "BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED", |
2961 | | "SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS", |
2962 | | "BEGIN","END","UTCTime","GeneralizedTime", |
2963 | | "GeneralString","FROM","IMPORTS","NULL","ENUMERATED", |
2964 | | "NumericString", "IA5String", "TeletexString", "PrintableString", |
2965 | | "UniversalString", "BMPString", "UTF8String", "VisibleString"}; |
2966 | | |
2967 | | static const int key_word_token[] = { |
2968 | | ASSIG, OPTIONAL, INTEGER, SIZE, OCTET, STRING, SEQUENCE, BIT, UNIVERSAL, |
2969 | | PRIVATE, OPTIONAL, DEFAULT, CHOICE, OF, OBJECT, STR_IDENTIFIER, |
2970 | | BOOLEAN, ASN1_TRUE, ASN1_FALSE, APPLICATION, ANY, DEFINED, SET, BY, |
2971 | | EXPLICIT, IMPLICIT, DEFINITIONS, TAGS, BEGIN, END, UTCTime, |
2972 | | GeneralizedTime, GeneralString, FROM, IMPORTS, TOKEN_NULL, |
2973 | | ENUMERATED, NumericString, IA5String, TeletexString, PrintableString, |
2974 | | UniversalString, BMPString, UTF8String, VisibleString |
2975 | | }; |
2976 | | |
2977 | | /*************************************************************/ |
2978 | | /* Function: _asn1_yylex */ |
2979 | | /* Description: looks for tokens in file_asn1 pointer file. */ |
2980 | | /* Return: int */ |
2981 | | /* Token identifier or ASCII code or 0(zero: End Of File) */ |
2982 | | /*************************************************************/ |
2983 | | static int |
2984 | | _asn1_yylex (void) |
2985 | 0 | { |
2986 | 0 | int c, counter = 0, k, lastc; |
2987 | 0 | char string[ASN1_MAX_NAME_SIZE + 1]; /* will contain the next token */ |
2988 | 0 | size_t i; |
2989 | |
|
2990 | 0 | while (1) |
2991 | 0 | { |
2992 | 0 | while ((c = fgetc (file_asn1)) == ' ' || c == '\t' || c == '\n') |
2993 | 0 | if (c == '\n') |
2994 | 0 | line_number++; |
2995 | |
|
2996 | 0 | if (c == EOF) |
2997 | 0 | { |
2998 | 0 | snprintf (last_token, sizeof(last_token), "End Of File"); |
2999 | 0 | return 0; |
3000 | 0 | } |
3001 | | |
3002 | 0 | if (c == '(' || c == ')' || c == '[' || c == ']' || |
3003 | 0 | c == '{' || c == '}' || c == ',' || c == '.' || |
3004 | 0 | c == '+' || c == '|') |
3005 | 0 | { |
3006 | 0 | last_token[0] = c; |
3007 | 0 | last_token[1] = 0; |
3008 | 0 | return c; |
3009 | 0 | } |
3010 | 0 | if (c == '-') |
3011 | 0 | { /* Maybe the first '-' of a comment */ |
3012 | 0 | if ((c = fgetc (file_asn1)) != '-') |
3013 | 0 | { |
3014 | 0 | ungetc (c, file_asn1); |
3015 | 0 | last_token[0] = '-'; |
3016 | 0 | last_token[1] = 0; |
3017 | 0 | return '-'; |
3018 | 0 | } |
3019 | 0 | else |
3020 | 0 | { /* Comments */ |
3021 | 0 | lastc = 0; |
3022 | 0 | counter = 0; |
3023 | | /* A comment finishes at the next double hyphen or the end of line */ |
3024 | 0 | while ((c = fgetc (file_asn1)) != EOF && c != '\n' && |
3025 | 0 | (lastc != '-' || (lastc == '-' && c != '-'))) |
3026 | 0 | lastc = c; |
3027 | 0 | if (c == EOF) |
3028 | 0 | { |
3029 | 0 | snprintf (last_token, sizeof(last_token), "End Of File"); |
3030 | 0 | return 0; |
3031 | 0 | } |
3032 | 0 | else |
3033 | 0 | { |
3034 | 0 | if (c == '\n') |
3035 | 0 | line_number++; |
3036 | 0 | continue; /* next char, please! (repeat the search) */ |
3037 | 0 | } |
3038 | 0 | } |
3039 | 0 | } |
3040 | 0 | string[counter++] = (char) c; |
3041 | | /* Till the end of the token */ |
3042 | 0 | while (! |
3043 | 0 | ((c = fgetc (file_asn1)) == EOF || c == ' ' || c == '\t' |
3044 | 0 | || c == '\n' || c == '(' || c == ')' || c == '[' || c == ']' |
3045 | 0 | || c == '{' || c == '}' || c == ',' || c == '.')) |
3046 | 0 | { |
3047 | 0 | if (counter >= ASN1_MAX_NAME_SIZE) |
3048 | 0 | { |
3049 | 0 | result_parse = ASN1_NAME_TOO_LONG; |
3050 | 0 | return 0; |
3051 | 0 | } |
3052 | 0 | string[counter++] = (char) c; |
3053 | 0 | } |
3054 | 0 | ungetc (c, file_asn1); |
3055 | 0 | string[counter] = 0; |
3056 | 0 | snprintf (last_token, sizeof(last_token), "%s", string); |
3057 | | |
3058 | | /* Is STRING a number? */ |
3059 | 0 | for (k = 0; k < counter; k++) |
3060 | 0 | if (!c_isdigit ((int)string[k])) |
3061 | 0 | break; |
3062 | 0 | if (k >= counter) |
3063 | 0 | { |
3064 | 0 | snprintf (yylval.str, sizeof(yylval.str), "%s", string); |
3065 | 0 | return NUM; /* return the number */ |
3066 | 0 | } |
3067 | | |
3068 | | /* Is STRING a keyword? */ |
3069 | 0 | for (i = 0; i < (sizeof (key_word) / sizeof (char *)); i++) |
3070 | 0 | if (!strcmp (string, key_word[i])) |
3071 | 0 | return key_word_token[i]; |
3072 | | |
3073 | | /* STRING is an IDENTIFIER */ |
3074 | 0 | snprintf (yylval.str, sizeof(yylval.str), "%s", string); |
3075 | 0 | return IDENTIFIER; |
3076 | 0 | } |
3077 | 0 | } |
3078 | | |
3079 | | /*************************************************************/ |
3080 | | /* Function: _asn1_create_errorDescription */ |
3081 | | /* Description: creates a string with the description of the*/ |
3082 | | /* error. */ |
3083 | | /* Parameters: */ |
3084 | | /* error : error to describe. */ |
3085 | | /* error_desc: string that will contain the */ |
3086 | | /* description. */ |
3087 | | /*************************************************************/ |
3088 | | static void |
3089 | | _asn1_create_errorDescription (int error, char *error_desc) |
3090 | 0 | { |
3091 | 0 | if (error_desc == NULL) |
3092 | 0 | return; |
3093 | | |
3094 | | |
3095 | 0 | switch (error) |
3096 | 0 | { |
3097 | 0 | case ASN1_FILE_NOT_FOUND: |
3098 | 0 | snprintf(error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s file was not found", file_name); |
3099 | 0 | break; |
3100 | 0 | case ASN1_SYNTAX_ERROR: |
3101 | 0 | snprintf(error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, "%s", last_error); |
3102 | 0 | break; |
3103 | 0 | case ASN1_NAME_TOO_LONG: |
3104 | 0 | snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, |
3105 | 0 | "%s:%u: name too long (more than %u characters)", file_name, |
3106 | 0 | line_number, (unsigned)ASN1_MAX_NAME_SIZE); |
3107 | 0 | break; |
3108 | 0 | case ASN1_IDENTIFIER_NOT_FOUND: |
3109 | 0 | snprintf (error_desc, ASN1_MAX_ERROR_DESCRIPTION_SIZE, |
3110 | 0 | "%s:: identifier '%s' not found", file_name, |
3111 | 0 | _asn1_identifierMissing); |
3112 | 0 | break; |
3113 | 0 | default: |
3114 | 0 | error_desc[0] = 0; |
3115 | 0 | break; |
3116 | 0 | } |
3117 | |
|
3118 | 0 | } |
3119 | | |
3120 | | /** |
3121 | | * asn1_parser2tree: |
3122 | | * @file: specify the path and the name of file that contains |
3123 | | * ASN.1 declarations. |
3124 | | * @definitions: return the pointer to the structure created from |
3125 | | * "file" ASN.1 declarations. |
3126 | | * @error_desc: return the error description or an empty |
3127 | | * string if success. |
3128 | | * |
3129 | | * Function used to start the parse algorithm. Creates the structures |
3130 | | * needed to manage the definitions included in @file file. |
3131 | | * |
3132 | | * Returns: %ASN1_SUCCESS if the file has a correct syntax and every |
3133 | | * identifier is known, %ASN1_ELEMENT_NOT_EMPTY if @definitions not |
3134 | | * %NULL, %ASN1_FILE_NOT_FOUND if an error occurred while |
3135 | | * opening @file, %ASN1_SYNTAX_ERROR if the syntax is not |
3136 | | * correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is an |
3137 | | * identifier that is not defined, %ASN1_NAME_TOO_LONG if in the |
3138 | | * file there is an identifier with more than %ASN1_MAX_NAME_SIZE |
3139 | | * characters. |
3140 | | **/ |
3141 | | int |
3142 | | asn1_parser2tree (const char *file, asn1_node * definitions, |
3143 | | char *error_desc) |
3144 | 0 | { |
3145 | 0 | if (*definitions != NULL) |
3146 | 0 | { |
3147 | 0 | result_parse = ASN1_ELEMENT_NOT_EMPTY; |
3148 | 0 | goto error; |
3149 | 0 | } |
3150 | | |
3151 | 0 | file_name = file; |
3152 | | |
3153 | | /* open the file to parse */ |
3154 | 0 | file_asn1 = fopen (file, "r"); |
3155 | |
|
3156 | 0 | if (file_asn1 == NULL) |
3157 | 0 | { |
3158 | 0 | result_parse = ASN1_FILE_NOT_FOUND; |
3159 | 0 | goto error; |
3160 | 0 | } |
3161 | | |
3162 | 0 | result_parse = ASN1_SUCCESS; |
3163 | |
|
3164 | 0 | line_number = 1; |
3165 | 0 | yyparse (); |
3166 | |
|
3167 | 0 | fclose (file_asn1); |
3168 | |
|
3169 | 0 | if (result_parse != ASN1_SUCCESS) |
3170 | 0 | goto error; |
3171 | | |
3172 | | /* set IMPLICIT or EXPLICIT property */ |
3173 | 0 | _asn1_set_default_tag (p_tree); |
3174 | | /* set CONST_SET and CONST_NOT_USED */ |
3175 | 0 | _asn1_type_set_config (p_tree); |
3176 | | /* check the identifier definitions */ |
3177 | 0 | result_parse = _asn1_check_identifier (p_tree); |
3178 | 0 | if (result_parse != ASN1_SUCCESS) |
3179 | 0 | goto error; |
3180 | | |
3181 | | /* Convert into DER coding the value assign to INTEGER constants */ |
3182 | 0 | _asn1_change_integer_value (p_tree); |
3183 | | /* Expand the IDs of OBJECT IDENTIFIER constants */ |
3184 | 0 | result_parse = _asn1_expand_object_id (&e_list, p_tree); |
3185 | 0 | if (result_parse != ASN1_SUCCESS) |
3186 | 0 | goto error; |
3187 | | |
3188 | | /* success */ |
3189 | 0 | *definitions = p_tree; |
3190 | 0 | _asn1_delete_list (e_list); |
3191 | 0 | e_list = NULL; |
3192 | 0 | p_tree = NULL; |
3193 | 0 | *error_desc = 0; |
3194 | 0 | return result_parse; |
3195 | | |
3196 | 0 | error: |
3197 | 0 | _asn1_delete_list_and_nodes (e_list); |
3198 | 0 | e_list = NULL; |
3199 | 0 | p_tree = NULL; |
3200 | |
|
3201 | 0 | _asn1_create_errorDescription (result_parse, error_desc); |
3202 | |
|
3203 | 0 | return result_parse; |
3204 | 0 | } |
3205 | | |
3206 | | /** |
3207 | | * asn1_parser2array: |
3208 | | * @inputFileName: specify the path and the name of file that |
3209 | | * contains ASN.1 declarations. |
3210 | | * @outputFileName: specify the path and the name of file that will |
3211 | | * contain the C vector definition. |
3212 | | * @vectorName: specify the name of the C vector. |
3213 | | * @error_desc: return the error description or an empty |
3214 | | * string if success. |
3215 | | * |
3216 | | * Function that generates a C structure from an ASN1 file. Creates a |
3217 | | * file containing a C vector to use to manage the definitions |
3218 | | * included in @inputFileName file. If @inputFileName is |
3219 | | * "/aa/bb/xx.yy" and @outputFileName is %NULL, the file created is |
3220 | | * "/aa/bb/xx_asn1_tab.c". If @vectorName is %NULL the vector name |
3221 | | * will be "xx_asn1_tab". |
3222 | | * |
3223 | | * Returns: %ASN1_SUCCESS if the file has a correct syntax and every |
3224 | | * identifier is known, %ASN1_FILE_NOT_FOUND if an error occurred |
3225 | | * while opening @inputFileName, %ASN1_SYNTAX_ERROR if the syntax is |
3226 | | * not correct, %ASN1_IDENTIFIER_NOT_FOUND if in the file there is |
3227 | | * an identifier that is not defined, %ASN1_NAME_TOO_LONG if in the |
3228 | | * file there is an identifier with more than %ASN1_MAX_NAME_SIZE |
3229 | | * characters. |
3230 | | **/ |
3231 | | int |
3232 | | asn1_parser2array (const char *inputFileName, const char *outputFileName, |
3233 | | const char *vectorName, char *error_desc) |
3234 | 0 | { |
3235 | 0 | char *file_out_name = NULL; |
3236 | 0 | char *vector_name = NULL; |
3237 | 0 | const char *char_p, *slash_p, *dot_p; |
3238 | |
|
3239 | 0 | p_tree = NULL; |
3240 | |
|
3241 | 0 | file_name = inputFileName; |
3242 | | |
3243 | | /* open the file to parse */ |
3244 | 0 | file_asn1 = fopen (inputFileName, "r"); |
3245 | |
|
3246 | 0 | if (file_asn1 == NULL) |
3247 | 0 | { |
3248 | 0 | result_parse = ASN1_FILE_NOT_FOUND; |
3249 | 0 | goto error2; |
3250 | 0 | } |
3251 | | |
3252 | 0 | result_parse = ASN1_SUCCESS; |
3253 | |
|
3254 | 0 | line_number = 1; |
3255 | 0 | yyparse (); |
3256 | |
|
3257 | 0 | fclose (file_asn1); |
3258 | 0 | if (result_parse != ASN1_SUCCESS) |
3259 | 0 | goto error1; |
3260 | | |
3261 | | /* set IMPLICIT or EXPLICIT property */ |
3262 | 0 | _asn1_set_default_tag (p_tree); |
3263 | | /* set CONST_SET and CONST_NOT_USED */ |
3264 | 0 | _asn1_type_set_config (p_tree); |
3265 | | /* check the identifier definitions */ |
3266 | 0 | result_parse = _asn1_check_identifier (p_tree); |
3267 | 0 | if (result_parse != ASN1_SUCCESS) |
3268 | 0 | goto error2; |
3269 | | |
3270 | | /* all identifier defined */ |
3271 | | /* searching the last '/' and '.' in inputFileName */ |
3272 | 0 | char_p = inputFileName; |
3273 | 0 | slash_p = inputFileName; |
3274 | 0 | while ((char_p = strchr (char_p, '/'))) |
3275 | 0 | { |
3276 | 0 | char_p++; |
3277 | 0 | slash_p = char_p; |
3278 | 0 | } |
3279 | |
|
3280 | 0 | char_p = slash_p; |
3281 | 0 | dot_p = inputFileName + strlen (inputFileName); |
3282 | |
|
3283 | 0 | while ((char_p = strchr (char_p, '.'))) |
3284 | 0 | { |
3285 | 0 | dot_p = char_p; |
3286 | 0 | char_p++; |
3287 | 0 | } |
3288 | |
|
3289 | 0 | if (outputFileName == NULL) |
3290 | 0 | { |
3291 | | /* file_out_name = inputFileName + _asn1_tab.c */ |
3292 | 0 | file_out_name = malloc (dot_p - inputFileName + 1 + |
3293 | 0 | sizeof ("_asn1_tab.c")-1); |
3294 | 0 | memcpy (file_out_name, inputFileName, |
3295 | 0 | dot_p - inputFileName); |
3296 | 0 | file_out_name[dot_p - inputFileName] = 0; |
3297 | 0 | strcat (file_out_name, "_asn1_tab.c"); |
3298 | 0 | } |
3299 | 0 | else |
3300 | 0 | { |
3301 | | /* file_out_name = inputFileName */ |
3302 | 0 | file_out_name = strdup(outputFileName); |
3303 | 0 | } |
3304 | |
|
3305 | 0 | if (vectorName == NULL) |
3306 | 0 | { |
3307 | 0 | unsigned len, i; |
3308 | | /* vector_name = file name + _asn1_tab */ |
3309 | 0 | vector_name = malloc (dot_p - slash_p + 1 + |
3310 | 0 | sizeof("_asn1_tab") - 1); |
3311 | 0 | memcpy (vector_name, slash_p, dot_p - slash_p); |
3312 | 0 | vector_name[dot_p - slash_p] = 0; |
3313 | 0 | strcat (vector_name, "_asn1_tab"); |
3314 | |
|
3315 | 0 | len = strlen(vector_name); |
3316 | 0 | for (i=0;i<len;i++) |
3317 | 0 | { |
3318 | 0 | if (vector_name[i] == '-') |
3319 | 0 | vector_name[i] = '_'; |
3320 | 0 | } |
3321 | 0 | } |
3322 | 0 | else |
3323 | 0 | { |
3324 | | /* vector_name = vectorName */ |
3325 | 0 | vector_name = strdup(vectorName); |
3326 | 0 | } |
3327 | | |
3328 | | /* Save structure in a file */ |
3329 | 0 | _asn1_create_static_structure (p_tree, |
3330 | 0 | file_out_name, vector_name); |
3331 | |
|
3332 | 0 | free (file_out_name); |
3333 | 0 | free (vector_name); |
3334 | |
|
3335 | 0 | error1: |
3336 | 0 | _asn1_delete_list_and_nodes (e_list); |
3337 | 0 | e_list = NULL; |
3338 | |
|
3339 | 0 | error2: |
3340 | 0 | _asn1_create_errorDescription (result_parse, error_desc); |
3341 | |
|
3342 | 0 | return result_parse; |
3343 | 0 | } |
3344 | | |
3345 | | /*************************************************************/ |
3346 | | /* Function: _asn1_yyerror */ |
3347 | | /* Description: function called when there are syntax errors*/ |
3348 | | /* Parameters: */ |
3349 | | /* char *s : error description */ |
3350 | | /* Return: int */ |
3351 | | /* */ |
3352 | | /*************************************************************/ |
3353 | | static void |
3354 | | _asn1_yyerror (const char *s) |
3355 | 0 | { |
3356 | | /* Sends the error description to the std_out */ |
3357 | 0 | last_error_token[0] = 0; |
3358 | |
|
3359 | 0 | if (result_parse != ASN1_NAME_TOO_LONG) |
3360 | 0 | { |
3361 | 0 | snprintf (last_error, sizeof(last_error), |
3362 | 0 | "%s:%u: Error: %s near '%s'", file_name, |
3363 | 0 | line_number, s, last_token); |
3364 | 0 | result_parse = ASN1_SYNTAX_ERROR; |
3365 | 0 | } |
3366 | |
|
3367 | 0 | return; |
3368 | 0 | } |