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