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