Doc fix.
[libtasn1.git] / lib / ASN1.c
blob04708e646e81a66c1ff812a58787fa32d3825fa7
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 29 "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 algorithm */
158 static node_asn *p_tree; /* pointer to the root of the structure
159 created by the parser*/
160 static unsigned long lineNumber; /* line number describing the parser position
161 inside the file */
162 static char lastToken[MAX_NAME_SIZE+1]; /* last token find in the file to
163 parse before the 'parse error' */
164 extern char _asn1_identifierMissing[];
165 static const char *fileName; /* file to parse */
167 int _asn1_yyerror (char *);
168 int _asn1_yylex(void);
172 /* Enabling traces. */
173 #ifndef YYDEBUG
174 # define YYDEBUG 0
175 #endif
177 /* Enabling verbose error messages. */
178 #ifdef YYERROR_VERBOSE
179 # undef YYERROR_VERBOSE
180 # define YYERROR_VERBOSE 1
181 #else
182 # define YYERROR_VERBOSE 0
183 #endif
185 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
186 #line 55 "ASN1.y"
187 typedef union YYSTYPE {
188 unsigned int constant;
189 char str[MAX_NAME_SIZE+1];
190 node_asn* node;
191 } YYSTYPE;
192 /* Line 191 of yacc.c. */
193 #line 194 "ASN1.c"
194 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
195 # define YYSTYPE_IS_DECLARED 1
196 # define YYSTYPE_IS_TRIVIAL 1
197 #endif
201 /* Copy the second part of user declarations. */
204 /* Line 214 of yacc.c. */
205 #line 206 "ASN1.c"
207 #if ! defined (yyoverflow) || YYERROR_VERBOSE
209 /* The parser invokes alloca or malloc; define the necessary symbols. */
211 # if YYSTACK_USE_ALLOCA
212 # define YYSTACK_ALLOC alloca
213 # else
214 # ifndef YYSTACK_USE_ALLOCA
215 # if defined (alloca) || defined (_ALLOCA_H)
216 # define YYSTACK_ALLOC alloca
217 # else
218 # ifdef __GNUC__
219 # define YYSTACK_ALLOC __builtin_alloca
220 # endif
221 # endif
222 # endif
223 # endif
225 # ifdef YYSTACK_ALLOC
226 /* Pacify GCC's `empty if-body' warning. */
227 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
228 # else
229 # if defined (__STDC__) || defined (__cplusplus)
230 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
231 # define YYSIZE_T size_t
232 # endif
233 # define YYSTACK_ALLOC malloc
234 # define YYSTACK_FREE free
235 # endif
236 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
239 #if (! defined (yyoverflow) \
240 && (! defined (__cplusplus) \
241 || (YYSTYPE_IS_TRIVIAL)))
243 /* A type that is properly aligned for any stack member. */
244 union yyalloc
246 short yyss;
247 YYSTYPE yyvs;
250 /* The size of the maximum gap between one aligned stack and the next. */
251 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
253 /* The size of an array large to enough to hold all stacks, each with
254 N elements. */
255 # define YYSTACK_BYTES(N) \
256 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
257 + YYSTACK_GAP_MAXIMUM)
259 /* Copy COUNT objects from FROM to TO. The source and destination do
260 not overlap. */
261 # ifndef YYCOPY
262 # if 1 < __GNUC__
263 # define YYCOPY(To, From, Count) \
264 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
265 # else
266 # define YYCOPY(To, From, Count) \
267 do \
269 register YYSIZE_T yyi; \
270 for (yyi = 0; yyi < (Count); yyi++) \
271 (To)[yyi] = (From)[yyi]; \
273 while (0)
274 # endif
275 # endif
277 /* Relocate STACK from its old location to the new one. The
278 local variables YYSIZE and YYSTACKSIZE give the old and new number of
279 elements in the stack, and YYPTR gives the new location of the
280 stack. Advance YYPTR to a properly aligned location for the next
281 stack. */
282 # define YYSTACK_RELOCATE(Stack) \
283 do \
285 YYSIZE_T yynewbytes; \
286 YYCOPY (&yyptr->Stack, Stack, yysize); \
287 Stack = &yyptr->Stack; \
288 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
289 yyptr += yynewbytes / sizeof (*yyptr); \
291 while (0)
293 #endif
295 #if defined (__STDC__) || defined (__cplusplus)
296 typedef signed char yysigned_char;
297 #else
298 typedef short yysigned_char;
299 #endif
301 /* YYFINAL -- State number of the termination state. */
302 #define YYFINAL 5
303 /* YYLAST -- Last index in YYTABLE. */
304 #define YYLAST 189
306 /* YYNTOKENS -- Number of terminals. */
307 #define YYNTOKENS 52
308 /* YYNNTS -- Number of nonterminals. */
309 #define YYNNTS 43
310 /* YYNRULES -- Number of rules. */
311 #define YYNRULES 98
312 /* YYNRULES -- Number of states. */
313 #define YYNSTATES 189
315 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
316 #define YYUNDEFTOK 2
317 #define YYMAXUTOK 295
319 #define YYTRANSLATE(YYX) \
320 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
322 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
323 static const unsigned char yytranslate[] =
325 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
326 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
328 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
329 43, 44, 2, 41, 45, 42, 51, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
334 2, 46, 2, 47, 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, 49, 48, 50, 2, 2, 2, 2,
338 2, 2, 2, 2, 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, 2, 2, 2, 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, 1, 2, 3, 4,
351 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
352 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
353 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
354 35, 36, 37, 38, 39, 40
357 #if YYDEBUG
358 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
359 YYRHS. */
360 static const unsigned short yyprhs[] =
362 0, 0, 3, 12, 14, 17, 20, 22, 24, 26,
363 28, 30, 32, 36, 41, 43, 47, 49, 54, 56,
364 59, 61, 63, 65, 69, 74, 76, 79, 82, 85,
365 88, 91, 93, 97, 99, 104, 109, 117, 119, 121,
366 123, 128, 136, 138, 142, 144, 147, 150, 154, 159,
367 161, 165, 168, 174, 179, 182, 184, 187, 189, 191,
368 193, 195, 197, 199, 201, 203, 205, 207, 209, 211,
369 213, 215, 218, 220, 223, 226, 229, 231, 235, 240,
370 244, 249, 254, 258, 263, 268, 270, 275, 279, 287,
371 294, 299, 301, 303, 305, 308, 313, 317, 319
374 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
375 static const yysigned_char yyrhs[] =
377 53, 0, -1, 93, 31, 94, 32, 3, 33, 92,
378 34, -1, 4, -1, 41, 4, -1, 42, 4, -1,
379 54, -1, 55, -1, 4, -1, 5, -1, 56, -1,
380 5, -1, 43, 56, 44, -1, 5, 43, 56, 44,
381 -1, 59, -1, 60, 45, 59, -1, 57, -1, 5,
382 43, 4, 44, -1, 61, -1, 62, 61, -1, 13,
383 -1, 14, -1, 15, -1, 46, 4, 47, -1, 46,
384 63, 4, 47, -1, 64, -1, 64, 29, -1, 64,
385 30, -1, 16, 58, -1, 16, 22, -1, 16, 23,
386 -1, 56, -1, 67, 48, 56, -1, 7, -1, 7,
387 49, 60, 50, -1, 7, 43, 67, 44, -1, 7,
388 43, 57, 51, 51, 57, 44, -1, 21, -1, 35,
389 -1, 36, -1, 8, 43, 57, 44, -1, 8, 43,
390 57, 51, 51, 57, 44, -1, 71, -1, 43, 71,
391 44, -1, 37, -1, 37, 72, -1, 9, 10, -1,
392 9, 10, 72, -1, 5, 43, 4, 44, -1, 75,
393 -1, 76, 45, 75, -1, 12, 10, -1, 12, 10,
394 49, 76, 50, -1, 40, 49, 76, 50, -1, 19,
395 20, -1, 5, -1, 5, 72, -1, 68, -1, 78,
396 -1, 69, -1, 70, -1, 74, -1, 77, -1, 73,
397 -1, 85, -1, 79, -1, 87, -1, 88, -1, 86,
398 -1, 24, -1, 80, -1, 65, 80, -1, 81, -1,
399 81, 66, -1, 81, 6, -1, 5, 82, -1, 83,
400 -1, 84, 45, 83, -1, 11, 49, 84, 50, -1,
401 11, 18, 80, -1, 11, 72, 18, 80, -1, 28,
402 49, 84, 50, -1, 28, 18, 80, -1, 28, 72,
403 18, 80, -1, 17, 49, 84, 50, -1, 25, -1,
404 25, 26, 27, 5, -1, 5, 3, 81, -1, 5,
405 19, 20, 3, 49, 62, 50, -1, 5, 5, 3,
406 49, 62, 50, -1, 5, 7, 3, 56, -1, 89,
407 -1, 90, -1, 91, -1, 92, 91, -1, 5, 49,
408 62, 50, -1, 5, 49, 50, -1, 29, -1, 30,
412 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
413 static const unsigned short yyrline[] =
415 0, 117, 117, 130, 131, 134, 138, 139, 142, 143,
416 146, 147, 150, 152, 157, 158, 162, 164, 169, 170,
417 174, 175, 176, 179, 181, 185, 186, 187, 190, 192,
418 193, 197, 198, 202, 203, 205, 206, 213, 216, 217,
419 220, 222, 228, 229, 232, 233, 237, 238, 242, 247,
420 248, 252, 253, 258, 264, 267, 269, 272, 273, 274,
421 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
422 287, 288, 293, 294, 297, 300, 303, 304, 308, 310,
423 312, 317, 319, 321, 326, 330, 331, 336, 339, 343,
424 348, 354, 355, 358, 359, 363, 366, 390, 391
426 #endif
428 #if YYDEBUG || YYERROR_VERBOSE
429 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
430 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
431 static const char *const yytname[] =
433 "$end", "error", "$undefined", "\"::=\"", "NUM", "IDENTIFIER", "OPTIONAL",
434 "INTEGER", "SIZE", "OCTET", "STRING", "SEQUENCE", "BIT", "UNIVERSAL",
435 "PRIVATE", "APPLICATION", "DEFAULT", "CHOICE", "OF", "OBJECT",
436 "STR_IDENTIFIER", "BOOLEAN", "TRUE", "FALSE", "TOKEN_NULL", "ANY",
437 "DEFINED", "BY", "SET", "EXPLICIT", "IMPLICIT", "DEFINITIONS", "TAGS",
438 "BEGIN", "END", "UTCTime", "GeneralizedTime", "GeneralString", "FROM",
439 "IMPORTS", "ENUMERATED", "'+'", "'-'", "'('", "')'", "','", "'['",
440 "']'", "'|'", "'{'", "'}'", "'.'", "$accept", "definitions", "pos_num",
441 "neg_num", "pos_neg_num", "num_identifier", "pos_neg_identifier",
442 "constant", "constant_list", "obj_constant", "obj_constant_list",
443 "class", "tag_type", "tag", "default", "pos_neg_list", "integer_def",
444 "boolean_def", "Time", "size_def2", "size_def", "generalstring_def",
445 "octet_string_def", "bit_element", "bit_element_list", "bit_string_def",
446 "enumerated_def", "object_def", "type_assig_right",
447 "type_assig_right_tag", "type_assig_right_tag_default", "type_assig",
448 "type_assig_list", "sequence_def", "set_def", "choise_def", "any_def",
449 "type_def", "constant_def", "type_constant", "type_constant_list",
450 "definitions_id", "explicit_implicit", 0
452 #endif
454 # ifdef YYPRINT
455 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
456 token YYLEX-NUM. */
457 static const unsigned short yytoknum[] =
459 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
460 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
461 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
462 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
463 295, 43, 45, 40, 41, 44, 91, 93, 124, 123,
464 125, 46
466 # endif
468 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
469 static const unsigned char yyr1[] =
471 0, 52, 53, 54, 54, 55, 56, 56, 57, 57,
472 58, 58, 59, 59, 60, 60, 61, 61, 62, 62,
473 63, 63, 63, 64, 64, 65, 65, 65, 66, 66,
474 66, 67, 67, 68, 68, 68, 68, 69, 70, 70,
475 71, 71, 72, 72, 73, 73, 74, 74, 75, 76,
476 76, 77, 77, 78, 79, 80, 80, 80, 80, 80,
477 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
478 81, 81, 82, 82, 82, 83, 84, 84, 85, 85,
479 85, 86, 86, 86, 87, 88, 88, 89, 90, 90,
480 90, 91, 91, 92, 92, 93, 93, 94, 94
483 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
484 static const unsigned char yyr2[] =
486 0, 2, 8, 1, 2, 2, 1, 1, 1, 1,
487 1, 1, 3, 4, 1, 3, 1, 4, 1, 2,
488 1, 1, 1, 3, 4, 1, 2, 2, 2, 2,
489 2, 1, 3, 1, 4, 4, 7, 1, 1, 1,
490 4, 7, 1, 3, 1, 2, 2, 3, 4, 1,
491 3, 2, 5, 4, 2, 1, 2, 1, 1, 1,
492 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
493 1, 2, 1, 2, 2, 2, 1, 3, 4, 3,
494 4, 4, 3, 4, 4, 1, 4, 3, 7, 6,
495 4, 1, 1, 1, 2, 4, 3, 1, 1
498 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
499 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
500 means the default is an error. */
501 static const unsigned char yydefact[] =
503 0, 0, 0, 0, 0, 1, 0, 8, 9, 96,
504 16, 18, 0, 97, 98, 0, 0, 95, 19, 0,
505 0, 0, 17, 0, 0, 91, 92, 93, 0, 0,
506 0, 0, 0, 2, 94, 55, 33, 0, 0, 0,
507 0, 0, 37, 69, 85, 0, 38, 39, 44, 0,
508 0, 25, 0, 57, 59, 60, 63, 61, 62, 58,
509 65, 70, 87, 64, 68, 66, 67, 0, 0, 0,
510 0, 0, 42, 56, 0, 0, 46, 0, 0, 0,
511 51, 0, 54, 0, 0, 0, 0, 45, 0, 0,
512 20, 21, 22, 0, 26, 27, 71, 0, 3, 0,
513 0, 6, 7, 90, 0, 0, 0, 3, 9, 31,
514 0, 0, 0, 0, 14, 0, 47, 79, 0, 76,
515 0, 0, 0, 0, 0, 82, 0, 0, 0, 49,
516 0, 23, 0, 0, 4, 5, 0, 0, 43, 0,
517 35, 0, 0, 0, 0, 34, 72, 75, 0, 78,
518 80, 0, 84, 86, 81, 83, 0, 0, 53, 24,
519 89, 0, 40, 0, 0, 32, 0, 12, 15, 74,
520 0, 73, 77, 52, 0, 50, 88, 0, 0, 13,
521 11, 29, 30, 10, 28, 48, 0, 36, 41
524 /* YYDEFGOTO[NTERM-NUM]. */
525 static const short yydefgoto[] =
527 -1, 2, 101, 102, 103, 10, 184, 114, 115, 11,
528 12, 93, 51, 52, 171, 111, 53, 54, 55, 72,
529 73, 56, 57, 129, 130, 58, 59, 60, 61, 62,
530 147, 119, 120, 63, 64, 65, 66, 25, 26, 27,
531 28, 3, 15
534 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
535 STATE-NUM. */
536 #define YYPACT_NINF -84
537 static const short yypact[] =
539 18, -32, 33, 15, 0, -84, 90, -84, 49, -84,
540 -84, -84, 2, -84, -84, 11, 45, -84, -84, 57,
541 50, 43, -84, 100, 74, -84, -84, -84, 10, 78,
542 105, 113, 106, -84, -84, 5, -31, 126, 8, 128,
543 79, 120, -84, -84, 115, 12, -84, -84, 5, 95,
544 96, 102, 118, -84, -84, -84, -84, -84, -84, -84,
545 -84, -84, -84, -84, -84, -84, -84, 98, 23, 142,
546 107, 140, -84, -84, 32, 20, 5, 118, 146, 134,
547 108, 146, -84, 132, 118, 146, 138, -84, 155, 114,
548 -84, -84, -84, 158, -84, -84, -84, 63, -84, 159,
549 160, -84, -84, -84, 116, 129, 122, 117, -84, -84,
550 119, 38, 124, 23, -84, -3, -84, -84, 78, -84,
551 21, 118, 155, 30, 164, -84, 51, 118, 130, -84,
552 62, -84, 125, 4, -84, -84, 63, -6, -84, 123,
553 -84, 23, 23, 127, 20, -84, 13, -84, 146, -84,
554 -84, 72, -84, -84, -84, -84, 171, 155, -84, -84,
555 -84, 6, -84, 131, 129, -84, 133, -84, -84, -84,
556 17, -84, -84, -84, 135, -84, -84, 129, 136, -84,
557 -84, -84, -84, -84, -84, -84, 137, -84, -84
560 /* YYPGOTO[NTERM-NUM]. */
561 static const short yypgoto[] =
563 -84, -84, -84, -84, -72, -73, -84, 34, -84, -12,
564 -83, -84, -84, -84, -84, -84, -84, -84, -84, 112,
565 -14, -84, -84, 19, 64, -84, -84, -84, -49, 66,
566 -84, 37, 3, -84, -84, -84, -84, -84, -84, 161,
567 -84, -84, -84
570 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
571 positive, shift that token. If negative, reduce the rule which
572 number is the opposite. If zero, do what YYDEFACT says.
573 If YYTABLE_NINF, syntax error. */
574 #define YYTABLE_NINF -9
575 static const short yytable[] =
577 18, 110, 109, 96, 7, 8, 7, 8, 7, 8,
578 7, 8, 74, 70, 133, 24, 70, 4, 75, 169,
579 70, 98, 180, 1, 79, 112, 77, 98, 117, 170,
580 84, 86, 137, 5, 87, 125, 107, 108, 162, 181,
581 182, 143, 144, 19, 33, 163, 6, 145, 71, 20,
582 9, 71, 17, 161, 160, 71, 176, 78, 99, 100,
583 21, 85, 116, 113, 99, 100, 148, 7, 8, 165,
584 166, 149, 150, 99, 100, 148, 23, 29, 155, 30,
585 152, 31, 140, 35, 123, 36, 141, 37, 126, 38,
586 39, 178, 16, 32, 22, 40, 148, 41, 183, 42,
587 89, 154, 43, 44, 186, 24, 45, 157, 67, 90,
588 91, 92, 158, 46, 47, 48, 68, 157, 49, 13,
589 14, 18, 173, 35, 50, 36, 69, 37, 81, 38,
590 39, 94, 95, 7, 108, 40, 76, 41, 80, 42,
591 82, 83, 43, 44, 88, 104, 45, 97, 70, 18,
592 105, 118, 121, 46, 47, 48, 127, 122, 49, 124,
593 128, 131, 132, 134, 135, 136, 138, 142, -8, 153,
594 139, 167, 159, 156, 164, 174, 175, 179, 168, 185,
595 187, 188, 177, 106, 146, 172, 151, 0, 0, 34
598 static const short yycheck[] =
600 12, 74, 74, 52, 4, 5, 4, 5, 4, 5,
601 4, 5, 43, 8, 97, 5, 8, 49, 49, 6,
602 8, 4, 5, 5, 38, 5, 18, 4, 77, 16,
603 18, 45, 105, 0, 48, 84, 4, 5, 44, 22,
604 23, 113, 45, 32, 34, 51, 31, 50, 43, 4,
605 50, 43, 50, 136, 50, 43, 50, 49, 41, 42,
606 3, 49, 76, 43, 41, 42, 45, 4, 5, 141,
607 142, 50, 121, 41, 42, 45, 33, 3, 127, 5,
608 50, 7, 44, 5, 81, 7, 48, 9, 85, 11,
609 12, 164, 43, 19, 44, 17, 45, 19, 170, 21,
610 4, 50, 24, 25, 177, 5, 28, 45, 3, 13,
611 14, 15, 50, 35, 36, 37, 3, 45, 40, 29,
612 30, 133, 50, 5, 46, 7, 20, 9, 49, 11,
613 12, 29, 30, 4, 5, 17, 10, 19, 10, 21,
614 20, 26, 24, 25, 49, 3, 28, 49, 8, 161,
615 43, 5, 18, 35, 36, 37, 18, 49, 40, 27,
616 5, 47, 4, 4, 4, 49, 44, 43, 51, 5,
617 51, 44, 47, 43, 51, 4, 157, 44, 144, 44,
618 44, 44, 51, 71, 118, 148, 122, -1, -1, 28
621 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
622 symbol of state STATE-NUM. */
623 static const unsigned char yystos[] =
625 0, 5, 53, 93, 49, 0, 31, 4, 5, 50,
626 57, 61, 62, 29, 30, 94, 43, 50, 61, 32,
627 4, 3, 44, 33, 5, 89, 90, 91, 92, 3,
628 5, 7, 19, 34, 91, 5, 7, 9, 11, 12,
629 17, 19, 21, 24, 25, 28, 35, 36, 37, 40,
630 46, 64, 65, 68, 69, 70, 73, 74, 77, 78,
631 79, 80, 81, 85, 86, 87, 88, 3, 3, 20,
632 8, 43, 71, 72, 43, 49, 10, 18, 49, 72,
633 10, 49, 20, 26, 18, 49, 72, 72, 49, 4,
634 13, 14, 15, 63, 29, 30, 80, 49, 4, 41,
635 42, 54, 55, 56, 3, 43, 71, 4, 5, 56,
636 57, 67, 5, 43, 59, 60, 72, 80, 5, 83,
637 84, 18, 49, 84, 27, 80, 84, 18, 5, 75,
638 76, 47, 4, 62, 4, 4, 49, 57, 44, 51,
639 44, 48, 43, 56, 45, 50, 81, 82, 45, 50,
640 80, 76, 50, 5, 50, 80, 43, 45, 50, 47,
641 50, 62, 44, 51, 51, 56, 56, 44, 59, 6,
642 16, 66, 83, 50, 4, 75, 50, 51, 57, 44,
643 5, 22, 23, 56, 58, 44, 57, 44, 44
646 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
647 # define YYSIZE_T __SIZE_TYPE__
648 #endif
649 #if ! defined (YYSIZE_T) && defined (size_t)
650 # define YYSIZE_T size_t
651 #endif
652 #if ! defined (YYSIZE_T)
653 # if defined (__STDC__) || defined (__cplusplus)
654 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
655 # define YYSIZE_T size_t
656 # endif
657 #endif
658 #if ! defined (YYSIZE_T)
659 # define YYSIZE_T unsigned int
660 #endif
662 #define yyerrok (yyerrstatus = 0)
663 #define yyclearin (yychar = YYEMPTY)
664 #define YYEMPTY (-2)
665 #define YYEOF 0
667 #define YYACCEPT goto yyacceptlab
668 #define YYABORT goto yyabortlab
669 #define YYERROR goto yyerrlab1
672 /* Like YYERROR except do call yyerror. This remains here temporarily
673 to ease the transition to the new meaning of YYERROR, for GCC.
674 Once GCC version 2 has supplanted version 1, this can go. */
676 #define YYFAIL goto yyerrlab
678 #define YYRECOVERING() (!!yyerrstatus)
680 #define YYBACKUP(Token, Value) \
681 do \
682 if (yychar == YYEMPTY && yylen == 1) \
684 yychar = (Token); \
685 yylval = (Value); \
686 yytoken = YYTRANSLATE (yychar); \
687 YYPOPSTACK; \
688 goto yybackup; \
690 else \
692 yyerror ("syntax error: cannot back up");\
693 YYERROR; \
695 while (0)
697 #define YYTERROR 1
698 #define YYERRCODE 256
700 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
701 are run). */
703 #ifndef YYLLOC_DEFAULT
704 # define YYLLOC_DEFAULT(Current, Rhs, N) \
705 Current.first_line = Rhs[1].first_line; \
706 Current.first_column = Rhs[1].first_column; \
707 Current.last_line = Rhs[N].last_line; \
708 Current.last_column = Rhs[N].last_column;
709 #endif
711 /* YYLEX -- calling `yylex' with the right arguments. */
713 #ifdef YYLEX_PARAM
714 # define YYLEX yylex (YYLEX_PARAM)
715 #else
716 # define YYLEX yylex ()
717 #endif
719 /* Enable debugging if requested. */
720 #if YYDEBUG
722 # ifndef YYFPRINTF
723 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
724 # define YYFPRINTF fprintf
725 # endif
727 # define YYDPRINTF(Args) \
728 do { \
729 if (yydebug) \
730 YYFPRINTF Args; \
731 } while (0)
733 # define YYDSYMPRINT(Args) \
734 do { \
735 if (yydebug) \
736 yysymprint Args; \
737 } while (0)
739 # define YYDSYMPRINTF(Title, Token, Value, Location) \
740 do { \
741 if (yydebug) \
743 YYFPRINTF (stderr, "%s ", Title); \
744 yysymprint (stderr, \
745 Token, Value); \
746 YYFPRINTF (stderr, "\n"); \
748 } while (0)
750 /*------------------------------------------------------------------.
751 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
752 | TOP (cinluded). |
753 `------------------------------------------------------------------*/
755 #if defined (__STDC__) || defined (__cplusplus)
756 static void
757 yy_stack_print (short *bottom, short *top)
758 #else
759 static void
760 yy_stack_print (bottom, top)
761 short *bottom;
762 short *top;
763 #endif
765 YYFPRINTF (stderr, "Stack now");
766 for (/* Nothing. */; bottom <= top; ++bottom)
767 YYFPRINTF (stderr, " %d", *bottom);
768 YYFPRINTF (stderr, "\n");
771 # define YY_STACK_PRINT(Bottom, Top) \
772 do { \
773 if (yydebug) \
774 yy_stack_print ((Bottom), (Top)); \
775 } while (0)
778 /*------------------------------------------------.
779 | Report that the YYRULE is going to be reduced. |
780 `------------------------------------------------*/
782 #if defined (__STDC__) || defined (__cplusplus)
783 static void
784 yy_reduce_print (int yyrule)
785 #else
786 static void
787 yy_reduce_print (yyrule)
788 int yyrule;
789 #endif
791 int yyi;
792 unsigned int yylineno = yyrline[yyrule];
793 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
794 yyrule - 1, yylineno);
795 /* Print the symbols being reduced, and their result. */
796 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
797 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
798 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
801 # define YY_REDUCE_PRINT(Rule) \
802 do { \
803 if (yydebug) \
804 yy_reduce_print (Rule); \
805 } while (0)
807 /* Nonzero means print parse trace. It is left uninitialized so that
808 multiple parsers can coexist. */
809 int yydebug;
810 #else /* !YYDEBUG */
811 # define YYDPRINTF(Args)
812 # define YYDSYMPRINT(Args)
813 # define YYDSYMPRINTF(Title, Token, Value, Location)
814 # define YY_STACK_PRINT(Bottom, Top)
815 # define YY_REDUCE_PRINT(Rule)
816 #endif /* !YYDEBUG */
819 /* YYINITDEPTH -- initial size of the parser's stacks. */
820 #ifndef YYINITDEPTH
821 # define YYINITDEPTH 200
822 #endif
824 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
825 if the built-in stack extension method is used).
827 Do not make this value too large; the results are undefined if
828 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
829 evaluated with infinite-precision integer arithmetic. */
831 #if YYMAXDEPTH == 0
832 # undef YYMAXDEPTH
833 #endif
835 #ifndef YYMAXDEPTH
836 # define YYMAXDEPTH 10000
837 #endif
841 #if YYERROR_VERBOSE
843 # ifndef yystrlen
844 # if defined (__GLIBC__) && defined (_STRING_H)
845 # define yystrlen strlen
846 # else
847 /* Return the length of YYSTR. */
848 static YYSIZE_T
849 # if defined (__STDC__) || defined (__cplusplus)
850 yystrlen (const char *yystr)
851 # else
852 yystrlen (yystr)
853 const char *yystr;
854 # endif
856 register const char *yys = yystr;
858 while (*yys++ != '\0')
859 continue;
861 return yys - yystr - 1;
863 # endif
864 # endif
866 # ifndef yystpcpy
867 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
868 # define yystpcpy stpcpy
869 # else
870 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
871 YYDEST. */
872 static char *
873 # if defined (__STDC__) || defined (__cplusplus)
874 yystpcpy (char *yydest, const char *yysrc)
875 # else
876 yystpcpy (yydest, yysrc)
877 char *yydest;
878 const char *yysrc;
879 # endif
881 register char *yyd = yydest;
882 register const char *yys = yysrc;
884 while ((*yyd++ = *yys++) != '\0')
885 continue;
887 return yyd - 1;
889 # endif
890 # endif
892 #endif /* !YYERROR_VERBOSE */
896 #if YYDEBUG
897 /*--------------------------------.
898 | Print this symbol on YYOUTPUT. |
899 `--------------------------------*/
901 #if defined (__STDC__) || defined (__cplusplus)
902 static void
903 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
904 #else
905 static void
906 yysymprint (yyoutput, yytype, yyvaluep)
907 FILE *yyoutput;
908 int yytype;
909 YYSTYPE *yyvaluep;
910 #endif
912 /* Pacify ``unused variable'' warnings. */
913 (void) yyvaluep;
915 if (yytype < YYNTOKENS)
917 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
918 # ifdef YYPRINT
919 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
920 # endif
922 else
923 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
925 switch (yytype)
927 default:
928 break;
930 YYFPRINTF (yyoutput, ")");
933 #endif /* ! YYDEBUG */
934 /*-----------------------------------------------.
935 | Release the memory associated to this symbol. |
936 `-----------------------------------------------*/
938 #if defined (__STDC__) || defined (__cplusplus)
939 static void
940 yydestruct (int yytype, YYSTYPE *yyvaluep)
941 #else
942 static void
943 yydestruct (yytype, yyvaluep)
944 int yytype;
945 YYSTYPE *yyvaluep;
946 #endif
948 /* Pacify ``unused variable'' warnings. */
949 (void) yyvaluep;
951 switch (yytype)
954 default:
955 break;
960 /* Prevent warnings from -Wmissing-prototypes. */
962 #ifdef YYPARSE_PARAM
963 # if defined (__STDC__) || defined (__cplusplus)
964 int yyparse (void *YYPARSE_PARAM);
965 # else
966 int yyparse ();
967 # endif
968 #else /* ! YYPARSE_PARAM */
969 #if defined (__STDC__) || defined (__cplusplus)
970 int yyparse (void);
971 #else
972 int yyparse ();
973 #endif
974 #endif /* ! YYPARSE_PARAM */
978 /* The lookahead symbol. */
979 int yychar;
981 /* The semantic value of the lookahead symbol. */
982 YYSTYPE yylval;
984 /* Number of syntax errors so far. */
985 int yynerrs;
989 /*----------.
990 | yyparse. |
991 `----------*/
993 #ifdef YYPARSE_PARAM
994 # if defined (__STDC__) || defined (__cplusplus)
995 int yyparse (void *YYPARSE_PARAM)
996 # else
997 int yyparse (YYPARSE_PARAM)
998 void *YYPARSE_PARAM;
999 # endif
1000 #else /* ! YYPARSE_PARAM */
1001 #if defined (__STDC__) || defined (__cplusplus)
1003 yyparse (void)
1004 #else
1006 yyparse ()
1008 #endif
1009 #endif
1012 register int yystate;
1013 register int yyn;
1014 int yyresult;
1015 /* Number of tokens to shift before error messages enabled. */
1016 int yyerrstatus;
1017 /* Lookahead token as an internal (translated) token number. */
1018 int yytoken = 0;
1020 /* Three stacks and their tools:
1021 `yyss': related to states,
1022 `yyvs': related to semantic values,
1023 `yyls': related to locations.
1025 Refer to the stacks thru separate pointers, to allow yyoverflow
1026 to reallocate them elsewhere. */
1028 /* The state stack. */
1029 short yyssa[YYINITDEPTH];
1030 short *yyss = yyssa;
1031 register short *yyssp;
1033 /* The semantic value stack. */
1034 YYSTYPE yyvsa[YYINITDEPTH];
1035 YYSTYPE *yyvs = yyvsa;
1036 register YYSTYPE *yyvsp;
1040 #define YYPOPSTACK (yyvsp--, yyssp--)
1042 YYSIZE_T yystacksize = YYINITDEPTH;
1044 /* The variables used to return semantic value and location from the
1045 action routines. */
1046 YYSTYPE yyval;
1049 /* When reducing, the number of symbols on the RHS of the reduced
1050 rule. */
1051 int yylen;
1053 YYDPRINTF ((stderr, "Starting parse\n"));
1055 yystate = 0;
1056 yyerrstatus = 0;
1057 yynerrs = 0;
1058 yychar = YYEMPTY; /* Cause a token to be read. */
1060 /* Initialize stack pointers.
1061 Waste one element of value and location stack
1062 so that they stay on the same level as the state stack.
1063 The wasted elements are never initialized. */
1065 yyssp = yyss;
1066 yyvsp = yyvs;
1068 goto yysetstate;
1070 /*------------------------------------------------------------.
1071 | yynewstate -- Push a new state, which is found in yystate. |
1072 `------------------------------------------------------------*/
1073 yynewstate:
1074 /* In all cases, when you get here, the value and location stacks
1075 have just been pushed. so pushing a state here evens the stacks.
1077 yyssp++;
1079 yysetstate:
1080 *yyssp = yystate;
1082 if (yyss + yystacksize - 1 <= yyssp)
1084 /* Get the current used size of the three stacks, in elements. */
1085 YYSIZE_T yysize = yyssp - yyss + 1;
1087 #ifdef yyoverflow
1089 /* Give user a chance to reallocate the stack. Use copies of
1090 these so that the &'s don't force the real ones into
1091 memory. */
1092 YYSTYPE *yyvs1 = yyvs;
1093 short *yyss1 = yyss;
1096 /* Each stack pointer address is followed by the size of the
1097 data in use in that stack, in bytes. This used to be a
1098 conditional around just the two extra args, but that might
1099 be undefined if yyoverflow is a macro. */
1100 yyoverflow ("parser stack overflow",
1101 &yyss1, yysize * sizeof (*yyssp),
1102 &yyvs1, yysize * sizeof (*yyvsp),
1104 &yystacksize);
1106 yyss = yyss1;
1107 yyvs = yyvs1;
1109 #else /* no yyoverflow */
1110 # ifndef YYSTACK_RELOCATE
1111 goto yyoverflowlab;
1112 # else
1113 /* Extend the stack our own way. */
1114 if (YYMAXDEPTH <= yystacksize)
1115 goto yyoverflowlab;
1116 yystacksize *= 2;
1117 if (YYMAXDEPTH < yystacksize)
1118 yystacksize = YYMAXDEPTH;
1121 short *yyss1 = yyss;
1122 union yyalloc *yyptr =
1123 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1124 if (! yyptr)
1125 goto yyoverflowlab;
1126 YYSTACK_RELOCATE (yyss);
1127 YYSTACK_RELOCATE (yyvs);
1129 # undef YYSTACK_RELOCATE
1130 if (yyss1 != yyssa)
1131 YYSTACK_FREE (yyss1);
1133 # endif
1134 #endif /* no yyoverflow */
1136 yyssp = yyss + yysize - 1;
1137 yyvsp = yyvs + yysize - 1;
1140 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1141 (unsigned long int) yystacksize));
1143 if (yyss + yystacksize - 1 <= yyssp)
1144 YYABORT;
1147 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1149 goto yybackup;
1151 /*-----------.
1152 | yybackup. |
1153 `-----------*/
1154 yybackup:
1156 /* Do appropriate processing given the current state. */
1157 /* Read a lookahead token if we need one and don't already have one. */
1158 /* yyresume: */
1160 /* First try to decide what to do without reference to lookahead token. */
1162 yyn = yypact[yystate];
1163 if (yyn == YYPACT_NINF)
1164 goto yydefault;
1166 /* Not known => get a lookahead token if don't already have one. */
1168 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1169 if (yychar == YYEMPTY)
1171 YYDPRINTF ((stderr, "Reading a token: "));
1172 yychar = YYLEX;
1175 if (yychar <= YYEOF)
1177 yychar = yytoken = YYEOF;
1178 YYDPRINTF ((stderr, "Now at end of input.\n"));
1180 else
1182 yytoken = YYTRANSLATE (yychar);
1183 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1186 /* If the proper action on seeing token YYTOKEN is to reduce or to
1187 detect an error, take that action. */
1188 yyn += yytoken;
1189 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1190 goto yydefault;
1191 yyn = yytable[yyn];
1192 if (yyn <= 0)
1194 if (yyn == 0 || yyn == YYTABLE_NINF)
1195 goto yyerrlab;
1196 yyn = -yyn;
1197 goto yyreduce;
1200 if (yyn == YYFINAL)
1201 YYACCEPT;
1203 /* Shift the lookahead token. */
1204 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1206 /* Discard the token being shifted unless it is eof. */
1207 if (yychar != YYEOF)
1208 yychar = YYEMPTY;
1210 *++yyvsp = yylval;
1213 /* Count tokens shifted since error; after three, turn off error
1214 status. */
1215 if (yyerrstatus)
1216 yyerrstatus--;
1218 yystate = yyn;
1219 goto yynewstate;
1222 /*-----------------------------------------------------------.
1223 | yydefault -- do the default action for the current state. |
1224 `-----------------------------------------------------------*/
1225 yydefault:
1226 yyn = yydefact[yystate];
1227 if (yyn == 0)
1228 goto yyerrlab;
1229 goto yyreduce;
1232 /*-----------------------------.
1233 | yyreduce -- Do a reduction. |
1234 `-----------------------------*/
1235 yyreduce:
1236 /* yyn is the number of a rule to reduce with. */
1237 yylen = yyr2[yyn];
1239 /* If YYLEN is nonzero, implement the default value of the action:
1240 `$$ = $1'.
1242 Otherwise, the following line sets YYVAL to garbage.
1243 This behavior is undocumented and Bison
1244 users should not rely upon it. Assigning to YYVAL
1245 unconditionally makes the parser a bit smaller, and it avoids a
1246 GCC warning that YYVAL may be used uninitialized. */
1247 yyval = yyvsp[1-yylen];
1250 YY_REDUCE_PRINT (yyn);
1251 switch (yyn)
1253 case 2:
1254 #line 120 "ASN1.y"
1255 {yyval.node=_asn1_add_node(TYPE_DEFINITIONS|yyvsp[-5].constant);
1256 _asn1_set_name(yyval.node,_asn1_get_name(yyvsp[-7].node));
1257 _asn1_set_name(yyvsp[-7].node,"");
1258 _asn1_set_right(yyvsp[-7].node,yyvsp[-1].node);
1259 _asn1_set_down(yyval.node,yyvsp[-7].node);
1261 p_tree=yyval.node;
1263 break;
1265 case 3:
1266 #line 130 "ASN1.y"
1267 {strcpy(yyval.str,yyvsp[0].str);}
1268 break;
1270 case 4:
1271 #line 131 "ASN1.y"
1272 {strcpy(yyval.str,yyvsp[0].str);}
1273 break;
1275 case 5:
1276 #line 134 "ASN1.y"
1277 {strcpy(yyval.str,"-");
1278 strcat(yyval.str,yyvsp[0].str);}
1279 break;
1281 case 6:
1282 #line 138 "ASN1.y"
1283 {strcpy(yyval.str,yyvsp[0].str);}
1284 break;
1286 case 7:
1287 #line 139 "ASN1.y"
1288 {strcpy(yyval.str,yyvsp[0].str);}
1289 break;
1291 case 8:
1292 #line 142 "ASN1.y"
1293 {strcpy(yyval.str,yyvsp[0].str);}
1294 break;
1296 case 9:
1297 #line 143 "ASN1.y"
1298 {strcpy(yyval.str,yyvsp[0].str);}
1299 break;
1301 case 10:
1302 #line 146 "ASN1.y"
1303 {strcpy(yyval.str,yyvsp[0].str);}
1304 break;
1306 case 11:
1307 #line 147 "ASN1.y"
1308 {strcpy(yyval.str,yyvsp[0].str);}
1309 break;
1311 case 12:
1312 #line 150 "ASN1.y"
1313 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1314 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1315 break;
1317 case 13:
1318 #line 152 "ASN1.y"
1319 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1320 _asn1_set_name(yyval.node,yyvsp[-3].str);
1321 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1322 break;
1324 case 14:
1325 #line 157 "ASN1.y"
1326 {yyval.node=yyvsp[0].node;}
1327 break;
1329 case 15:
1330 #line 158 "ASN1.y"
1331 {yyval.node=yyvsp[-2].node;
1332 _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
1333 break;
1335 case 16:
1336 #line 162 "ASN1.y"
1337 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1338 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1339 break;
1341 case 17:
1342 #line 164 "ASN1.y"
1343 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1344 _asn1_set_name(yyval.node,yyvsp[-3].str);
1345 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1346 break;
1348 case 18:
1349 #line 169 "ASN1.y"
1350 {yyval.node=yyvsp[0].node;}
1351 break;
1353 case 19:
1354 #line 170 "ASN1.y"
1355 {yyval.node=yyvsp[-1].node;
1356 _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
1357 break;
1359 case 20:
1360 #line 174 "ASN1.y"
1361 {yyval.constant=CONST_UNIVERSAL;}
1362 break;
1364 case 21:
1365 #line 175 "ASN1.y"
1366 {yyval.constant=CONST_PRIVATE;}
1367 break;
1369 case 22:
1370 #line 176 "ASN1.y"
1371 {yyval.constant=CONST_APPLICATION;}
1372 break;
1374 case 23:
1375 #line 179 "ASN1.y"
1376 {yyval.node=_asn1_add_node(TYPE_TAG);
1377 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1378 break;
1380 case 24:
1381 #line 181 "ASN1.y"
1382 {yyval.node=_asn1_add_node(TYPE_TAG | yyvsp[-2].constant);
1383 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1384 break;
1386 case 25:
1387 #line 185 "ASN1.y"
1388 {yyval.node=yyvsp[0].node;}
1389 break;
1391 case 26:
1392 #line 186 "ASN1.y"
1393 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_EXPLICIT);}
1394 break;
1396 case 27:
1397 #line 187 "ASN1.y"
1398 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_IMPLICIT);}
1399 break;
1401 case 28:
1402 #line 190 "ASN1.y"
1403 {yyval.node=_asn1_add_node(TYPE_DEFAULT);
1404 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1405 break;
1407 case 29:
1408 #line 192 "ASN1.y"
1409 {yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);}
1410 break;
1412 case 30:
1413 #line 193 "ASN1.y"
1414 {yyval.node=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);}
1415 break;
1417 case 33:
1418 #line 202 "ASN1.y"
1419 {yyval.node=_asn1_add_node(TYPE_INTEGER);}
1420 break;
1422 case 34:
1423 #line 203 "ASN1.y"
1424 {yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_LIST);
1425 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1426 break;
1428 case 35:
1429 #line 205 "ASN1.y"
1430 {yyval.node=_asn1_add_node(TYPE_INTEGER);}
1431 break;
1433 case 36:
1434 #line 207 "ASN1.y"
1435 {yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_MIN_MAX);
1436 _asn1_set_down(yyval.node,_asn1_add_node(TYPE_SIZE));
1437 _asn1_set_value(_asn1_get_down(yyval.node),yyvsp[-1].str,strlen(yyvsp[-1].str)+1);
1438 _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[-4].str);}
1439 break;
1441 case 37:
1442 #line 213 "ASN1.y"
1443 {yyval.node=_asn1_add_node(TYPE_BOOLEAN);}
1444 break;
1446 case 38:
1447 #line 216 "ASN1.y"
1448 {yyval.node=_asn1_add_node(TYPE_TIME|CONST_UTC);}
1449 break;
1451 case 39:
1452 #line 217 "ASN1.y"
1453 {yyval.node=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);}
1454 break;
1456 case 40:
1457 #line 220 "ASN1.y"
1458 {yyval.node=_asn1_add_node(TYPE_SIZE|CONST_1_PARAM);
1459 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1460 break;
1462 case 41:
1463 #line 223 "ASN1.y"
1464 {yyval.node=_asn1_add_node(TYPE_SIZE|CONST_MIN_MAX);
1465 _asn1_set_value(yyval.node,yyvsp[-4].str,strlen(yyvsp[-4].str)+1);
1466 _asn1_set_name(yyval.node,yyvsp[-1].str);}
1467 break;
1469 case 42:
1470 #line 228 "ASN1.y"
1471 {yyval.node=yyvsp[0].node;}
1472 break;
1474 case 43:
1475 #line 229 "ASN1.y"
1476 {yyval.node=yyvsp[-1].node;}
1477 break;
1479 case 44:
1480 #line 232 "ASN1.y"
1481 {yyval.node=_asn1_add_node(TYPE_GENERALSTRING);}
1482 break;
1484 case 45:
1485 #line 233 "ASN1.y"
1486 {yyval.node=_asn1_add_node(TYPE_GENERALSTRING|CONST_SIZE);
1487 _asn1_set_down(yyval.node,yyvsp[0].node);}
1488 break;
1490 case 46:
1491 #line 237 "ASN1.y"
1492 {yyval.node=_asn1_add_node(TYPE_OCTET_STRING);}
1493 break;
1495 case 47:
1496 #line 238 "ASN1.y"
1497 {yyval.node=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE);
1498 _asn1_set_down(yyval.node,yyvsp[0].node);}
1499 break;
1501 case 48:
1502 #line 242 "ASN1.y"
1503 {yyval.node=_asn1_add_node(TYPE_CONSTANT);
1504 _asn1_set_name(yyval.node,yyvsp[-3].str);
1505 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);}
1506 break;
1508 case 49:
1509 #line 247 "ASN1.y"
1510 {yyval.node=yyvsp[0].node;}
1511 break;
1513 case 50:
1514 #line 248 "ASN1.y"
1515 {yyval.node=yyvsp[-2].node;
1516 _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
1517 break;
1519 case 51:
1520 #line 252 "ASN1.y"
1521 {yyval.node=_asn1_add_node(TYPE_BIT_STRING);}
1522 break;
1524 case 52:
1525 #line 254 "ASN1.y"
1526 {yyval.node=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST);
1527 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1528 break;
1530 case 53:
1531 #line 259 "ASN1.y"
1532 {yyval.node=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST);
1533 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1534 break;
1536 case 54:
1537 #line 264 "ASN1.y"
1538 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID);}
1539 break;
1541 case 55:
1542 #line 267 "ASN1.y"
1543 {yyval.node=_asn1_add_node(TYPE_IDENTIFIER);
1544 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1545 break;
1547 case 56:
1548 #line 269 "ASN1.y"
1549 {yyval.node=_asn1_add_node(TYPE_IDENTIFIER|CONST_SIZE);
1550 _asn1_set_value(yyval.node,yyvsp[-1].str,strlen(yyvsp[-1].str)+1);
1551 _asn1_set_down(yyval.node,yyvsp[0].node);}
1552 break;
1554 case 57:
1555 #line 272 "ASN1.y"
1556 {yyval.node=yyvsp[0].node;}
1557 break;
1559 case 58:
1560 #line 273 "ASN1.y"
1561 {yyval.node=yyvsp[0].node;}
1562 break;
1564 case 59:
1565 #line 274 "ASN1.y"
1566 {yyval.node=yyvsp[0].node;}
1567 break;
1569 case 61:
1570 #line 276 "ASN1.y"
1571 {yyval.node=yyvsp[0].node;}
1572 break;
1574 case 62:
1575 #line 277 "ASN1.y"
1576 {yyval.node=yyvsp[0].node;}
1577 break;
1579 case 63:
1580 #line 278 "ASN1.y"
1581 {yyval.node=yyvsp[0].node;}
1582 break;
1584 case 64:
1585 #line 279 "ASN1.y"
1586 {yyval.node=yyvsp[0].node;}
1587 break;
1589 case 65:
1590 #line 280 "ASN1.y"
1591 {yyval.node=yyvsp[0].node;}
1592 break;
1594 case 66:
1595 #line 281 "ASN1.y"
1596 {yyval.node=yyvsp[0].node;}
1597 break;
1599 case 67:
1600 #line 282 "ASN1.y"
1601 {yyval.node=yyvsp[0].node;}
1602 break;
1604 case 68:
1605 #line 283 "ASN1.y"
1606 {yyval.node=yyvsp[0].node;}
1607 break;
1609 case 69:
1610 #line 284 "ASN1.y"
1611 {yyval.node=_asn1_add_node(TYPE_NULL);}
1612 break;
1614 case 70:
1615 #line 287 "ASN1.y"
1616 {yyval.node=yyvsp[0].node;}
1617 break;
1619 case 71:
1620 #line 288 "ASN1.y"
1621 {yyval.node=_asn1_mod_type(yyvsp[0].node,CONST_TAG);
1622 _asn1_set_right(yyvsp[-1].node,_asn1_get_down(yyval.node));
1623 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1624 break;
1626 case 72:
1627 #line 293 "ASN1.y"
1628 {yyval.node=yyvsp[0].node;}
1629 break;
1631 case 73:
1632 #line 294 "ASN1.y"
1633 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_DEFAULT);
1634 _asn1_set_right(yyvsp[0].node,_asn1_get_down(yyval.node));
1635 _asn1_set_down(yyval.node,yyvsp[0].node);}
1636 break;
1638 case 74:
1639 #line 297 "ASN1.y"
1640 {yyval.node=_asn1_mod_type(yyvsp[-1].node,CONST_OPTION);}
1641 break;
1643 case 75:
1644 #line 300 "ASN1.y"
1645 {yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-1].str);}
1646 break;
1648 case 76:
1649 #line 303 "ASN1.y"
1650 {yyval.node=yyvsp[0].node;}
1651 break;
1653 case 77:
1654 #line 304 "ASN1.y"
1655 {yyval.node=yyvsp[-2].node;
1656 _asn1_set_right(_asn1_get_last_right(yyvsp[-2].node),yyvsp[0].node);}
1657 break;
1659 case 78:
1660 #line 308 "ASN1.y"
1661 {yyval.node=_asn1_add_node(TYPE_SEQUENCE);
1662 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1663 break;
1665 case 79:
1666 #line 310 "ASN1.y"
1667 {yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF);
1668 _asn1_set_down(yyval.node,yyvsp[0].node);}
1669 break;
1671 case 80:
1672 #line 312 "ASN1.y"
1673 {yyval.node=_asn1_add_node(TYPE_SEQUENCE_OF|CONST_SIZE);
1674 _asn1_set_right(yyvsp[-2].node,yyvsp[0].node);
1675 _asn1_set_down(yyval.node,yyvsp[-2].node);}
1676 break;
1678 case 81:
1679 #line 317 "ASN1.y"
1680 {yyval.node=_asn1_add_node(TYPE_SET);
1681 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1682 break;
1684 case 82:
1685 #line 319 "ASN1.y"
1686 {yyval.node=_asn1_add_node(TYPE_SET_OF);
1687 _asn1_set_down(yyval.node,yyvsp[0].node);}
1688 break;
1690 case 83:
1691 #line 321 "ASN1.y"
1692 {yyval.node=_asn1_add_node(TYPE_SET_OF|CONST_SIZE);
1693 _asn1_set_right(yyvsp[-2].node,yyvsp[0].node);
1694 _asn1_set_down(yyval.node,yyvsp[-2].node);}
1695 break;
1697 case 84:
1698 #line 326 "ASN1.y"
1699 {yyval.node=_asn1_add_node(TYPE_CHOICE);
1700 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1701 break;
1703 case 85:
1704 #line 330 "ASN1.y"
1705 {yyval.node=_asn1_add_node(TYPE_ANY);}
1706 break;
1708 case 86:
1709 #line 331 "ASN1.y"
1710 {yyval.node=_asn1_add_node(TYPE_ANY|CONST_DEFINED_BY);
1711 _asn1_set_down(yyval.node,_asn1_add_node(TYPE_CONSTANT));
1712 _asn1_set_name(_asn1_get_down(yyval.node),yyvsp[0].str);}
1713 break;
1715 case 87:
1716 #line 336 "ASN1.y"
1717 {yyval.node=_asn1_set_name(yyvsp[0].node,yyvsp[-2].str);}
1718 break;
1720 case 88:
1721 #line 340 "ASN1.y"
1722 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN);
1723 _asn1_set_name(yyval.node,yyvsp[-6].str);
1724 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1725 break;
1727 case 89:
1728 #line 344 "ASN1.y"
1729 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM);
1730 _asn1_set_name(yyval.node,yyvsp[-5].str);
1731 _asn1_set_value(yyval.node,yyvsp[-4].str,strlen(yyvsp[-4].str)+1);
1732 _asn1_set_down(yyval.node,yyvsp[-1].node);}
1733 break;
1735 case 90:
1736 #line 349 "ASN1.y"
1737 {yyval.node=_asn1_add_node(TYPE_INTEGER|CONST_ASSIGN);
1738 _asn1_set_name(yyval.node,yyvsp[-3].str);
1739 _asn1_set_value(yyval.node,yyvsp[0].str,strlen(yyvsp[0].str)+1);}
1740 break;
1742 case 91:
1743 #line 354 "ASN1.y"
1744 {yyval.node=yyvsp[0].node;}
1745 break;
1747 case 92:
1748 #line 355 "ASN1.y"
1749 {yyval.node=yyvsp[0].node;}
1750 break;
1752 case 93:
1753 #line 358 "ASN1.y"
1754 {yyval.node=yyvsp[0].node;}
1755 break;
1757 case 94:
1758 #line 359 "ASN1.y"
1759 {yyval.node=yyvsp[-1].node;
1760 _asn1_set_right(_asn1_get_last_right(yyvsp[-1].node),yyvsp[0].node);}
1761 break;
1763 case 95:
1764 #line 363 "ASN1.y"
1765 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
1766 _asn1_set_down(yyval.node,yyvsp[-1].node);
1767 _asn1_set_name(yyval.node,yyvsp[-3].str);}
1768 break;
1770 case 96:
1771 #line 366 "ASN1.y"
1772 {yyval.node=_asn1_add_node(TYPE_OBJECT_ID);
1773 _asn1_set_name(yyval.node,yyvsp[-2].str);}
1774 break;
1776 case 97:
1777 #line 390 "ASN1.y"
1778 {yyval.constant=CONST_EXPLICIT;}
1779 break;
1781 case 98:
1782 #line 391 "ASN1.y"
1783 {yyval.constant=CONST_IMPLICIT;}
1784 break;
1789 /* Line 999 of yacc.c. */
1790 #line 1791 "ASN1.c"
1792 yyvsp -= yylen;
1793 yyssp -= yylen;
1796 YY_STACK_PRINT (yyss, yyssp);
1798 *++yyvsp = yyval;
1801 /* Now `shift' the result of the reduction. Determine what state
1802 that goes to, based on the state we popped back to and the rule
1803 number reduced by. */
1805 yyn = yyr1[yyn];
1807 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1808 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1809 yystate = yytable[yystate];
1810 else
1811 yystate = yydefgoto[yyn - YYNTOKENS];
1813 goto yynewstate;
1816 /*------------------------------------.
1817 | yyerrlab -- here on detecting error |
1818 `------------------------------------*/
1819 yyerrlab:
1820 /* If not already recovering from an error, report this error. */
1821 if (!yyerrstatus)
1823 ++yynerrs;
1824 #if YYERROR_VERBOSE
1825 yyn = yypact[yystate];
1827 if (YYPACT_NINF < yyn && yyn < YYLAST)
1829 YYSIZE_T yysize = 0;
1830 int yytype = YYTRANSLATE (yychar);
1831 char *yymsg;
1832 int yyx, yycount;
1834 yycount = 0;
1835 /* Start YYX at -YYN if negative to avoid negative indexes in
1836 YYCHECK. */
1837 for (yyx = yyn < 0 ? -yyn : 0;
1838 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1839 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1840 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1841 yysize += yystrlen ("syntax error, unexpected ") + 1;
1842 yysize += yystrlen (yytname[yytype]);
1843 yymsg = (char *) YYSTACK_ALLOC (yysize);
1844 if (yymsg != 0)
1846 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1847 yyp = yystpcpy (yyp, yytname[yytype]);
1849 if (yycount < 5)
1851 yycount = 0;
1852 for (yyx = yyn < 0 ? -yyn : 0;
1853 yyx < (int) (sizeof (yytname) / sizeof (char *));
1854 yyx++)
1855 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1857 const char *yyq = ! yycount ? ", expecting " : " or ";
1858 yyp = yystpcpy (yyp, yyq);
1859 yyp = yystpcpy (yyp, yytname[yyx]);
1860 yycount++;
1863 yyerror (yymsg);
1864 YYSTACK_FREE (yymsg);
1866 else
1867 yyerror ("syntax error; also virtual memory exhausted");
1869 else
1870 #endif /* YYERROR_VERBOSE */
1871 yyerror ("syntax error");
1876 if (yyerrstatus == 3)
1878 /* If just tried and failed to reuse lookahead token after an
1879 error, discard it. */
1881 /* Return failure if at end of input. */
1882 if (yychar == YYEOF)
1884 /* Pop the error token. */
1885 YYPOPSTACK;
1886 /* Pop the rest of the stack. */
1887 while (yyss < yyssp)
1889 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1890 yydestruct (yystos[*yyssp], yyvsp);
1891 YYPOPSTACK;
1893 YYABORT;
1896 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1897 yydestruct (yytoken, &yylval);
1898 yychar = YYEMPTY;
1902 /* Else will try to reuse lookahead token after shifting the error
1903 token. */
1904 goto yyerrlab1;
1907 /*----------------------------------------------------.
1908 | yyerrlab1 -- error raised explicitly by an action. |
1909 `----------------------------------------------------*/
1910 yyerrlab1:
1911 yyerrstatus = 3; /* Each real token shifted decrements this. */
1913 for (;;)
1915 yyn = yypact[yystate];
1916 if (yyn != YYPACT_NINF)
1918 yyn += YYTERROR;
1919 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1921 yyn = yytable[yyn];
1922 if (0 < yyn)
1923 break;
1927 /* Pop the current state because it cannot handle the error token. */
1928 if (yyssp == yyss)
1929 YYABORT;
1931 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1932 yydestruct (yystos[yystate], yyvsp);
1933 yyvsp--;
1934 yystate = *--yyssp;
1936 YY_STACK_PRINT (yyss, yyssp);
1939 if (yyn == YYFINAL)
1940 YYACCEPT;
1942 YYDPRINTF ((stderr, "Shifting error token, "));
1944 *++yyvsp = yylval;
1947 yystate = yyn;
1948 goto yynewstate;
1951 /*-------------------------------------.
1952 | yyacceptlab -- YYACCEPT comes here. |
1953 `-------------------------------------*/
1954 yyacceptlab:
1955 yyresult = 0;
1956 goto yyreturn;
1958 /*-----------------------------------.
1959 | yyabortlab -- YYABORT comes here. |
1960 `-----------------------------------*/
1961 yyabortlab:
1962 yyresult = 1;
1963 goto yyreturn;
1965 #ifndef yyoverflow
1966 /*----------------------------------------------.
1967 | yyoverflowlab -- parser overflow comes here. |
1968 `----------------------------------------------*/
1969 yyoverflowlab:
1970 yyerror ("parser stack overflow");
1971 yyresult = 2;
1972 /* Fall through. */
1973 #endif
1975 yyreturn:
1976 #ifndef yyoverflow
1977 if (yyss != yyssa)
1978 YYSTACK_FREE (yyss);
1979 #endif
1980 return yyresult;
1984 #line 395 "ASN1.y"
1989 const char *key_word[]={"::=","OPTIONAL","INTEGER","SIZE","OCTET","STRING"
1990 ,"SEQUENCE","BIT","UNIVERSAL","PRIVATE","OPTIONAL"
1991 ,"DEFAULT","CHOICE","OF","OBJECT","IDENTIFIER"
1992 ,"BOOLEAN","TRUE","FALSE","APPLICATION","ANY","DEFINED"
1993 ,"SET","BY","EXPLICIT","IMPLICIT","DEFINITIONS","TAGS"
1994 ,"BEGIN","END","UTCTime","GeneralizedTime"
1995 ,"GeneralString","FROM","IMPORTS","NULL","ENUMERATED"};
1996 const int key_word_token[]={ASSIG,OPTIONAL,INTEGER,SIZE,OCTET,STRING
1997 ,SEQUENCE,BIT,UNIVERSAL,PRIVATE,OPTIONAL
1998 ,DEFAULT,CHOICE,OF,OBJECT,STR_IDENTIFIER
1999 ,BOOLEAN,TRUE,FALSE,APPLICATION,ANY,DEFINED
2000 ,SET,BY,EXPLICIT,IMPLICIT,DEFINITIONS,TAGS
2001 ,BEGIN,END,UTCTime,GeneralizedTime
2002 ,GeneralString,FROM,IMPORTS,TOKEN_NULL,ENUMERATED};
2004 /*************************************************************/
2005 /* Function: _asn1_yylex */
2006 /* Description: looks for tokens in file_asn1 pointer file. */
2007 /* Return: int */
2008 /* Token identifier or ASCII code or 0(zero: End Of File) */
2009 /*************************************************************/
2010 int
2011 _asn1_yylex()
2013 int c,counter=0,k,lastc;
2014 char string[MAX_NAME_SIZE+1]; /* will contain the next token */
2016 while(1)
2018 while((c=fgetc(file_asn1))==' ' || c=='\t' || c=='\n')
2019 if(c=='\n') lineNumber++;
2021 if(c==EOF){
2022 strcpy(lastToken,"End Of File");
2023 return 0;
2026 if(c=='(' || c==')' || c=='[' || c==']' ||
2027 c=='{' || c=='}' || c==',' || c=='.' ||
2028 c=='+' || c=='|'){
2029 lastToken[0]=c;lastToken[1]=0;
2030 return c;
2032 if(c=='-'){ /* Maybe the first '-' of a comment */
2033 if((c=fgetc(file_asn1))!='-'){
2034 ungetc(c,file_asn1);
2035 lastToken[0]='-';lastToken[1]=0;
2036 return '-';
2038 else{ /* Comments */
2039 lastc=0;
2040 counter=0;
2041 /* A comment finishes at the next double hypen or the end of line */
2042 while((c=fgetc(file_asn1))!=EOF && c!='\n' &&
2043 (lastc!='-' || (lastc=='-' && c!='-')))
2044 lastc=c;
2045 if(c==EOF){
2046 strcpy(lastToken,"End Of File");
2047 return 0;
2049 else{
2050 if(c=='\n') lineNumber++;
2051 continue; /* next char, please! (repeat the search) */
2055 string[counter++]=c;
2056 /* Till the end of the token */
2057 while(!((c=fgetc(file_asn1))==EOF || c==' '|| c=='\t' || c=='\n' ||
2058 c=='(' || c==')' || c=='[' || c==']' ||
2059 c=='{' || c=='}' || c==',' || c=='.'))
2061 if(counter>=MAX_NAME_SIZE){
2062 result_parse=ASN1_NAME_TOO_LONG;
2063 return 0;
2065 string[counter++]=c;
2067 ungetc(c,file_asn1);
2068 string[counter]=0;
2069 strcpy(lastToken,string);
2071 /* Is STRING a number? */
2072 for(k=0;k<counter;k++)
2073 if(!isdigit(string[k])) break;
2074 if(k>=counter)
2076 strcpy(yylval.str,string);
2077 return NUM; /* return the number */
2080 /* Is STRING a keyword? */
2081 for(k=0;k<(sizeof(key_word)/sizeof(char*));k++)
2082 if(!strcmp(string,key_word[k])) return key_word_token[k];
2084 /* STRING is an IDENTIFIER */
2085 strcpy(yylval.str,string);
2086 return IDENTIFIER;
2091 /*************************************************************/
2092 /* Function: _asn1_create_errorDescription */
2093 /* Description: creates a string with the description of the*/
2094 /* error. */
2095 /* Parameters: */
2096 /* error : error to describe. */
2097 /* errorDescription: string that will contain the */
2098 /* description. */
2099 /*************************************************************/
2100 void
2101 _asn1_create_errorDescription(int error,char *errorDescription)
2103 switch(error){
2104 case ASN1_SUCCESS: case ASN1_FILE_NOT_FOUND:
2105 if (errorDescription!=NULL) errorDescription[0]=0;
2106 break;
2107 case ASN1_SYNTAX_ERROR:
2108 if (errorDescription!=NULL) {
2109 strcpy(errorDescription,fileName);
2110 strcat(errorDescription,":");
2111 _asn1_ltostr(lineNumber,errorDescription+strlen(fileName)+1);
2112 strcat(errorDescription,": parse error near '");
2113 strcat(errorDescription,lastToken);
2114 strcat(errorDescription,"'");
2116 break;
2117 case ASN1_NAME_TOO_LONG:
2118 if (errorDescription!=NULL) {
2119 strcpy(errorDescription,fileName);
2120 strcat(errorDescription,":");
2121 _asn1_ltostr(lineNumber,errorDescription+strlen(fileName)+1);
2122 strcat(errorDescription,": name too long (more than ");
2123 _asn1_ltostr(MAX_NAME_SIZE,errorDescription+strlen(errorDescription));
2124 strcat(errorDescription," characters)");
2126 break;
2127 case ASN1_IDENTIFIER_NOT_FOUND:
2128 if (errorDescription!=NULL) {
2129 strcpy(errorDescription,fileName);
2130 strcat(errorDescription,":");
2131 strcat(errorDescription,": identifier '");
2132 strcat(errorDescription,_asn1_identifierMissing);
2133 strcat(errorDescription,"' not found");
2135 break;
2136 default:
2137 if (errorDescription!=NULL) errorDescription[0]=0;
2138 break;
2145 * asn1_parser2tree - function used to start the parse algorithm.
2146 * @file_name: specify the path and the name of file that contains ASN.1 declarations.
2147 * @definitions: return the pointer to the structure created from
2148 * "file_name" ASN.1 declarations.
2149 * @errorDescription : return the error description or an empty string if success.
2150 * Description:
2152 * Creates the structures needed to manage the definitions included in *FILE_NAME file.
2154 * Returns:
2156 * ASN1_SUCCESS\: the file has a correct syntax and every identifier is known.
2158 * ASN1_ELEMENT_NOT_EMPTY\: *POINTER not ASN1_TYPE_EMPTY.
2160 * ASN1_FILE_NOT_FOUND\: an error occured while opening FILE_NAME.
2162 * ASN1_SYNTAX_ERROR\: the syntax is not correct.
2164 * ASN1_IDENTIFIER_NOT_FOUND\: in the file there is an identifier that is not defined.
2165 * ASN1_NAME_TOO_LONG\: in the file there is an identifier whith more than MAX_NAME_SIZE characters.
2167 asn1_retCode
2168 asn1_parser2tree(const char *file_name,ASN1_TYPE *definitions,char *errorDescription){
2170 p_tree=ASN1_TYPE_EMPTY;
2172 if(*definitions != ASN1_TYPE_EMPTY)
2173 return ASN1_ELEMENT_NOT_EMPTY;
2175 *definitions=ASN1_TYPE_EMPTY;
2177 fileName = file_name;
2179 /* open the file to parse */
2180 file_asn1=fopen(file_name,"r");
2182 if(file_asn1==NULL){
2183 result_parse=ASN1_FILE_NOT_FOUND;
2185 else{
2186 result_parse=ASN1_SUCCESS;
2188 lineNumber=1;
2189 yyparse();
2191 fclose(file_asn1);
2193 if(result_parse==ASN1_SUCCESS){ /* syntax OK */
2194 /* set IMPLICIT or EXPLICIT property */
2195 _asn1_set_default_tag(p_tree);
2196 /* set CONST_SET and CONST_NOT_USED */
2197 _asn1_type_set_config(p_tree);
2198 /* check the identifier definitions */
2199 result_parse=_asn1_check_identifier(p_tree);
2200 if(result_parse==ASN1_SUCCESS){ /* all identifier defined */
2201 /* Delete the list and keep the ASN1 structure */
2202 _asn1_delete_list();
2203 /* Convert into DER coding the value assign to INTEGER constants */
2204 _asn1_change_integer_value(p_tree);
2205 /* Expand the IDs of OBJECT IDENTIFIER constants */
2206 _asn1_expand_object_id(p_tree);
2208 *definitions=p_tree;
2210 else /* some identifiers not defined */
2211 /* Delete the list and the ASN1 structure */
2212 _asn1_delete_list_and_nodes();
2214 else /* syntax error */
2215 /* Delete the list and the ASN1 structure */
2216 _asn1_delete_list_and_nodes();
2219 if (errorDescription!=NULL)
2220 _asn1_create_errorDescription(result_parse,errorDescription);
2222 return result_parse;
2227 * asn1_parser2array - function that generates a C structure from an ASN1 file
2228 * @inputFileName: specify the path and the name of file that contains ASN.1 declarations.
2229 * @outputFileName: specify the path and the name of file that will contain the C vector definition.
2230 * @vectorName: specify the name of the C vector.
2231 * @errorDescription : return the error description or an empty string if success.
2232 * Description:
2234 * Creates a file containing a C vector to use to manage the definitions included in
2235 * *INPUTFILENAME file. If *INPUTFILENAME is "/aa/bb/xx.yy" and OUTPUTFILENAME is NULL, the file created is "/aa/bb/xx_asn1_tab.c".
2236 * If VECTORNAME is NULL the vector name will be "xx_asn1_tab".
2238 * Returns:
2240 * ASN1_SUCCESS\: the file has a correct syntax and every identifier is known.
2242 * ASN1_FILE_NOT_FOUND\: an error occured while opening FILE_NAME.
2244 * ASN1_SYNTAX_ERROR\: the syntax is not correct.
2246 * ASN1_IDENTIFIER_NOT_FOUND\: in the file there is an identifier that is not defined.
2247 * ASN1_NAME_TOO_LONG\: in the file there is an identifier whith more than MAX_NAME_SIZE characters.
2249 int asn1_parser2array(const char *inputFileName,const char *outputFileName,
2250 const char *vectorName,char *errorDescription){
2251 char *file_out_name=NULL;
2252 char *vector_name=NULL;
2253 const char *char_p,*slash_p,*dot_p;
2255 p_tree=NULL;
2257 fileName = inputFileName;
2259 /* open the file to parse */
2260 file_asn1=fopen(inputFileName,"r");
2262 if(file_asn1==NULL)
2263 result_parse=ASN1_FILE_NOT_FOUND;
2264 else{
2265 result_parse=ASN1_SUCCESS;
2267 lineNumber=1;
2268 yyparse();
2270 fclose(file_asn1);
2272 if(result_parse==ASN1_SUCCESS){ /* syntax OK */
2273 /* set IMPLICIT or EXPLICIT property */
2274 _asn1_set_default_tag(p_tree);
2275 /* set CONST_SET and CONST_NOT_USED */
2276 _asn1_type_set_config(p_tree);
2277 /* check the identifier definitions */
2278 result_parse=_asn1_check_identifier(p_tree);
2280 if(result_parse==ASN1_SUCCESS){ /* all identifier defined */
2282 /* searching the last '/' and '.' in inputFileName */
2283 char_p=inputFileName;
2284 slash_p=inputFileName;
2285 while((char_p=strchr(char_p,'/'))){
2286 char_p++;
2287 slash_p=char_p;
2290 char_p=slash_p;
2291 dot_p=inputFileName+strlen(inputFileName);
2293 while((char_p=strchr(char_p,'.'))){
2294 dot_p=char_p;
2295 char_p++;
2298 if(outputFileName == NULL){
2299 /* file_out_name = inputFileName + _asn1_tab.c */
2300 file_out_name=(char *)malloc(dot_p-inputFileName+1+
2301 strlen("_asn1_tab.c"));
2302 memcpy(file_out_name,inputFileName,dot_p-inputFileName);
2303 file_out_name[dot_p-inputFileName]=0;
2304 strcat(file_out_name,"_asn1_tab.c");
2306 else{
2307 /* file_out_name = inputFileName */
2308 file_out_name=(char *)malloc(strlen(outputFileName)+1);
2309 strcpy(file_out_name,outputFileName);
2312 if(vectorName == NULL){
2313 /* vector_name = file name + _asn1_tab */
2314 vector_name=(char *)malloc(dot_p-slash_p+1+
2315 strlen("_asn1_tab"));
2316 memcpy(vector_name,slash_p,dot_p-slash_p);
2317 vector_name[dot_p-slash_p]=0;
2318 strcat(vector_name,"_asn1_tab");
2320 else{
2321 /* vector_name = vectorName */
2322 vector_name=(char *)malloc(strlen(vectorName)+1);
2323 strcpy(vector_name,vectorName);
2326 /* Save structure in a file */
2327 _asn1_create_static_structure(p_tree,
2328 file_out_name,vector_name);
2330 free(file_out_name);
2331 free(vector_name);
2332 } /* result == OK */
2333 } /* result == OK */
2335 /* Delete the list and the ASN1 structure */
2336 _asn1_delete_list_and_nodes();
2337 } /* inputFile exist */
2339 if (errorDescription!=NULL)
2340 _asn1_create_errorDescription(result_parse,errorDescription);
2342 return result_parse;
2346 /*************************************************************/
2347 /* Function: _asn1_yyerror */
2348 /* Description: function called when there are syntax errors*/
2349 /* Parameters: */
2350 /* char *s : error description */
2351 /* Return: int */
2352 /* */
2353 /*************************************************************/
2354 int _asn1_yyerror (char *s)
2356 /* Sends the error description to the std_out */
2358 #ifdef LIBTASN1_DEBUG_PARSER
2359 _libtasn1_log("_asn1_yyerror:%s:%d: %s (Last Token:'%s')\n",fileName,
2360 lineNumber,s,lastToken);
2361 #endif
2363 if(result_parse!=ASN1_NAME_TOO_LONG)
2364 result_parse=ASN1_SYNTAX_ERROR;
2366 return 0;