Add.
[libtasn1.git] / lib / ASN1.c
blob12cfaf78864f8fc45207597ac5638ef5d4a486cd
1 /* A Bison parser, made by GNU Bison 1.875a. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
37 #define YYBISON 1
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
42 /* Pure parsers. */
43 #define YYPURE 0
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
49 names. */
50 #define yyparse _asn1_yyparse
51 #define yylex _asn1_yylex
52 #define yyerror _asn1_yyerror
53 #define yylval _asn1_yylval
54 #define yychar _asn1_yychar
55 #define yydebug _asn1_yydebug
56 #define yynerrs _asn1_yynerrs
59 /* Tokens. */
60 #ifndef YYTOKENTYPE
61 # define YYTOKENTYPE
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
63 know about them. */
64 enum yytokentype {
65 ASSIG = 258,
66 NUM = 259,
67 IDENTIFIER = 260,
68 OPTIONAL = 261,
69 INTEGER = 262,
70 SIZE = 263,
71 OCTET = 264,
72 STRING = 265,
73 SEQUENCE = 266,
74 BIT = 267,
75 UNIVERSAL = 268,
76 PRIVATE = 269,
77 APPLICATION = 270,
78 DEFAULT = 271,
79 CHOICE = 272,
80 OF = 273,
81 OBJECT = 274,
82 STR_IDENTIFIER = 275,
83 BOOLEAN = 276,
84 TRUE = 277,
85 FALSE = 278,
86 TOKEN_NULL = 279,
87 ANY = 280,
88 DEFINED = 281,
89 BY = 282,
90 SET = 283,
91 EXPLICIT = 284,
92 IMPLICIT = 285,
93 DEFINITIONS = 286,
94 TAGS = 287,
95 BEGIN = 288,
96 END = 289,
97 UTCTime = 290,
98 GeneralizedTime = 291,
99 GeneralString = 292,
100 FROM = 293,
101 IMPORTS = 294,
102 ENUMERATED = 295
104 #endif
105 #define ASSIG 258
106 #define NUM 259
107 #define IDENTIFIER 260
108 #define OPTIONAL 261
109 #define INTEGER 262
110 #define SIZE 263
111 #define OCTET 264
112 #define STRING 265
113 #define SEQUENCE 266
114 #define BIT 267
115 #define UNIVERSAL 268
116 #define PRIVATE 269
117 #define APPLICATION 270
118 #define DEFAULT 271
119 #define CHOICE 272
120 #define OF 273
121 #define OBJECT 274
122 #define STR_IDENTIFIER 275
123 #define BOOLEAN 276
124 #define TRUE 277
125 #define FALSE 278
126 #define TOKEN_NULL 279
127 #define ANY 280
128 #define DEFINED 281
129 #define BY 282
130 #define SET 283
131 #define EXPLICIT 284
132 #define IMPLICIT 285
133 #define DEFINITIONS 286
134 #define TAGS 287
135 #define BEGIN 288
136 #define END 289
137 #define UTCTime 290
138 #define GeneralizedTime 291
139 #define GeneralString 292
140 #define FROM 293
141 #define IMPORTS 294
142 #define ENUMERATED 295
147 /* Copy the first part of user declarations. */
148 #line 30 "ASN1.y"
150 #include <int.h>
151 #include <errors.h>
152 #include <parser_aux.h>
153 #include <structure.h>
156 static FILE *file_asn1; /* Pointer to file to parse */
157 static asn1_retCode result_parse; /* result of the parser
158 algorithm */
159 static node_asn *p_tree; /* pointer to the root of the
160 structure created by the
161 parser*/
162 static unsigned long lineNumber; /* line number describing the
163 parser position inside the
164 file */
165 static char lastToken[MAX_NAME_SIZE+1]; /* last token find in the file
166 to parse before the 'parse
167 error' */
168 extern char _asn1_identifierMissing[];
169 static const char *fileName; /* file to parse */
171 int _asn1_yyerror (char *);
172 int _asn1_yylex(void);
176 /* Enabling traces. */
177 #ifndef YYDEBUG
178 # define YYDEBUG 0
179 #endif
181 /* Enabling verbose error messages. */
182 #ifdef YYERROR_VERBOSE
183 # undef YYERROR_VERBOSE
184 # define YYERROR_VERBOSE 1
185 #else
186 # define YYERROR_VERBOSE 0
187 #endif
189 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
190 #line 60 "ASN1.y"
191 typedef union YYSTYPE {
192 unsigned int constant;
193 char str[MAX_NAME_SIZE+1];
194 node_asn* node;
195 } YYSTYPE;
196 /* Line 191 of yacc.c. */
197 #line 198 "ASN1.c"
198 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
199 # define YYSTYPE_IS_DECLARED 1
200 # define YYSTYPE_IS_TRIVIAL 1
201 #endif
205 /* Copy the second part of user declarations. */
208 /* Line 214 of yacc.c. */
209 #line 210 "ASN1.c"
211 #if ! defined (yyoverflow) || YYERROR_VERBOSE
213 /* The parser invokes alloca or malloc; define the necessary symbols. */
215 # if YYSTACK_USE_ALLOCA
216 # define YYSTACK_ALLOC alloca
217 # else
218 # ifndef YYSTACK_USE_ALLOCA
219 # if defined (alloca) || defined (_ALLOCA_H)
220 # define YYSTACK_ALLOC alloca
221 # else
222 # ifdef __GNUC__
223 # define YYSTACK_ALLOC __builtin_alloca
224 # endif
225 # endif
226 # endif
227 # endif
229 # ifdef YYSTACK_ALLOC
230 /* Pacify GCC's `empty if-body' warning. */
231 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
232 # else
233 # if defined (__STDC__) || defined (__cplusplus)
234 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
235 # define YYSIZE_T size_t
236 # endif
237 # define YYSTACK_ALLOC malloc
238 # define YYSTACK_FREE free
239 # endif
240 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
243 #if (! defined (yyoverflow) \
244 && (! defined (__cplusplus) \
245 || (YYSTYPE_IS_TRIVIAL)))
247 /* A type that is properly aligned for any stack member. */
248 union yyalloc
250 short yyss;
251 YYSTYPE yyvs;
254 /* The size of the maximum gap between one aligned stack and the next. */
255 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
257 /* The size of an array large to enough to hold all stacks, each with
258 N elements. */
259 # define YYSTACK_BYTES(N) \
260 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
261 + YYSTACK_GAP_MAXIMUM)
263 /* Copy COUNT objects from FROM to TO. The source and destination do
264 not overlap. */
265 # ifndef YYCOPY
266 # if 1 < __GNUC__
267 # define YYCOPY(To, From, Count) \
268 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
269 # else
270 # define YYCOPY(To, From, Count) \
271 do \
273 register YYSIZE_T yyi; \
274 for (yyi = 0; yyi < (Count); yyi++) \
275 (To)[yyi] = (From)[yyi]; \
277 while (0)
278 # endif
279 # endif
281 /* Relocate STACK from its old location to the new one. The
282 local variables YYSIZE and YYSTACKSIZE give the old and new number of
283 elements in the stack, and YYPTR gives the new location of the
284 stack. Advance YYPTR to a properly aligned location for the next
285 stack. */
286 # define YYSTACK_RELOCATE(Stack) \
287 do \
289 YYSIZE_T yynewbytes; \
290 YYCOPY (&yyptr->Stack, Stack, yysize); \
291 Stack = &yyptr->Stack; \
292 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
293 yyptr += yynewbytes / sizeof (*yyptr); \
295 while (0)
297 #endif
299 #if defined (__STDC__) || defined (__cplusplus)
300 typedef signed char yysigned_char;
301 #else
302 typedef short yysigned_char;
303 #endif
305 /* YYFINAL -- State number of the termination state. */
306 #define YYFINAL 5
307 /* YYLAST -- Last index in YYTABLE. */
308 #define YYLAST 189
310 /* YYNTOKENS -- Number of terminals. */
311 #define YYNTOKENS 52
312 /* YYNNTS -- Number of nonterminals. */
313 #define YYNNTS 43
314 /* YYNRULES -- Number of rules. */
315 #define YYNRULES 98
316 /* YYNRULES -- Number of states. */
317 #define YYNSTATES 189
319 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
320 #define YYUNDEFTOK 2
321 #define YYMAXUTOK 295
323 #define YYTRANSLATE(YYX) \
324 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
326 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
327 static const unsigned char yytranslate[] =
329 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
330 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
331 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
332 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
333 43, 44, 2, 41, 45, 42, 51, 2, 2, 2,
334 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338 2, 46, 2, 47, 2, 2, 2, 2, 2, 2,
339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 49, 48, 50, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
355 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
356 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
357 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
358 35, 36, 37, 38, 39, 40
361 #if YYDEBUG
362 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
363 YYRHS. */
364 static const unsigned short yyprhs[] =
366 0, 0, 3, 12, 14, 17, 20, 22, 24, 26,
367 28, 30, 32, 36, 41, 43, 47, 49, 54, 56,
368 59, 61, 63, 65, 69, 74, 76, 79, 82, 85,
369 88, 91, 93, 97, 99, 104, 109, 117, 119, 121,
370 123, 128, 136, 138, 142, 144, 147, 150, 154, 159,
371 161, 165, 168, 174, 179, 182, 184, 187, 189, 191,
372 193, 195, 197, 199, 201, 203, 205, 207, 209, 211,
373 213, 215, 218, 220, 223, 226, 229, 231, 235, 240,
374 244, 249, 254, 258, 263, 268, 270, 275, 279, 287,
375 294, 299, 301, 303, 305, 308, 313, 317, 319
378 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
379 static const yysigned_char yyrhs[] =
381 53, 0, -1, 93, 31, 94, 32, 3, 33, 92,
382 34, -1, 4, -1, 41, 4, -1, 42, 4, -1,
383 54, -1, 55, -1, 4, -1, 5, -1, 56, -1,
384 5, -1, 43, 56, 44, -1, 5, 43, 56, 44,
385 -1, 59, -1, 60, 45, 59, -1, 57, -1, 5,
386 43, 4, 44, -1, 61, -1, 62, 61, -1, 13,
387 -1, 14, -1, 15, -1, 46, 4, 47, -1, 46,
388 63, 4, 47, -1, 64, -1, 64, 29, -1, 64,
389 30, -1, 16, 58, -1, 16, 22, -1, 16, 23,
390 -1, 56, -1, 67, 48, 56, -1, 7, -1, 7,
391 49, 60, 50, -1, 7, 43, 67, 44, -1, 7,
392 43, 57, 51, 51, 57, 44, -1, 21, -1, 35,
393 -1, 36, -1, 8, 43, 57, 44, -1, 8, 43,
394 57, 51, 51, 57, 44, -1, 71, -1, 43, 71,
395 44, -1, 37, -1, 37, 72, -1, 9, 10, -1,
396 9, 10, 72, -1, 5, 43, 4, 44, -1, 75,
397 -1, 76, 45, 75, -1, 12, 10, -1, 12, 10,
398 49, 76, 50, -1, 40, 49, 76, 50, -1, 19,
399 20, -1, 5, -1, 5, 72, -1, 68, -1, 78,
400 -1, 69, -1, 70, -1, 74, -1, 77, -1, 73,
401 -1, 85, -1, 79, -1, 87, -1, 88, -1, 86,
402 -1, 24, -1, 80, -1, 65, 80, -1, 81, -1,
403 81, 66, -1, 81, 6, -1, 5, 82, -1, 83,
404 -1, 84, 45, 83, -1, 11, 49, 84, 50, -1,
405 11, 18, 80, -1, 11, 72, 18, 80, -1, 28,
406 49, 84, 50, -1, 28, 18, 80, -1, 28, 72,
407 18, 80, -1, 17, 49, 84, 50, -1, 25, -1,
408 25, 26, 27, 5, -1, 5, 3, 81, -1, 5,
409 19, 20, 3, 49, 62, 50, -1, 5, 5, 3,
410 49, 62, 50, -1, 5, 7, 3, 56, -1, 89,
411 -1, 90, -1, 91, -1, 92, 91, -1, 5, 49,
412 62, 50, -1, 5, 49, 50, -1, 29, -1, 30,
416 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
417 static const unsigned short yyrline[] =
419 0, 122, 122, 135, 136, 139, 143, 144, 147, 148,
420 151, 152, 155, 157, 162, 163, 167, 169, 174, 175,
421 179, 180, 181, 184, 186, 190, 191, 192, 195, 197,
422 198, 202, 203, 207, 208, 210, 211, 218, 221, 222,
423 225, 227, 233, 234, 237, 238, 242, 243, 247, 252,
424 253, 257, 258, 263, 269, 272, 274, 277, 278, 279,
425 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
426 292, 293, 298, 299, 302, 305, 308, 309, 313, 315,
427 317, 322, 324, 326, 331, 335, 336, 341, 344, 348,
428 353, 359, 360, 363, 364, 368, 371, 395, 396
430 #endif
432 #if YYDEBUG || YYERROR_VERBOSE
433 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
434 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
435 static const char *const yytname[] =
437 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER", "OPTIONAL",
438 "INTEGER", "SIZE", "OCTET", "STRING", "SEQUENCE", "BIT", "UNIVERSAL",
439 "PRIVATE", "APPLICATION", "DEFAULT", "CHOICE", "OF", "OBJECT",
440 "STR_IDENTIFIER", "BOOLEAN", "TRUE", "FALSE", "TOKEN_NULL", "ANY",
441 "DEFINED", "BY", "SET", "EXPLICIT", "IMPLICIT", "DEFINITIONS", "TAGS",
442 "BEGIN", "END", "UTCTime", "GeneralizedTime", "GeneralString", "FROM",
443 "IMPORTS", "ENUMERATED", "'+'", "'-'", "'('", "')'", "','", "'['",
444 "']'", "'|'", "'{'", "'}'", "'.'", "$accept", "definitions", "pos_num",
445 "neg_num", "pos_neg_num", "num_identifier", "pos_neg_identifier",
446 "constant", "constant_list", "obj_constant", "obj_constant_list",
447 "class", "tag_type", "tag", "default", "pos_neg_list", "integer_def",
448 "boolean_def", "Time", "size_def2", "size_def", "generalstring_def",
449 "octet_string_def", "bit_element", "bit_element_list", "bit_string_def",
450 "enumerated_def", "object_def", "type_assig_right",
451 "type_assig_right_tag", "type_assig_right_tag_default", "type_assig",
452 "type_assig_list", "sequence_def", "set_def", "choise_def", "any_def",
453 "type_def", "constant_def", "type_constant", "type_constant_list",
454 "definitions_id", "explicit_implicit", 0
456 #endif
458 # ifdef YYPRINT
459 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
460 token YYLEX-NUM. */
461 static const unsigned short yytoknum[] =
463 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
464 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
465 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
466 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
467 295, 43, 45, 40, 41, 44, 91, 93, 124, 123,
468 125, 46
470 # endif
472 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
473 static const unsigned char yyr1[] =
475 0, 52, 53, 54, 54, 55, 56, 56, 57, 57,
476 58, 58, 59, 59, 60, 60, 61, 61, 62, 62,
477 63, 63, 63, 64, 64, 65, 65, 65, 66, 66,
478 66, 67, 67, 68, 68, 68, 68, 69, 70, 70,
479 71, 71, 72, 72, 73, 73, 74, 74, 75, 76,
480 76, 77, 77, 78, 79, 80, 80, 80, 80, 80,
481 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
482 81, 81, 82, 82, 82, 83, 84, 84, 85, 85,
483 85, 86, 86, 86, 87, 88, 88, 89, 90, 90,
484 90, 91, 91, 92, 92, 93, 93, 94, 94
487 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
488 static const unsigned char yyr2[] =
490 0, 2, 8, 1, 2, 2, 1, 1, 1, 1,
491 1, 1, 3, 4, 1, 3, 1, 4, 1, 2,
492 1, 1, 1, 3, 4, 1, 2, 2, 2, 2,
493 2, 1, 3, 1, 4, 4, 7, 1, 1, 1,
494 4, 7, 1, 3, 1, 2, 2, 3, 4, 1,
495 3, 2, 5, 4, 2, 1, 2, 1, 1, 1,
496 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
497 1, 2, 1, 2, 2, 2, 1, 3, 4, 3,
498 4, 4, 3, 4, 4, 1, 4, 3, 7, 6,
499 4, 1, 1, 1, 2, 4, 3, 1, 1
502 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
503 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
504 means the default is an error. */
505 static const unsigned char yydefact[] =
507 0, 0, 0, 0, 0, 1, 0, 8, 9, 96,
508 16, 18, 0, 97, 98, 0, 0, 95, 19, 0,
509 0, 0, 17, 0, 0, 91, 92, 93, 0, 0,
510 0, 0, 0, 2, 94, 55, 33, 0, 0, 0,
511 0, 0, 37, 69, 85, 0, 38, 39, 44, 0,
512 0, 25, 0, 57, 59, 60, 63, 61, 62, 58,
513 65, 70, 87, 64, 68, 66, 67, 0, 0, 0,
514 0, 0, 42, 56, 0, 0, 46, 0, 0, 0,
515 51, 0, 54, 0, 0, 0, 0, 45, 0, 0,
516 20, 21, 22, 0, 26, 27, 71, 0, 3, 0,
517 0, 6, 7, 90, 0, 0, 0, 3, 9, 31,
518 0, 0, 0, 0, 14, 0, 47, 79, 0, 76,
519 0, 0, 0, 0, 0, 82, 0, 0, 0, 49,
520 0, 23, 0, 0, 4, 5, 0, 0, 43, 0,
521 35, 0, 0, 0, 0, 34, 72, 75, 0, 78,
522 80, 0, 84, 86, 81, 83, 0, 0, 53, 24,
523 89, 0, 40, 0, 0, 32, 0, 12, 15, 74,
524 0, 73, 77, 52, 0, 50, 88, 0, 0, 13,
525 11, 29, 30, 10, 28, 48, 0, 36, 41
528 /* YYDEFGOTO[NTERM-NUM]. */
529 static const short yydefgoto[] =
531 -1, 2, 101, 102, 103, 10, 184, 114, 115, 11,
532 12, 93, 51, 52, 171, 111, 53, 54, 55, 72,
533 73, 56, 57, 129, 130, 58, 59, 60, 61, 62,
534 147, 119, 120, 63, 64, 65, 66, 25, 26, 27,
535 28, 3, 15
538 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
539 STATE-NUM. */
540 #define YYPACT_NINF -84
541 static const short yypact[] =
543 18, -32, 33, 15, 0, -84, 90, -84, 49, -84,
544 -84, -84, 2, -84, -84, 11, 45, -84, -84, 57,
545 50, 43, -84, 100, 74, -84, -84, -84, 10, 78,
546 105, 113, 106, -84, -84, 5, -31, 126, 8, 128,
547 79, 120, -84, -84, 115, 12, -84, -84, 5, 95,
548 96, 102, 118, -84, -84, -84, -84, -84, -84, -84,
549 -84, -84, -84, -84, -84, -84, -84, 98, 23, 142,
550 107, 140, -84, -84, 32, 20, 5, 118, 146, 134,
551 108, 146, -84, 132, 118, 146, 138, -84, 155, 114,
552 -84, -84, -84, 158, -84, -84, -84, 63, -84, 159,
553 160, -84, -84, -84, 116, 129, 122, 117, -84, -84,
554 119, 38, 124, 23, -84, -3, -84, -84, 78, -84,
555 21, 118, 155, 30, 164, -84, 51, 118, 130, -84,
556 62, -84, 125, 4, -84, -84, 63, -6, -84, 123,
557 -84, 23, 23, 127, 20, -84, 13, -84, 146, -84,
558 -84, 72, -84, -84, -84, -84, 171, 155, -84, -84,
559 -84, 6, -84, 131, 129, -84, 133, -84, -84, -84,
560 17, -84, -84, -84, 135, -84, -84, 129, 136, -84,
561 -84, -84, -84, -84, -84, -84, 137, -84, -84
564 /* YYPGOTO[NTERM-NUM]. */
565 static const short yypgoto[] =
567 -84, -84, -84, -84, -72, -73, -84, 34, -84, -12,
568 -83, -84, -84, -84, -84, -84, -84, -84, -84, 112,
569 -14, -84, -84, 19, 64, -84, -84, -84, -49, 66,
570 -84, 37, 3, -84, -84, -84, -84, -84, -84, 161,
571 -84, -84, -84
574 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
575 positive, shift that token. If negative, reduce the rule which
576 number is the opposite. If zero, do what YYDEFACT says.
577 If YYTABLE_NINF, syntax error. */
578 #define YYTABLE_NINF -9
579 static const short yytable[] =
581 18, 110, 109, 96, 7, 8, 7, 8, 7, 8,
582 7, 8, 74, 70, 133, 24, 70, 4, 75, 169,
583 70, 98, 180, 1, 79, 112, 77, 98, 117, 170,
584 84, 86, 137, 5, 87, 125, 107, 108, 162, 181,
585 182, 143, 144, 19, 33, 163, 6, 145, 71, 20,
586 9, 71, 17, 161, 160, 71, 176, 78, 99, 100,
587 21, 85, 116, 113, 99, 100, 148, 7, 8, 165,
588 166, 149, 150, 99, 100, 148, 23, 29, 155, 30,
589 152, 31, 140, 35, 123, 36, 141, 37, 126, 38,
590 39, 178, 16, 32, 22, 40, 148, 41, 183, 42,
591 89, 154, 43, 44, 186, 24, 45, 157, 67, 90,
592 91, 92, 158, 46, 47, 48, 68, 157, 49, 13,
593 14, 18, 173, 35, 50, 36, 69, 37, 81, 38,
594 39, 94, 95, 7, 108, 40, 76, 41, 80, 42,
595 82, 83, 43, 44, 88, 104, 45, 97, 70, 18,
596 105, 118, 121, 46, 47, 48, 127, 122, 49, 124,
597 128, 131, 132, 134, 135, 136, 138, 142, -8, 153,
598 139, 167, 159, 156, 164, 174, 175, 179, 168, 185,
599 187, 188, 177, 106, 146, 172, 151, 0, 0, 34
602 static const short yycheck[] =
604 12, 74, 74, 52, 4, 5, 4, 5, 4, 5,
605 4, 5, 43, 8, 97, 5, 8, 49, 49, 6,
606 8, 4, 5, 5, 38, 5, 18, 4, 77, 16,
607 18, 45, 105, 0, 48, 84, 4, 5, 44, 22,
608 23, 113, 45, 32, 34, 51, 31, 50, 43, 4,
609 50, 43, 50, 136, 50, 43, 50, 49, 41, 42,
610 3, 49, 76, 43, 41, 42, 45, 4, 5, 141,
611 142, 50, 121, 41, 42, 45, 33, 3, 127, 5,
612 50, 7, 44, 5, 81, 7, 48, 9, 85, 11,
613 12, 164, 43, 19, 44, 17, 45, 19, 170, 21,
614 4, 50, 24, 25, 177, 5, 28, 45, 3, 13,
615 14, 15, 50, 35, 36, 37, 3, 45, 40, 29,
616 30, 133, 50, 5, 46, 7, 20, 9, 49, 11,
617 12, 29, 30, 4, 5, 17, 10, 19, 10, 21,
618 20, 26, 24, 25, 49, 3, 28, 49, 8, 161,
619 43, 5, 18, 35, 36, 37, 18, 49, 40, 27,
620 5, 47, 4, 4, 4, 49, 44, 43, 51, 5,
621 51, 44, 47, 43, 51, 4, 157, 44, 144, 44,
622 44, 44, 51, 71, 118, 148, 122, -1, -1, 28
625 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
626 symbol of state STATE-NUM. */
627 static const unsigned char yystos[] =
629 0, 5, 53, 93, 49, 0, 31, 4, 5, 50,
630 57, 61, 62, 29, 30, 94, 43, 50, 61, 32,
631 4, 3, 44, 33, 5, 89, 90, 91, 92, 3,
632 5, 7, 19, 34, 91, 5, 7, 9, 11, 12,
633 17, 19, 21, 24, 25, 28, 35, 36, 37, 40,
634 46, 64, 65, 68, 69, 70, 73, 74, 77, 78,
635 79, 80, 81, 85, 86, 87, 88, 3, 3, 20,
636 8, 43, 71, 72, 43, 49, 10, 18, 49, 72,
637 10, 49, 20, 26, 18, 49, 72, 72, 49, 4,
638 13, 14, 15, 63, 29, 30, 80, 49, 4, 41,
639 42, 54, 55, 56, 3, 43, 71, 4, 5, 56,
640 57, 67, 5, 43, 59, 60, 72, 80, 5, 83,
641 84, 18, 49, 84, 27, 80, 84, 18, 5, 75,
642 76, 47, 4, 62, 4, 4, 49, 57, 44, 51,
643 44, 48, 43, 56, 45, 50, 81, 82, 45, 50,
644 80, 76, 50, 5, 50, 80, 43, 45, 50, 47,
645 50, 62, 44, 51, 51, 56, 56, 44, 59, 6,
646 16, 66, 83, 50, 4, 75, 50, 51, 57, 44,
647 5, 22, 23, 56, 58, 44, 57, 44, 44
650 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
651 # define YYSIZE_T __SIZE_TYPE__
652 #endif
653 #if ! defined (YYSIZE_T) && defined (size_t)
654 # define YYSIZE_T size_t
655 #endif
656 #if ! defined (YYSIZE_T)
657 # if defined (__STDC__) || defined (__cplusplus)
658 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
659 # define YYSIZE_T size_t
660 # endif
661 #endif
662 #if ! defined (YYSIZE_T)
663 # define YYSIZE_T unsigned int
664 #endif
666 #define yyerrok (yyerrstatus = 0)
667 #define yyclearin (yychar = YYEMPTY)
668 #define YYEMPTY (-2)
669 #define YYEOF 0
671 #define YYACCEPT goto yyacceptlab
672 #define YYABORT goto yyabortlab
673 #define YYERROR goto yyerrlab1
676 /* Like YYERROR except do call yyerror. This remains here temporarily
677 to ease the transition to the new meaning of YYERROR, for GCC.
678 Once GCC version 2 has supplanted version 1, this can go. */
680 #define YYFAIL goto yyerrlab
682 #define YYRECOVERING() (!!yyerrstatus)
684 #define YYBACKUP(Token, Value) \
685 do \
686 if (yychar == YYEMPTY && yylen == 1) \
688 yychar = (Token); \
689 yylval = (Value); \
690 yytoken = YYTRANSLATE (yychar); \
691 YYPOPSTACK; \
692 goto yybackup; \
694 else \
696 yyerror ("syntax error: cannot back up");\
697 YYERROR; \
699 while (0)
701 #define YYTERROR 1
702 #define YYERRCODE 256
704 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
705 are run). */
707 #ifndef YYLLOC_DEFAULT
708 # define YYLLOC_DEFAULT(Current, Rhs, N) \
709 Current.first_line = Rhs[1].first_line; \
710 Current.first_column = Rhs[1].first_column; \
711 Current.last_line = Rhs[N].last_line; \
712 Current.last_column = Rhs[N].last_column;
713 #endif
715 /* YYLEX -- calling `yylex' with the right arguments. */
717 #ifdef YYLEX_PARAM
718 # define YYLEX yylex (YYLEX_PARAM)
719 #else
720 # define YYLEX yylex ()
721 #endif
723 /* Enable debugging if requested. */
724 #if YYDEBUG
726 # ifndef YYFPRINTF
727 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
728 # define YYFPRINTF fprintf
729 # endif
731 # define YYDPRINTF(Args) \
732 do { \
733 if (yydebug) \
734 YYFPRINTF Args; \
735 } while (0)
737 # define YYDSYMPRINT(Args) \
738 do { \
739 if (yydebug) \
740 yysymprint Args; \
741 } while (0)
743 # define YYDSYMPRINTF(Title, Token, Value, Location) \
744 do { \
745 if (yydebug) \
747 YYFPRINTF (stderr, "%s ", Title); \
748 yysymprint (stderr, \
749 Token, Value); \
750 YYFPRINTF (stderr, "\n"); \
752 } while (0)
754 /*------------------------------------------------------------------.
755 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
756 | TOP (cinluded). |
757 `------------------------------------------------------------------*/
759 #if defined (__STDC__) || defined (__cplusplus)
760 static void
761 yy_stack_print (short *bottom, short *top)
762 #else
763 static void
764 yy_stack_print (bottom, top)
765 short *bottom;
766 short *top;
767 #endif
769 YYFPRINTF (stderr, "Stack now");
770 for (/* Nothing. */; bottom <= top; ++bottom)
771 YYFPRINTF (stderr, " %d", *bottom);
772 YYFPRINTF (stderr, "\n");
775 # define YY_STACK_PRINT(Bottom, Top) \
776 do { \
777 if (yydebug) \
778 yy_stack_print ((Bottom), (Top)); \
779 } while (0)
782 /*------------------------------------------------.
783 | Report that the YYRULE is going to be reduced. |
784 `------------------------------------------------*/
786 #if defined (__STDC__) || defined (__cplusplus)
787 static void
788 yy_reduce_print (int yyrule)
789 #else
790 static void
791 yy_reduce_print (yyrule)
792 int yyrule;
793 #endif
795 int yyi;
796 unsigned int yylineno = yyrline[yyrule];
797 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
798 yyrule - 1, yylineno);
799 /* Print the symbols being reduced, and their result. */
800 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
801 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
802 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
805 # define YY_REDUCE_PRINT(Rule) \
806 do { \
807 if (yydebug) \
808 yy_reduce_print (Rule); \
809 } while (0)
811 /* Nonzero means print parse trace. It is left uninitialized so that
812 multiple parsers can coexist. */
813 int yydebug;
814 #else /* !YYDEBUG */
815 # define YYDPRINTF(Args)
816 # define YYDSYMPRINT(Args)
817 # define YYDSYMPRINTF(Title, Token, Value, Location)
818 # define YY_STACK_PRINT(Bottom, Top)
819 # define YY_REDUCE_PRINT(Rule)
820 #endif /* !YYDEBUG */
823 /* YYINITDEPTH -- initial size of the parser's stacks. */
824 #ifndef YYINITDEPTH
825 # define YYINITDEPTH 200
826 #endif
828 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
829 if the built-in stack extension method is used).
831 Do not make this value too large; the results are undefined if
832 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
833 evaluated with infinite-precision integer arithmetic. */
835 #if YYMAXDEPTH == 0
836 # undef YYMAXDEPTH
837 #endif
839 #ifndef YYMAXDEPTH
840 # define YYMAXDEPTH 10000
841 #endif
845 #if YYERROR_VERBOSE
847 # ifndef yystrlen
848 # if defined (__GLIBC__) && defined (_STRING_H)
849 # define yystrlen strlen
850 # else
851 /* Return the length of YYSTR. */
852 static YYSIZE_T
853 # if defined (__STDC__) || defined (__cplusplus)
854 yystrlen (const char *yystr)
855 # else
856 yystrlen (yystr)
857 const char *yystr;
858 # endif
860 register const char *yys = yystr;
862 while (*yys++ != '\0')
863 continue;
865 return yys - yystr - 1;
867 # endif
868 # endif
870 # ifndef yystpcpy
871 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
872 # define yystpcpy stpcpy
873 # else
874 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
875 YYDEST. */
876 static char *
877 # if defined (__STDC__) || defined (__cplusplus)
878 yystpcpy (char *yydest, const char *yysrc)
879 # else
880 yystpcpy (yydest, yysrc)
881 char *yydest;
882 const char *yysrc;
883 # endif
885 register char *yyd = yydest;
886 register const char *yys = yysrc;
888 while ((*yyd++ = *yys++) != '\0')
889 continue;
891 return yyd - 1;
893 # endif
894 # endif
896 #endif /* !YYERROR_VERBOSE */
900 #if YYDEBUG
901 /*--------------------------------.
902 | Print this symbol on YYOUTPUT. |
903 `--------------------------------*/
905 #if defined (__STDC__) || defined (__cplusplus)
906 static void
907 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
908 #else
909 static void
910 yysymprint (yyoutput, yytype, yyvaluep)
911 FILE *yyoutput;
912 int yytype;
913 YYSTYPE *yyvaluep;
914 #endif
916 /* Pacify ``unused variable'' warnings. */
917 (void) yyvaluep;
919 if (yytype < YYNTOKENS)
921 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
922 # ifdef YYPRINT
923 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
924 # endif
926 else
927 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
929 switch (yytype)
931 default:
932 break;
934 YYFPRINTF (yyoutput, ")");
937 #endif /* ! YYDEBUG */
938 /*-----------------------------------------------.
939 | Release the memory associated to this symbol. |
940 `-----------------------------------------------*/
942 #if defined (__STDC__) || defined (__cplusplus)
943 static void
944 yydestruct (int yytype, YYSTYPE *yyvaluep)
945 #else
946 static void
947 yydestruct (yytype, yyvaluep)
948 int yytype;
949 YYSTYPE *yyvaluep;
950 #endif
952 /* Pacify ``unused variable'' warnings. */
953 (void) yyvaluep;
955 switch (yytype)
958 default:
959 break;
964 /* Prevent warnings from -Wmissing-prototypes. */
966 #ifdef YYPARSE_PARAM
967 # if defined (__STDC__) || defined (__cplusplus)
968 int yyparse (void *YYPARSE_PARAM);
969 # else
970 int yyparse ();
971 # endif
972 #else /* ! YYPARSE_PARAM */
973 #if defined (__STDC__) || defined (__cplusplus)
974 int yyparse (void);
975 #else
976 int yyparse ();
977 #endif
978 #endif /* ! YYPARSE_PARAM */
982 /* The lookahead symbol. */
983 int yychar;
985 /* The semantic value of the lookahead symbol. */
986 YYSTYPE yylval;
988 /* Number of syntax errors so far. */
989 int yynerrs;
993 /*----------.
994 | yyparse. |
995 `----------*/
997 #ifdef YYPARSE_PARAM
998 # if defined (__STDC__) || defined (__cplusplus)
999 int yyparse (void *YYPARSE_PARAM)
1000 # else
1001 int yyparse (YYPARSE_PARAM)
1002 void *YYPARSE_PARAM;
1003 # endif
1004 #else /* ! YYPARSE_PARAM */
1005 #if defined (__STDC__) || defined (__cplusplus)
1007 yyparse (void)
1008 #else
1010 yyparse ()
1012 #endif
1013 #endif
1016 register int yystate;
1017 register int yyn;
1018 int yyresult;
1019 /* Number of tokens to shift before error messages enabled. */
1020 int yyerrstatus;
1021 /* Lookahead token as an internal (translated) token number. */
1022 int yytoken = 0;
1024 /* Three stacks and their tools:
1025 `yyss': related to states,
1026 `yyvs': related to semantic values,
1027 `yyls': related to locations.
1029 Refer to the stacks thru separate pointers, to allow yyoverflow
1030 to reallocate them elsewhere. */
1032 /* The state stack. */
1033 short yyssa[YYINITDEPTH];
1034 short *yyss = yyssa;
1035 register short *yyssp;
1037 /* The semantic value stack. */
1038 YYSTYPE yyvsa[YYINITDEPTH];
1039 YYSTYPE *yyvs = yyvsa;
1040 register YYSTYPE *yyvsp;
1044 #define YYPOPSTACK (yyvsp--, yyssp--)
1046 YYSIZE_T yystacksize = YYINITDEPTH;
1048 /* The variables used to return semantic value and location from the
1049 action routines. */
1050 YYSTYPE yyval;
1053 /* When reducing, the number of symbols on the RHS of the reduced
1054 rule. */
1055 int yylen;
1057 YYDPRINTF ((stderr, "Starting parse\n"));
1059 yystate = 0;
1060 yyerrstatus = 0;
1061 yynerrs = 0;
1062 yychar = YYEMPTY; /* Cause a token to be read. */
1064 /* Initialize stack pointers.
1065 Waste one element of value and location stack
1066 so that they stay on the same level as the state stack.
1067 The wasted elements are never initialized. */
1069 yyssp = yyss;
1070 yyvsp = yyvs;
1072 goto yysetstate;
1074 /*------------------------------------------------------------.
1075 | yynewstate -- Push a new state, which is found in yystate. |
1076 `------------------------------------------------------------*/
1077 yynewstate:
1078 /* In all cases, when you get here, the value and location stacks
1079 have just been pushed. so pushing a state here evens the stacks.
1081 yyssp++;
1083 yysetstate:
1084 *yyssp = yystate;
1086 if (yyss + yystacksize - 1 <= yyssp)
1088 /* Get the current used size of the three stacks, in elements. */
1089 YYSIZE_T yysize = yyssp - yyss + 1;
1091 #ifdef yyoverflow
1093 /* Give user a chance to reallocate the stack. Use copies of
1094 these so that the &'s don't force the real ones into
1095 memory. */
1096 YYSTYPE *yyvs1 = yyvs;
1097 short *yyss1 = yyss;
1100 /* Each stack pointer address is followed by the size of the
1101 data in use in that stack, in bytes. This used to be a
1102 conditional around just the two extra args, but that might
1103 be undefined if yyoverflow is a macro. */
1104 yyoverflow ("parser stack overflow",
1105 &yyss1, yysize * sizeof (*yyssp),
1106 &yyvs1, yysize * sizeof (*yyvsp),
1108 &yystacksize);
1110 yyss = yyss1;
1111 yyvs = yyvs1;
1113 #else /* no yyoverflow */
1114 # ifndef YYSTACK_RELOCATE
1115 goto yyoverflowlab;
1116 # else
1117 /* Extend the stack our own way. */
1118 if (YYMAXDEPTH <= yystacksize)
1119 goto yyoverflowlab;
1120 yystacksize *= 2;
1121 if (YYMAXDEPTH < yystacksize)
1122 yystacksize = YYMAXDEPTH;
1125 short *yyss1 = yyss;
1126 union yyalloc *yyptr =
1127 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1128 if (! yyptr)
1129 goto yyoverflowlab;
1130 YYSTACK_RELOCATE (yyss);
1131 YYSTACK_RELOCATE (yyvs);
1133 # undef YYSTACK_RELOCATE
1134 if (yyss1 != yyssa)
1135 YYSTACK_FREE (yyss1);
1137 # endif
1138 #endif /* no yyoverflow */
1140 yyssp = yyss + yysize - 1;
1141 yyvsp = yyvs + yysize - 1;
1144 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1145 (unsigned long int) yystacksize));
1147 if (yyss + yystacksize - 1 <= yyssp)
1148 YYABORT;
1151 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1153 goto yybackup;
1155 /*-----------.
1156 | yybackup. |
1157 `-----------*/
1158 yybackup:
1160 /* Do appropriate processing given the current state. */
1161 /* Read a lookahead token if we need one and don't already have one. */
1162 /* yyresume: */
1164 /* First try to decide what to do without reference to lookahead token. */
1166 yyn = yypact[yystate];
1167 if (yyn == YYPACT_NINF)
1168 goto yydefault;
1170 /* Not known => get a lookahead token if don't already have one. */
1172 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1173 if (yychar == YYEMPTY)
1175 YYDPRINTF ((stderr, "Reading a token: "));
1176 yychar = YYLEX;
1179 if (yychar <= YYEOF)
1181 yychar = yytoken = YYEOF;
1182 YYDPRINTF ((stderr, "Now at end of input.\n"));
1184 else
1186 yytoken = YYTRANSLATE (yychar);
1187 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1190 /* If the proper action on seeing token YYTOKEN is to reduce or to
1191 detect an error, take that action. */
1192 yyn += yytoken;
1193 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1194 goto yydefault;
1195 yyn = yytable[yyn];
1196 if (yyn <= 0)
1198 if (yyn == 0 || yyn == YYTABLE_NINF)
1199 goto yyerrlab;
1200 yyn = -yyn;
1201 goto yyreduce;
1204 if (yyn == YYFINAL)
1205 YYACCEPT;
1207 /* Shift the lookahead token. */
1208 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1210 /* Discard the token being shifted unless it is eof. */
1211 if (yychar != YYEOF)
1212 yychar = YYEMPTY;
1214 *++yyvsp = yylval;
1217 /* Count tokens shifted since error; after three, turn off error
1218 status. */
1219 if (yyerrstatus)
1220 yyerrstatus--;
1222 yystate = yyn;
1223 goto yynewstate;
1226 /*-----------------------------------------------------------.
1227 | yydefault -- do the default action for the current state. |
1228 `-----------------------------------------------------------*/
1229 yydefault:
1230 yyn = yydefact[yystate];
1231 if (yyn == 0)
1232 goto yyerrlab;
1233 goto yyreduce;
1236 /*-----------------------------.
1237 | yyreduce -- Do a reduction. |
1238 `-----------------------------*/
1239 yyreduce:
1240 /* yyn is the number of a rule to reduce with. */
1241 yylen = yyr2[yyn];
1243 /* If YYLEN is nonzero, implement the default value of the action:
1244 `$$ = $1'.
1246 Otherwise, the following line sets YYVAL to garbage.
1247 This behavior is undocumented and Bison
1248 users should not rely upon it. Assigning to YYVAL
1249 unconditionally makes the parser a bit smaller, and it avoids a
1250 GCC warning that YYVAL may be used uninitialized. */
1251 yyval = yyvsp[1-yylen];
1254 YY_REDUCE_PRINT (yyn);
1255 switch (yyn)
1257 case 2:
1258 #line 125 "ASN1.y"
1259 {yyval.node=_asn1_add_node(TYPE_DEFINITIONS|yyvsp[-5].constant);
1260 _asn1_set_name(yyval.node,_asn1_get_name(yyvsp[-7].node));
1261 _asn1_set_name(yyvsp[-7].node,"");
1262 _asn1_set_right(yyvsp[-7].node,yyvsp[-1].node);
1263 _asn1_set_down(yyval.node,yyvsp[-7].node);
1265 p_tree=yyval.node;
1267 break;
1269 case 3:
1270 #line 135 "ASN1.y"
1271 {strcpy(yyval.str,yyvsp[0].str);}
1272 break;
1274 case 4:
1275 #line 136 "ASN1.y"
1276 {strcpy(yyval.str,yyvsp[0].str);}
1277 break;
1279 case 5:
1280 #line 139 "ASN1.y"
1281 {strcpy(yyval.str,"-");
1282 strcat(yyval.str,yyvsp[0].str);}
1283 break;
1285 case 6:
1286 #line 143 "ASN1.y"
1287 {strcpy(yyval.str,yyvsp[0].str);}
1288 break;
1290 case 7:
1291 #line 144 "ASN1.y"
1292 {strcpy(yyval.str,yyvsp[0].str);}
1293 break;
1295 case 8:
1296 #line 147 "ASN1.y"
1297 {strcpy(yyval.str,yyvsp[0].str);}
1298 break;
1300 case 9:
1301 #line 148 "ASN1.y"
1302 {strcpy(yyval.str,yyvsp[0].str);}
1303 break;
1305 case 10:
1306 #line 151 "ASN1.y"
1307 {strcpy(yyval.str,yyvsp[0].str);}
1308 break;
1310 case 11:
1311 #line 152 "ASN1.y"
1312 {strcpy(yyval.str,yyvsp[0].str);}
1313 break;
1315 case 12:
1316 #line 155 "ASN1.y"
1317 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1318 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1319 break;
1321 case 13:
1322 #line 157 "ASN1.y"
1323 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1324 _asn1_set_name(yyval.node,yyvsp[-3].str);
1325 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1326 break;
1328 case 14:
1329 #line 162 "ASN1.y"
1330 {yyval.node=yyvsp[0].node;}
1331 break;
1333 case 15:
1334 #line 163 "ASN1.y"
1335 {yyval.node=yyvsp[-2].node;
1336 _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
1337 break;
1339 case 16:
1340 #line 167 "ASN1.y"
1341 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1342 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1343 break;
1345 case 17:
1346 #line 169 "ASN1.y"
1347 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1348 _asn1_set_name(yyval.node,yyvsp[-3].str);
1349 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1350 break;
1352 case 18:
1353 #line 174 "ASN1.y"
1354 {yyval.node=yyvsp[0].node;}
1355 break;
1357 case 19:
1358 #line 175 "ASN1.y"
1359 {yyval.node=yyvsp[-1].node;
1360 _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
1361 break;
1363 case 20:
1364 #line 179 "ASN1.y"
1365 {yyval.constant=CONST_UNIVERSAL;}
1366 break;
1368 case 21:
1369 #line 180 "ASN1.y"
1370 {yyval.constant=CONST_PRIVATE;}
1371 break;
1373 case 22:
1374 #line 181 "ASN1.y"
1375 {yyval.constant=CONST_APPLICATION;}
1376 break;
1378 case 23:
1379 #line 184 "ASN1.y"
1380 {yyval.node=_asn1_add_node(TYPE_TAG);
1381 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1382 break;
1384 case 24:
1385 #line 186 "ASN1.y"
1386 {yyval.node=_asn1_add_node(TYPE_TAG | yyvsp[-2].constant);
1387 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1388 break;
1390 case 25:
1391 #line 190 "ASN1.y"
1392 {yyval.node=yyvsp[0].node;}
1393 break;
1395 case 26:
1396 #line 191 "ASN1.y"
1397 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_EXPLICIT);}
1398 break;
1400 case 27:
1401 #line 192 "ASN1.y"
1402 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_IMPLICIT);}
1403 break;
1405 case 28:
1406 #line 195 "ASN1.y"
1407 {yyval.node=_asn1_add_node(TYPE_DEFAULT);
1408 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1409 break;
1411 case 29:
1412 #line 197 "ASN1.y"
1413 {yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);}
1414 break;
1416 case 30:
1417 #line 198 "ASN1.y"
1418 {yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);}
1419 break;
1421 case 33:
1422 #line 207 "ASN1.y"
1423 {yyval.node=_asn1_add_node(TYPE_INTEGER);}
1424 break;
1426 case 34:
1427 #line 208 "ASN1.y"
1428 {yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_LIST);
1429 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1430 break;
1432 case 35:
1433 #line 210 "ASN1.y"
1434 {yyval.node=_asn1_add_node(TYPE_INTEGER);}
1435 break;
1437 case 36:
1438 #line 212 "ASN1.y"
1439 {yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_MIN_MAX);
1440 _asn1_set_down(yyval.node,_asn1_add_node(TYPE_SIZE));
1441 _asn1_set_value(_asn1_get_down(yyval.node),yyvsp[-1].str,strlen(yyvsp[-1].str)+1);
1442 _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[-4].str);}
1443 break;
1445 case 37:
1446 #line 218 "ASN1.y"
1447 {yyval.node=_asn1_add_node(TYPE_BOOLEAN);}
1448 break;
1450 case 38:
1451 #line 221 "ASN1.y"
1452 {yyval.node=_asn1_add_node(TYPE_TIME|CONST_UTC);}
1453 break;
1455 case 39:
1456 #line 222 "ASN1.y"
1457 {yyval.node=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);}
1458 break;
1460 case 40:
1461 #line 225 "ASN1.y"
1462 {yyval.node=_asn1_add_node(TYPE_SIZE|CONST_1_PARAM);
1463 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1464 break;
1466 case 41:
1467 #line 228 "ASN1.y"
1468 {yyval.node=_asn1_add_node(TYPE_SIZE|CONST_MIN_MAX);
1469 _asn1_set_value(yyval.node,yyvsp[-4].str,strlen(yyvsp[-4].str)+1);
1470 _asn1_set_name(yyval.node,yyvsp[-1].str);}
1471 break;
1473 case 42:
1474 #line 233 "ASN1.y"
1475 {yyval.node=yyvsp[0].node;}
1476 break;
1478 case 43:
1479 #line 234 "ASN1.y"
1480 {yyval.node=yyvsp[-1].node;}
1481 break;
1483 case 44:
1484 #line 237 "ASN1.y"
1485 {yyval.node=_asn1_add_node(TYPE_GENERALSTRING);}
1486 break;
1488 case 45:
1489 #line 238 "ASN1.y"
1490 {yyval.node=_asn1_add_node(TYPE_GENERALSTRING|CONST_SIZE);
1491 _asn1_set_down(yyval.node,yyvsp[0].node);}
1492 break;
1494 case 46:
1495 #line 242 "ASN1.y"
1496 {yyval.node=_asn1_add_node(TYPE_OCTET_STRING);}
1497 break;
1499 case 47:
1500 #line 243 "ASN1.y"
1501 {yyval.node=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE);
1502 _asn1_set_down(yyval.node,yyvsp[0].node);}
1503 break;
1505 case 48:
1506 #line 247 "ASN1.y"
1507 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1508 _asn1_set_name(yyval.node,yyvsp[-3].str);
1509 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1510 break;
1512 case 49:
1513 #line 252 "ASN1.y"
1514 {yyval.node=yyvsp[0].node;}
1515 break;
1517 case 50:
1518 #line 253 "ASN1.y"
1519 {yyval.node=yyvsp[-2].node;
1520 _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
1521 break;
1523 case 51:
1524 #line 257 "ASN1.y"
1525 {yyval.node=_asn1_add_node(TYPE_BIT_STRING);}
1526 break;
1528 case 52:
1529 #line 259 "ASN1.y"
1530 {yyval.node=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST);
1531 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1532 break;
1534 case 53:
1535 #line 264 "ASN1.y"
1536 {yyval.node=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST);
1537 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1538 break;
1540 case 54:
1541 #line 269 "ASN1.y"
1542 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID);}
1543 break;
1545 case 55:
1546 #line 272 "ASN1.y"
1547 {yyval.node=_asn1_add_node(TYPE_IDENTIFIER);
1548 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1549 break;
1551 case 56:
1552 #line 274 "ASN1.y"
1553 {yyval.node=_asn1_add_node(TYPE_IDENTIFIER|CONST_SIZE);
1554 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);
1555 _asn1_set_down(yyval.node,yyvsp[0].node);}
1556 break;
1558 case 57:
1559 #line 277 "ASN1.y"
1560 {yyval.node=yyvsp[0].node;}
1561 break;
1563 case 58:
1564 #line 278 "ASN1.y"
1565 {yyval.node=yyvsp[0].node;}
1566 break;
1568 case 59:
1569 #line 279 "ASN1.y"
1570 {yyval.node=yyvsp[0].node;}
1571 break;
1573 case 61:
1574 #line 281 "ASN1.y"
1575 {yyval.node=yyvsp[0].node;}
1576 break;
1578 case 62:
1579 #line 282 "ASN1.y"
1580 {yyval.node=yyvsp[0].node;}
1581 break;
1583 case 63:
1584 #line 283 "ASN1.y"
1585 {yyval.node=yyvsp[0].node;}
1586 break;
1588 case 64:
1589 #line 284 "ASN1.y"
1590 {yyval.node=yyvsp[0].node;}
1591 break;
1593 case 65:
1594 #line 285 "ASN1.y"
1595 {yyval.node=yyvsp[0].node;}
1596 break;
1598 case 66:
1599 #line 286 "ASN1.y"
1600 {yyval.node=yyvsp[0].node;}
1601 break;
1603 case 67:
1604 #line 287 "ASN1.y"
1605 {yyval.node=yyvsp[0].node;}
1606 break;
1608 case 68:
1609 #line 288 "ASN1.y"
1610 {yyval.node=yyvsp[0].node;}
1611 break;
1613 case 69:
1614 #line 289 "ASN1.y"
1615 {yyval.node=_asn1_add_node(TYPE_NULL);}
1616 break;
1618 case 70:
1619 #line 292 "ASN1.y"
1620 {yyval.node=yyvsp[0].node;}
1621 break;
1623 case 71:
1624 #line 293 "ASN1.y"
1625 {yyval.node=_asn1_mod_type(yyvsp[0].node,CONST_TAG);
1626 _asn1_set_right(yyvsp[-1].node,_asn1_get_down(yyval.node));
1627 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1628 break;
1630 case 72:
1631 #line 298 "ASN1.y"
1632 {yyval.node=yyvsp[0].node;}
1633 break;
1635 case 73:
1636 #line 299 "ASN1.y"
1637 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_DEFAULT);
1638 _asn1_set_right(yyvsp[0].node,_asn1_get_down(yyval.node));
1639 _asn1_set_down(yyval.node,yyvsp[0].node);}
1640 break;
1642 case 74:
1643 #line 302 "ASN1.y"
1644 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_OPTION);}
1645 break;
1647 case 75:
1648 #line 305 "ASN1.y"
1649 {yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-1].str);}
1650 break;
1652 case 76:
1653 #line 308 "ASN1.y"
1654 {yyval.node=yyvsp[0].node;}
1655 break;
1657 case 77:
1658 #line 309 "ASN1.y"
1659 {yyval.node=yyvsp[-2].node;
1660 _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
1661 break;
1663 case 78:
1664 #line 313 "ASN1.y"
1665 {yyval.node=_asn1_add_node(TYPE_SEQUENCE);
1666 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1667 break;
1669 case 79:
1670 #line 315 "ASN1.y"
1671 {yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF);
1672 _asn1_set_down(yyval.node,yyvsp[0].node);}
1673 break;
1675 case 80:
1676 #line 317 "ASN1.y"
1677 {yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF|CONST_SIZE);
1678 _asn1_set_right(yyvsp[-2].node,yyvsp[0].node);
1679 _asn1_set_down(yyval.node,yyvsp[-2].node);}
1680 break;
1682 case 81:
1683 #line 322 "ASN1.y"
1684 {yyval.node=_asn1_add_node(TYPE_SET);
1685 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1686 break;
1688 case 82:
1689 #line 324 "ASN1.y"
1690 {yyval.node=_asn1_add_node(TYPE_SET_OF);
1691 _asn1_set_down(yyval.node,yyvsp[0].node);}
1692 break;
1694 case 83:
1695 #line 326 "ASN1.y"
1696 {yyval.node=_asn1_add_node(TYPE_SET_OF|CONST_SIZE);
1697 _asn1_set_right(yyvsp[-2].node,yyvsp[0].node);
1698 _asn1_set_down(yyval.node,yyvsp[-2].node);}
1699 break;
1701 case 84:
1702 #line 331 "ASN1.y"
1703 {yyval.node=_asn1_add_node(TYPE_CHOICE);
1704 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1705 break;
1707 case 85:
1708 #line 335 "ASN1.y"
1709 {yyval.node=_asn1_add_node(TYPE_ANY);}
1710 break;
1712 case 86:
1713 #line 336 "ASN1.y"
1714 {yyval.node=_asn1_add_node(TYPE_ANY|CONST_DEFINED_BY);
1715 _asn1_set_down(yyval.node,_asn1_add_node(TYPE_CONSTANT));
1716 _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[0].str);}
1717 break;
1719 case 87:
1720 #line 341 "ASN1.y"
1721 {yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-2].str);}
1722 break;
1724 case 88:
1725 #line 345 "ASN1.y"
1726 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN);
1727 _asn1_set_name(yyval.node,yyvsp[-6].str);
1728 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1729 break;
1731 case 89:
1732 #line 349 "ASN1.y"
1733 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM);
1734 _asn1_set_name(yyval.node,yyvsp[-5].str);
1735 _asn1_set_value(yyval.node,yyvsp[-4].str,strlen(yyvsp[-4].str)+1);
1736 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1737 break;
1739 case 90:
1740 #line 354 "ASN1.y"
1741 {yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_ASSIGN);
1742 _asn1_set_name(yyval.node,yyvsp[-3].str);
1743 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1744 break;
1746 case 91:
1747 #line 359 "ASN1.y"
1748 {yyval.node=yyvsp[0].node;}
1749 break;
1751 case 92:
1752 #line 360 "ASN1.y"
1753 {yyval.node=yyvsp[0].node;}
1754 break;
1756 case 93:
1757 #line 363 "ASN1.y"
1758 {yyval.node=yyvsp[0].node;}
1759 break;
1761 case 94:
1762 #line 364 "ASN1.y"
1763 {yyval.node=yyvsp[-1].node;
1764 _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
1765 break;
1767 case 95:
1768 #line 368 "ASN1.y"
1769 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
1770 _asn1_set_down(yyval.node,yyvsp[-1].node);
1771 _asn1_set_name(yyval.node,yyvsp[-3].str);}
1772 break;
1774 case 96:
1775 #line 371 "ASN1.y"
1776 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
1777 _asn1_set_name(yyval.node,yyvsp[-2].str);}
1778 break;
1780 case 97:
1781 #line 395 "ASN1.y"
1782 {yyval.constant=CONST_EXPLICIT;}
1783 break;
1785 case 98:
1786 #line 396 "ASN1.y"
1787 {yyval.constant=CONST_IMPLICIT;}
1788 break;
1793 /* Line 999 of yacc.c. */
1794 #line 1795 "ASN1.c"
1796 yyvsp -= yylen;
1797 yyssp -= yylen;
1800 YY_STACK_PRINT (yyss, yyssp);
1802 *++yyvsp = yyval;
1805 /* Now `shift' the result of the reduction. Determine what state
1806 that goes to, based on the state we popped back to and the rule
1807 number reduced by. */
1809 yyn = yyr1[yyn];
1811 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1812 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1813 yystate = yytable[yystate];
1814 else
1815 yystate = yydefgoto[yyn - YYNTOKENS];
1817 goto yynewstate;
1820 /*------------------------------------.
1821 | yyerrlab -- here on detecting error |
1822 `------------------------------------*/
1823 yyerrlab:
1824 /* If not already recovering from an error, report this error. */
1825 if (!yyerrstatus)
1827 ++yynerrs;
1828 #if YYERROR_VERBOSE
1829 yyn = yypact[yystate];
1831 if (YYPACT_NINF < yyn && yyn < YYLAST)
1833 YYSIZE_T yysize = 0;
1834 int yytype = YYTRANSLATE (yychar);
1835 char *yymsg;
1836 int yyx, yycount;
1838 yycount = 0;
1839 /* Start YYX at -YYN if negative to avoid negative indexes in
1840 YYCHECK. */
1841 for (yyx = yyn < 0 ? -yyn : 0;
1842 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1843 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1844 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1845 yysize += yystrlen ("syntax error, unexpected ") + 1;
1846 yysize += yystrlen (yytname[yytype]);
1847 yymsg = (char *) YYSTACK_ALLOC (yysize);
1848 if (yymsg != 0)
1850 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1851 yyp = yystpcpy (yyp, yytname[yytype]);
1853 if (yycount < 5)
1855 yycount = 0;
1856 for (yyx = yyn < 0 ? -yyn : 0;
1857 yyx < (int) (sizeof (yytname) / sizeof (char *));
1858 yyx++)
1859 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1861 const char *yyq = ! yycount ? ", expecting " : " or ";
1862 yyp = yystpcpy (yyp, yyq);
1863 yyp = yystpcpy (yyp, yytname[yyx]);
1864 yycount++;
1867 yyerror (yymsg);
1868 YYSTACK_FREE (yymsg);
1870 else
1871 yyerror ("syntax error; also virtual memory exhausted");
1873 else
1874 #endif /* YYERROR_VERBOSE */
1875 yyerror ("syntax error");
1880 if (yyerrstatus == 3)
1882 /* If just tried and failed to reuse lookahead token after an
1883 error, discard it. */
1885 /* Return failure if at end of input. */
1886 if (yychar == YYEOF)
1888 /* Pop the error token. */
1889 YYPOPSTACK;
1890 /* Pop the rest of the stack. */
1891 while (yyss < yyssp)
1893 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1894 yydestruct (yystos[*yyssp], yyvsp);
1895 YYPOPSTACK;
1897 YYABORT;
1900 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1901 yydestruct (yytoken, &yylval);
1902 yychar = YYEMPTY;
1906 /* Else will try to reuse lookahead token after shifting the error
1907 token. */
1908 goto yyerrlab1;
1911 /*----------------------------------------------------.
1912 | yyerrlab1 -- error raised explicitly by an action. |
1913 `----------------------------------------------------*/
1914 yyerrlab1:
1915 yyerrstatus = 3; /* Each real token shifted decrements this. */
1917 for (;;)
1919 yyn = yypact[yystate];
1920 if (yyn != YYPACT_NINF)
1922 yyn += YYTERROR;
1923 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1925 yyn = yytable[yyn];
1926 if (0 < yyn)
1927 break;
1931 /* Pop the current state because it cannot handle the error token. */
1932 if (yyssp == yyss)
1933 YYABORT;
1935 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1936 yydestruct (yystos[yystate], yyvsp);
1937 yyvsp--;
1938 yystate = *--yyssp;
1940 YY_STACK_PRINT (yyss, yyssp);
1943 if (yyn == YYFINAL)
1944 YYACCEPT;
1946 YYDPRINTF ((stderr, "Shifting error token, "));
1948 *++yyvsp = yylval;
1951 yystate = yyn;
1952 goto yynewstate;
1955 /*-------------------------------------.
1956 | yyacceptlab -- YYACCEPT comes here. |
1957 `-------------------------------------*/
1958 yyacceptlab:
1959 yyresult = 0;
1960 goto yyreturn;
1962 /*-----------------------------------.
1963 | yyabortlab -- YYABORT comes here. |
1964 `-----------------------------------*/
1965 yyabortlab:
1966 yyresult = 1;
1967 goto yyreturn;
1969 #ifndef yyoverflow
1970 /*----------------------------------------------.
1971 | yyoverflowlab -- parser overflow comes here. |
1972 `----------------------------------------------*/
1973 yyoverflowlab:
1974 yyerror ("parser stack overflow");
1975 yyresult = 2;
1976 /* Fall through. */
1977 #endif
1979 yyreturn:
1980 #ifndef yyoverflow
1981 if (yyss != yyssa)
1982 YYSTACK_FREE (yyss);
1983 #endif
1984 return yyresult;
1988 #line 400 "ASN1.y"
1993 const char *key_word[]={"::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING"
1994 ,"SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL"
1995 ,"DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER"
1996 ,"BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED"
1997 ,"SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS"
1998 ,"BEGIN","END","UTCTime","GeneralizedTime"
1999 ,"GeneralString","FROM","IMPORTS","NULL","ENUMERATED"};
2000 const int key_word_token[]={ASSIG,OPTIONAL,INTEGER,SIZE,OCTET,STRING
2001 ,SEQUENCE,BIT,UNIVERSAL,PRIVATE,OPTIONAL
2002 ,DEFAULT,CHOICE,OF,OBJECT,STR_IDENTIFIER
2003 ,BOOLEAN,TRUE,FALSE,APPLICATION,ANY,DEFINED
2004 ,SET,BY,EXPLICIT,IMPLICIT,DEFINITIONS,TAGS
2005 ,BEGIN,END,UTCTime,GeneralizedTime
2006 ,GeneralString,FROM,IMPORTS,TOKEN_NULL,ENUMERATED};
2008 /*************************************************************/
2009 /* Function: _asn1_yylex */
2010 /* Description: looks for tokens in file_asn1 pointer file. */
2011 /* Return: int */
2012 /* Token identifier or ASCII code or 0(zero: End Of File) */
2013 /*************************************************************/
2015 _asn1_yylex()
2017 int c,counter=0,k,lastc;
2018 char string[MAX_NAME_SIZE+1]; /* will contain the next token */
2020 while(1)
2022 while((c=fgetc(file_asn1))==' ' || c=='\t' || c=='\n')
2023 if(c=='\n') lineNumber++;
2025 if(c==EOF){
2026 strcpy(lastToken,"End Of File");
2027 return 0;
2030 if(c=='(' || c==')' || c=='[' || c==']' ||
2031 c=='{' || c=='}' || c==',' || c=='.' ||
2032 c=='+' || c=='|'){
2033 lastToken[0]=c;lastToken[1]=0;
2034 return c;
2036 if(c=='-'){ /* Maybe the first '-' of a comment */
2037 if((c=fgetc(file_asn1))!='-'){
2038 ungetc(c,file_asn1);
2039 lastToken[0]='-';lastToken[1]=0;
2040 return '-';
2042 else{ /* Comments */
2043 lastc=0;
2044 counter=0;
2045 /* A comment finishes at the next double hypen or the end of line */
2046 while((c=fgetc(file_asn1))!=EOF && c!='\n' &&
2047 (lastc!='-' || (lastc=='-' && c!='-')))
2048 lastc=c;
2049 if(c==EOF){
2050 strcpy(lastToken,"End Of File");
2051 return 0;
2053 else{
2054 if(c=='\n') lineNumber++;
2055 continue; /* next char, please! (repeat the search) */
2059 string[counter++]=c;
2060 /* Till the end of the token */
2061 while(!((c=fgetc(file_asn1))==EOF || c==' '|| c=='\t' || c=='\n' ||
2062 c=='(' || c==')' || c=='[' || c==']' ||
2063 c=='{' || c=='}' || c==',' || c=='.'))
2065 if(counter>=MAX_NAME_SIZE){
2066 result_parse=ASN1_NAME_TOO_LONG;
2067 return 0;
2069 string[counter++]=c;
2071 ungetc(c,file_asn1);
2072 string[counter]=0;
2073 strcpy(lastToken,string);
2075 /* Is STRING a number? */
2076 for(k=0;k<counter;k++)
2077 if(!isdigit(string[k])) break;
2078 if(k>=counter)
2080 strcpy(yylval.str,string);
2081 return NUM; /* return the number */
2084 /* Is STRING a keyword? */
2085 for(k=0;k<(sizeof(key_word)/sizeof(char*));k++)
2086 if(!strcmp(string,key_word[k])) return key_word_token[k];
2088 /* STRING is an IDENTIFIER */
2089 strcpy(yylval.str,string);
2090 return IDENTIFIER;
2095 /*************************************************************/
2096 /* Function: _asn1_create_errorDescription */
2097 /* Description: creates a string with the description of the*/
2098 /* error. */
2099 /* Parameters: */
2100 /* error : error to describe. */
2101 /* errorDescription: string that will contain the */
2102 /* description. */
2103 /*************************************************************/
2104 void
2105 _asn1_create_errorDescription(int error,char *errorDescription)
2107 switch(error){
2108 case ASN1_SUCCESS: case ASN1_FILE_NOT_FOUND:
2109 if (errorDescription!=NULL) errorDescription[0]=0;
2110 break;
2111 case ASN1_SYNTAX_ERROR:
2112 if (errorDescription!=NULL) {
2113 strcpy(errorDescription,fileName);
2114 strcat(errorDescription,":");
2115 _asn1_ltostr(lineNumber,errorDescription+strlen(fileName)+1);
2116 strcat(errorDescription,": parse error near '");
2117 strcat(errorDescription,lastToken);
2118 strcat(errorDescription,"'");
2120 break;
2121 case ASN1_NAME_TOO_LONG:
2122 if (errorDescription!=NULL) {
2123 strcpy(errorDescription,fileName);
2124 strcat(errorDescription,":");
2125 _asn1_ltostr(lineNumber,errorDescription+strlen(fileName)+1);
2126 strcat(errorDescription,": name too long (more than ");
2127 _asn1_ltostr(MAX_NAME_SIZE,errorDescription+strlen(errorDescription));
2128 strcat(errorDescription," characters)");
2130 break;
2131 case ASN1_IDENTIFIER_NOT_FOUND:
2132 if (errorDescription!=NULL) {
2133 strcpy(errorDescription,fileName);
2134 strcat(errorDescription,":");
2135 strcat(errorDescription,": identifier '");
2136 strcat(errorDescription,_asn1_identifierMissing);
2137 strcat(errorDescription,"' not found");
2139 break;
2140 default:
2141 if (errorDescription!=NULL) errorDescription[0]=0;
2142 break;
2149 * asn1_parser2tree - function used to start the parse algorithm.
2150 * @file_name: specify the path and the name of file that contains
2151 * ASN.1 declarations.
2152 * @definitions: return the pointer to the structure created from
2153 * "file_name" ASN.1 declarations.
2154 * @errorDescription: return the error description or an empty
2155 * string if success.
2157 * Creates the structures needed to manage the definitions included
2158 * in *FILE_NAME file.
2160 * Returns:
2162 * ASN1_SUCCESS: The file has a correct syntax and every identifier
2163 * is known.
2165 * ASN1_ELEMENT_NOT_EMPTY: *POINTER not ASN1_TYPE_EMPTY.
2167 * ASN1_FILE_NOT_FOUND: An error occured while opening FILE_NAME.
2169 * ASN1_SYNTAX_ERROR: The syntax is not correct.
2171 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
2172 * is not defined.
2174 * ASN1_NAME_TOO_LONG: In the file there is an identifier whith more
2175 * than MAX_NAME_SIZE characters.
2177 asn1_retCode
2178 asn1_parser2tree(const char *file_name, ASN1_TYPE *definitions,
2179 char *errorDescription){
2181 p_tree=ASN1_TYPE_EMPTY;
2183 if(*definitions != ASN1_TYPE_EMPTY)
2184 return ASN1_ELEMENT_NOT_EMPTY;
2186 *definitions=ASN1_TYPE_EMPTY;
2188 fileName = file_name;
2190 /* open the file to parse */
2191 file_asn1=fopen(file_name,"r");
2193 if(file_asn1==NULL){
2194 result_parse=ASN1_FILE_NOT_FOUND;
2196 else{
2197 result_parse=ASN1_SUCCESS;
2199 lineNumber=1;
2200 yyparse();
2202 fclose(file_asn1);
2204 if(result_parse==ASN1_SUCCESS){ /* syntax OK */
2205 /* set IMPLICIT or EXPLICIT property */
2206 _asn1_set_default_tag(p_tree);
2207 /* set CONST_SET and CONST_NOT_USED */
2208 _asn1_type_set_config(p_tree);
2209 /* check the identifier definitions */
2210 result_parse=_asn1_check_identifier(p_tree);
2211 if(result_parse==ASN1_SUCCESS){ /* all identifier defined */
2212 /* Delete the list and keep the ASN1 structure */
2213 _asn1_delete_list();
2214 /* Convert into DER coding the value assign to INTEGER constants */
2215 _asn1_change_integer_value(p_tree);
2216 /* Expand the IDs of OBJECT IDENTIFIER constants */
2217 _asn1_expand_object_id(p_tree);
2219 *definitions=p_tree;
2221 else /* some identifiers not defined */
2222 /* Delete the list and the ASN1 structure */
2223 _asn1_delete_list_and_nodes();
2225 else /* syntax error */
2226 /* Delete the list and the ASN1 structure */
2227 _asn1_delete_list_and_nodes();
2230 if (errorDescription!=NULL)
2231 _asn1_create_errorDescription(result_parse,errorDescription);
2233 return result_parse;
2238 * asn1_parser2array - function that generates a C structure from an ASN1 file
2239 * @inputFileName: specify the path and the name of file that
2240 * contains ASN.1 declarations.
2241 * @outputFileName: specify the path and the name of file that will
2242 * contain the C vector definition.
2243 * @vectorName: specify the name of the C vector.
2244 * @errorDescription : return the error description or an empty
2245 * string if success.
2247 * Creates a file containing a C vector to use to manage the
2248 * definitions included in *INPUTFILENAME file. If *INPUTFILENAME is
2249 * "/aa/bb/xx.yy" and OUTPUTFILENAME is NULL, the file created is
2250 * "/aa/bb/xx_asn1_tab.c". If VECTORNAME is NULL the vector name
2251 * will be "xx_asn1_tab".
2253 * Returns:
2255 * ASN1_SUCCESS: The file has a correct syntax and every identifier
2256 * is known.
2258 * ASN1_FILE_NOT_FOUND: An error occured while opening FILE_NAME.
2260 * ASN1_SYNTAX_ERROR: The syntax is not correct.
2262 * ASN1_IDENTIFIER_NOT_FOUND: In the file there is an identifier that
2263 * is not defined.
2265 * ASN1_NAME_TOO_LONG: In the file there is an identifier whith more
2266 * than MAX_NAME_SIZE characters.
2268 int asn1_parser2array(const char *inputFileName,const char *outputFileName,
2269 const char *vectorName,char *errorDescription){
2270 char *file_out_name=NULL;
2271 char *vector_name=NULL;
2272 const char *char_p,*slash_p,*dot_p;
2274 p_tree=NULL;
2276 fileName = inputFileName;
2278 /* open the file to parse */
2279 file_asn1=fopen(inputFileName,"r");
2281 if(file_asn1==NULL)
2282 result_parse=ASN1_FILE_NOT_FOUND;
2283 else{
2284 result_parse=ASN1_SUCCESS;
2286 lineNumber=1;
2287 yyparse();
2289 fclose(file_asn1);
2291 if(result_parse==ASN1_SUCCESS){ /* syntax OK */
2292 /* set IMPLICIT or EXPLICIT property */
2293 _asn1_set_default_tag(p_tree);
2294 /* set CONST_SET and CONST_NOT_USED */
2295 _asn1_type_set_config(p_tree);
2296 /* check the identifier definitions */
2297 result_parse=_asn1_check_identifier(p_tree);
2299 if(result_parse==ASN1_SUCCESS){ /* all identifier defined */
2301 /* searching the last '/' and '.' in inputFileName */
2302 char_p=inputFileName;
2303 slash_p=inputFileName;
2304 while((char_p=strchr(char_p,'/'))){
2305 char_p++;
2306 slash_p=char_p;
2309 char_p=slash_p;
2310 dot_p=inputFileName+strlen(inputFileName);
2312 while((char_p=strchr(char_p,'.'))){
2313 dot_p=char_p;
2314 char_p++;
2317 if(outputFileName == NULL){
2318 /* file_out_name = inputFileName + _asn1_tab.c */
2319 file_out_name=(char *)malloc(dot_p-inputFileName+1+
2320 strlen("_asn1_tab.c"));
2321 memcpy(file_out_name,inputFileName,dot_p-inputFileName);
2322 file_out_name[dot_p-inputFileName]=0;
2323 strcat(file_out_name,"_asn1_tab.c");
2325 else{
2326 /* file_out_name = inputFileName */
2327 file_out_name=(char *)malloc(strlen(outputFileName)+1);
2328 strcpy(file_out_name,outputFileName);
2331 if(vectorName == NULL){
2332 /* vector_name = file name + _asn1_tab */
2333 vector_name=(char *)malloc(dot_p-slash_p+1+
2334 strlen("_asn1_tab"));
2335 memcpy(vector_name,slash_p,dot_p-slash_p);
2336 vector_name[dot_p-slash_p]=0;
2337 strcat(vector_name,"_asn1_tab");
2339 else{
2340 /* vector_name = vectorName */
2341 vector_name=(char *)malloc(strlen(vectorName)+1);
2342 strcpy(vector_name,vectorName);
2345 /* Save structure in a file */
2346 _asn1_create_static_structure(p_tree,
2347 file_out_name,vector_name);
2349 free(file_out_name);
2350 free(vector_name);
2351 } /* result == OK */
2352 } /* result == OK */
2354 /* Delete the list and the ASN1 structure */
2355 _asn1_delete_list_and_nodes();
2356 } /* inputFile exist */
2358 if (errorDescription!=NULL)
2359 _asn1_create_errorDescription(result_parse,errorDescription);
2361 return result_parse;
2365 /*************************************************************/
2366 /* Function: _asn1_yyerror */
2367 /* Description: function called when there are syntax errors*/
2368 /* Parameters: */
2369 /* char *s : error description */
2370 /* Return: int */
2371 /* */
2372 /*************************************************************/
2373 int _asn1_yyerror (char *s)
2375 /* Sends the error description to the std_out */
2377 #ifdef LIBTASN1_DEBUG_PARSER
2378 _libtasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName,
2379 lineNumber,s,lastToken);
2380 #endif
2382 if(result_parse!=ASN1_NAME_TOO_LONG)
2383 result_parse=ASN1_SYNTAX_ERROR;
2385 return 0;