source: heimdal/trunk/lib/asn1/asn1parse.c@ 5

Last change on this file since 5 was 1, checked in by Paul Smedley, 10 years ago

Initial commit of Heimdal 1.5.3

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