No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / lib / asn1 / parse.c
blobdf913f316d471603a7885b97b2e905b1ecc9946a
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 kw_ABSENT = 258,
70 kw_ABSTRACT_SYNTAX = 259,
71 kw_ALL = 260,
72 kw_APPLICATION = 261,
73 kw_AUTOMATIC = 262,
74 kw_BEGIN = 263,
75 kw_BIT = 264,
76 kw_BMPString = 265,
77 kw_BOOLEAN = 266,
78 kw_BY = 267,
79 kw_CHARACTER = 268,
80 kw_CHOICE = 269,
81 kw_CLASS = 270,
82 kw_COMPONENT = 271,
83 kw_COMPONENTS = 272,
84 kw_CONSTRAINED = 273,
85 kw_CONTAINING = 274,
86 kw_DEFAULT = 275,
87 kw_DEFINITIONS = 276,
88 kw_EMBEDDED = 277,
89 kw_ENCODED = 278,
90 kw_END = 279,
91 kw_ENUMERATED = 280,
92 kw_EXCEPT = 281,
93 kw_EXPLICIT = 282,
94 kw_EXPORTS = 283,
95 kw_EXTENSIBILITY = 284,
96 kw_EXTERNAL = 285,
97 kw_FALSE = 286,
98 kw_FROM = 287,
99 kw_GeneralString = 288,
100 kw_GeneralizedTime = 289,
101 kw_GraphicString = 290,
102 kw_IA5String = 291,
103 kw_IDENTIFIER = 292,
104 kw_IMPLICIT = 293,
105 kw_IMPLIED = 294,
106 kw_IMPORTS = 295,
107 kw_INCLUDES = 296,
108 kw_INSTANCE = 297,
109 kw_INTEGER = 298,
110 kw_INTERSECTION = 299,
111 kw_ISO646String = 300,
112 kw_MAX = 301,
113 kw_MIN = 302,
114 kw_MINUS_INFINITY = 303,
115 kw_NULL = 304,
116 kw_NumericString = 305,
117 kw_OBJECT = 306,
118 kw_OCTET = 307,
119 kw_OF = 308,
120 kw_OPTIONAL = 309,
121 kw_ObjectDescriptor = 310,
122 kw_PATTERN = 311,
123 kw_PDV = 312,
124 kw_PLUS_INFINITY = 313,
125 kw_PRESENT = 314,
126 kw_PRIVATE = 315,
127 kw_PrintableString = 316,
128 kw_REAL = 317,
129 kw_RELATIVE_OID = 318,
130 kw_SEQUENCE = 319,
131 kw_SET = 320,
132 kw_SIZE = 321,
133 kw_STRING = 322,
134 kw_SYNTAX = 323,
135 kw_T61String = 324,
136 kw_TAGS = 325,
137 kw_TRUE = 326,
138 kw_TYPE_IDENTIFIER = 327,
139 kw_TeletexString = 328,
140 kw_UNION = 329,
141 kw_UNIQUE = 330,
142 kw_UNIVERSAL = 331,
143 kw_UTCTime = 332,
144 kw_UTF8String = 333,
145 kw_UniversalString = 334,
146 kw_VideotexString = 335,
147 kw_VisibleString = 336,
148 kw_WITH = 337,
149 RANGE = 338,
150 EEQUAL = 339,
151 ELLIPSIS = 340,
152 IDENTIFIER = 341,
153 referencename = 342,
154 STRING = 343,
155 NUMBER = 344
157 #endif
158 /* Tokens. */
159 #define kw_ABSENT 258
160 #define kw_ABSTRACT_SYNTAX 259
161 #define kw_ALL 260
162 #define kw_APPLICATION 261
163 #define kw_AUTOMATIC 262
164 #define kw_BEGIN 263
165 #define kw_BIT 264
166 #define kw_BMPString 265
167 #define kw_BOOLEAN 266
168 #define kw_BY 267
169 #define kw_CHARACTER 268
170 #define kw_CHOICE 269
171 #define kw_CLASS 270
172 #define kw_COMPONENT 271
173 #define kw_COMPONENTS 272
174 #define kw_CONSTRAINED 273
175 #define kw_CONTAINING 274
176 #define kw_DEFAULT 275
177 #define kw_DEFINITIONS 276
178 #define kw_EMBEDDED 277
179 #define kw_ENCODED 278
180 #define kw_END 279
181 #define kw_ENUMERATED 280
182 #define kw_EXCEPT 281
183 #define kw_EXPLICIT 282
184 #define kw_EXPORTS 283
185 #define kw_EXTENSIBILITY 284
186 #define kw_EXTERNAL 285
187 #define kw_FALSE 286
188 #define kw_FROM 287
189 #define kw_GeneralString 288
190 #define kw_GeneralizedTime 289
191 #define kw_GraphicString 290
192 #define kw_IA5String 291
193 #define kw_IDENTIFIER 292
194 #define kw_IMPLICIT 293
195 #define kw_IMPLIED 294
196 #define kw_IMPORTS 295
197 #define kw_INCLUDES 296
198 #define kw_INSTANCE 297
199 #define kw_INTEGER 298
200 #define kw_INTERSECTION 299
201 #define kw_ISO646String 300
202 #define kw_MAX 301
203 #define kw_MIN 302
204 #define kw_MINUS_INFINITY 303
205 #define kw_NULL 304
206 #define kw_NumericString 305
207 #define kw_OBJECT 306
208 #define kw_OCTET 307
209 #define kw_OF 308
210 #define kw_OPTIONAL 309
211 #define kw_ObjectDescriptor 310
212 #define kw_PATTERN 311
213 #define kw_PDV 312
214 #define kw_PLUS_INFINITY 313
215 #define kw_PRESENT 314
216 #define kw_PRIVATE 315
217 #define kw_PrintableString 316
218 #define kw_REAL 317
219 #define kw_RELATIVE_OID 318
220 #define kw_SEQUENCE 319
221 #define kw_SET 320
222 #define kw_SIZE 321
223 #define kw_STRING 322
224 #define kw_SYNTAX 323
225 #define kw_T61String 324
226 #define kw_TAGS 325
227 #define kw_TRUE 326
228 #define kw_TYPE_IDENTIFIER 327
229 #define kw_TeletexString 328
230 #define kw_UNION 329
231 #define kw_UNIQUE 330
232 #define kw_UNIVERSAL 331
233 #define kw_UTCTime 332
234 #define kw_UTF8String 333
235 #define kw_UniversalString 334
236 #define kw_VideotexString 335
237 #define kw_VisibleString 336
238 #define kw_WITH 337
239 #define RANGE 338
240 #define EEQUAL 339
241 #define ELLIPSIS 340
242 #define IDENTIFIER 341
243 #define referencename 342
244 #define STRING 343
245 #define NUMBER 344
250 /* Copy the first part of user declarations. */
251 #line 36 "parse.y"
253 #ifdef HAVE_CONFIG_H
254 #include <config.h>
255 #endif
256 #include <stdio.h>
257 #include <stdlib.h>
258 #include <string.h>
259 #include "symbol.h"
260 #include "lex.h"
261 #include "gen_locl.h"
262 #include "der.h"
264 __RCSID("$Heimdal: parse.y 21597 2007-07-16 18:48:58Z lha $"
265 "$NetBSD$");
267 static Type *new_type (Typetype t);
268 static struct constraint_spec *new_constraint_spec(enum ctype);
269 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
270 void yyerror (const char *);
271 static struct objid *new_objid(const char *label, int value);
272 static void add_oid_to_tail(struct objid *, struct objid *);
273 static void fix_labels(Symbol *s);
275 struct string_list {
276 char *string;
277 struct string_list *next;
282 /* Enabling traces. */
283 #ifndef YYDEBUG
284 # define YYDEBUG 1
285 #endif
287 /* Enabling verbose error messages. */
288 #ifdef YYERROR_VERBOSE
289 # undef YYERROR_VERBOSE
290 # define YYERROR_VERBOSE 1
291 #else
292 # define YYERROR_VERBOSE 0
293 #endif
295 /* Enabling the token table. */
296 #ifndef YYTOKEN_TABLE
297 # define YYTOKEN_TABLE 0
298 #endif
300 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
301 typedef union YYSTYPE
302 #line 65 "parse.y"
304 int constant;
305 struct value *value;
306 struct range *range;
307 char *name;
308 Type *type;
309 Member *member;
310 struct objid *objid;
311 char *defval;
312 struct string_list *sl;
313 struct tagtype tag;
314 struct memhead *members;
315 struct constraint_spec *constraint_spec;
317 /* Line 193 of yacc.c. */
318 #line 318 "parse.c"
319 YYSTYPE;
320 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
321 # define YYSTYPE_IS_DECLARED 1
322 # define YYSTYPE_IS_TRIVIAL 1
323 #endif
327 /* Copy the second part of user declarations. */
330 /* Line 216 of yacc.c. */
331 #line 331 "parse.c"
333 #ifdef short
334 # undef short
335 #endif
337 #ifdef YYTYPE_UINT8
338 typedef YYTYPE_UINT8 yytype_uint8;
339 #else
340 typedef unsigned char yytype_uint8;
341 #endif
343 #ifdef YYTYPE_INT8
344 typedef YYTYPE_INT8 yytype_int8;
345 #elif (defined __STDC__ || defined __C99__FUNC__ \
346 || defined __cplusplus || defined _MSC_VER)
347 typedef signed char yytype_int8;
348 #else
349 typedef short int yytype_int8;
350 #endif
352 #ifdef YYTYPE_UINT16
353 typedef YYTYPE_UINT16 yytype_uint16;
354 #else
355 typedef unsigned short int yytype_uint16;
356 #endif
358 #ifdef YYTYPE_INT16
359 typedef YYTYPE_INT16 yytype_int16;
360 #else
361 typedef short int yytype_int16;
362 #endif
364 #ifndef YYSIZE_T
365 # ifdef __SIZE_TYPE__
366 # define YYSIZE_T __SIZE_TYPE__
367 # elif defined size_t
368 # define YYSIZE_T size_t
369 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
370 || defined __cplusplus || defined _MSC_VER)
371 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
372 # define YYSIZE_T size_t
373 # else
374 # define YYSIZE_T unsigned int
375 # endif
376 #endif
378 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
380 #ifndef YY_
381 # if defined YYENABLE_NLS && YYENABLE_NLS
382 # if ENABLE_NLS
383 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
384 # define YY_(msgid) dgettext ("bison-runtime", msgid)
385 # endif
386 # endif
387 # ifndef YY_
388 # define YY_(msgid) msgid
389 # endif
390 #endif
392 /* Suppress unused-variable warnings by "using" E. */
393 #if ! defined lint || defined __GNUC__
394 # define YYUSE(e) ((void) (e))
395 #else
396 # define YYUSE(e) /* empty */
397 #endif
399 /* Identity function, used to suppress warnings about constant conditions. */
400 #ifndef lint
401 # define YYID(n) (n)
402 #else
403 #if (defined __STDC__ || defined __C99__FUNC__ \
404 || defined __cplusplus || defined _MSC_VER)
405 static int
406 YYID (int i)
407 #else
408 static int
409 YYID (i)
410 int i;
411 #endif
413 return i;
415 #endif
417 #if ! defined yyoverflow || YYERROR_VERBOSE
419 /* The parser invokes alloca or malloc; define the necessary symbols. */
421 # ifdef YYSTACK_USE_ALLOCA
422 # if YYSTACK_USE_ALLOCA
423 # ifdef __GNUC__
424 # define YYSTACK_ALLOC __builtin_alloca
425 # elif defined __BUILTIN_VA_ARG_INCR
426 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
427 # elif defined _AIX
428 # define YYSTACK_ALLOC __alloca
429 # elif defined _MSC_VER
430 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
431 # define alloca _alloca
432 # else
433 # define YYSTACK_ALLOC alloca
434 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
435 || defined __cplusplus || defined _MSC_VER)
436 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
437 # ifndef _STDLIB_H
438 # define _STDLIB_H 1
439 # endif
440 # endif
441 # endif
442 # endif
443 # endif
445 # ifdef YYSTACK_ALLOC
446 /* Pacify GCC's `empty if-body' warning. */
447 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
448 # ifndef YYSTACK_ALLOC_MAXIMUM
449 /* The OS might guarantee only one guard page at the bottom of the stack,
450 and a page size can be as small as 4096 bytes. So we cannot safely
451 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
452 to allow for a few compiler-allocated temporary stack slots. */
453 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
454 # endif
455 # else
456 # define YYSTACK_ALLOC YYMALLOC
457 # define YYSTACK_FREE YYFREE
458 # ifndef YYSTACK_ALLOC_MAXIMUM
459 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
460 # endif
461 # if (defined __cplusplus && ! defined _STDLIB_H \
462 && ! ((defined YYMALLOC || defined malloc) \
463 && (defined YYFREE || defined free)))
464 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
465 # ifndef _STDLIB_H
466 # define _STDLIB_H 1
467 # endif
468 # endif
469 # ifndef YYMALLOC
470 # define YYMALLOC malloc
471 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
472 || defined __cplusplus || defined _MSC_VER)
473 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
474 # endif
475 # endif
476 # ifndef YYFREE
477 # define YYFREE free
478 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
479 || defined __cplusplus || defined _MSC_VER)
480 void free (void *); /* INFRINGES ON USER NAME SPACE */
481 # endif
482 # endif
483 # endif
484 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
487 #if (! defined yyoverflow \
488 && (! defined __cplusplus \
489 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
491 /* A type that is properly aligned for any stack member. */
492 union yyalloc
494 yytype_int16 yyss;
495 YYSTYPE yyvs;
498 /* The size of the maximum gap between one aligned stack and the next. */
499 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
501 /* The size of an array large to enough to hold all stacks, each with
502 N elements. */
503 # define YYSTACK_BYTES(N) \
504 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
505 + YYSTACK_GAP_MAXIMUM)
507 /* Copy COUNT objects from FROM to TO. The source and destination do
508 not overlap. */
509 # ifndef YYCOPY
510 # if defined __GNUC__ && 1 < __GNUC__
511 # define YYCOPY(To, From, Count) \
512 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
513 # else
514 # define YYCOPY(To, From, Count) \
515 do \
517 YYSIZE_T yyi; \
518 for (yyi = 0; yyi < (Count); yyi++) \
519 (To)[yyi] = (From)[yyi]; \
521 while (YYID (0))
522 # endif
523 # endif
525 /* Relocate STACK from its old location to the new one. The
526 local variables YYSIZE and YYSTACKSIZE give the old and new number of
527 elements in the stack, and YYPTR gives the new location of the
528 stack. Advance YYPTR to a properly aligned location for the next
529 stack. */
530 # define YYSTACK_RELOCATE(Stack) \
531 do \
533 YYSIZE_T yynewbytes; \
534 YYCOPY (&yyptr->Stack, Stack, yysize); \
535 Stack = &yyptr->Stack; \
536 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
537 yyptr += yynewbytes / sizeof (*yyptr); \
539 while (YYID (0))
541 #endif
543 /* YYFINAL -- State number of the termination state. */
544 #define YYFINAL 6
545 /* YYLAST -- Last index in YYTABLE. */
546 #define YYLAST 195
548 /* YYNTOKENS -- Number of terminals. */
549 #define YYNTOKENS 98
550 /* YYNNTS -- Number of nonterminals. */
551 #define YYNNTS 68
552 /* YYNRULES -- Number of rules. */
553 #define YYNRULES 136
554 /* YYNRULES -- Number of states. */
555 #define YYNSTATES 214
557 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
558 #define YYUNDEFTOK 2
559 #define YYMAXUTOK 344
561 #define YYTRANSLATE(YYX) \
562 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
564 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
565 static const yytype_uint8 yytranslate[] =
567 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 92, 93, 2, 2, 91, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 90,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 96, 2, 97, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 94, 2, 95, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
593 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
594 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
595 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
596 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
597 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
598 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
599 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
600 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
601 85, 86, 87, 88, 89
604 #if YYDEBUG
605 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
606 YYRHS. */
607 static const yytype_uint16 yyprhs[] =
609 0, 0, 3, 13, 16, 19, 22, 23, 26, 27,
610 30, 31, 35, 36, 38, 39, 41, 44, 49, 51,
611 54, 56, 58, 62, 64, 68, 70, 72, 74, 76,
612 78, 80, 82, 84, 86, 88, 90, 92, 94, 96,
613 98, 100, 102, 104, 110, 116, 122, 126, 128, 131,
614 136, 138, 142, 146, 151, 156, 158, 161, 167, 170,
615 174, 176, 177, 180, 185, 189, 194, 199, 203, 207,
616 212, 214, 216, 218, 220, 222, 225, 229, 231, 233,
617 235, 238, 242, 248, 253, 257, 262, 263, 265, 267,
618 269, 270, 272, 274, 279, 281, 283, 285, 287, 289,
619 291, 293, 295, 297, 301, 305, 308, 310, 313, 317,
620 319, 323, 328, 330, 331, 335, 336, 339, 344, 346,
621 348, 350, 352, 354, 356, 358, 360, 362, 364, 366,
622 368, 370, 372, 374, 376, 378, 380
625 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
626 static const yytype_int16 yyrhs[] =
628 99, 0, -1, 86, 151, 21, 100, 101, 84, 8,
629 102, 24, -1, 27, 70, -1, 38, 70, -1, 7,
630 70, -1, -1, 29, 39, -1, -1, 103, 107, -1,
631 -1, 40, 104, 90, -1, -1, 105, -1, -1, 106,
632 -1, 105, 106, -1, 109, 32, 86, 151, -1, 108,
633 -1, 108, 107, -1, 110, -1, 143, -1, 86, 91,
634 109, -1, 86, -1, 86, 84, 111, -1, 112, -1,
635 130, -1, 133, -1, 120, -1, 113, -1, 144, -1,
636 129, -1, 118, -1, 115, -1, 123, -1, 121, -1,
637 122, -1, 125, -1, 126, -1, 127, -1, 128, -1,
638 139, -1, 11, -1, 92, 155, 83, 155, 93, -1,
639 92, 155, 83, 46, 93, -1, 92, 47, 83, 155,
640 93, -1, 92, 155, 93, -1, 43, -1, 43, 114,
641 -1, 43, 94, 116, 95, -1, 117, -1, 116, 91,
642 117, -1, 116, 91, 85, -1, 86, 92, 163, 93,
643 -1, 25, 94, 119, 95, -1, 116, -1, 9, 67,
644 -1, 9, 67, 94, 149, 95, -1, 51, 37, -1,
645 52, 67, 124, -1, 49, -1, -1, 66, 114, -1,
646 64, 94, 146, 95, -1, 64, 94, 95, -1, 64,
647 124, 53, 111, -1, 65, 94, 146, 95, -1, 65,
648 94, 95, -1, 65, 53, 111, -1, 14, 94, 146,
649 95, -1, 131, -1, 132, -1, 86, -1, 34, -1,
650 77, -1, 111, 134, -1, 92, 135, 93, -1, 136,
651 -1, 137, -1, 138, -1, 19, 111, -1, 23, 12,
652 155, -1, 19, 111, 23, 12, 155, -1, 18, 12,
653 94, 95, -1, 140, 142, 111, -1, 96, 141, 89,
654 97, -1, -1, 76, -1, 6, -1, 60, -1, -1,
655 27, -1, 38, -1, 86, 111, 84, 155, -1, 145,
656 -1, 33, -1, 78, -1, 61, -1, 81, -1, 36,
657 -1, 10, -1, 79, -1, 148, -1, 146, 91, 148,
658 -1, 146, 91, 85, -1, 86, 111, -1, 147, -1,
659 147, 54, -1, 147, 20, 155, -1, 150, -1, 149,
660 91, 150, -1, 86, 92, 89, 93, -1, 152, -1,
661 -1, 94, 153, 95, -1, -1, 154, 153, -1, 86,
662 92, 89, 93, -1, 86, -1, 89, -1, 156, -1,
663 157, -1, 161, -1, 160, -1, 162, -1, 165, -1,
664 164, -1, 158, -1, 159, -1, 86, -1, 88, -1,
665 71, -1, 31, -1, 163, -1, 89, -1, 49, -1,
666 152, -1
669 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
670 static const yytype_uint16 yyrline[] =
672 0, 233, 233, 240, 241, 243, 245, 248, 250, 253,
673 254, 257, 258, 261, 262, 265, 266, 269, 280, 281,
674 284, 285, 288, 294, 302, 312, 313, 314, 317, 318,
675 319, 320, 321, 322, 323, 324, 325, 326, 327, 328,
676 329, 330, 333, 340, 350, 358, 366, 377, 382, 388,
677 396, 402, 407, 411, 424, 432, 435, 442, 450, 456,
678 465, 473, 474, 479, 485, 493, 502, 508, 516, 524,
679 531, 532, 535, 546, 551, 558, 574, 580, 583, 584,
680 587, 593, 601, 611, 617, 630, 639, 642, 646, 650,
681 657, 660, 664, 671, 682, 685, 690, 695, 700, 705,
682 710, 715, 723, 729, 734, 745, 756, 762, 768, 776,
683 782, 789, 802, 803, 806, 813, 816, 827, 831, 842,
684 848, 849, 852, 853, 854, 855, 856, 859, 862, 865,
685 876, 884, 890, 898, 906, 909, 914
687 #endif
689 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
690 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
691 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
692 static const char *const yytname[] =
694 "$end", "error", "$undefined", "kw_ABSENT", "kw_ABSTRACT_SYNTAX",
695 "kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC", "kw_BEGIN", "kw_BIT",
696 "kw_BMPString", "kw_BOOLEAN", "kw_BY", "kw_CHARACTER", "kw_CHOICE",
697 "kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS", "kw_CONSTRAINED",
698 "kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS", "kw_EMBEDDED",
699 "kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT", "kw_EXPLICIT",
700 "kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL", "kw_FALSE", "kw_FROM",
701 "kw_GeneralString", "kw_GeneralizedTime", "kw_GraphicString",
702 "kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT", "kw_IMPLIED",
703 "kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",
704 "kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",
705 "kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",
706 "kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",
707 "kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",
708 "kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",
709 "kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",
710 "kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",
711 "kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",
712 "kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",
713 "RANGE", "EEQUAL", "ELLIPSIS", "IDENTIFIER", "referencename", "STRING",
714 "NUMBER", "';'", "','", "'('", "')'", "'{'", "'}'", "'['", "']'",
715 "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",
716 "ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList",
717 "SymbolsFromModule", "AssignmentList", "Assignment", "referencenames",
718 "TypeAssignment", "Type", "BuiltinType", "BooleanType", "range",
719 "IntegerType", "NamedNumberList", "NamedNumber", "EnumeratedType",
720 "Enumerations", "BitStringType", "ObjectIdentifierType",
721 "OctetStringType", "NullType", "size", "SequenceType", "SequenceOfType",
722 "SetType", "SetOfType", "ChoiceType", "ReferencedType", "DefinedType",
723 "UsefulType", "ConstrainedType", "Constraint", "ConstraintSpec",
724 "GeneralConstraint", "ContentsConstraint", "UserDefinedConstraint",
725 "TaggedType", "Tag", "Class", "tagenv", "ValueAssignment",
726 "CharacterStringType", "RestrictedCharactedStringType",
727 "ComponentTypeList", "NamedType", "ComponentType", "NamedBitList",
728 "NamedBit", "objid_opt", "objid", "objid_list", "objid_element", "Value",
729 "BuiltinValue", "ReferencedValue", "DefinedValue", "Valuereference",
730 "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",
731 "NullValue", "ObjectIdentifierValue", 0
733 #endif
735 # ifdef YYPRINT
736 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
737 token YYLEX-NUM. */
738 static const yytype_uint16 yytoknum[] =
740 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
741 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
742 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
743 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
744 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
745 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
746 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
747 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
748 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
749 59, 44, 40, 41, 123, 125, 91, 93
751 # endif
753 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
754 static const yytype_uint8 yyr1[] =
756 0, 98, 99, 100, 100, 100, 100, 101, 101, 102,
757 102, 103, 103, 104, 104, 105, 105, 106, 107, 107,
758 108, 108, 109, 109, 110, 111, 111, 111, 112, 112,
759 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
760 112, 112, 113, 114, 114, 114, 114, 115, 115, 115,
761 116, 116, 116, 117, 118, 119, 120, 120, 121, 122,
762 123, 124, 124, 125, 125, 126, 127, 127, 128, 129,
763 130, 130, 131, 132, 132, 133, 134, 135, 136, 136,
764 137, 137, 137, 138, 139, 140, 141, 141, 141, 141,
765 142, 142, 142, 143, 144, 145, 145, 145, 145, 145,
766 145, 145, 146, 146, 146, 147, 148, 148, 148, 149,
767 149, 150, 151, 151, 152, 153, 153, 154, 154, 154,
768 155, 155, 156, 156, 156, 156, 156, 157, 158, 159,
769 160, 161, 161, 162, 163, 164, 165
772 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
773 static const yytype_uint8 yyr2[] =
775 0, 2, 9, 2, 2, 2, 0, 2, 0, 2,
776 0, 3, 0, 1, 0, 1, 2, 4, 1, 2,
777 1, 1, 3, 1, 3, 1, 1, 1, 1, 1,
778 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
779 1, 1, 1, 5, 5, 5, 3, 1, 2, 4,
780 1, 3, 3, 4, 4, 1, 2, 5, 2, 3,
781 1, 0, 2, 4, 3, 4, 4, 3, 3, 4,
782 1, 1, 1, 1, 1, 2, 3, 1, 1, 1,
783 2, 3, 5, 4, 3, 4, 0, 1, 1, 1,
784 0, 1, 1, 4, 1, 1, 1, 1, 1, 1,
785 1, 1, 1, 3, 3, 2, 1, 2, 3, 1,
786 3, 4, 1, 0, 3, 0, 2, 4, 1, 1,
787 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
788 1, 1, 1, 1, 1, 1, 1
791 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
792 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
793 means the default is an error. */
794 static const yytype_uint8 yydefact[] =
796 0, 113, 0, 115, 0, 112, 1, 118, 119, 0,
797 115, 6, 0, 114, 116, 0, 0, 0, 8, 0,
798 5, 3, 4, 0, 0, 117, 7, 0, 10, 14,
799 0, 0, 23, 0, 13, 15, 0, 2, 0, 9,
800 18, 20, 21, 0, 11, 16, 0, 0, 100, 42,
801 0, 0, 95, 73, 99, 47, 60, 0, 0, 97,
802 61, 0, 74, 96, 101, 98, 0, 72, 86, 0,
803 25, 29, 33, 32, 28, 35, 36, 34, 37, 38,
804 39, 40, 31, 26, 70, 71, 27, 41, 90, 30,
805 94, 19, 22, 113, 56, 0, 0, 0, 0, 48,
806 58, 61, 0, 0, 0, 0, 0, 24, 88, 89,
807 87, 0, 0, 0, 75, 91, 92, 0, 17, 0,
808 0, 0, 106, 102, 0, 55, 50, 0, 132, 0,
809 135, 131, 129, 130, 134, 136, 0, 120, 121, 127,
810 128, 123, 122, 124, 133, 126, 125, 0, 59, 62,
811 64, 0, 0, 68, 67, 0, 0, 93, 0, 0,
812 0, 0, 77, 78, 79, 84, 0, 0, 109, 105,
813 0, 69, 0, 107, 0, 0, 54, 0, 0, 46,
814 49, 63, 65, 66, 85, 0, 80, 0, 76, 0,
815 0, 57, 104, 103, 108, 0, 52, 51, 0, 0,
816 0, 0, 0, 81, 0, 110, 53, 45, 44, 43,
817 83, 0, 111, 82
820 /* YYDEFGOTO[NTERM-NUM]. */
821 static const yytype_int16 yydefgoto[] =
823 -1, 2, 18, 24, 30, 31, 33, 34, 35, 39,
824 40, 36, 41, 69, 70, 71, 99, 72, 125, 126,
825 73, 127, 74, 75, 76, 77, 104, 78, 79, 80,
826 81, 82, 83, 84, 85, 86, 114, 161, 162, 163,
827 164, 87, 88, 111, 117, 42, 89, 90, 121, 122,
828 123, 167, 168, 4, 135, 9, 10, 136, 137, 138,
829 139, 140, 141, 142, 143, 144, 145, 146
832 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
833 STATE-NUM. */
834 #define YYPACT_NINF -113
835 static const yytype_int16 yypact[] =
837 -74, -67, 38, -69, 23, -113, -113, -44, -113, -41,
838 -69, 4, -26, -113, -113, -3, 1, 10, 52, -10,
839 -113, -113, -113, 45, 13, -113, -113, 77, -35, 15,
840 64, 19, 17, 20, 15, -113, 85, -113, 25, -113,
841 19, -113, -113, 15, -113, -113, 27, 47, -113, -113,
842 26, 29, -113, -113, -113, -30, -113, 89, 61, -113,
843 -57, -47, -113, -113, -113, -113, 82, -113, -4, -68,
844 -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
845 -113, -113, -113, -113, -113, -113, -113, -113, -17, -113,
846 -113, -113, -113, -67, 35, 33, 46, 51, 46, -113,
847 -113, 69, 44, -73, 88, 82, -72, 56, -113, -113,
848 -113, 49, 93, 7, -113, -113, -113, 82, -113, 58,
849 82, -76, -13, -113, 57, 59, -113, 60, -113, 68,
850 -113, -113, -113, -113, -113, -113, -75, -113, -113, -113,
851 -113, -113, -113, -113, -113, -113, -113, -63, -113, -113,
852 -113, -62, 82, 56, -113, -46, 65, -113, 141, 82,
853 142, 63, -113, -113, -113, 56, 66, -38, -113, 56,
854 -16, -113, 93, -113, 76, -7, -113, 93, 81, -113,
855 -113, -113, 56, -113, -113, 72, -19, 93, -113, 83,
856 58, -113, -113, -113, -113, 78, -113, -113, 80, 84,
857 87, 62, 162, -113, 90, -113, -113, -113, -113, -113,
858 -113, 93, -113, -113
861 /* YYPGOTO[NTERM-NUM]. */
862 static const yytype_int16 yypgoto[] =
864 -113, -113, -113, -113, -113, -113, -113, -113, 150, 136,
865 -113, 143, -113, -65, -113, -113, 86, -113, 91, 16,
866 -113, -113, -113, -113, -113, -113, 92, -113, -113, -113,
867 -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
868 -113, -113, -113, -113, -113, -113, -113, -113, -60, -113,
869 22, -113, -5, 97, 2, 184, -113, -112, -113, -113,
870 -113, -113, -113, -113, -113, 21, -113, -113
873 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
874 positive, shift that token. If negative, reduce the rule which
875 number is the opposite. If zero, do what YYDEFACT says.
876 If YYTABLE_NINF, syntax error. */
877 #define YYTABLE_NINF -13
878 static const yytype_int16 yytable[] =
880 157, 107, 108, 5, 202, 29, 105, 172, 178, 102,
881 115, 15, 1, 120, 120, 170, 112, 7, 179, 171,
882 8, 116, 150, 154, 113, 158, 159, 3, 175, 170,
883 160, 16, 180, 181, 47, 48, 49, 103, 6, 50,
884 153, 173, 17, 151, 11, 170, 155, 106, 12, 183,
885 51, -12, 165, 190, 13, 169, 109, 191, 52, 53,
886 194, 54, 97, 19, 98, 198, 200, 20, 55, 192,
887 120, 21, 110, 113, 56, 203, 57, 58, 196, 124,
888 22, 23, 128, 25, 26, 28, 59, 182, 37, 60,
889 61, 47, 48, 49, 186, 5, 50, 27, 129, 213,
890 130, 32, 62, 63, 64, 38, 65, 51, 43, 66,
891 44, 67, 128, 93, 94, 52, 53, 46, 54, 120,
892 95, 68, 131, 96, 128, 55, 100, 199, 101, 119,
893 130, 56, 124, 57, 58, 102, 97, 132, 156, 133,
894 134, 152, 130, 59, 166, 3, 60, 61, 113, 174,
895 175, 177, 131, 185, 187, 176, 188, 210, 189, 62,
896 63, 64, 184, 65, 131, 134, 201, 132, 67, 133,
897 134, 206, 204, 207, 211, 3, 91, 208, 68, 132,
898 209, 133, 134, 212, 45, 205, 92, 3, 149, 147,
899 118, 197, 193, 148, 14, 195
902 static const yytype_uint8 yycheck[] =
904 112, 66, 6, 1, 23, 40, 53, 20, 83, 66,
905 27, 7, 86, 86, 86, 91, 84, 86, 93, 95,
906 89, 38, 95, 95, 92, 18, 19, 94, 91, 91,
907 23, 27, 95, 95, 9, 10, 11, 94, 0, 14,
908 105, 54, 38, 103, 21, 91, 106, 94, 92, 95,
909 25, 86, 117, 91, 95, 120, 60, 95, 33, 34,
910 172, 36, 92, 89, 94, 177, 178, 70, 43, 85,
911 86, 70, 76, 92, 49, 187, 51, 52, 85, 86,
912 70, 29, 31, 93, 39, 8, 61, 152, 24, 64,
913 65, 9, 10, 11, 159, 93, 14, 84, 47, 211,
914 49, 86, 77, 78, 79, 86, 81, 25, 91, 84,
915 90, 86, 31, 86, 67, 33, 34, 32, 36, 86,
916 94, 96, 71, 94, 31, 43, 37, 46, 67, 94,
917 49, 49, 86, 51, 52, 66, 92, 86, 89, 88,
918 89, 53, 49, 61, 86, 94, 64, 65, 92, 92,
919 91, 83, 71, 12, 12, 95, 93, 95, 92, 77,
920 78, 79, 97, 81, 71, 89, 94, 86, 86, 88,
921 89, 93, 89, 93, 12, 94, 40, 93, 96, 86,
922 93, 88, 89, 93, 34, 190, 43, 94, 102, 98,
923 93, 175, 170, 101, 10, 174
926 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
927 symbol of state STATE-NUM. */
928 static const yytype_uint8 yystos[] =
930 0, 86, 99, 94, 151, 152, 0, 86, 89, 153,
931 154, 21, 92, 95, 153, 7, 27, 38, 100, 89,
932 70, 70, 70, 29, 101, 93, 39, 84, 8, 40,
933 102, 103, 86, 104, 105, 106, 109, 24, 86, 107,
934 108, 110, 143, 91, 90, 106, 32, 9, 10, 11,
935 14, 25, 33, 34, 36, 43, 49, 51, 52, 61,
936 64, 65, 77, 78, 79, 81, 84, 86, 96, 111,
937 112, 113, 115, 118, 120, 121, 122, 123, 125, 126,
938 127, 128, 129, 130, 131, 132, 133, 139, 140, 144,
939 145, 107, 109, 86, 67, 94, 94, 92, 94, 114,
940 37, 67, 66, 94, 124, 53, 94, 111, 6, 60,
941 76, 141, 84, 92, 134, 27, 38, 142, 151, 94,
942 86, 146, 147, 148, 86, 116, 117, 119, 31, 47,
943 49, 71, 86, 88, 89, 152, 155, 156, 157, 158,
944 159, 160, 161, 162, 163, 164, 165, 116, 124, 114,
945 95, 146, 53, 111, 95, 146, 89, 155, 18, 19,
946 23, 135, 136, 137, 138, 111, 86, 149, 150, 111,
947 91, 95, 20, 54, 92, 91, 95, 83, 83, 93,
948 95, 95, 111, 95, 97, 12, 111, 12, 93, 92,
949 91, 95, 85, 148, 155, 163, 85, 117, 155, 46,
950 155, 94, 23, 155, 89, 150, 93, 93, 93, 93,
951 95, 12, 93, 155
954 #define yyerrok (yyerrstatus = 0)
955 #define yyclearin (yychar = YYEMPTY)
956 #define YYEMPTY (-2)
957 #define YYEOF 0
959 #define YYACCEPT goto yyacceptlab
960 #define YYABORT goto yyabortlab
961 #define YYERROR goto yyerrorlab
964 /* Like YYERROR except do call yyerror. This remains here temporarily
965 to ease the transition to the new meaning of YYERROR, for GCC.
966 Once GCC version 2 has supplanted version 1, this can go. */
968 #define YYFAIL goto yyerrlab
970 #define YYRECOVERING() (!!yyerrstatus)
972 #define YYBACKUP(Token, Value) \
973 do \
974 if (yychar == YYEMPTY && yylen == 1) \
976 yychar = (Token); \
977 yylval = (Value); \
978 yytoken = YYTRANSLATE (yychar); \
979 YYPOPSTACK (1); \
980 goto yybackup; \
982 else \
984 yyerror (YY_("syntax error: cannot back up")); \
985 YYERROR; \
987 while (YYID (0))
990 #define YYTERROR 1
991 #define YYERRCODE 256
994 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
995 If N is 0, then set CURRENT to the empty location which ends
996 the previous symbol: RHS[0] (always defined). */
998 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
999 #ifndef YYLLOC_DEFAULT
1000 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1001 do \
1002 if (YYID (N)) \
1004 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1005 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1006 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1007 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1009 else \
1011 (Current).first_line = (Current).last_line = \
1012 YYRHSLOC (Rhs, 0).last_line; \
1013 (Current).first_column = (Current).last_column = \
1014 YYRHSLOC (Rhs, 0).last_column; \
1016 while (YYID (0))
1017 #endif
1020 /* YY_LOCATION_PRINT -- Print the location on the stream.
1021 This macro was not mandated originally: define only if we know
1022 we won't break user code: when these are the locations we know. */
1024 #ifndef YY_LOCATION_PRINT
1025 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1026 # define YY_LOCATION_PRINT(File, Loc) \
1027 fprintf (File, "%d.%d-%d.%d", \
1028 (Loc).first_line, (Loc).first_column, \
1029 (Loc).last_line, (Loc).last_column)
1030 # else
1031 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1032 # endif
1033 #endif
1036 /* YYLEX -- calling `yylex' with the right arguments. */
1038 #ifdef YYLEX_PARAM
1039 # define YYLEX yylex (YYLEX_PARAM)
1040 #else
1041 # define YYLEX yylex ()
1042 #endif
1044 /* Enable debugging if requested. */
1045 #if YYDEBUG
1047 # ifndef YYFPRINTF
1048 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1049 # define YYFPRINTF fprintf
1050 # endif
1052 # define YYDPRINTF(Args) \
1053 do { \
1054 if (yydebug) \
1055 YYFPRINTF Args; \
1056 } while (YYID (0))
1058 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1059 do { \
1060 if (yydebug) \
1062 YYFPRINTF (stderr, "%s ", Title); \
1063 yy_symbol_print (stderr, \
1064 Type, Value); \
1065 YYFPRINTF (stderr, "\n"); \
1067 } while (YYID (0))
1070 /*--------------------------------.
1071 | Print this symbol on YYOUTPUT. |
1072 `--------------------------------*/
1074 /*ARGSUSED*/
1075 #if (defined __STDC__ || defined __C99__FUNC__ \
1076 || defined __cplusplus || defined _MSC_VER)
1077 static void
1078 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1079 #else
1080 static void
1081 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1082 FILE *yyoutput;
1083 int yytype;
1084 YYSTYPE const * const yyvaluep;
1085 #endif
1087 if (!yyvaluep)
1088 return;
1089 # ifdef YYPRINT
1090 if (yytype < YYNTOKENS)
1091 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1092 # else
1093 YYUSE (yyoutput);
1094 # endif
1095 switch (yytype)
1097 default:
1098 break;
1103 /*--------------------------------.
1104 | Print this symbol on YYOUTPUT. |
1105 `--------------------------------*/
1107 #if (defined __STDC__ || defined __C99__FUNC__ \
1108 || defined __cplusplus || defined _MSC_VER)
1109 static void
1110 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1111 #else
1112 static void
1113 yy_symbol_print (yyoutput, yytype, yyvaluep)
1114 FILE *yyoutput;
1115 int yytype;
1116 YYSTYPE const * const yyvaluep;
1117 #endif
1119 if (yytype < YYNTOKENS)
1120 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1121 else
1122 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1124 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1125 YYFPRINTF (yyoutput, ")");
1128 /*------------------------------------------------------------------.
1129 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1130 | TOP (included). |
1131 `------------------------------------------------------------------*/
1133 #if (defined __STDC__ || defined __C99__FUNC__ \
1134 || defined __cplusplus || defined _MSC_VER)
1135 static void
1136 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1137 #else
1138 static void
1139 yy_stack_print (bottom, top)
1140 yytype_int16 *bottom;
1141 yytype_int16 *top;
1142 #endif
1144 YYFPRINTF (stderr, "Stack now");
1145 for (; bottom <= top; ++bottom)
1146 YYFPRINTF (stderr, " %d", *bottom);
1147 YYFPRINTF (stderr, "\n");
1150 # define YY_STACK_PRINT(Bottom, Top) \
1151 do { \
1152 if (yydebug) \
1153 yy_stack_print ((Bottom), (Top)); \
1154 } while (YYID (0))
1157 /*------------------------------------------------.
1158 | Report that the YYRULE is going to be reduced. |
1159 `------------------------------------------------*/
1161 #if (defined __STDC__ || defined __C99__FUNC__ \
1162 || defined __cplusplus || defined _MSC_VER)
1163 static void
1164 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1165 #else
1166 static void
1167 yy_reduce_print (yyvsp, yyrule)
1168 YYSTYPE *yyvsp;
1169 int yyrule;
1170 #endif
1172 int yynrhs = yyr2[yyrule];
1173 int yyi;
1174 unsigned long int yylno = yyrline[yyrule];
1175 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1176 yyrule - 1, yylno);
1177 /* The symbols being reduced. */
1178 for (yyi = 0; yyi < yynrhs; yyi++)
1180 fprintf (stderr, " $%d = ", yyi + 1);
1181 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1182 &(yyvsp[(yyi + 1) - (yynrhs)])
1184 fprintf (stderr, "\n");
1188 # define YY_REDUCE_PRINT(Rule) \
1189 do { \
1190 if (yydebug) \
1191 yy_reduce_print (yyvsp, Rule); \
1192 } while (YYID (0))
1194 /* Nonzero means print parse trace. It is left uninitialized so that
1195 multiple parsers can coexist. */
1196 int yydebug;
1197 #else /* !YYDEBUG */
1198 # define YYDPRINTF(Args)
1199 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1200 # define YY_STACK_PRINT(Bottom, Top)
1201 # define YY_REDUCE_PRINT(Rule)
1202 #endif /* !YYDEBUG */
1205 /* YYINITDEPTH -- initial size of the parser's stacks. */
1206 #ifndef YYINITDEPTH
1207 # define YYINITDEPTH 200
1208 #endif
1210 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1211 if the built-in stack extension method is used).
1213 Do not make this value too large; the results are undefined if
1214 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1215 evaluated with infinite-precision integer arithmetic. */
1217 #ifndef YYMAXDEPTH
1218 # define YYMAXDEPTH 10000
1219 #endif
1223 #if YYERROR_VERBOSE
1225 # ifndef yystrlen
1226 # if defined __GLIBC__ && defined _STRING_H
1227 # define yystrlen strlen
1228 # else
1229 /* Return the length of YYSTR. */
1230 #if (defined __STDC__ || defined __C99__FUNC__ \
1231 || defined __cplusplus || defined _MSC_VER)
1232 static YYSIZE_T
1233 yystrlen (const char *yystr)
1234 #else
1235 static YYSIZE_T
1236 yystrlen (yystr)
1237 const char *yystr;
1238 #endif
1240 YYSIZE_T yylen;
1241 for (yylen = 0; yystr[yylen]; yylen++)
1242 continue;
1243 return yylen;
1245 # endif
1246 # endif
1248 # ifndef yystpcpy
1249 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1250 # define yystpcpy stpcpy
1251 # else
1252 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1253 YYDEST. */
1254 #if (defined __STDC__ || defined __C99__FUNC__ \
1255 || defined __cplusplus || defined _MSC_VER)
1256 static char *
1257 yystpcpy (char *yydest, const char *yysrc)
1258 #else
1259 static char *
1260 yystpcpy (yydest, yysrc)
1261 char *yydest;
1262 const char *yysrc;
1263 #endif
1265 char *yyd = yydest;
1266 const char *yys = yysrc;
1268 while ((*yyd++ = *yys++) != '\0')
1269 continue;
1271 return yyd - 1;
1273 # endif
1274 # endif
1276 # ifndef yytnamerr
1277 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1278 quotes and backslashes, so that it's suitable for yyerror. The
1279 heuristic is that double-quoting is unnecessary unless the string
1280 contains an apostrophe, a comma, or backslash (other than
1281 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1282 null, do not copy; instead, return the length of what the result
1283 would have been. */
1284 static YYSIZE_T
1285 yytnamerr (char *yyres, const char *yystr)
1287 if (*yystr == '"')
1289 YYSIZE_T yyn = 0;
1290 char const *yyp = yystr;
1292 for (;;)
1293 switch (*++yyp)
1295 case '\'':
1296 case ',':
1297 goto do_not_strip_quotes;
1299 case '\\':
1300 if (*++yyp != '\\')
1301 goto do_not_strip_quotes;
1302 /* Fall through. */
1303 default:
1304 if (yyres)
1305 yyres[yyn] = *yyp;
1306 yyn++;
1307 break;
1309 case '"':
1310 if (yyres)
1311 yyres[yyn] = '\0';
1312 return yyn;
1314 do_not_strip_quotes: ;
1317 if (! yyres)
1318 return yystrlen (yystr);
1320 return yystpcpy (yyres, yystr) - yyres;
1322 # endif
1324 /* Copy into YYRESULT an error message about the unexpected token
1325 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1326 including the terminating null byte. If YYRESULT is null, do not
1327 copy anything; just return the number of bytes that would be
1328 copied. As a special case, return 0 if an ordinary "syntax error"
1329 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1330 size calculation. */
1331 static YYSIZE_T
1332 yysyntax_error (char *yyresult, int yystate, int yychar)
1334 int yyn = yypact[yystate];
1336 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1337 return 0;
1338 else
1340 int yytype = YYTRANSLATE (yychar);
1341 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1342 YYSIZE_T yysize = yysize0;
1343 YYSIZE_T yysize1;
1344 int yysize_overflow = 0;
1345 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1346 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1347 int yyx;
1349 # if 0
1350 /* This is so xgettext sees the translatable formats that are
1351 constructed on the fly. */
1352 YY_("syntax error, unexpected %s");
1353 YY_("syntax error, unexpected %s, expecting %s");
1354 YY_("syntax error, unexpected %s, expecting %s or %s");
1355 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1356 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1357 # endif
1358 char *yyfmt;
1359 char const *yyf;
1360 static char const yyunexpected[] = "syntax error, unexpected %s";
1361 static char const yyexpecting[] = ", expecting %s";
1362 static char const yyor[] = " or %s";
1363 char yyformat[sizeof yyunexpected
1364 + sizeof yyexpecting - 1
1365 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1366 * (sizeof yyor - 1))];
1367 char const *yyprefix = yyexpecting;
1369 /* Start YYX at -YYN if negative to avoid negative indexes in
1370 YYCHECK. */
1371 int yyxbegin = yyn < 0 ? -yyn : 0;
1373 /* Stay within bounds of both yycheck and yytname. */
1374 int yychecklim = YYLAST - yyn + 1;
1375 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1376 int yycount = 1;
1378 yyarg[0] = yytname[yytype];
1379 yyfmt = yystpcpy (yyformat, yyunexpected);
1381 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1382 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1384 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1386 yycount = 1;
1387 yysize = yysize0;
1388 yyformat[sizeof yyunexpected - 1] = '\0';
1389 break;
1391 yyarg[yycount++] = yytname[yyx];
1392 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1393 yysize_overflow |= (yysize1 < yysize);
1394 yysize = yysize1;
1395 yyfmt = yystpcpy (yyfmt, yyprefix);
1396 yyprefix = yyor;
1399 yyf = YY_(yyformat);
1400 yysize1 = yysize + yystrlen (yyf);
1401 yysize_overflow |= (yysize1 < yysize);
1402 yysize = yysize1;
1404 if (yysize_overflow)
1405 return YYSIZE_MAXIMUM;
1407 if (yyresult)
1409 /* Avoid sprintf, as that infringes on the user's name space.
1410 Don't have undefined behavior even if the translation
1411 produced a string with the wrong number of "%s"s. */
1412 char *yyp = yyresult;
1413 int yyi = 0;
1414 while ((*yyp = *yyf) != '\0')
1416 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1418 yyp += yytnamerr (yyp, yyarg[yyi++]);
1419 yyf += 2;
1421 else
1423 yyp++;
1424 yyf++;
1428 return yysize;
1431 #endif /* YYERROR_VERBOSE */
1434 /*-----------------------------------------------.
1435 | Release the memory associated to this symbol. |
1436 `-----------------------------------------------*/
1438 /*ARGSUSED*/
1439 #if (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441 static void
1442 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1443 #else
1444 static void
1445 yydestruct (yymsg, yytype, yyvaluep)
1446 const char *yymsg;
1447 int yytype;
1448 YYSTYPE *yyvaluep;
1449 #endif
1451 YYUSE (yyvaluep);
1453 if (!yymsg)
1454 yymsg = "Deleting";
1455 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1457 switch (yytype)
1460 default:
1461 break;
1466 /* Prevent warnings from -Wmissing-prototypes. */
1468 #ifdef YYPARSE_PARAM
1469 #if defined __STDC__ || defined __cplusplus
1470 int yyparse (void *YYPARSE_PARAM);
1471 #else
1472 int yyparse ();
1473 #endif
1474 #else /* ! YYPARSE_PARAM */
1475 #if defined __STDC__ || defined __cplusplus
1476 int yyparse (void);
1477 #else
1478 int yyparse ();
1479 #endif
1480 #endif /* ! YYPARSE_PARAM */
1484 /* The look-ahead symbol. */
1485 int yychar;
1487 /* The semantic value of the look-ahead symbol. */
1488 YYSTYPE yylval;
1490 /* Number of syntax errors so far. */
1491 int yynerrs;
1495 /*----------.
1496 | yyparse. |
1497 `----------*/
1499 #ifdef YYPARSE_PARAM
1500 #if (defined __STDC__ || defined __C99__FUNC__ \
1501 || defined __cplusplus || defined _MSC_VER)
1503 yyparse (void *YYPARSE_PARAM)
1504 #else
1506 yyparse (YYPARSE_PARAM)
1507 void *YYPARSE_PARAM;
1508 #endif
1509 #else /* ! YYPARSE_PARAM */
1510 #if (defined __STDC__ || defined __C99__FUNC__ \
1511 || defined __cplusplus || defined _MSC_VER)
1513 yyparse (void)
1514 #else
1516 yyparse ()
1518 #endif
1519 #endif
1522 int yystate;
1523 int yyn;
1524 int yyresult;
1525 /* Number of tokens to shift before error messages enabled. */
1526 int yyerrstatus;
1527 /* Look-ahead token as an internal (translated) token number. */
1528 int yytoken = 0;
1529 #if YYERROR_VERBOSE
1530 /* Buffer for error messages, and its allocated size. */
1531 char yymsgbuf[128];
1532 char *yymsg = yymsgbuf;
1533 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1534 #endif
1536 /* Three stacks and their tools:
1537 `yyss': related to states,
1538 `yyvs': related to semantic values,
1539 `yyls': related to locations.
1541 Refer to the stacks thru separate pointers, to allow yyoverflow
1542 to reallocate them elsewhere. */
1544 /* The state stack. */
1545 yytype_int16 yyssa[YYINITDEPTH];
1546 yytype_int16 *yyss = yyssa;
1547 yytype_int16 *yyssp;
1549 /* The semantic value stack. */
1550 YYSTYPE yyvsa[YYINITDEPTH];
1551 YYSTYPE *yyvs = yyvsa;
1552 YYSTYPE *yyvsp;
1556 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1558 YYSIZE_T yystacksize = YYINITDEPTH;
1560 /* The variables used to return semantic value and location from the
1561 action routines. */
1562 YYSTYPE yyval;
1565 /* The number of symbols on the RHS of the reduced rule.
1566 Keep to zero when no symbol should be popped. */
1567 int yylen = 0;
1569 YYDPRINTF ((stderr, "Starting parse\n"));
1571 yystate = 0;
1572 yyerrstatus = 0;
1573 yynerrs = 0;
1574 yychar = YYEMPTY; /* Cause a token to be read. */
1576 /* Initialize stack pointers.
1577 Waste one element of value and location stack
1578 so that they stay on the same level as the state stack.
1579 The wasted elements are never initialized. */
1581 yyssp = yyss;
1582 yyvsp = yyvs;
1584 goto yysetstate;
1586 /*------------------------------------------------------------.
1587 | yynewstate -- Push a new state, which is found in yystate. |
1588 `------------------------------------------------------------*/
1589 yynewstate:
1590 /* In all cases, when you get here, the value and location stacks
1591 have just been pushed. So pushing a state here evens the stacks. */
1592 yyssp++;
1594 yysetstate:
1595 *yyssp = yystate;
1597 if (yyss + yystacksize - 1 <= yyssp)
1599 /* Get the current used size of the three stacks, in elements. */
1600 YYSIZE_T yysize = yyssp - yyss + 1;
1602 #ifdef yyoverflow
1604 /* Give user a chance to reallocate the stack. Use copies of
1605 these so that the &'s don't force the real ones into
1606 memory. */
1607 YYSTYPE *yyvs1 = yyvs;
1608 yytype_int16 *yyss1 = yyss;
1611 /* Each stack pointer address is followed by the size of the
1612 data in use in that stack, in bytes. This used to be a
1613 conditional around just the two extra args, but that might
1614 be undefined if yyoverflow is a macro. */
1615 yyoverflow (YY_("memory exhausted"),
1616 &yyss1, yysize * sizeof (*yyssp),
1617 &yyvs1, yysize * sizeof (*yyvsp),
1619 &yystacksize);
1621 yyss = yyss1;
1622 yyvs = yyvs1;
1624 #else /* no yyoverflow */
1625 # ifndef YYSTACK_RELOCATE
1626 goto yyexhaustedlab;
1627 # else
1628 /* Extend the stack our own way. */
1629 if (YYMAXDEPTH <= yystacksize)
1630 goto yyexhaustedlab;
1631 yystacksize *= 2;
1632 if (YYMAXDEPTH < yystacksize)
1633 yystacksize = YYMAXDEPTH;
1636 yytype_int16 *yyss1 = yyss;
1637 union yyalloc *yyptr =
1638 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1639 if (! yyptr)
1640 goto yyexhaustedlab;
1641 YYSTACK_RELOCATE (yyss);
1642 YYSTACK_RELOCATE (yyvs);
1644 # undef YYSTACK_RELOCATE
1645 if (yyss1 != yyssa)
1646 YYSTACK_FREE (yyss1);
1648 # endif
1649 #endif /* no yyoverflow */
1651 yyssp = yyss + yysize - 1;
1652 yyvsp = yyvs + yysize - 1;
1655 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1656 (unsigned long int) yystacksize));
1658 if (yyss + yystacksize - 1 <= yyssp)
1659 YYABORT;
1662 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1664 goto yybackup;
1666 /*-----------.
1667 | yybackup. |
1668 `-----------*/
1669 yybackup:
1671 /* Do appropriate processing given the current state. Read a
1672 look-ahead token if we need one and don't already have one. */
1674 /* First try to decide what to do without reference to look-ahead token. */
1675 yyn = yypact[yystate];
1676 if (yyn == YYPACT_NINF)
1677 goto yydefault;
1679 /* Not known => get a look-ahead token if don't already have one. */
1681 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1682 if (yychar == YYEMPTY)
1684 YYDPRINTF ((stderr, "Reading a token: "));
1685 yychar = YYLEX;
1688 if (yychar <= YYEOF)
1690 yychar = yytoken = YYEOF;
1691 YYDPRINTF ((stderr, "Now at end of input.\n"));
1693 else
1695 yytoken = YYTRANSLATE (yychar);
1696 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1699 /* If the proper action on seeing token YYTOKEN is to reduce or to
1700 detect an error, take that action. */
1701 yyn += yytoken;
1702 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1703 goto yydefault;
1704 yyn = yytable[yyn];
1705 if (yyn <= 0)
1707 if (yyn == 0 || yyn == YYTABLE_NINF)
1708 goto yyerrlab;
1709 yyn = -yyn;
1710 goto yyreduce;
1713 if (yyn == YYFINAL)
1714 YYACCEPT;
1716 /* Count tokens shifted since error; after three, turn off error
1717 status. */
1718 if (yyerrstatus)
1719 yyerrstatus--;
1721 /* Shift the look-ahead token. */
1722 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1724 /* Discard the shifted token unless it is eof. */
1725 if (yychar != YYEOF)
1726 yychar = YYEMPTY;
1728 yystate = yyn;
1729 *++yyvsp = yylval;
1731 goto yynewstate;
1734 /*-----------------------------------------------------------.
1735 | yydefault -- do the default action for the current state. |
1736 `-----------------------------------------------------------*/
1737 yydefault:
1738 yyn = yydefact[yystate];
1739 if (yyn == 0)
1740 goto yyerrlab;
1741 goto yyreduce;
1744 /*-----------------------------.
1745 | yyreduce -- Do a reduction. |
1746 `-----------------------------*/
1747 yyreduce:
1748 /* yyn is the number of a rule to reduce with. */
1749 yylen = yyr2[yyn];
1751 /* If YYLEN is nonzero, implement the default value of the action:
1752 `$$ = $1'.
1754 Otherwise, the following line sets YYVAL to garbage.
1755 This behavior is undocumented and Bison
1756 users should not rely upon it. Assigning to YYVAL
1757 unconditionally makes the parser a bit smaller, and it avoids a
1758 GCC warning that YYVAL may be used uninitialized. */
1759 yyval = yyvsp[1-yylen];
1762 YY_REDUCE_PRINT (yyn);
1763 switch (yyn)
1765 case 2:
1766 #line 235 "parse.y"
1768 checkundefined();
1770 break;
1772 case 4:
1773 #line 242 "parse.y"
1774 { error_message("implicit tagging is not supported"); }
1775 break;
1777 case 5:
1778 #line 244 "parse.y"
1779 { error_message("automatic tagging is not supported"); }
1780 break;
1782 case 7:
1783 #line 249 "parse.y"
1784 { error_message("no extensibility options supported"); }
1785 break;
1787 case 17:
1788 #line 270 "parse.y"
1790 struct string_list *sl;
1791 for(sl = (yyvsp[(1) - (4)].sl); sl != NULL; sl = sl->next) {
1792 Symbol *s = addsym(sl->string);
1793 s->stype = Stype;
1795 add_import((yyvsp[(3) - (4)].name));
1797 break;
1799 case 22:
1800 #line 289 "parse.y"
1802 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1803 (yyval.sl)->string = (yyvsp[(1) - (3)].name);
1804 (yyval.sl)->next = (yyvsp[(3) - (3)].sl);
1806 break;
1808 case 23:
1809 #line 295 "parse.y"
1811 (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
1812 (yyval.sl)->string = (yyvsp[(1) - (1)].name);
1813 (yyval.sl)->next = NULL;
1815 break;
1817 case 24:
1818 #line 303 "parse.y"
1820 Symbol *s = addsym ((yyvsp[(1) - (3)].name));
1821 s->stype = Stype;
1822 s->type = (yyvsp[(3) - (3)].type);
1823 fix_labels(s);
1824 generate_type (s);
1826 break;
1828 case 42:
1829 #line 334 "parse.y"
1831 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
1832 TE_EXPLICIT, new_type(TBoolean));
1834 break;
1836 case 43:
1837 #line 341 "parse.y"
1839 if((yyvsp[(2) - (5)].value)->type != integervalue)
1840 error_message("Non-integer used in first part of range");
1841 if((yyvsp[(2) - (5)].value)->type != integervalue)
1842 error_message("Non-integer in second part of range");
1843 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1844 (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;
1845 (yyval.range)->max = (yyvsp[(4) - (5)].value)->u.integervalue;
1847 break;
1849 case 44:
1850 #line 351 "parse.y"
1852 if((yyvsp[(2) - (5)].value)->type != integervalue)
1853 error_message("Non-integer in first part of range");
1854 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1855 (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;
1856 (yyval.range)->max = (yyvsp[(2) - (5)].value)->u.integervalue - 1;
1858 break;
1860 case 45:
1861 #line 359 "parse.y"
1863 if((yyvsp[(4) - (5)].value)->type != integervalue)
1864 error_message("Non-integer in second part of range");
1865 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1866 (yyval.range)->min = (yyvsp[(4) - (5)].value)->u.integervalue + 2;
1867 (yyval.range)->max = (yyvsp[(4) - (5)].value)->u.integervalue;
1869 break;
1871 case 46:
1872 #line 367 "parse.y"
1874 if((yyvsp[(2) - (3)].value)->type != integervalue)
1875 error_message("Non-integer used in limit");
1876 (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
1877 (yyval.range)->min = (yyvsp[(2) - (3)].value)->u.integervalue;
1878 (yyval.range)->max = (yyvsp[(2) - (3)].value)->u.integervalue;
1880 break;
1882 case 47:
1883 #line 378 "parse.y"
1885 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
1886 TE_EXPLICIT, new_type(TInteger));
1888 break;
1890 case 48:
1891 #line 383 "parse.y"
1893 (yyval.type) = new_type(TInteger);
1894 (yyval.type)->range = (yyvsp[(2) - (2)].range);
1895 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1897 break;
1899 case 49:
1900 #line 389 "parse.y"
1902 (yyval.type) = new_type(TInteger);
1903 (yyval.type)->members = (yyvsp[(3) - (4)].members);
1904 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));
1906 break;
1908 case 50:
1909 #line 397 "parse.y"
1911 (yyval.members) = emalloc(sizeof(*(yyval.members)));
1912 ASN1_TAILQ_INIT((yyval.members));
1913 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);
1915 break;
1917 case 51:
1918 #line 403 "parse.y"
1920 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
1921 (yyval.members) = (yyvsp[(1) - (3)].members);
1923 break;
1925 case 52:
1926 #line 408 "parse.y"
1927 { (yyval.members) = (yyvsp[(1) - (3)].members); }
1928 break;
1930 case 53:
1931 #line 412 "parse.y"
1933 (yyval.member) = emalloc(sizeof(*(yyval.member)));
1934 (yyval.member)->name = (yyvsp[(1) - (4)].name);
1935 (yyval.member)->gen_name = estrdup((yyvsp[(1) - (4)].name));
1936 output_name ((yyval.member)->gen_name);
1937 (yyval.member)->val = (yyvsp[(3) - (4)].constant);
1938 (yyval.member)->optional = 0;
1939 (yyval.member)->ellipsis = 0;
1940 (yyval.member)->type = NULL;
1942 break;
1944 case 54:
1945 #line 425 "parse.y"
1947 (yyval.type) = new_type(TInteger);
1948 (yyval.type)->members = (yyvsp[(3) - (4)].members);
1949 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));
1951 break;
1953 case 56:
1954 #line 436 "parse.y"
1956 (yyval.type) = new_type(TBitString);
1957 (yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));
1958 ASN1_TAILQ_INIT((yyval.type)->members);
1959 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1961 break;
1963 case 57:
1964 #line 443 "parse.y"
1966 (yyval.type) = new_type(TBitString);
1967 (yyval.type)->members = (yyvsp[(4) - (5)].members);
1968 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));
1970 break;
1972 case 58:
1973 #line 451 "parse.y"
1975 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
1976 TE_EXPLICIT, new_type(TOID));
1978 break;
1980 case 59:
1981 #line 457 "parse.y"
1983 Type *t = new_type(TOctetString);
1984 t->range = (yyvsp[(3) - (3)].range);
1985 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,
1986 TE_EXPLICIT, t);
1988 break;
1990 case 60:
1991 #line 466 "parse.y"
1993 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
1994 TE_EXPLICIT, new_type(TNull));
1996 break;
1998 case 61:
1999 #line 473 "parse.y"
2000 { (yyval.range) = NULL; }
2001 break;
2003 case 62:
2004 #line 475 "parse.y"
2005 { (yyval.range) = (yyvsp[(2) - (2)].range); }
2006 break;
2008 case 63:
2009 #line 480 "parse.y"
2011 (yyval.type) = new_type(TSequence);
2012 (yyval.type)->members = (yyvsp[(3) - (4)].members);
2013 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
2015 break;
2017 case 64:
2018 #line 486 "parse.y"
2020 (yyval.type) = new_type(TSequence);
2021 (yyval.type)->members = NULL;
2022 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
2024 break;
2026 case 65:
2027 #line 494 "parse.y"
2029 (yyval.type) = new_type(TSequenceOf);
2030 (yyval.type)->range = (yyvsp[(2) - (4)].range);
2031 (yyval.type)->subtype = (yyvsp[(4) - (4)].type);
2032 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));
2034 break;
2036 case 66:
2037 #line 503 "parse.y"
2039 (yyval.type) = new_type(TSet);
2040 (yyval.type)->members = (yyvsp[(3) - (4)].members);
2041 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
2043 break;
2045 case 67:
2046 #line 509 "parse.y"
2048 (yyval.type) = new_type(TSet);
2049 (yyval.type)->members = NULL;
2050 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
2052 break;
2054 case 68:
2055 #line 517 "parse.y"
2057 (yyval.type) = new_type(TSetOf);
2058 (yyval.type)->subtype = (yyvsp[(3) - (3)].type);
2059 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));
2061 break;
2063 case 69:
2064 #line 525 "parse.y"
2066 (yyval.type) = new_type(TChoice);
2067 (yyval.type)->members = (yyvsp[(3) - (4)].members);
2069 break;
2071 case 72:
2072 #line 536 "parse.y"
2074 Symbol *s = addsym((yyvsp[(1) - (1)].name));
2075 (yyval.type) = new_type(TType);
2076 if(s->stype != Stype && s->stype != SUndefined)
2077 error_message ("%s is not a type\n", (yyvsp[(1) - (1)].name));
2078 else
2079 (yyval.type)->symbol = s;
2081 break;
2083 case 73:
2084 #line 547 "parse.y"
2086 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
2087 TE_EXPLICIT, new_type(TGeneralizedTime));
2089 break;
2091 case 74:
2092 #line 552 "parse.y"
2094 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
2095 TE_EXPLICIT, new_type(TUTCTime));
2097 break;
2099 case 75:
2100 #line 559 "parse.y"
2102 /* if (Constraint.type == contentConstrant) {
2103 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
2104 if (Constraint.u.constraint.type) {
2105 assert((Constraint.u.constraint.type.length % 8) == 0);
2108 if (Constraint.u.constraint.encoding) {
2109 type == der-oid|ber-oid
2113 break;
2115 case 76:
2116 #line 575 "parse.y"
2118 (yyval.constraint_spec) = (yyvsp[(2) - (3)].constraint_spec);
2120 break;
2122 case 80:
2123 #line 588 "parse.y"
2125 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2126 (yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (2)].type);
2127 (yyval.constraint_spec)->u.content.encoding = NULL;
2129 break;
2131 case 81:
2132 #line 594 "parse.y"
2134 if ((yyvsp[(3) - (3)].value)->type != objectidentifiervalue)
2135 error_message("Non-OID used in ENCODED BY constraint");
2136 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2137 (yyval.constraint_spec)->u.content.type = NULL;
2138 (yyval.constraint_spec)->u.content.encoding = (yyvsp[(3) - (3)].value);
2140 break;
2142 case 82:
2143 #line 602 "parse.y"
2145 if ((yyvsp[(5) - (5)].value)->type != objectidentifiervalue)
2146 error_message("Non-OID used in ENCODED BY constraint");
2147 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
2148 (yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (5)].type);
2149 (yyval.constraint_spec)->u.content.encoding = (yyvsp[(5) - (5)].value);
2151 break;
2153 case 83:
2154 #line 612 "parse.y"
2156 (yyval.constraint_spec) = new_constraint_spec(CT_USER);
2158 break;
2160 case 84:
2161 #line 618 "parse.y"
2163 (yyval.type) = new_type(TTag);
2164 (yyval.type)->tag = (yyvsp[(1) - (3)].tag);
2165 (yyval.type)->tag.tagenv = (yyvsp[(2) - (3)].constant);
2166 if((yyvsp[(3) - (3)].type)->type == TTag && (yyvsp[(2) - (3)].constant) == TE_IMPLICIT) {
2167 (yyval.type)->subtype = (yyvsp[(3) - (3)].type)->subtype;
2168 free((yyvsp[(3) - (3)].type));
2169 } else
2170 (yyval.type)->subtype = (yyvsp[(3) - (3)].type);
2172 break;
2174 case 85:
2175 #line 631 "parse.y"
2177 (yyval.tag).tagclass = (yyvsp[(2) - (4)].constant);
2178 (yyval.tag).tagvalue = (yyvsp[(3) - (4)].constant);
2179 (yyval.tag).tagenv = TE_EXPLICIT;
2181 break;
2183 case 86:
2184 #line 639 "parse.y"
2186 (yyval.constant) = ASN1_C_CONTEXT;
2188 break;
2190 case 87:
2191 #line 643 "parse.y"
2193 (yyval.constant) = ASN1_C_UNIV;
2195 break;
2197 case 88:
2198 #line 647 "parse.y"
2200 (yyval.constant) = ASN1_C_APPL;
2202 break;
2204 case 89:
2205 #line 651 "parse.y"
2207 (yyval.constant) = ASN1_C_PRIVATE;
2209 break;
2211 case 90:
2212 #line 657 "parse.y"
2214 (yyval.constant) = TE_EXPLICIT;
2216 break;
2218 case 91:
2219 #line 661 "parse.y"
2221 (yyval.constant) = TE_EXPLICIT;
2223 break;
2225 case 92:
2226 #line 665 "parse.y"
2228 (yyval.constant) = TE_IMPLICIT;
2230 break;
2232 case 93:
2233 #line 672 "parse.y"
2235 Symbol *s;
2236 s = addsym ((yyvsp[(1) - (4)].name));
2238 s->stype = SValue;
2239 s->value = (yyvsp[(4) - (4)].value);
2240 generate_constant (s);
2242 break;
2244 case 95:
2245 #line 686 "parse.y"
2247 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
2248 TE_EXPLICIT, new_type(TGeneralString));
2250 break;
2252 case 96:
2253 #line 691 "parse.y"
2255 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
2256 TE_EXPLICIT, new_type(TUTF8String));
2258 break;
2260 case 97:
2261 #line 696 "parse.y"
2263 (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
2264 TE_EXPLICIT, new_type(TPrintableString));
2266 break;
2268 case 98:
2269 #line 701 "parse.y"
2271 (yyval.type) = new_tag(ASN1_C_UNIV, UT_VisibleString,
2272 TE_EXPLICIT, new_type(TVisibleString));
2274 break;
2276 case 99:
2277 #line 706 "parse.y"
2279 (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
2280 TE_EXPLICIT, new_type(TIA5String));
2282 break;
2284 case 100:
2285 #line 711 "parse.y"
2287 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
2288 TE_EXPLICIT, new_type(TBMPString));
2290 break;
2292 case 101:
2293 #line 716 "parse.y"
2295 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
2296 TE_EXPLICIT, new_type(TUniversalString));
2298 break;
2300 case 102:
2301 #line 724 "parse.y"
2303 (yyval.members) = emalloc(sizeof(*(yyval.members)));
2304 ASN1_TAILQ_INIT((yyval.members));
2305 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);
2307 break;
2309 case 103:
2310 #line 730 "parse.y"
2312 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
2313 (yyval.members) = (yyvsp[(1) - (3)].members);
2315 break;
2317 case 104:
2318 #line 735 "parse.y"
2320 struct member *m = ecalloc(1, sizeof(*m));
2321 m->name = estrdup("...");
2322 m->gen_name = estrdup("asn1_ellipsis");
2323 m->ellipsis = 1;
2324 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), m, members);
2325 (yyval.members) = (yyvsp[(1) - (3)].members);
2327 break;
2329 case 105:
2330 #line 746 "parse.y"
2332 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2333 (yyval.member)->name = (yyvsp[(1) - (2)].name);
2334 (yyval.member)->gen_name = estrdup((yyvsp[(1) - (2)].name));
2335 output_name ((yyval.member)->gen_name);
2336 (yyval.member)->type = (yyvsp[(2) - (2)].type);
2337 (yyval.member)->ellipsis = 0;
2339 break;
2341 case 106:
2342 #line 757 "parse.y"
2344 (yyval.member) = (yyvsp[(1) - (1)].member);
2345 (yyval.member)->optional = 0;
2346 (yyval.member)->defval = NULL;
2348 break;
2350 case 107:
2351 #line 763 "parse.y"
2353 (yyval.member) = (yyvsp[(1) - (2)].member);
2354 (yyval.member)->optional = 1;
2355 (yyval.member)->defval = NULL;
2357 break;
2359 case 108:
2360 #line 769 "parse.y"
2362 (yyval.member) = (yyvsp[(1) - (3)].member);
2363 (yyval.member)->optional = 0;
2364 (yyval.member)->defval = (yyvsp[(3) - (3)].value);
2366 break;
2368 case 109:
2369 #line 777 "parse.y"
2371 (yyval.members) = emalloc(sizeof(*(yyval.members)));
2372 ASN1_TAILQ_INIT((yyval.members));
2373 ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);
2375 break;
2377 case 110:
2378 #line 783 "parse.y"
2380 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
2381 (yyval.members) = (yyvsp[(1) - (3)].members);
2383 break;
2385 case 111:
2386 #line 790 "parse.y"
2388 (yyval.member) = emalloc(sizeof(*(yyval.member)));
2389 (yyval.member)->name = (yyvsp[(1) - (4)].name);
2390 (yyval.member)->gen_name = estrdup((yyvsp[(1) - (4)].name));
2391 output_name ((yyval.member)->gen_name);
2392 (yyval.member)->val = (yyvsp[(3) - (4)].constant);
2393 (yyval.member)->optional = 0;
2394 (yyval.member)->ellipsis = 0;
2395 (yyval.member)->type = NULL;
2397 break;
2399 case 113:
2400 #line 803 "parse.y"
2401 { (yyval.objid) = NULL; }
2402 break;
2404 case 114:
2405 #line 807 "parse.y"
2407 (yyval.objid) = (yyvsp[(2) - (3)].objid);
2409 break;
2411 case 115:
2412 #line 813 "parse.y"
2414 (yyval.objid) = NULL;
2416 break;
2418 case 116:
2419 #line 817 "parse.y"
2421 if ((yyvsp[(2) - (2)].objid)) {
2422 (yyval.objid) = (yyvsp[(2) - (2)].objid);
2423 add_oid_to_tail((yyvsp[(2) - (2)].objid), (yyvsp[(1) - (2)].objid));
2424 } else {
2425 (yyval.objid) = (yyvsp[(1) - (2)].objid);
2428 break;
2430 case 117:
2431 #line 828 "parse.y"
2433 (yyval.objid) = new_objid((yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].constant));
2435 break;
2437 case 118:
2438 #line 832 "parse.y"
2440 Symbol *s = addsym((yyvsp[(1) - (1)].name));
2441 if(s->stype != SValue ||
2442 s->value->type != objectidentifiervalue) {
2443 error_message("%s is not an object identifier\n",
2444 s->name);
2445 exit(1);
2447 (yyval.objid) = s->value->u.objectidentifiervalue;
2449 break;
2451 case 119:
2452 #line 843 "parse.y"
2454 (yyval.objid) = new_objid(NULL, (yyvsp[(1) - (1)].constant));
2456 break;
2458 case 129:
2459 #line 866 "parse.y"
2461 Symbol *s = addsym((yyvsp[(1) - (1)].name));
2462 if(s->stype != SValue)
2463 error_message ("%s is not a value\n",
2464 s->name);
2465 else
2466 (yyval.value) = s->value;
2468 break;
2470 case 130:
2471 #line 877 "parse.y"
2473 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2474 (yyval.value)->type = stringvalue;
2475 (yyval.value)->u.stringvalue = (yyvsp[(1) - (1)].name);
2477 break;
2479 case 131:
2480 #line 885 "parse.y"
2482 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2483 (yyval.value)->type = booleanvalue;
2484 (yyval.value)->u.booleanvalue = 0;
2486 break;
2488 case 132:
2489 #line 891 "parse.y"
2491 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2492 (yyval.value)->type = booleanvalue;
2493 (yyval.value)->u.booleanvalue = 0;
2495 break;
2497 case 133:
2498 #line 899 "parse.y"
2500 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2501 (yyval.value)->type = integervalue;
2502 (yyval.value)->u.integervalue = (yyvsp[(1) - (1)].constant);
2504 break;
2506 case 135:
2507 #line 910 "parse.y"
2510 break;
2512 case 136:
2513 #line 915 "parse.y"
2515 (yyval.value) = emalloc(sizeof(*(yyval.value)));
2516 (yyval.value)->type = objectidentifiervalue;
2517 (yyval.value)->u.objectidentifiervalue = (yyvsp[(1) - (1)].objid);
2519 break;
2522 /* Line 1267 of yacc.c. */
2523 #line 2523 "parse.c"
2524 default: break;
2526 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2528 YYPOPSTACK (yylen);
2529 yylen = 0;
2530 YY_STACK_PRINT (yyss, yyssp);
2532 *++yyvsp = yyval;
2535 /* Now `shift' the result of the reduction. Determine what state
2536 that goes to, based on the state we popped back to and the rule
2537 number reduced by. */
2539 yyn = yyr1[yyn];
2541 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2542 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2543 yystate = yytable[yystate];
2544 else
2545 yystate = yydefgoto[yyn - YYNTOKENS];
2547 goto yynewstate;
2550 /*------------------------------------.
2551 | yyerrlab -- here on detecting error |
2552 `------------------------------------*/
2553 yyerrlab:
2554 /* If not already recovering from an error, report this error. */
2555 if (!yyerrstatus)
2557 ++yynerrs;
2558 #if ! YYERROR_VERBOSE
2559 yyerror (YY_("syntax error"));
2560 #else
2562 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2563 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2565 YYSIZE_T yyalloc = 2 * yysize;
2566 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2567 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2568 if (yymsg != yymsgbuf)
2569 YYSTACK_FREE (yymsg);
2570 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2571 if (yymsg)
2572 yymsg_alloc = yyalloc;
2573 else
2575 yymsg = yymsgbuf;
2576 yymsg_alloc = sizeof yymsgbuf;
2580 if (0 < yysize && yysize <= yymsg_alloc)
2582 (void) yysyntax_error (yymsg, yystate, yychar);
2583 yyerror (yymsg);
2585 else
2587 yyerror (YY_("syntax error"));
2588 if (yysize != 0)
2589 goto yyexhaustedlab;
2592 #endif
2597 if (yyerrstatus == 3)
2599 /* If just tried and failed to reuse look-ahead token after an
2600 error, discard it. */
2602 if (yychar <= YYEOF)
2604 /* Return failure if at end of input. */
2605 if (yychar == YYEOF)
2606 YYABORT;
2608 else
2610 yydestruct ("Error: discarding",
2611 yytoken, &yylval);
2612 yychar = YYEMPTY;
2616 /* Else will try to reuse look-ahead token after shifting the error
2617 token. */
2618 goto yyerrlab1;
2621 /*---------------------------------------------------.
2622 | yyerrorlab -- error raised explicitly by YYERROR. |
2623 `---------------------------------------------------*/
2624 yyerrorlab:
2626 /* Pacify compilers like GCC when the user code never invokes
2627 YYERROR and the label yyerrorlab therefore never appears in user
2628 code. */
2629 if (/*CONSTCOND*/ 0)
2630 goto yyerrorlab;
2632 /* Do not reclaim the symbols of the rule which action triggered
2633 this YYERROR. */
2634 YYPOPSTACK (yylen);
2635 yylen = 0;
2636 YY_STACK_PRINT (yyss, yyssp);
2637 yystate = *yyssp;
2638 goto yyerrlab1;
2641 /*-------------------------------------------------------------.
2642 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2643 `-------------------------------------------------------------*/
2644 yyerrlab1:
2645 yyerrstatus = 3; /* Each real token shifted decrements this. */
2647 for (;;)
2649 yyn = yypact[yystate];
2650 if (yyn != YYPACT_NINF)
2652 yyn += YYTERROR;
2653 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2655 yyn = yytable[yyn];
2656 if (0 < yyn)
2657 break;
2661 /* Pop the current state because it cannot handle the error token. */
2662 if (yyssp == yyss)
2663 YYABORT;
2666 yydestruct ("Error: popping",
2667 yystos[yystate], yyvsp);
2668 YYPOPSTACK (1);
2669 yystate = *yyssp;
2670 YY_STACK_PRINT (yyss, yyssp);
2673 if (yyn == YYFINAL)
2674 YYACCEPT;
2676 *++yyvsp = yylval;
2679 /* Shift the error token. */
2680 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2682 yystate = yyn;
2683 goto yynewstate;
2686 /*-------------------------------------.
2687 | yyacceptlab -- YYACCEPT comes here. |
2688 `-------------------------------------*/
2689 yyacceptlab:
2690 yyresult = 0;
2691 goto yyreturn;
2693 /*-----------------------------------.
2694 | yyabortlab -- YYABORT comes here. |
2695 `-----------------------------------*/
2696 yyabortlab:
2697 yyresult = 1;
2698 goto yyreturn;
2700 #ifndef yyoverflow
2701 /*-------------------------------------------------.
2702 | yyexhaustedlab -- memory exhaustion comes here. |
2703 `-------------------------------------------------*/
2704 yyexhaustedlab:
2705 yyerror (YY_("memory exhausted"));
2706 yyresult = 2;
2707 /* Fall through. */
2708 #endif
2710 yyreturn:
2711 if (yychar != YYEOF && yychar != YYEMPTY)
2712 yydestruct ("Cleanup: discarding lookahead",
2713 yytoken, &yylval);
2714 /* Do not reclaim the symbols of the rule which action triggered
2715 this YYABORT or YYACCEPT. */
2716 YYPOPSTACK (yylen);
2717 YY_STACK_PRINT (yyss, yyssp);
2718 while (yyssp != yyss)
2720 yydestruct ("Cleanup: popping",
2721 yystos[*yyssp], yyvsp);
2722 YYPOPSTACK (1);
2724 #ifndef yyoverflow
2725 if (yyss != yyssa)
2726 YYSTACK_FREE (yyss);
2727 #endif
2728 #if YYERROR_VERBOSE
2729 if (yymsg != yymsgbuf)
2730 YYSTACK_FREE (yymsg);
2731 #endif
2732 /* Make sure YYID is used. */
2733 return YYID (yyresult);
2737 #line 922 "parse.y"
2740 void
2741 yyerror (const char *s)
2743 error_message ("%s\n", s);
2746 static Type *
2747 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
2749 Type *t;
2750 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
2751 t = oldtype;
2752 oldtype = oldtype->subtype; /* XXX */
2753 } else
2754 t = new_type (TTag);
2756 t->tag.tagclass = tagclass;
2757 t->tag.tagvalue = tagvalue;
2758 t->tag.tagenv = tagenv;
2759 t->subtype = oldtype;
2760 return t;
2763 static struct objid *
2764 new_objid(const char *label, int value)
2766 struct objid *s;
2767 s = emalloc(sizeof(*s));
2768 s->label = label;
2769 s->value = value;
2770 s->next = NULL;
2771 return s;
2774 static void
2775 add_oid_to_tail(struct objid *head, struct objid *tail)
2777 struct objid *o;
2778 o = head;
2779 while (o->next)
2780 o = o->next;
2781 o->next = tail;
2784 static Type *
2785 new_type (Typetype tt)
2787 Type *t = ecalloc(1, sizeof(*t));
2788 t->type = tt;
2789 return t;
2792 static struct constraint_spec *
2793 new_constraint_spec(enum ctype ct)
2795 struct constraint_spec *c = ecalloc(1, sizeof(*c));
2796 c->ctype = ct;
2797 return c;
2800 static void fix_labels2(Type *t, const char *prefix);
2801 static void fix_labels1(struct memhead *members, const char *prefix)
2803 Member *m;
2805 if(members == NULL)
2806 return;
2807 ASN1_TAILQ_FOREACH(m, members, members) {
2808 asprintf(&m->label, "%s_%s", prefix, m->gen_name);
2809 if (m->label == NULL)
2810 errx(1, "malloc");
2811 if(m->type != NULL)
2812 fix_labels2(m->type, m->label);
2816 static void fix_labels2(Type *t, const char *prefix)
2818 for(; t; t = t->subtype)
2819 fix_labels1(t->members, prefix);
2822 static void
2823 fix_labels(Symbol *s)
2825 char *p;
2826 asprintf(&p, "choice_%s", s->gen_name);
2827 if (p == NULL)
2828 errx(1, "malloc");
2829 fix_labels2(s->type, p);
2830 free(p);