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