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