NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / libasn1parser / asn1p_y.c
1 /* A Bison parser, made by GNU Bison 2.3.  */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2, or (at your option)
11    any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.  */
22
23 /* As a special exception, you may create a larger work that contains
24    part or all of the Bison parser skeleton and distribute that work
25    under terms of your choice, so long as that work isn't itself a
26    parser generator using the skeleton or a modified version thereof
27    as a parser skeleton.  Alternatively, if you modify or redistribute
28    the parser skeleton itself, you may (at your option) remove this
29    special exception, which will cause the skeleton and the resulting
30    Bison output files to be licensed under the GNU General Public
31    License without this special exception.
32
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40    infringing on user name space.  This should be done even for local
41    variables, as they might otherwise be expanded by user macros.
42    There are some unavoidable exceptions within include files to
43    define necessary library symbols; they are noted "INFRINGES ON
44    USER NAME SPACE" below.  */
45
46 /* Identify Bison output.  */
47 #define YYBISON 1
48
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers.  */
56 #define YYPURE 0
57
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names.  */
62 #define yyparse asn1p_parse
63 #define yylex   asn1p_lex
64 #define yyerror asn1p_error
65 #define yylval  asn1p_lval
66 #define yychar  asn1p_char
67 #define yydebug asn1p_debug
68 #define yynerrs asn1p_nerrs
69
70
71 /* Tokens.  */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74    /* Put the tokens into the symbol table, so that GDB and other debuggers
75       know about them.  */
76    enum yytokentype {
77      TOK_PPEQ = 258,
78      TOK_VBracketLeft = 259,
79      TOK_VBracketRight = 260,
80      TOK_whitespace = 261,
81      TOK_opaque = 262,
82      TOK_bstring = 263,
83      TOK_cstring = 264,
84      TOK_hstring = 265,
85      TOK_identifier = 266,
86      TOK_number = 267,
87      TOK_number_negative = 268,
88      TOK_realnumber = 269,
89      TOK_tuple = 270,
90      TOK_quadruple = 271,
91      TOK_typereference = 272,
92      TOK_capitalreference = 273,
93      TOK_typefieldreference = 274,
94      TOK_valuefieldreference = 275,
95      TOK_Literal = 276,
96      TOK_ExtValue_BIT_STRING = 277,
97      TOK_ABSENT = 278,
98      TOK_ABSTRACT_SYNTAX = 279,
99      TOK_ALL = 280,
100      TOK_ANY = 281,
101      TOK_APPLICATION = 282,
102      TOK_AUTOMATIC = 283,
103      TOK_BEGIN = 284,
104      TOK_BIT = 285,
105      TOK_BMPString = 286,
106      TOK_BOOLEAN = 287,
107      TOK_BY = 288,
108      TOK_CHARACTER = 289,
109      TOK_CHOICE = 290,
110      TOK_CLASS = 291,
111      TOK_COMPONENT = 292,
112      TOK_COMPONENTS = 293,
113      TOK_CONSTRAINED = 294,
114      TOK_CONTAINING = 295,
115      TOK_DEFAULT = 296,
116      TOK_DEFINITIONS = 297,
117      TOK_DEFINED = 298,
118      TOK_EMBEDDED = 299,
119      TOK_ENCODED = 300,
120      TOK_ENCODING_CONTROL = 301,
121      TOK_END = 302,
122      TOK_ENUMERATED = 303,
123      TOK_EXPLICIT = 304,
124      TOK_EXPORTS = 305,
125      TOK_EXTENSIBILITY = 306,
126      TOK_EXTERNAL = 307,
127      TOK_FALSE = 308,
128      TOK_FROM = 309,
129      TOK_GeneralizedTime = 310,
130      TOK_GeneralString = 311,
131      TOK_GraphicString = 312,
132      TOK_IA5String = 313,
133      TOK_IDENTIFIER = 314,
134      TOK_IMPLICIT = 315,
135      TOK_IMPLIED = 316,
136      TOK_IMPORTS = 317,
137      TOK_INCLUDES = 318,
138      TOK_INSTANCE = 319,
139      TOK_INSTRUCTIONS = 320,
140      TOK_INTEGER = 321,
141      TOK_ISO646String = 322,
142      TOK_MAX = 323,
143      TOK_MIN = 324,
144      TOK_MINUS_INFINITY = 325,
145      TOK_NULL = 326,
146      TOK_NumericString = 327,
147      TOK_OBJECT = 328,
148      TOK_ObjectDescriptor = 329,
149      TOK_OCTET = 330,
150      TOK_OF = 331,
151      TOK_OPTIONAL = 332,
152      TOK_PATTERN = 333,
153      TOK_PDV = 334,
154      TOK_PLUS_INFINITY = 335,
155      TOK_PRESENT = 336,
156      TOK_PrintableString = 337,
157      TOK_PRIVATE = 338,
158      TOK_REAL = 339,
159      TOK_RELATIVE_OID = 340,
160      TOK_SEQUENCE = 341,
161      TOK_SET = 342,
162      TOK_SIZE = 343,
163      TOK_STRING = 344,
164      TOK_SYNTAX = 345,
165      TOK_T61String = 346,
166      TOK_TAGS = 347,
167      TOK_TeletexString = 348,
168      TOK_TRUE = 349,
169      TOK_TYPE_IDENTIFIER = 350,
170      TOK_UNIQUE = 351,
171      TOK_UNIVERSAL = 352,
172      TOK_UniversalString = 353,
173      TOK_UTCTime = 354,
174      TOK_UTF8String = 355,
175      TOK_VideotexString = 356,
176      TOK_VisibleString = 357,
177      TOK_WITH = 358,
178      UTF8_BOM = 359,
179      TOK_EXCEPT = 360,
180      TOK_INTERSECTION = 361,
181      TOK_UNION = 362,
182      TOK_TwoDots = 363,
183      TOK_ThreeDots = 364
184    };
185 #endif
186 /* Tokens.  */
187 #define TOK_PPEQ 258
188 #define TOK_VBracketLeft 259
189 #define TOK_VBracketRight 260
190 #define TOK_whitespace 261
191 #define TOK_opaque 262
192 #define TOK_bstring 263
193 #define TOK_cstring 264
194 #define TOK_hstring 265
195 #define TOK_identifier 266
196 #define TOK_number 267
197 #define TOK_number_negative 268
198 #define TOK_realnumber 269
199 #define TOK_tuple 270
200 #define TOK_quadruple 271
201 #define TOK_typereference 272
202 #define TOK_capitalreference 273
203 #define TOK_typefieldreference 274
204 #define TOK_valuefieldreference 275
205 #define TOK_Literal 276
206 #define TOK_ExtValue_BIT_STRING 277
207 #define TOK_ABSENT 278
208 #define TOK_ABSTRACT_SYNTAX 279
209 #define TOK_ALL 280
210 #define TOK_ANY 281
211 #define TOK_APPLICATION 282
212 #define TOK_AUTOMATIC 283
213 #define TOK_BEGIN 284
214 #define TOK_BIT 285
215 #define TOK_BMPString 286
216 #define TOK_BOOLEAN 287
217 #define TOK_BY 288
218 #define TOK_CHARACTER 289
219 #define TOK_CHOICE 290
220 #define TOK_CLASS 291
221 #define TOK_COMPONENT 292
222 #define TOK_COMPONENTS 293
223 #define TOK_CONSTRAINED 294
224 #define TOK_CONTAINING 295
225 #define TOK_DEFAULT 296
226 #define TOK_DEFINITIONS 297
227 #define TOK_DEFINED 298
228 #define TOK_EMBEDDED 299
229 #define TOK_ENCODED 300
230 #define TOK_ENCODING_CONTROL 301
231 #define TOK_END 302
232 #define TOK_ENUMERATED 303
233 #define TOK_EXPLICIT 304
234 #define TOK_EXPORTS 305
235 #define TOK_EXTENSIBILITY 306
236 #define TOK_EXTERNAL 307
237 #define TOK_FALSE 308
238 #define TOK_FROM 309
239 #define TOK_GeneralizedTime 310
240 #define TOK_GeneralString 311
241 #define TOK_GraphicString 312
242 #define TOK_IA5String 313
243 #define TOK_IDENTIFIER 314
244 #define TOK_IMPLICIT 315
245 #define TOK_IMPLIED 316
246 #define TOK_IMPORTS 317
247 #define TOK_INCLUDES 318
248 #define TOK_INSTANCE 319
249 #define TOK_INSTRUCTIONS 320
250 #define TOK_INTEGER 321
251 #define TOK_ISO646String 322
252 #define TOK_MAX 323
253 #define TOK_MIN 324
254 #define TOK_MINUS_INFINITY 325
255 #define TOK_NULL 326
256 #define TOK_NumericString 327
257 #define TOK_OBJECT 328
258 #define TOK_ObjectDescriptor 329
259 #define TOK_OCTET 330
260 #define TOK_OF 331
261 #define TOK_OPTIONAL 332
262 #define TOK_PATTERN 333
263 #define TOK_PDV 334
264 #define TOK_PLUS_INFINITY 335
265 #define TOK_PRESENT 336
266 #define TOK_PrintableString 337
267 #define TOK_PRIVATE 338
268 #define TOK_REAL 339
269 #define TOK_RELATIVE_OID 340
270 #define TOK_SEQUENCE 341
271 #define TOK_SET 342
272 #define TOK_SIZE 343
273 #define TOK_STRING 344
274 #define TOK_SYNTAX 345
275 #define TOK_T61String 346
276 #define TOK_TAGS 347
277 #define TOK_TeletexString 348
278 #define TOK_TRUE 349
279 #define TOK_TYPE_IDENTIFIER 350
280 #define TOK_UNIQUE 351
281 #define TOK_UNIVERSAL 352
282 #define TOK_UniversalString 353
283 #define TOK_UTCTime 354
284 #define TOK_UTF8String 355
285 #define TOK_VideotexString 356
286 #define TOK_VisibleString 357
287 #define TOK_WITH 358
288 #define UTF8_BOM 359
289 #define TOK_EXCEPT 360
290 #define TOK_INTERSECTION 361
291 #define TOK_UNION 362
292 #define TOK_TwoDots 363
293 #define TOK_ThreeDots 364
294
295
296
297
298 /* Copy the first part of user declarations.  */
299 #line 1 "asn1p_y.y"
300
301
302 #include <stdlib.h>
303 #include <stdio.h>
304 #include <string.h>
305 #include <stdarg.h>
306 #include <errno.h>
307 #include <assert.h>
308
309 #include "asn1parser.h"
310
311 #define YYPARSE_PARAM   param
312 #define YYPARSE_PARAM_TYPE      void **
313 #define YYERROR_VERBOSE
314 #define YYDEBUG 1
315 #define YYFPRINTF   prefixed_fprintf
316
317 /*
318  * Prefix parser debug with "PARSER: " for easier human eye scanning.
319  */
320 static int
321 __attribute__((format(printf, 2, 3)))
322 prefixed_fprintf(FILE *f, const char *fmt, ...) {
323     static int line_ended = 1;
324     va_list ap;
325     va_start(ap, fmt);
326     if(line_ended) {
327         fprintf(f, "PARSER: ");
328         line_ended = 0;
329     }
330     size_t len = strlen(fmt);
331     if(len && fmt[len-1] == '\n') {
332         line_ended = 1;
333     }
334     int ret = vfprintf(f, fmt, ap);
335     va_end(ap);
336     return ret;
337 }
338
339 int yylex(void);
340 static int yyerror(const char *msg);
341
342 #ifdef  YYBYACC
343 int yyparse(void **param);      /* byacc does not produce a prototype */
344 #endif
345 void asn1p_lexer_hack_push_opaque_state(void);
346 void asn1p_lexer_hack_enable_with_syntax(void);
347 void asn1p_lexer_hack_push_encoding_control(void);
348 #define yylineno        asn1p_lineno
349 extern int asn1p_lineno;
350 const char *asn1p_parse_debug_filename;
351 #define ASN_FILENAME asn1p_parse_debug_filename
352 int ext_num = 1;
353
354 /*
355  * Process directives as <ASN1C:RepresentAsPointer>
356  */
357 extern int asn1p_as_pointer;
358
359 /*
360  * This temporary variable is used to solve the shortcomings of 1-lookahead
361  * parser.
362  */
363 static struct AssignedIdentifier *saved_aid;
364
365 static asn1p_value_t *_convert_bitstring2binary(char *str, int base);
366 static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
367
368 static asn1p_module_t *currentModule;
369 #define NEW_EXPR()      (asn1p_expr_new(yylineno, currentModule))
370
371 #define checkmem(ptr)   do {                                            \
372                 if(!(ptr))                                              \
373                 return yyerror("Memory failure");                       \
374         } while(0)
375
376 #define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do {           \
377                 if(arg1->type != constr_type) {                         \
378                         int __ret;                                      \
379                         root = asn1p_constraint_new(yylineno, currentModule);   \
380                         checkmem(root);                                 \
381                         root->type = constr_type;                       \
382                         __ret = asn1p_constraint_insert(root,           \
383                                 arg1);                                  \
384                         checkmem(__ret == 0);                           \
385                 } else {                                                \
386                         root = arg1;                                    \
387                 }                                                       \
388                 if(arg2) {                                              \
389                         int __ret                                       \
390                         = asn1p_constraint_insert(root, arg2);          \
391                         checkmem(__ret == 0);                           \
392                 }                                                       \
393         } while(0)
394
395 #ifdef  AL_IMPORT
396 #error  AL_IMPORT DEFINED ELSEWHERE!
397 #endif
398 #define AL_IMPORT(to, where, from, field)                                      \
399     do {                                                                       \
400         if(!(from)) break;                                                     \
401         while(TQ_FIRST(&((from)->where))) {                                    \
402             TQ_ADD(&((to)->where), TQ_REMOVE(&((from)->where), field), field); \
403         }                                                                      \
404         assert(TQ_FIRST(&((from)->where)) == 0);                               \
405     } while(0)
406
407
408
409 /* Enabling traces.  */
410 #ifndef YYDEBUG
411 # define YYDEBUG 0
412 #endif
413
414 /* Enabling verbose error messages.  */
415 #ifdef YYERROR_VERBOSE
416 # undef YYERROR_VERBOSE
417 # define YYERROR_VERBOSE 1
418 #else
419 # define YYERROR_VERBOSE 0
420 #endif
421
422 /* Enabling the token table.  */
423 #ifndef YYTOKEN_TABLE
424 # define YYTOKEN_TABLE 0
425 #endif
426
427 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
428 typedef union YYSTYPE
429 #line 115 "asn1p_y.y"
430 {
431         asn1p_t                 *a_grammar;
432         asn1p_module_flags_e     a_module_flags;
433         asn1p_module_t          *a_module;
434         asn1p_expr_type_e        a_type;        /* ASN.1 Type */
435         asn1p_expr_t            *a_expr;        /* Constructed collection */
436         asn1p_constraint_t      *a_constr;      /* Constraint */
437         enum asn1p_constraint_type_e    a_ctype;/* Constraint type */
438         asn1p_xports_t          *a_xports;      /* IMports/EXports */
439         struct AssignedIdentifier a_aid;        /* Assigned Identifier */
440         asn1p_oid_t             *a_oid;         /* Object Identifier */
441         asn1p_oid_arc_t          a_oid_arc;     /* Single OID's arc */
442         struct asn1p_type_tag_s  a_tag;         /* A tag */
443         asn1p_ref_t             *a_ref;         /* Reference to custom type */
444         asn1p_wsyntx_t          *a_wsynt;       /* WITH SYNTAX contents */
445         asn1p_wsyntx_chunk_t    *a_wchunk;      /* WITH SYNTAX chunk */
446         struct asn1p_ref_component_s a_refcomp; /* Component of a reference */
447         asn1p_value_t           *a_value;       /* Number, DefinedValue, etc */
448         struct asn1p_param_s     a_parg;        /* A parameter argument */
449         asn1p_paramlist_t       *a_plist;       /* A pargs list */
450         struct asn1p_expr_marker_s a_marker;    /* OPTIONAL/DEFAULT */
451         enum asn1p_constr_pres_e a_pres;        /* PRESENT/ABSENT/OPTIONAL */
452         asn1c_integer_t          a_int;
453         double                   a_dbl;
454         char    *tv_str;
455         struct {
456                 char *buf;
457                 int len;
458         }       tv_opaque;
459         struct {
460                 char *name;
461                 struct asn1p_type_tag_s tag;
462         } tv_nametag;
463 }
464 /* Line 193 of yacc.c.  */
465 #line 465 "asn1p_y.c"
466         YYSTYPE;
467 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
468 # define YYSTYPE_IS_DECLARED 1
469 # define YYSTYPE_IS_TRIVIAL 1
470 #endif
471
472
473
474 /* Copy the second part of user declarations.  */
475
476
477 /* Line 216 of yacc.c.  */
478 #line 478 "asn1p_y.c"
479
480 #ifdef short
481 # undef short
482 #endif
483
484 #ifdef YYTYPE_UINT8
485 typedef YYTYPE_UINT8 yytype_uint8;
486 #else
487 typedef unsigned char yytype_uint8;
488 #endif
489
490 #ifdef YYTYPE_INT8
491 typedef YYTYPE_INT8 yytype_int8;
492 #elif (defined __STDC__ || defined __C99__FUNC__ \
493      || defined __cplusplus || defined _MSC_VER)
494 typedef signed char yytype_int8;
495 #else
496 typedef short int yytype_int8;
497 #endif
498
499 #ifdef YYTYPE_UINT16
500 typedef YYTYPE_UINT16 yytype_uint16;
501 #else
502 typedef unsigned short int yytype_uint16;
503 #endif
504
505 #ifdef YYTYPE_INT16
506 typedef YYTYPE_INT16 yytype_int16;
507 #else
508 typedef short int yytype_int16;
509 #endif
510
511 #ifndef YYSIZE_T
512 # ifdef __SIZE_TYPE__
513 #  define YYSIZE_T __SIZE_TYPE__
514 # elif defined size_t
515 #  define YYSIZE_T size_t
516 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
517      || defined __cplusplus || defined _MSC_VER)
518 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
519 #  define YYSIZE_T size_t
520 # else
521 #  define YYSIZE_T unsigned int
522 # endif
523 #endif
524
525 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
526
527 #ifndef YY_
528 # if defined YYENABLE_NLS && YYENABLE_NLS
529 #  if ENABLE_NLS
530 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
531 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
532 #  endif
533 # endif
534 # ifndef YY_
535 #  define YY_(msgid) msgid
536 # endif
537 #endif
538
539 /* Suppress unused-variable warnings by "using" E.  */
540 #if ! defined lint || defined __GNUC__
541 # define YYUSE(e) ((void) (e))
542 #else
543 # define YYUSE(e) /* empty */
544 #endif
545
546 /* Identity function, used to suppress warnings about constant conditions.  */
547 #ifndef lint
548 # define YYID(n) (n)
549 #else
550 #if (defined __STDC__ || defined __C99__FUNC__ \
551      || defined __cplusplus || defined _MSC_VER)
552 static int
553 YYID (int i)
554 #else
555 static int
556 YYID (i)
557     int i;
558 #endif
559 {
560   return i;
561 }
562 #endif
563
564 #if ! defined yyoverflow || YYERROR_VERBOSE
565
566 /* The parser invokes alloca or malloc; define the necessary symbols.  */
567
568 # ifdef YYSTACK_USE_ALLOCA
569 #  if YYSTACK_USE_ALLOCA
570 #   ifdef __GNUC__
571 #    define YYSTACK_ALLOC __builtin_alloca
572 #   elif defined __BUILTIN_VA_ARG_INCR
573 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
574 #   elif defined _AIX
575 #    define YYSTACK_ALLOC __alloca
576 #   elif defined _MSC_VER
577 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
578 #    define alloca _alloca
579 #   else
580 #    define YYSTACK_ALLOC alloca
581 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
582      || defined __cplusplus || defined _MSC_VER)
583 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
584 #     ifndef _STDLIB_H
585 #      define _STDLIB_H 1
586 #     endif
587 #    endif
588 #   endif
589 #  endif
590 # endif
591
592 # ifdef YYSTACK_ALLOC
593    /* Pacify GCC's `empty if-body' warning.  */
594 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
595 #  ifndef YYSTACK_ALLOC_MAXIMUM
596     /* The OS might guarantee only one guard page at the bottom of the stack,
597        and a page size can be as small as 4096 bytes.  So we cannot safely
598        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
599        to allow for a few compiler-allocated temporary stack slots.  */
600 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
601 #  endif
602 # else
603 #  define YYSTACK_ALLOC YYMALLOC
604 #  define YYSTACK_FREE YYFREE
605 #  ifndef YYSTACK_ALLOC_MAXIMUM
606 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
607 #  endif
608 #  if (defined __cplusplus && ! defined _STDLIB_H \
609        && ! ((defined YYMALLOC || defined malloc) \
610              && (defined YYFREE || defined free)))
611 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
612 #   ifndef _STDLIB_H
613 #    define _STDLIB_H 1
614 #   endif
615 #  endif
616 #  ifndef YYMALLOC
617 #   define YYMALLOC malloc
618 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
619      || defined __cplusplus || defined _MSC_VER)
620 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
621 #   endif
622 #  endif
623 #  ifndef YYFREE
624 #   define YYFREE free
625 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
626      || defined __cplusplus || defined _MSC_VER)
627 void free (void *); /* INFRINGES ON USER NAME SPACE */
628 #   endif
629 #  endif
630 # endif
631 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
632
633
634 #if (! defined yyoverflow \
635      && (! defined __cplusplus \
636          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
637
638 /* A type that is properly aligned for any stack member.  */
639 union yyalloc
640 {
641   yytype_int16 yyss;
642   YYSTYPE yyvs;
643   };
644
645 /* The size of the maximum gap between one aligned stack and the next.  */
646 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
647
648 /* The size of an array large to enough to hold all stacks, each with
649    N elements.  */
650 # define YYSTACK_BYTES(N) \
651      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
652       + YYSTACK_GAP_MAXIMUM)
653
654 /* Copy COUNT objects from FROM to TO.  The source and destination do
655    not overlap.  */
656 # ifndef YYCOPY
657 #  if defined __GNUC__ && 1 < __GNUC__
658 #   define YYCOPY(To, From, Count) \
659       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
660 #  else
661 #   define YYCOPY(To, From, Count)              \
662       do                                        \
663         {                                       \
664           YYSIZE_T yyi;                         \
665           for (yyi = 0; yyi < (Count); yyi++)   \
666             (To)[yyi] = (From)[yyi];            \
667         }                                       \
668       while (YYID (0))
669 #  endif
670 # endif
671
672 /* Relocate STACK from its old location to the new one.  The
673    local variables YYSIZE and YYSTACKSIZE give the old and new number of
674    elements in the stack, and YYPTR gives the new location of the
675    stack.  Advance YYPTR to a properly aligned location for the next
676    stack.  */
677 # define YYSTACK_RELOCATE(Stack)                                        \
678     do                                                                  \
679       {                                                                 \
680         YYSIZE_T yynewbytes;                                            \
681         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
682         Stack = &yyptr->Stack;                                          \
683         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
684         yyptr += yynewbytes / sizeof (*yyptr);                          \
685       }                                                                 \
686     while (YYID (0))
687
688 #endif
689
690 /* YYFINAL -- State number of the termination state.  */
691 #define YYFINAL  9
692 /* YYLAST -- Last index in YYTABLE.  */
693 #define YYLAST   919
694
695 /* YYNTOKENS -- Number of terminals.  */
696 #define YYNTOKENS  126
697 /* YYNNTS -- Number of nonterminals.  */
698 #define YYNNTS  147
699 /* YYNRULES -- Number of rules.  */
700 #define YYNRULES  342
701 /* YYNRULES -- Number of states.  */
702 #define YYNSTATES  522
703
704 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
705 #define YYUNDEFTOK  2
706 #define YYMAXUTOK   365
707
708 #define YYTRANSLATE(YYX)                                                \
709   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
710
711 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
712 static const yytype_uint8 yytranslate[] =
713 {
714        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
715        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
716        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
717        2,     2,     2,   122,     2,     2,     2,     2,     2,     2,
718      115,   116,     2,     2,   118,     2,   123,     2,     2,     2,
719        2,     2,     2,     2,     2,     2,     2,     2,   119,   117,
720      124,     2,     2,     2,   125,     2,     2,     2,     2,     2,
721        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
722        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
723        2,   120,     2,   121,   106,     2,     2,     2,     2,     2,
724        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
725        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
726        2,     2,     2,   113,   108,   114,     2,     2,     2,     2,
727        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
728        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
729        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
730        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
731        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
732        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
733        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
734        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
735        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
736        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
737        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
738        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
739        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
740        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
741       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
742       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
743       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
744       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
745       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
746       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
747       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
748       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
749       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
750      105,   107,   109,   110,   111,   112
751 };
752
753 #if YYDEBUG
754 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
755    YYRHS.  */
756 static const yytype_uint16 yyprhs[] =
757 {
758        0,     0,     3,     6,     8,    10,    13,    14,    24,    25,
759       27,    31,    34,    36,    39,    41,    46,    48,    49,    51,
760       53,    56,    59,    62,    65,    68,    71,    72,    74,    78,
761       80,    83,    85,    87,    89,    90,    94,    96,    97,    99,
762      103,   106,   107,   109,   111,   114,   115,   117,   122,   124,
763      128,   130,   134,   136,   137,   139,   143,   147,   150,   152,
764      156,   158,   162,   164,   168,   173,   175,   180,   184,   188,
765      195,   202,   204,   208,   210,   214,   218,   222,   226,   228,
766      232,   234,   236,   238,   240,   241,   243,   245,   249,   255,
767      259,   262,   266,   268,   270,   274,   277,   279,   281,   287,
768      288,   290,   292,   296,   299,   304,   308,   312,   316,   320,
769      324,   325,   327,   328,   335,   337,   340,   342,   344,   346,
770      350,   352,   356,   360,   362,   365,   368,   371,   375,   376,
771      379,   381,   383,   385,   390,   395,   400,   407,   414,   416,
772      421,   425,   427,   429,   433,   437,   441,   443,   447,   449,
773      451,   453,   455,   459,   463,   465,   470,   472,   474,   475,
774      479,   481,   483,   485,   487,   489,   491,   493,   495,   499,
775      501,   503,   505,   507,   510,   512,   514,   516,   518,   520,
776      523,   526,   528,   530,   533,   536,   538,   540,   542,   544,
777      546,   548,   551,   553,   558,   563,   569,   574,   578,   580,
778      582,   584,   586,   588,   590,   592,   594,   596,   598,   600,
779      602,   604,   606,   608,   610,   612,   614,   615,   617,   618,
780      620,   621,   623,   625,   629,   631,   634,   636,   638,   640,
781      642,   644,   648,   654,   656,   660,   662,   666,   668,   672,
782      674,   678,   680,   684,   686,   688,   690,   692,   694,   696,
783      698,   701,   704,   707,   710,   714,   716,   718,   720,   722,
784      724,   726,   728,   731,   733,   737,   741,   743,   745,   747,
785      751,   757,   759,   763,   767,   768,   770,   772,   774,   776,
786      778,   780,   782,   783,   789,   792,   794,   797,   800,   804,
787      806,   808,   812,   817,   819,   823,   826,   830,   832,   836,
788      837,   839,   841,   844,   846,   850,   852,   854,   858,   863,
789      868,   870,   874,   879,   884,   886,   888,   892,   894,   899,
790      904,   906,   908,   910,   912,   914,   915,   917,   920,   925,
791      926,   928,   930,   932,   933,   935,   937,   939,   941,   942,
792      944,   946,   948
793 };
794
795 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
796 static const yytype_int16 yyrhs[] =
797 {
798      127,     0,    -1,   104,   128,    -1,   128,    -1,   129,    -1,
799      128,   129,    -1,    -1,   268,   130,   131,    42,   135,     3,
800       29,   138,    47,    -1,    -1,   132,    -1,   113,   133,   114,
801       -1,   113,   114,    -1,   134,    -1,   133,   134,    -1,   270,
802       -1,   270,   115,    12,   116,    -1,    12,    -1,    -1,   136,
803       -1,   137,    -1,   136,   137,    -1,    49,    92,    -1,    60,
804       92,    -1,    28,    92,    -1,    51,    61,    -1,    18,    65,
805       -1,    -1,   139,    -1,   151,   143,   140,    -1,   141,    -1,
806      140,   141,    -1,   158,    -1,   193,    -1,   156,    -1,    -1,
807       46,    18,   142,    -1,   204,    -1,    -1,   144,    -1,    62,
808      145,   117,    -1,    62,    54,    -1,    -1,   146,    -1,   148,
809       -1,   146,   148,    -1,    -1,   132,    -1,   149,    54,   268,
810      147,    -1,   150,    -1,   149,   118,   150,    -1,   268,    -1,
811      268,   113,   114,    -1,   270,    -1,    -1,   152,    -1,    50,
812      153,   117,    -1,    50,    25,   117,    -1,    50,   117,    -1,
813      154,    -1,   153,   118,   154,    -1,   268,    -1,   268,   113,
814      114,    -1,   270,    -1,   113,   214,   114,    -1,   268,   178,
815        3,   155,    -1,   187,    -1,   187,   113,   161,   114,    -1,
816      268,     3,   178,    -1,   268,     3,   168,    -1,   268,   113,
817      159,   114,     3,   178,    -1,   268,   113,   159,   114,     3,
818      168,    -1,   160,    -1,   159,   118,   160,    -1,   268,    -1,
819      268,   119,   270,    -1,   268,   119,   268,    -1,   201,   119,
820      270,    -1,   201,   119,   268,    -1,   162,    -1,   161,   118,
821      162,    -1,   181,    -1,   196,    -1,   197,    -1,   155,    -1,
822       -1,   164,    -1,   165,    -1,   164,   118,   165,    -1,   164,
823      118,     4,   164,     5,    -1,   270,   182,   250,    -1,   182,
824      250,    -1,    38,    76,   182,    -1,   177,    -1,   167,    -1,
825      166,   118,   167,    -1,   270,   182,    -1,   177,    -1,   182,
826       -1,    36,   113,   170,   114,   172,    -1,    -1,    96,    -1,
827      171,    -1,   170,   118,   171,    -1,    19,   250,    -1,    20,
828      178,   169,   250,    -1,    20,   191,   250,    -1,    20,   192,
829      250,    -1,    19,   191,   250,    -1,    19,   178,   250,    -1,
830       19,   192,   250,    -1,    -1,   173,    -1,    -1,   103,    90,
831      113,   174,   175,   114,    -1,   176,    -1,   175,   176,    -1,
832        6,    -1,    21,    -1,   190,    -1,   120,   175,   121,    -1,
833      111,    -1,   111,   122,   197,    -1,   111,   122,   261,    -1,
834      179,    -1,   263,   181,    -1,   157,   208,    -1,   185,   208,
835       -1,   263,   184,   208,    -1,    -1,   183,   185,    -1,   186,
836       -1,   157,    -1,   203,    -1,    35,   113,   166,   114,    -1,
837       86,   113,   163,   114,    -1,    87,   113,   163,   114,    -1,
838       86,   209,    76,   269,   263,   184,    -1,    87,   209,    76,
839      269,   263,   184,    -1,    26,    -1,    26,    43,    33,   270,
840       -1,    64,    76,   187,    -1,    17,    -1,    18,    -1,    17,
841      123,   268,    -1,    18,   123,   268,    -1,    18,   123,   188,
842       -1,   189,    -1,   188,   123,   189,    -1,   190,    -1,    19,
843       -1,    20,    -1,    19,    -1,   191,   123,    19,    -1,   191,
844      123,    20,    -1,    18,    -1,   270,   178,     3,   194,    -1,
845      196,    -1,   197,    -1,    -1,   113,   195,   199,    -1,    71,
846       -1,    53,    -1,    94,    -1,   261,    -1,   262,    -1,   198,
847       -1,   228,    -1,   272,    -1,   268,   123,   270,    -1,     9,
848       -1,    15,    -1,    16,    -1,   200,    -1,   199,     7,    -1,
849        7,    -1,   270,    -1,    32,    -1,    71,    -1,    84,    -1,
850       75,    89,    -1,    73,    59,    -1,    85,    -1,    52,    -1,
851       44,    79,    -1,    34,    89,    -1,    99,    -1,    55,    -1,
852      204,    -1,   202,    -1,    66,    -1,    48,    -1,    30,    89,
853       -1,   201,    -1,    66,   113,   254,   114,    -1,    48,   113,
854      258,   114,    -1,    30,    89,   113,   256,   114,    -1,    22,
855      113,   252,   114,    -1,    22,   113,   114,    -1,    31,    -1,
856       56,    -1,    57,    -1,    58,    -1,    67,    -1,    72,    -1,
857       82,    -1,    91,    -1,    93,    -1,    98,    -1,   100,    -1,
858      101,    -1,   102,    -1,    74,    -1,   108,    -1,   109,    -1,
859      106,    -1,   107,    -1,    -1,   210,    -1,    -1,   211,    -1,
860       -1,   210,    -1,   222,    -1,   115,   212,   116,    -1,   210,
861       -1,   211,   210,    -1,   213,    -1,   239,    -1,   214,    -1,
862      111,    -1,   215,    -1,   215,   118,   111,    -1,   215,   118,
863      111,   118,   215,    -1,   216,    -1,    25,   105,   219,    -1,
864      217,    -1,   216,   205,   217,    -1,   218,    -1,   217,   206,
865      218,    -1,   219,    -1,   219,   105,   219,    -1,   220,    -1,
866      115,   215,   116,    -1,   227,    -1,   229,    -1,   221,    -1,
867      222,    -1,   230,    -1,   223,    -1,   224,    -1,    54,   210,
868       -1,    88,   210,    -1,    78,     9,    -1,    78,   270,    -1,
869      225,   243,   226,    -1,   227,    -1,    69,    -1,   227,    -1,
870       68,    -1,   194,    -1,     8,    -1,    10,    -1,    63,   178,
871       -1,   180,    -1,   103,    37,   231,    -1,   103,    38,   232,
872       -1,   210,    -1,   233,    -1,   234,    -1,   113,   235,   114,
873       -1,   113,   111,   118,   235,   114,    -1,   236,    -1,   235,
874      118,   236,    -1,   272,   207,   237,    -1,    -1,   238,    -1,
875       81,    -1,    23,    -1,    77,    -1,   240,    -1,   244,    -1,
876      242,    -1,    -1,    39,    33,   113,   241,   199,    -1,    40,
877      178,    -1,   110,    -1,   110,   124,    -1,   124,   110,    -1,
878      124,   110,   124,    -1,   245,    -1,   246,    -1,   113,   268,
879      114,    -1,   245,   113,   247,   114,    -1,   248,    -1,   247,
880      118,   248,    -1,   125,   249,    -1,   125,   123,   249,    -1,
881      270,    -1,   249,   123,   270,    -1,    -1,   251,    -1,    77,
882       -1,    41,   194,    -1,   253,    -1,   252,   118,   253,    -1,
883      270,    -1,   255,    -1,   254,   118,   255,    -1,   270,   115,
884      261,   116,    -1,   270,   115,   197,   116,    -1,   257,    -1,
885      256,   118,   257,    -1,   270,   115,    12,   116,    -1,   270,
886      115,   197,   116,    -1,   259,    -1,   260,    -1,   259,   118,
887      260,    -1,   270,    -1,   270,   115,   261,   116,    -1,   270,
888      115,   197,   116,    -1,   261,    -1,   111,    -1,    12,    -1,
889       13,    -1,    14,    -1,    -1,   264,    -1,   265,   267,    -1,
890      120,   266,    12,   121,    -1,    -1,    97,    -1,    27,    -1,
891       83,    -1,    -1,    60,    -1,    49,    -1,    17,    -1,    18,
892       -1,    -1,   270,    -1,    11,    -1,   270,    -1,   271,    -1
893 };
894
895 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
896 static const yytype_uint16 yyrline[] =
897 {
898        0,   414,   414,   417,   423,   428,   445,   445,   474,   475,
899      479,   482,   488,   494,   503,   507,   511,   521,   522,   531,
900      534,   543,   546,   549,   552,   556,   577,   578,   587,   600,
901      603,   620,   627,   641,   649,   648,   662,   675,   676,   679,
902      689,   695,   696,   699,   704,   711,   712,   716,   727,   732,
903      739,   745,   751,   761,   762,   774,   777,   780,   788,   793,
904      800,   806,   812,   821,   824,   844,   854,   874,   880,   896,
905      902,   910,   919,   930,   934,   942,   950,   958,   969,   974,
906      981,   982,   990,   998,  1021,  1022,  1025,  1030,  1034,  1042,
907     1049,  1055,  1062,  1068,  1073,  1080,  1085,  1088,  1095,  1105,
908     1106,  1110,  1117,  1127,  1137,  1148,  1158,  1169,  1179,  1190,
909     1202,  1203,  1210,  1209,  1218,  1222,  1229,  1233,  1236,  1240,
910     1246,  1254,  1263,  1274,  1277,  1284,  1307,  1330,  1354,  1361,
911     1380,  1381,  1384,  1385,  1391,  1397,  1403,  1413,  1423,  1429,
912     1441,  1456,  1464,  1472,  1483,  1494,  1516,  1524,  1533,  1537,
913     1542,  1551,  1556,  1561,  1569,  1592,  1602,  1603,  1604,  1604,
914     1612,  1617,  1622,  1627,  1628,  1629,  1630,  1634,  1635,  1653,
915     1657,  1662,  1670,  1679,  1694,  1695,  1701,  1702,  1703,  1704,
916     1705,  1706,  1707,  1708,  1709,  1710,  1711,  1712,  1713,  1720,
917     1721,  1722,  1726,  1732,  1737,  1742,  1747,  1752,  1761,  1762,
918     1766,  1770,  1771,  1772,  1773,  1774,  1778,  1779,  1780,  1781,
919     1785,  1786,  1793,  1793,  1794,  1794,  1798,  1799,  1803,  1804,
920     1808,  1809,  1810,  1814,  1820,  1821,  1830,  1830,  1832,  1835,
921     1839,  1840,  1846,  1857,  1858,  1864,  1865,  1871,  1872,  1879,
922     1880,  1886,  1887,  1898,  1904,  1910,  1911,  1913,  1914,  1915,
923     1920,  1925,  1930,  1935,  1947,  1956,  1957,  1963,  1964,  1969,
924     1972,  1977,  1985,  1991,  2003,  2006,  2012,  2013,  2013,  2014,
925     2016,  2029,  2034,  2040,  2054,  2055,  2059,  2062,  2065,  2073,
926     2074,  2075,  2080,  2079,  2091,  2100,  2101,  2102,  2103,  2106,
927     2109,  2118,  2134,  2140,  2146,  2160,  2171,  2187,  2190,  2210,
928     2214,  2218,  2222,  2229,  2234,  2240,  2249,  2254,  2261,  2269,
929     2279,  2284,  2291,  2299,  2309,  2324,  2329,  2336,  2343,  2351,
930     2359,  2366,  2377,  2381,  2388,  2419,  2420,  2424,  2431,  2437,
931     2438,  2439,  2440,  2444,  2445,  2446,  2450,  2454,  2462,  2463,
932     2469,  2476,  2483
933 };
934 #endif
935
936 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
937 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
938    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
939 static const char *const yytname[] =
940 {
941   "$end", "error", "$undefined", "TOK_PPEQ", "TOK_VBracketLeft",
942   "TOK_VBracketRight", "TOK_whitespace", "TOK_opaque", "TOK_bstring",
943   "TOK_cstring", "TOK_hstring", "\"identifier\"", "\"number\"",
944   "\"negative number\"", "TOK_realnumber", "TOK_tuple", "TOK_quadruple",
945   "TOK_typereference", "TOK_capitalreference", "TOK_typefieldreference",
946   "TOK_valuefieldreference", "TOK_Literal", "TOK_ExtValue_BIT_STRING",
947   "TOK_ABSENT", "TOK_ABSTRACT_SYNTAX", "TOK_ALL", "TOK_ANY",
948   "TOK_APPLICATION", "TOK_AUTOMATIC", "TOK_BEGIN", "TOK_BIT",
949   "TOK_BMPString", "TOK_BOOLEAN", "TOK_BY", "TOK_CHARACTER", "TOK_CHOICE",
950   "TOK_CLASS", "TOK_COMPONENT", "TOK_COMPONENTS", "TOK_CONSTRAINED",
951   "TOK_CONTAINING", "TOK_DEFAULT", "TOK_DEFINITIONS", "TOK_DEFINED",
952   "TOK_EMBEDDED", "TOK_ENCODED", "TOK_ENCODING_CONTROL", "TOK_END",
953   "TOK_ENUMERATED", "TOK_EXPLICIT", "TOK_EXPORTS", "TOK_EXTENSIBILITY",
954   "TOK_EXTERNAL", "TOK_FALSE", "TOK_FROM", "TOK_GeneralizedTime",
955   "TOK_GeneralString", "TOK_GraphicString", "TOK_IA5String",
956   "TOK_IDENTIFIER", "TOK_IMPLICIT", "TOK_IMPLIED", "TOK_IMPORTS",
957   "TOK_INCLUDES", "TOK_INSTANCE", "TOK_INSTRUCTIONS", "TOK_INTEGER",
958   "TOK_ISO646String", "TOK_MAX", "TOK_MIN", "TOK_MINUS_INFINITY",
959   "TOK_NULL", "TOK_NumericString", "TOK_OBJECT", "TOK_ObjectDescriptor",
960   "TOK_OCTET", "TOK_OF", "TOK_OPTIONAL", "TOK_PATTERN", "TOK_PDV",
961   "TOK_PLUS_INFINITY", "TOK_PRESENT", "TOK_PrintableString", "TOK_PRIVATE",
962   "TOK_REAL", "TOK_RELATIVE_OID", "TOK_SEQUENCE", "TOK_SET", "TOK_SIZE",
963   "TOK_STRING", "TOK_SYNTAX", "TOK_T61String", "TOK_TAGS",
964   "TOK_TeletexString", "TOK_TRUE", "TOK_TYPE_IDENTIFIER", "TOK_UNIQUE",
965   "TOK_UNIVERSAL", "TOK_UniversalString", "TOK_UTCTime", "TOK_UTF8String",
966   "TOK_VideotexString", "TOK_VisibleString", "TOK_WITH",
967   "\"UTF-8 byte order mark\"", "TOK_EXCEPT", "'^'", "TOK_INTERSECTION",
968   "'|'", "TOK_UNION", "\"..\"", "\"...\"", "\"concrete TypeDeclaration\"",
969   "'{'", "'}'", "'('", "')'", "';'", "','", "':'", "'['", "']'", "'!'",
970   "'.'", "'<'", "'@'", "$accept", "ParsedGrammar", "ModuleList",
971   "ModuleDefinition", "@1", "optObjectIdentifier", "ObjectIdentifier",
972   "ObjectIdentifierBody", "ObjectIdentifierElement",
973   "optModuleDefinitionFlags", "ModuleDefinitionFlags",
974   "ModuleDefinitionFlag", "optModuleBody", "ModuleBody", "AssignmentList",
975   "Assignment", "@2", "optImports", "ImportsDefinition",
976   "optImportsBundleSet", "ImportsBundleSet", "AssignedIdentifier",
977   "ImportsBundle", "ImportsList", "ImportsElement", "optExports",
978   "ExportsDefinition", "ExportsBody", "ExportsElement", "ValueSet",
979   "ValueSetTypeAssignment", "DefinedType", "DataTypeReference",
980   "ParameterArgumentList", "ParameterArgumentName", "ActualParameterList",
981   "ActualParameter", "optComponentTypeLists", "ComponentTypeLists",
982   "ComponentType", "AlternativeTypeLists", "AlternativeType",
983   "ObjectClass", "optUNIQUE", "FieldSpec", "ClassField", "optWithSyntax",
984   "WithSyntax", "@3", "WithSyntaxList", "WithSyntaxToken",
985   "ExtensionAndException", "Type", "TaggedType", "DefinedUntaggedType",
986   "UntaggedType", "MaybeIndirectTaggedType", "NSTD_IndirectMarker",
987   "MaybeIndirectTypeDeclaration", "TypeDeclaration",
988   "ConcreteTypeDeclaration", "ComplexTypeReference",
989   "ComplexTypeReferenceAmpList", "ComplexTypeReferenceElement",
990   "PrimitiveFieldReference", "FieldName", "DefinedObjectClass",
991   "ValueAssignment", "Value", "@4", "SimpleValue", "DefinedValue",
992   "RestrictedCharacterStringValue", "Opaque", "OpaqueFirstToken",
993   "BasicTypeId", "BasicTypeId_UniverationCompatible", "BuiltinType",
994   "BasicString", "UnionMark", "IntersectionMark", "optConstraint",
995   "optManyConstraints", "optSizeOrConstraint", "Constraint",
996   "ManyConstraints", "ConstraintSpec", "SubtypeConstraint",
997   "ElementSetSpecs", "ElementSetSpec", "Unions", "Intersections",
998   "IntersectionElements", "Elements", "SubtypeElements",
999   "PermittedAlphabet", "SizeConstraint", "PatternConstraint", "ValueRange",
1000   "LowerEndValue", "UpperEndValue", "SingleValue", "BitStringValue",
1001   "ContainedSubtype", "InnerTypeConstraints", "SingleTypeConstraint",
1002   "MultipleTypeConstraints", "FullSpecification", "PartialSpecification",
1003   "TypeConstraints", "NamedConstraint", "optPresenceConstraint",
1004   "PresenceConstraint", "GeneralConstraint", "UserDefinedConstraint", "@5",
1005   "ContentsConstraint", "ConstraintRangeSpec", "TableConstraint",
1006   "SimpleTableConstraint", "ComponentRelationConstraint", "AtNotationList",
1007   "AtNotationElement", "ComponentIdList", "optMarker", "Marker",
1008   "IdentifierList", "IdentifierElement", "NamedNumberList", "NamedNumber",
1009   "NamedBitList", "NamedBit", "Enumerations", "UniverationList",
1010   "UniverationElement", "SignedNumber", "RealValue", "optTag", "Tag",
1011   "TagTypeValue", "TagClass", "TagPlicit", "TypeRefName", "optIdentifier",
1012   "Identifier", "IdentifierAsReference", "IdentifierAsValue", 0
1013 };
1014 #endif
1015
1016 # ifdef YYPRINT
1017 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1018    token YYLEX-NUM.  */
1019 static const yytype_uint16 yytoknum[] =
1020 {
1021        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1022      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1023      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1024      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1025      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1026      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1027      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1028      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1029      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1030      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1031      355,   356,   357,   358,   359,   360,    94,   361,   124,   362,
1032      363,   364,   365,   123,   125,    40,    41,    59,    44,    58,
1033       91,    93,    33,    46,    60,    64
1034 };
1035 # endif
1036
1037 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1038 static const yytype_uint16 yyr1[] =
1039 {
1040        0,   126,   127,   127,   128,   128,   130,   129,   131,   131,
1041      132,   132,   133,   133,   134,   134,   134,   135,   135,   136,
1042      136,   137,   137,   137,   137,   137,   138,   138,   139,   140,
1043      140,   141,   141,   141,   142,   141,   141,   143,   143,   144,
1044      144,   145,   145,   146,   146,   147,   147,   148,   149,   149,
1045      150,   150,   150,   151,   151,   152,   152,   152,   153,   153,
1046      154,   154,   154,   155,   156,   157,   157,   158,   158,   158,
1047      158,   159,   159,   160,   160,   160,   160,   160,   161,   161,
1048      162,   162,   162,   162,   163,   163,   164,   164,   164,   165,
1049      165,   165,   165,   166,   166,   167,   167,   167,   168,   169,
1050      169,   170,   170,   171,   171,   171,   171,   171,   171,   171,
1051      172,   172,   174,   173,   175,   175,   176,   176,   176,   176,
1052      177,   177,   177,   178,   179,   180,   181,   182,   183,   184,
1053      185,   185,   186,   186,   186,   186,   186,   186,   186,   186,
1054      186,   187,   187,   187,   187,   187,   188,   188,   189,   190,
1055      190,   191,   191,   191,   192,   193,   194,   194,   195,   194,
1056      196,   196,   196,   196,   196,   196,   196,   197,   197,   198,
1057      198,   198,   199,   199,   200,   200,   201,   201,   201,   201,
1058      201,   201,   201,   201,   201,   201,   201,   201,   201,   202,
1059      202,   202,   203,   203,   203,   203,   203,   203,   204,   204,
1060      204,   204,   204,   204,   204,   204,   204,   204,   204,   204,
1061      204,   204,   205,   205,   206,   206,   207,   207,   208,   208,
1062      209,   209,   209,   210,   211,   211,   212,   212,   213,   214,
1063      214,   214,   214,   215,   215,   216,   216,   217,   217,   218,
1064      218,   219,   219,   220,   220,   220,   220,   220,   220,   220,
1065      221,   222,   223,   223,   224,   225,   225,   226,   226,   227,
1066      228,   228,   229,   229,   230,   230,   231,   232,   232,   233,
1067      234,   235,   235,   236,   237,   237,   238,   238,   238,   239,
1068      239,   239,   241,   240,   242,   243,   243,   243,   243,   244,
1069      244,   245,   246,   247,   247,   248,   248,   249,   249,   250,
1070      250,   251,   251,   252,   252,   253,   254,   254,   255,   255,
1071      256,   256,   257,   257,   258,   259,   259,   260,   260,   260,
1072      260,   260,   261,   261,   262,   263,   263,   264,   265,   266,
1073      266,   266,   266,   267,   267,   267,   268,   268,   269,   269,
1074      270,   271,   272
1075 };
1076
1077 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
1078 static const yytype_uint8 yyr2[] =
1079 {
1080        0,     2,     2,     1,     1,     2,     0,     9,     0,     1,
1081        3,     2,     1,     2,     1,     4,     1,     0,     1,     1,
1082        2,     2,     2,     2,     2,     2,     0,     1,     3,     1,
1083        2,     1,     1,     1,     0,     3,     1,     0,     1,     3,
1084        2,     0,     1,     1,     2,     0,     1,     4,     1,     3,
1085        1,     3,     1,     0,     1,     3,     3,     2,     1,     3,
1086        1,     3,     1,     3,     4,     1,     4,     3,     3,     6,
1087        6,     1,     3,     1,     3,     3,     3,     3,     1,     3,
1088        1,     1,     1,     1,     0,     1,     1,     3,     5,     3,
1089        2,     3,     1,     1,     3,     2,     1,     1,     5,     0,
1090        1,     1,     3,     2,     4,     3,     3,     3,     3,     3,
1091        0,     1,     0,     6,     1,     2,     1,     1,     1,     3,
1092        1,     3,     3,     1,     2,     2,     2,     3,     0,     2,
1093        1,     1,     1,     4,     4,     4,     6,     6,     1,     4,
1094        3,     1,     1,     3,     3,     3,     1,     3,     1,     1,
1095        1,     1,     3,     3,     1,     4,     1,     1,     0,     3,
1096        1,     1,     1,     1,     1,     1,     1,     1,     3,     1,
1097        1,     1,     1,     2,     1,     1,     1,     1,     1,     2,
1098        2,     1,     1,     2,     2,     1,     1,     1,     1,     1,
1099        1,     2,     1,     4,     4,     5,     4,     3,     1,     1,
1100        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1101        1,     1,     1,     1,     1,     1,     0,     1,     0,     1,
1102        0,     1,     1,     3,     1,     2,     1,     1,     1,     1,
1103        1,     3,     5,     1,     3,     1,     3,     1,     3,     1,
1104        3,     1,     3,     1,     1,     1,     1,     1,     1,     1,
1105        2,     2,     2,     2,     3,     1,     1,     1,     1,     1,
1106        1,     1,     2,     1,     3,     3,     1,     1,     1,     3,
1107        5,     1,     3,     3,     0,     1,     1,     1,     1,     1,
1108        1,     1,     0,     5,     2,     1,     2,     2,     3,     1,
1109        1,     3,     4,     1,     3,     2,     3,     1,     3,     0,
1110        1,     1,     2,     1,     3,     1,     1,     3,     4,     4,
1111        1,     3,     4,     4,     1,     1,     3,     1,     4,     4,
1112        1,     1,     1,     1,     1,     0,     1,     2,     4,     0,
1113        1,     1,     1,     0,     1,     1,     1,     1,     0,     1,
1114        1,     1,     1
1115 };
1116
1117 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1118    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
1119    means the default is an error.  */
1120 static const yytype_uint16 yydefact[] =
1121 {
1122        0,   336,   337,     0,     0,     3,     4,     6,     2,     1,
1123        5,     8,     0,     0,     9,   340,    16,    11,     0,    12,
1124       14,    17,    10,    13,     0,     0,     0,     0,     0,     0,
1125        0,    18,    19,     0,    25,    23,    21,    24,    22,     0,
1126       20,    15,    53,     0,     0,    27,    37,    54,     0,    57,
1127        0,    58,    60,    62,     7,    41,     0,    38,    56,    55,
1128        0,     0,    40,     0,    42,    43,     0,    48,    50,    52,
1129      198,     0,   199,   200,   201,   202,   203,   211,   204,   205,
1130      206,   207,   208,   209,   210,    28,    29,    33,    31,    32,
1131       36,   325,   325,    59,    61,    39,    44,     0,     0,     0,
1132       34,    30,   325,     0,   329,     0,   123,     0,   326,   333,
1133        0,    45,    49,    51,    35,     0,    68,    67,     0,   176,
1134        0,     0,   190,   182,   186,   189,   177,     0,     0,   178,
1135      181,   185,     0,    71,     0,   188,   187,    73,   331,   332,
1136      330,     0,     0,   141,   142,     0,   138,     0,     0,   190,
1137        0,   189,   220,   220,   131,   124,   218,   130,    65,   192,
1138      132,   335,   334,   327,     0,    46,    47,     0,   191,   184,
1139      183,   180,   179,     0,     0,     0,     0,     0,     0,    64,
1140        0,     0,     0,     0,   191,   325,     0,     0,     0,     0,
1141      325,     0,     0,   221,   222,   325,     0,   126,   224,   219,
1142        0,   260,   169,   261,   322,   323,   324,   170,   171,   161,
1143      160,   162,   158,   155,   156,   157,   165,   166,   163,   164,
1144        0,   341,   342,   167,   325,   325,     0,   101,   325,    72,
1145       77,    76,    75,    74,   328,   141,   142,     0,     0,   325,
1146      256,     0,     0,   229,     0,   218,   263,   259,     0,   230,
1147      233,   235,   237,   239,   241,   245,   246,   248,   249,     0,
1148      243,   244,   247,   143,   149,   150,   145,   146,   148,   144,
1149      197,     0,   303,   305,     0,     0,   120,     0,    93,    96,
1150       97,   128,   325,   321,     0,   314,   315,   320,   317,   140,
1151        0,   306,     0,   251,     0,     0,    85,    86,    92,   299,
1152      325,     0,   325,   158,     0,   226,   228,   227,   279,   281,
1153      280,   289,   290,   338,     0,   338,   225,   160,    83,     0,
1154       78,    80,    81,    82,     0,     0,   154,   151,     0,   301,
1155      299,   299,   299,   103,   300,    99,   299,   299,   110,     0,
1156       70,    69,     0,   250,   262,   252,   253,     0,     0,     0,
1157      125,    63,     0,   212,   213,     0,   214,   215,     0,     0,
1158      285,     0,     0,     0,   196,     0,   139,     0,   310,     0,
1159        0,   133,   325,     0,   218,    95,   194,     0,     0,   193,
1160        0,     0,   325,   134,   325,    90,   299,     0,   284,     0,
1161      223,     0,   325,   339,   135,   325,    66,     0,   174,   159,
1162      172,   175,   168,   302,   108,     0,   107,   109,   100,   299,
1163      105,   106,     0,    98,   111,   102,   234,   266,   264,     0,
1164      265,   267,   268,   242,   231,   236,   238,   240,   286,   287,
1165      258,   254,   257,   147,   304,   195,     0,     0,   121,   122,
1166       94,   129,   127,   316,     0,     0,   307,     0,     0,    91,
1167      325,    87,    89,   282,   291,     0,     0,   293,   128,   128,
1168       79,   173,   152,   153,   104,     0,     0,     0,   271,   216,
1169        0,   288,   311,     0,     0,   319,   318,   309,   308,     0,
1170        0,     0,   295,   297,   292,     0,   136,   137,   112,     0,
1171      269,     0,   274,   217,   232,   312,   313,    88,   283,   296,
1172        0,   294,     0,     0,   272,   277,   278,   276,   273,   275,
1173      298,   116,   117,     0,     0,   114,   118,   270,     0,   113,
1174      115,   119
1175 };
1176
1177 /* YYDEFGOTO[NTERM-NUM].  */
1178 static const yytype_int16 yydefgoto[] =
1179 {
1180       -1,     4,     5,     6,    11,    13,    14,    18,    19,    30,
1181       31,    32,    44,    45,    85,    86,   114,    56,    57,    63,
1182       64,   166,    65,    66,    67,    46,    47,    50,    51,   318,
1183       87,   245,    88,   132,   133,   319,   320,   295,   296,   297,
1184      277,   278,   116,   409,   226,   227,   413,   414,   502,   514,
1185      515,   298,   105,   106,   246,   321,   299,   373,   374,   156,
1186      157,   158,   266,   267,   516,   331,   332,    89,   247,   324,
1187      214,   215,   216,   399,   400,   159,   135,   160,   136,   355,
1188      358,   492,   197,   192,   198,   199,   304,   305,   248,   249,
1189      250,   251,   252,   253,   254,   255,   256,   257,   258,   259,
1190      431,   260,   217,   261,   262,   418,   420,   421,   422,   467,
1191      468,   508,   509,   307,   308,   480,   309,   362,   310,   311,
1192      312,   456,   457,   482,   333,   334,   271,   272,   290,   291,
1193      367,   368,   284,   285,   286,   218,   219,   281,   108,   109,
1194      141,   163,   220,   392,   221,   222,   223
1195 };
1196
1197 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1198    STATE-NUM.  */
1199 #define YYPACT_NINF -296
1200 static const yytype_int16 yypact[] =
1201 {
1202       51,  -296,  -296,   217,    41,   217,  -296,  -296,   217,  -296,
1203     -296,   -63,    53,    43,  -296,  -296,  -296,  -296,    70,  -296,
1204      -45,   204,  -296,  -296,    79,    32,    30,    38,   110,    87,
1205      200,   204,  -296,    95,  -296,  -296,  -296,  -296,  -296,   198,
1206     -296,  -296,   247,    12,   178,  -296,   174,  -296,   134,  -296,
1207      140,  -296,   183,  -296,  -296,    72,   663,  -296,  -296,  -296,
1208      213,   173,  -296,   187,   213,  -296,    50,  -296,   211,  -296,
1209     -296,   293,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,
1210     -296,  -296,  -296,  -296,  -296,   663,  -296,  -296,  -296,  -296,
1211     -296,    19,   219,  -296,  -296,  -296,  -296,   217,   213,   227,
1212     -296,  -296,    -2,   817,    68,   340,  -296,   740,  -296,   120,
1213      356,   -63,  -296,  -296,  -296,   249,  -296,  -296,   272,  -296,
1214      274,   285,  -296,  -296,  -296,  -296,  -296,   307,   278,  -296,
1215     -296,  -296,    13,  -296,   250,  -296,  -296,   251,  -296,  -296,
1216     -296,   359,   260,   264,   265,   261,   346,   301,   279,   281,
1217      315,   294,   113,   135,  -296,  -296,   280,  -296,   295,  -296,
1218     -296,  -296,  -296,  -296,   510,  -296,  -296,   290,  -296,  -296,
1219     -296,  -296,  -296,   406,   817,   213,   213,   289,   368,  -296,
1220      217,   309,    14,   378,   299,    29,   108,   318,   403,   280,
1221       61,   229,   339,  -296,  -296,    61,   341,  -296,  -296,   280,
1222      604,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,
1223     -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,
1224      296,  -296,  -296,  -296,    84,    28,    98,  -296,    -2,  -296,
1225     -296,  -296,  -296,  -296,  -296,   264,   265,   311,   280,   219,
1226     -296,   104,   300,  -296,   388,   280,  -296,  -296,   304,   302,
1227      237,   241,  -296,   320,  -296,  -296,  -296,  -296,  -296,   -18,
1228      -17,  -296,  -296,  -296,  -296,  -296,   303,  -296,  -296,  -296,
1229     -296,   138,  -296,  -296,   403,   403,   305,   167,  -296,  -296,
1230     -296,  -296,   219,  -296,   314,   312,  -296,  -296,   308,  -296,
1231      170,  -296,   317,  -296,   353,   319,   316,  -296,  -296,    -3,
1232      219,   402,   219,   217,   324,  -296,  -296,  -296,  -296,  -296,
1233     -296,   323,  -296,   403,   331,   403,  -296,   329,  -296,   172,
1234     -296,  -296,  -296,  -296,   282,   403,  -296,  -296,   510,  -296,
1235       -3,    10,    -3,  -296,  -296,   351,    10,    -3,   345,   290,
1236     -296,  -296,   496,  -296,  -296,  -296,  -296,   280,   336,   334,
1237     -296,  -296,   342,  -296,  -296,   496,  -296,  -296,   496,   496,
1238      328,   344,   262,   330,  -296,   403,  -296,   181,  -296,   343,
1239      248,  -296,    29,   740,   280,  -296,  -296,   108,   248,  -296,
1240      403,   248,   219,  -296,    24,  -296,    -3,   347,  -296,   349,
1241     -296,   348,   219,  -296,  -296,   219,  -296,   604,  -296,   448,
1242     -296,  -296,  -296,  -296,  -296,   332,  -296,  -296,  -296,    -3,
1243     -296,  -296,   371,  -296,  -296,  -296,  -296,  -296,  -296,    25,
1244     -296,  -296,  -296,  -296,   352,   241,  -296,  -296,  -296,   350,
1245     -296,  -296,  -296,  -296,  -296,  -296,   403,   196,  -296,  -296,
1246     -296,  -296,  -296,  -296,   361,   362,  -296,   364,   369,  -296,
1247       42,  -296,  -296,  -296,  -296,    22,   188,  -296,  -296,  -296,
1248     -296,  -296,  -296,  -296,  -296,   354,   357,   202,  -296,   280,
1249      388,  -296,  -296,   370,   373,  -296,  -296,  -296,  -296,    16,
1250      282,   403,   367,  -296,  -296,   348,  -296,  -296,  -296,   403,
1251     -296,   403,    77,  -296,  -296,  -296,  -296,  -296,   448,   367,
1252      403,  -296,    57,   207,  -296,  -296,  -296,  -296,  -296,  -296,
1253     -296,  -296,  -296,    57,    36,  -296,  -296,  -296,    39,  -296,
1254     -296,  -296
1255 };
1256
1257 /* YYPGOTO[NTERM-NUM].  */
1258 static const yytype_int16 yypgoto[] =
1259 {
1260     -296,  -296,   461,   326,  -296,  -296,   376,  -296,   447,  -296,
1261     -296,   441,  -296,  -296,  -296,   399,  -296,  -296,  -296,  -296,
1262     -296,  -296,   428,  -296,   395,  -296,  -296,  -296,   434,   355,
1263     -296,  -106,  -296,  -296,   321,  -296,    99,   322,    48,   115,
1264     -296,   128,   287,  -296,  -296,   163,  -296,  -296,  -296,     3,
1265     -196,  -172,   -82,  -296,  -296,   422,  -177,  -296,  -104,   157,
1266     -296,   358,  -296,   168,  -164,   310,   313,  -296,  -140,  -296,
1267     -191,  -188,  -296,    52,  -296,   -76,  -296,  -296,   -24,  -296,
1268     -296,  -296,  -227,   380,  -150,  -296,  -296,  -296,   360,  -237,
1269     -296,   179,   182,  -258,  -296,  -296,   205,  -296,  -296,  -296,
1270     -296,   175,  -296,  -296,  -296,  -296,  -296,  -296,  -296,    47,
1271       55,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,  -296,
1272     -296,  -296,    54,    60,  -220,  -296,  -296,   177,  -296,   164,
1273     -296,   107,  -296,  -296,   171,  -160,  -296,   -87,  -296,  -296,
1274     -296,  -296,    11,   232,   -12,  -296,  -295
1275 };
1276
1277 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
1278    positive, shift that token.  If negative, reduce the rule which
1279    number is the opposite.  If zero, do what YYDEFACT says.
1280    If YYTABLE_NINF, syntax error.  */
1281 #define YYTABLE_NINF -300
1282 static const yytype_int16 yytable[] =
1283 {
1284       20,   154,   193,   193,   107,   107,    20,   349,   280,   322,
1285      110,     7,   323,   279,     7,   107,     7,   268,   350,     7,
1286      117,   497,   102,    15,   213,    15,   287,   134,   450,     1,
1287        2,    53,    90,    15,   115,    15,    15,    48,   328,   293,
1288       15,     9,   511,    69,    92,   511,   326,   327,    53,   316,
1289       12,   328,    69,    15,    52,   264,   265,   512,   264,   265,
1290      512,    90,   294,   511,    15,    16,    68,    91,     1,     2,
1291       24,    52,    15,    92,   329,    68,   264,   265,   512,   385,
1292      294,    15,    16,    15,   416,    21,    69,   329,   343,     1,
1293        2,    33,   360,  -255,   154,   138,    91,    34,   134,   294,
1294      505,   427,   326,   327,    97,   375,   361,  -255,   111,    68,
1295      404,   406,   407,   345,   137,    15,   410,   411,   104,    15,
1296      204,   205,    35,   386,   469,   328,    62,   173,   270,    49,
1297       36,   174,   103,   405,   384,   276,   466,   107,   107,   104,
1298      276,   107,   330,   335,   104,   481,   341,   442,   104,   104,
1299      519,   139,   107,   276,   506,     3,   513,   344,   507,   513,
1300      521,   329,   104,   231,   233,   140,   452,    17,    98,   161,
1301      273,    37,   276,   282,   288,   -84,   292,   513,   300,    38,
1302      162,   104,   438,   300,    22,   137,   230,   232,   403,   464,
1303      444,   263,   269,   447,   469,   280,   469,   417,  -299,   268,
1304      279,   189,  -299,    39,   104,   449,   322,    15,   473,   323,
1305      439,    41,   338,     1,     2,   107,   339,   287,   445,   283,
1306      388,   448,    25,   189,    15,    54,   190,    42,   191,   346,
1307        1,     2,    26,   494,     1,     2,    55,   201,   202,   203,
1308       15,   204,   205,   206,   207,   208,   235,   236,   195,   474,
1309      191,    58,   364,    27,   237,    28,   365,    59,    60,    15,
1310      204,   205,   366,   369,    29,     1,     2,   154,   301,   302,
1311      201,   202,   203,    15,   204,   205,   206,   207,   208,     1,
1312        2,   371,   209,   238,   379,   372,   396,    94,   380,   398,
1313      397,   154,   239,    15,   -26,   435,    61,    43,   240,   436,
1314      210,   393,   484,   393,    95,   458,   485,   241,   459,   224,
1315      225,   100,   401,   402,   389,   209,   490,   189,   520,   493,
1316      491,   517,   520,   211,    99,   491,     1,     2,   264,   265,
1317      430,    10,   242,   210,    10,   143,   144,   347,   348,   104,
1318      243,   113,   303,   142,   244,   353,   354,   356,   357,   264,
1319      265,   462,   463,   273,   486,   487,   211,   194,   194,   164,
1320      282,   168,   167,   169,   170,   288,   171,   172,   292,   175,
1321      176,   177,   300,   178,   182,   212,   201,   202,   203,    15,
1322      204,   205,   206,   207,   208,   235,   236,   180,   181,   183,
1323      184,   187,   185,   237,   186,   191,   201,   202,   203,    15,
1324      204,   205,   206,   207,   208,   235,   236,   188,   200,   228,
1325      234,   274,   275,   237,    15,   313,   342,   315,   351,   325,
1326      352,   209,   238,   378,   369,   359,   363,   370,   376,   382,
1327      377,   239,   381,   383,   384,   387,   391,   240,   300,   210,
1328      390,   209,   238,   483,  -177,   394,   241,   408,   412,   419,
1329      423,   239,   428,   424,   429,   461,   189,   240,   437,   210,
1330      453,   465,   211,   454,     8,    23,   241,   488,   401,   483,
1331      470,   242,    40,   455,   471,   489,   189,   475,   476,   243,
1332      477,   212,   211,   244,   101,   478,   495,   165,   510,   496,
1333      500,   242,    96,   112,    93,   229,   460,   179,   479,   451,
1334      440,   212,   415,   244,   201,   202,   203,    15,   204,   205,
1335      206,   207,   208,   235,   236,   340,   518,   314,   201,   202,
1336      203,    15,   204,   205,   206,   207,   208,     1,     2,   155,
1337      441,   433,   498,   196,   425,   336,   503,   432,   337,   501,
1338      426,   499,   434,   472,   446,   289,   504,   395,   443,   209,
1339      238,   306,     0,     0,     0,     0,     0,     0,     0,   239,
1340        0,     0,     0,   209,     0,   240,     0,   210,     0,     0,
1341        0,     0,     0,     0,   241,     0,     0,     0,     0,     0,
1342        0,   210,     0,     0,   189,     0,     0,     0,     0,     0,
1343      211,     0,     0,     0,     0,     0,     0,     0,     0,   242,
1344        0,     0,     0,     0,   211,     0,     0,     0,     0,   212,
1345        0,   244,   201,   202,   203,    15,   204,   205,   206,   207,
1346      208,   235,   236,   212,     0,     0,   145,     0,     0,     0,
1347      146,     0,     0,     0,   147,    70,   119,     0,   120,   148,
1348        0,     0,     0,     0,     0,     0,     0,     0,   121,     0,
1349        0,     0,   149,     0,     0,     0,   123,   209,     0,   124,
1350       72,    73,    74,     0,     0,     0,     0,     0,   150,     0,
1351      151,    75,     0,     0,    15,   317,    76,   127,    77,   128,
1352        1,     2,     0,     0,     0,     0,    78,     0,   129,   130,
1353      152,   153,     0,     0,    70,    79,     0,    80,   211,     0,
1354        0,     0,    81,   131,    82,    83,    84,     0,     0,    71,
1355        0,     0,     0,     0,     0,     0,     0,   178,     0,    72,
1356       73,    74,     0,     0,     0,     0,     0,     0,     0,     0,
1357       75,     0,     0,     0,     0,    76,     0,    77,     0,     0,
1358        0,     0,     0,     0,     0,    78,     0,     0,     0,     0,
1359        0,     0,     0,     0,    79,     0,    80,   143,   144,     0,
1360        0,    81,   145,    82,    83,    84,   146,     0,     0,     0,
1361      147,    70,   119,     0,   120,   148,     0,     0,     0,     0,
1362        0,     0,     0,     0,   121,     0,     0,     0,   149,     0,
1363        0,     0,   123,     0,     0,   124,    72,    73,    74,     0,
1364        0,     0,     0,     0,   150,     0,   151,    75,     0,     0,
1365        0,   126,    76,   127,    77,   128,     0,     0,     0,     0,
1366        0,     0,    78,     0,   129,   130,   152,   153,     0,     0,
1367        0,    79,     0,    80,     1,     2,     0,     0,    81,   131,
1368       82,    83,    84,     0,     0,     0,     0,   118,    70,   119,
1369        0,   120,     0,     0,     0,     0,     0,     0,     0,     0,
1370        0,   121,     0,     0,     0,   122,     0,     0,     0,   123,
1371        0,     0,   124,    72,    73,    74,     0,     0,     0,     0,
1372        0,     0,     0,   125,    75,     0,     0,     0,   126,    76,
1373      127,    77,   128,     0,     0,     0,     0,     0,     0,    78,
1374        0,   129,   130,     0,     0,     0,     0,     0,    79,     0,
1375       80,     0,     0,     0,     0,    81,   131,    82,    83,    84
1376 };
1377
1378 static const yytype_int16 yycheck[] =
1379 {
1380       12,   107,   152,   153,    91,    92,    18,   244,   185,   200,
1381       92,     0,   200,   185,     3,   102,     5,   181,   245,     8,
1382      102,     5,     3,    11,   164,    11,   186,   103,     4,    17,
1383       18,    43,    56,    11,    36,    11,    11,    25,    41,   189,
1384       11,     0,     6,    55,    56,     6,    18,    19,    60,   199,
1385      113,    41,    64,    11,    43,    19,    20,    21,    19,    20,
1386       21,    85,    38,     6,    11,    12,    55,    56,    17,    18,
1387      115,    60,    11,    85,    77,    64,    19,    20,    21,   299,
1388       38,    11,    12,    11,   342,    42,    98,    77,   238,    17,
1389       18,    12,   110,   110,   200,    27,    85,    65,   174,    38,
1390       23,   359,    18,    19,    54,   282,   124,   124,    97,    98,
1391      330,   331,   332,     9,   103,    11,   336,   337,   120,    11,
1392       12,    13,    92,   300,   419,    41,    54,   114,   114,   117,
1393       92,   118,   113,   123,   118,   111,   111,   224,   225,   120,
1394      111,   228,   224,   225,   120,   123,   228,   374,   120,   120,
1395      114,    83,   239,   111,    77,   104,   120,   239,    81,   120,
1396      121,    77,   120,   175,   176,    97,   386,   114,   118,    49,
1397      182,    61,   111,   185,   186,   114,   188,   120,   190,    92,
1398       60,   120,   370,   195,   114,   174,   175,   176,   328,   409,
1399      378,   180,   181,   381,   489,   372,   491,   347,   114,   363,
1400      372,    88,   118,     3,   120,   382,   397,    11,    12,   397,
1401      370,   116,   114,    17,    18,   302,   118,   377,   378,   111,
1402      302,   381,    18,    88,    11,    47,   113,    29,   115,   241,
1403       17,    18,    28,   470,    17,    18,    62,     8,     9,    10,
1404       11,    12,    13,    14,    15,    16,    17,    18,   113,   437,
1405      115,   117,   114,    49,    25,    51,   118,   117,   118,    11,
1406       12,    13,   274,   275,    60,    17,    18,   373,    39,    40,
1407        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
1408       18,   114,    53,    54,   114,   118,   114,   114,   118,     7,
1409      118,   397,    63,    11,    47,   114,   113,    50,    69,   118,
1410       71,   313,   114,   315,   117,   392,   118,    78,   395,    19,
1411       20,    18,   324,   325,   303,    53,   114,    88,   514,   469,
1412      118,   114,   518,    94,   113,   118,    17,    18,    19,    20,
1413       68,     5,   103,    71,     8,    17,    18,    37,    38,   120,
1414      111,   114,   113,     3,   115,   108,   109,   106,   107,    19,
1415       20,    19,    20,   365,   458,   459,    94,   152,   153,     3,
1416      372,    89,   113,    89,    79,   377,    59,    89,   380,   119,
1417      119,    12,   384,   113,   113,   113,     8,     9,    10,    11,
1418       12,    13,    14,    15,    16,    17,    18,   123,   123,    43,
1419       89,    76,   113,    25,   113,   115,     8,     9,    10,    11,
1420       12,    13,    14,    15,    16,    17,    18,   113,   113,     3,
1421      121,    33,   113,    25,    11,    76,   105,    76,   114,   123,
1422      118,    53,    54,   115,   436,   105,   123,   122,   114,    76,
1423      118,    63,   115,   114,   118,    33,   113,    69,   450,    71,
1424      116,    53,    54,   455,   115,   114,    78,    96,   103,   113,
1425      116,    63,   124,   111,   110,     7,    88,    69,   115,    71,
1426      113,    90,    94,   114,     3,    18,    78,   113,   480,   481,
1427      118,   103,    31,   125,   124,   118,    88,   116,   116,   111,
1428      116,   113,    94,   115,    85,   116,   116,   111,   500,   116,
1429      123,   103,    64,    98,    60,   174,   397,   142,   450,   384,
1430      372,   113,   339,   115,     8,     9,    10,    11,    12,    13,
1431       14,    15,    16,    17,    18,   228,   513,   195,     8,     9,
1432       10,    11,    12,    13,    14,    15,    16,    17,    18,   107,
1433      373,   363,   480,   153,   355,   225,   489,   362,   225,   485,
1434      358,   481,   365,   436,   380,   187,   491,   315,   377,    53,
1435       54,   191,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,
1436       -1,    -1,    -1,    53,    -1,    69,    -1,    71,    -1,    -1,
1437       -1,    -1,    -1,    -1,    78,    -1,    -1,    -1,    -1,    -1,
1438       -1,    71,    -1,    -1,    88,    -1,    -1,    -1,    -1,    -1,
1439       94,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   103,
1440       -1,    -1,    -1,    -1,    94,    -1,    -1,    -1,    -1,   113,
1441       -1,   115,     8,     9,    10,    11,    12,    13,    14,    15,
1442       16,    17,    18,   113,    -1,    -1,    22,    -1,    -1,    -1,
1443       26,    -1,    -1,    -1,    30,    31,    32,    -1,    34,    35,
1444       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    44,    -1,
1445       -1,    -1,    48,    -1,    -1,    -1,    52,    53,    -1,    55,
1446       56,    57,    58,    -1,    -1,    -1,    -1,    -1,    64,    -1,
1447       66,    67,    -1,    -1,    11,    71,    72,    73,    74,    75,
1448       17,    18,    -1,    -1,    -1,    -1,    82,    -1,    84,    85,
1449       86,    87,    -1,    -1,    31,    91,    -1,    93,    94,    -1,
1450       -1,    -1,    98,    99,   100,   101,   102,    -1,    -1,    46,
1451       -1,    -1,    -1,    -1,    -1,    -1,    -1,   113,    -1,    56,
1452       57,    58,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1453       67,    -1,    -1,    -1,    -1,    72,    -1,    74,    -1,    -1,
1454       -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    -1,    -1,
1455       -1,    -1,    -1,    -1,    91,    -1,    93,    17,    18,    -1,
1456       -1,    98,    22,   100,   101,   102,    26,    -1,    -1,    -1,
1457       30,    31,    32,    -1,    34,    35,    -1,    -1,    -1,    -1,
1458       -1,    -1,    -1,    -1,    44,    -1,    -1,    -1,    48,    -1,
1459       -1,    -1,    52,    -1,    -1,    55,    56,    57,    58,    -1,
1460       -1,    -1,    -1,    -1,    64,    -1,    66,    67,    -1,    -1,
1461       -1,    71,    72,    73,    74,    75,    -1,    -1,    -1,    -1,
1462       -1,    -1,    82,    -1,    84,    85,    86,    87,    -1,    -1,
1463       -1,    91,    -1,    93,    17,    18,    -1,    -1,    98,    99,
1464      100,   101,   102,    -1,    -1,    -1,    -1,    30,    31,    32,
1465       -1,    34,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1466       -1,    44,    -1,    -1,    -1,    48,    -1,    -1,    -1,    52,
1467       -1,    -1,    55,    56,    57,    58,    -1,    -1,    -1,    -1,
1468       -1,    -1,    -1,    66,    67,    -1,    -1,    -1,    71,    72,
1469       73,    74,    75,    -1,    -1,    -1,    -1,    -1,    -1,    82,
1470       -1,    84,    85,    -1,    -1,    -1,    -1,    -1,    91,    -1,
1471       93,    -1,    -1,    -1,    -1,    98,    99,   100,   101,   102
1472 };
1473
1474 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1475    symbol of state STATE-NUM.  */
1476 static const yytype_uint16 yystos[] =
1477 {
1478        0,    17,    18,   104,   127,   128,   129,   268,   128,     0,
1479      129,   130,   113,   131,   132,    11,    12,   114,   133,   134,
1480      270,    42,   114,   134,   115,    18,    28,    49,    51,    60,
1481      135,   136,   137,    12,    65,    92,    92,    61,    92,     3,
1482      137,   116,    29,    50,   138,   139,   151,   152,    25,   117,
1483      153,   154,   268,   270,    47,    62,   143,   144,   117,   117,
1484      118,   113,    54,   145,   146,   148,   149,   150,   268,   270,
1485       31,    46,    56,    57,    58,    67,    72,    74,    82,    91,
1486       93,    98,   100,   101,   102,   140,   141,   156,   158,   193,
1487      204,   268,   270,   154,   114,   117,   148,    54,   118,   113,
1488       18,   141,     3,   113,   120,   178,   179,   263,   264,   265,
1489      178,   268,   150,   114,   142,    36,   168,   178,    30,    32,
1490       34,    44,    48,    52,    55,    66,    71,    73,    75,    84,
1491       85,    99,   159,   160,   201,   202,   204,   268,    27,    83,
1492       97,   266,     3,    17,    18,    22,    26,    30,    35,    48,
1493       64,    66,    86,    87,   157,   181,   185,   186,   187,   201,
1494      203,    49,    60,   267,     3,   132,   147,   113,    89,    89,
1495       79,    59,    89,   114,   118,   119,   119,    12,   113,   155,
1496      123,   123,   113,    43,    89,   113,   113,    76,   113,    88,
1497      113,   115,   209,   210,   222,   113,   209,   208,   210,   211,
1498      113,     8,     9,    10,    12,    13,    14,    15,    16,    53,
1499       71,    94,   113,   194,   196,   197,   198,   228,   261,   262,
1500      268,   270,   271,   272,    19,    20,   170,   171,     3,   160,
1501      268,   270,   268,   270,   121,    17,    18,    25,    54,    63,
1502       69,    78,   103,   111,   115,   157,   180,   194,   214,   215,
1503      216,   217,   218,   219,   220,   221,   222,   223,   224,   225,
1504      227,   229,   230,   268,    19,    20,   188,   189,   190,   268,
1505      114,   252,   253,   270,    33,   113,   111,   166,   167,   177,
1506      182,   263,   270,   111,   258,   259,   260,   261,   270,   187,
1507      254,   255,   270,   210,    38,   163,   164,   165,   177,   182,
1508      270,    39,    40,   113,   212,   213,   214,   239,   240,   242,
1509      244,   245,   246,    76,   163,    76,   210,    71,   155,   161,
1510      162,   181,   196,   197,   195,   123,    18,    19,    41,    77,
1511      178,   191,   192,   250,   251,   178,   191,   192,   114,   118,
1512      168,   178,   105,   210,   178,     9,   270,    37,    38,   215,
1513      208,   114,   118,   108,   109,   205,   106,   107,   206,   105,
1514      110,   124,   243,   123,   114,   118,   270,   256,   257,   270,
1515      122,   114,   118,   183,   184,   182,   114,   118,   115,   114,
1516      118,   115,    76,   114,   118,   250,   182,    33,   178,   268,
1517      116,   113,   269,   270,   114,   269,   114,   118,     7,   199,
1518      200,   270,   270,   194,   250,   123,   250,   250,    96,   169,
1519      250,   250,   103,   172,   173,   171,   219,   210,   231,   113,
1520      232,   233,   234,   116,   111,   217,   218,   219,   124,   110,
1521       68,   226,   227,   189,   253,   114,   118,   115,   197,   261,
1522      167,   185,   208,   260,   197,   261,   255,   197,   261,   182,
1523        4,   165,   250,   113,   114,   125,   247,   248,   263,   263,
1524      162,     7,    19,    20,   250,    90,   111,   235,   236,   272,
1525      118,   124,   257,    12,   197,   116,   116,   116,   116,   164,
1526      241,   123,   249,   270,   114,   118,   184,   184,   113,   118,
1527      114,   118,   207,   210,   215,   116,   116,     5,   199,   249,
1528      123,   248,   174,   235,   236,    23,    77,    81,   237,   238,
1529      270,     6,    21,   120,   175,   176,   190,   114,   175,   114,
1530      176,   121
1531 };
1532
1533 #define yyerrok         (yyerrstatus = 0)
1534 #define yyclearin       (yychar = YYEMPTY)
1535 #define YYEMPTY         (-2)
1536 #define YYEOF           0
1537
1538 #define YYACCEPT        goto yyacceptlab
1539 #define YYABORT         goto yyabortlab
1540 #define YYERROR         goto yyerrorlab
1541
1542
1543 /* Like YYERROR except do call yyerror.  This remains here temporarily
1544    to ease the transition to the new meaning of YYERROR, for GCC.
1545    Once GCC version 2 has supplanted version 1, this can go.  */
1546
1547 #define YYFAIL          goto yyerrlab
1548
1549 #define YYRECOVERING()  (!!yyerrstatus)
1550
1551 #define YYBACKUP(Token, Value)                                  \
1552 do                                                              \
1553   if (yychar == YYEMPTY && yylen == 1)                          \
1554     {                                                           \
1555       yychar = (Token);                                         \
1556       yylval = (Value);                                         \
1557       yytoken = YYTRANSLATE (yychar);                           \
1558       YYPOPSTACK (1);                                           \
1559       goto yybackup;                                            \
1560     }                                                           \
1561   else                                                          \
1562     {                                                           \
1563       yyerror (YY_("syntax error: cannot back up")); \
1564       YYERROR;                                                  \
1565     }                                                           \
1566 while (YYID (0))
1567
1568
1569 #define YYTERROR        1
1570 #define YYERRCODE       256
1571
1572
1573 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1574    If N is 0, then set CURRENT to the empty location which ends
1575    the previous symbol: RHS[0] (always defined).  */
1576
1577 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1578 #ifndef YYLLOC_DEFAULT
1579 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
1580     do                                                                  \
1581       if (YYID (N))                                                    \
1582         {                                                               \
1583           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
1584           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
1585           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
1586           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
1587         }                                                               \
1588       else                                                              \
1589         {                                                               \
1590           (Current).first_line   = (Current).last_line   =              \
1591             YYRHSLOC (Rhs, 0).last_line;                                \
1592           (Current).first_column = (Current).last_column =              \
1593             YYRHSLOC (Rhs, 0).last_column;                              \
1594         }                                                               \
1595     while (YYID (0))
1596 #endif
1597
1598
1599 /* YY_LOCATION_PRINT -- Print the location on the stream.
1600    This macro was not mandated originally: define only if we know
1601    we won't break user code: when these are the locations we know.  */
1602
1603 #ifndef YY_LOCATION_PRINT
1604 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1605 #  define YY_LOCATION_PRINT(File, Loc)                  \
1606      fprintf (File, "%d.%d-%d.%d",                      \
1607               (Loc).first_line, (Loc).first_column,     \
1608               (Loc).last_line,  (Loc).last_column)
1609 # else
1610 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1611 # endif
1612 #endif
1613
1614
1615 /* YYLEX -- calling `yylex' with the right arguments.  */
1616
1617 #ifdef YYLEX_PARAM
1618 # define YYLEX yylex (YYLEX_PARAM)
1619 #else
1620 # define YYLEX yylex ()
1621 #endif
1622
1623 /* Enable debugging if requested.  */
1624 #if YYDEBUG
1625
1626 # ifndef YYFPRINTF
1627 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1628 #  define YYFPRINTF fprintf
1629 # endif
1630
1631 # define YYDPRINTF(Args)                        \
1632 do {                                            \
1633   if (yydebug)                                  \
1634     YYFPRINTF Args;                             \
1635 } while (YYID (0))
1636
1637 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
1638 do {                                                                      \
1639   if (yydebug)                                                            \
1640     {                                                                     \
1641       YYFPRINTF (stderr, "%s ", Title);                                   \
1642       yy_symbol_print (stderr,                                            \
1643                   Type, Value); \
1644       YYFPRINTF (stderr, "\n");                                           \
1645     }                                                                     \
1646 } while (YYID (0))
1647
1648
1649 /*--------------------------------.
1650 | Print this symbol on YYOUTPUT.  |
1651 `--------------------------------*/
1652
1653 /*ARGSUSED*/
1654 #if (defined __STDC__ || defined __C99__FUNC__ \
1655      || defined __cplusplus || defined _MSC_VER)
1656 static void
1657 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1658 #else
1659 static void
1660 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1661     FILE *yyoutput;
1662     int yytype;
1663     YYSTYPE const * const yyvaluep;
1664 #endif
1665 {
1666   if (!yyvaluep)
1667     return;
1668 # ifdef YYPRINT
1669   if (yytype < YYNTOKENS)
1670     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1671 # else
1672   YYUSE (yyoutput);
1673 # endif
1674   switch (yytype)
1675     {
1676       default:
1677         break;
1678     }
1679 }
1680
1681
1682 /*--------------------------------.
1683 | Print this symbol on YYOUTPUT.  |
1684 `--------------------------------*/
1685
1686 #if (defined __STDC__ || defined __C99__FUNC__ \
1687      || defined __cplusplus || defined _MSC_VER)
1688 static void
1689 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1690 #else
1691 static void
1692 yy_symbol_print (yyoutput, yytype, yyvaluep)
1693     FILE *yyoutput;
1694     int yytype;
1695     YYSTYPE const * const yyvaluep;
1696 #endif
1697 {
1698   if (yytype < YYNTOKENS)
1699     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1700   else
1701     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1702
1703   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1704   YYFPRINTF (yyoutput, ")");
1705 }
1706
1707 /*------------------------------------------------------------------.
1708 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1709 | TOP (included).                                                   |
1710 `------------------------------------------------------------------*/
1711
1712 #if (defined __STDC__ || defined __C99__FUNC__ \
1713      || defined __cplusplus || defined _MSC_VER)
1714 static void
1715 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1716 #else
1717 static void
1718 yy_stack_print (bottom, top)
1719     yytype_int16 *bottom;
1720     yytype_int16 *top;
1721 #endif
1722 {
1723   YYFPRINTF (stderr, "Stack now");
1724   for (; bottom <= top; ++bottom)
1725     YYFPRINTF (stderr, " %d", *bottom);
1726   YYFPRINTF (stderr, "\n");
1727 }
1728
1729 # define YY_STACK_PRINT(Bottom, Top)                            \
1730 do {                                                            \
1731   if (yydebug)                                                  \
1732     yy_stack_print ((Bottom), (Top));                           \
1733 } while (YYID (0))
1734
1735
1736 /*------------------------------------------------.
1737 | Report that the YYRULE is going to be reduced.  |
1738 `------------------------------------------------*/
1739
1740 #if (defined __STDC__ || defined __C99__FUNC__ \
1741      || defined __cplusplus || defined _MSC_VER)
1742 static void
1743 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1744 #else
1745 static void
1746 yy_reduce_print (yyvsp, yyrule)
1747     YYSTYPE *yyvsp;
1748     int yyrule;
1749 #endif
1750 {
1751   int yynrhs = yyr2[yyrule];
1752   int yyi;
1753   unsigned long int yylno = yyrline[yyrule];
1754   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1755              yyrule - 1, yylno);
1756   /* The symbols being reduced.  */
1757   for (yyi = 0; yyi < yynrhs; yyi++)
1758     {
1759       fprintf (stderr, "   $%d = ", yyi + 1);
1760       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1761                        &(yyvsp[(yyi + 1) - (yynrhs)])
1762                                        );
1763       fprintf (stderr, "\n");
1764     }
1765 }
1766
1767 # define YY_REDUCE_PRINT(Rule)          \
1768 do {                                    \
1769   if (yydebug)                          \
1770     yy_reduce_print (yyvsp, Rule); \
1771 } while (YYID (0))
1772
1773 /* Nonzero means print parse trace.  It is left uninitialized so that
1774    multiple parsers can coexist.  */
1775 int yydebug;
1776 #else /* !YYDEBUG */
1777 # define YYDPRINTF(Args)
1778 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1779 # define YY_STACK_PRINT(Bottom, Top)
1780 # define YY_REDUCE_PRINT(Rule)
1781 #endif /* !YYDEBUG */
1782
1783
1784 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1785 #ifndef YYINITDEPTH
1786 # define YYINITDEPTH 200
1787 #endif
1788
1789 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1790    if the built-in stack extension method is used).
1791
1792    Do not make this value too large; the results are undefined if
1793    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1794    evaluated with infinite-precision integer arithmetic.  */
1795
1796 #ifndef YYMAXDEPTH
1797 # define YYMAXDEPTH 10000
1798 #endif
1799
1800 \f
1801
1802 #if YYERROR_VERBOSE
1803
1804 # ifndef yystrlen
1805 #  if defined __GLIBC__ && defined _STRING_H
1806 #   define yystrlen strlen
1807 #  else
1808 /* Return the length of YYSTR.  */
1809 #if (defined __STDC__ || defined __C99__FUNC__ \
1810      || defined __cplusplus || defined _MSC_VER)
1811 static YYSIZE_T
1812 yystrlen (const char *yystr)
1813 #else
1814 static YYSIZE_T
1815 yystrlen (yystr)
1816     const char *yystr;
1817 #endif
1818 {
1819   YYSIZE_T yylen;
1820   for (yylen = 0; yystr[yylen]; yylen++)
1821     continue;
1822   return yylen;
1823 }
1824 #  endif
1825 # endif
1826
1827 # ifndef yystpcpy
1828 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1829 #   define yystpcpy stpcpy
1830 #  else
1831 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1832    YYDEST.  */
1833 #if (defined __STDC__ || defined __C99__FUNC__ \
1834      || defined __cplusplus || defined _MSC_VER)
1835 static char *
1836 yystpcpy (char *yydest, const char *yysrc)
1837 #else
1838 static char *
1839 yystpcpy (yydest, yysrc)
1840     char *yydest;
1841     const char *yysrc;
1842 #endif
1843 {
1844   char *yyd = yydest;
1845   const char *yys = yysrc;
1846
1847   while ((*yyd++ = *yys++) != '\0')
1848     continue;
1849
1850   return yyd - 1;
1851 }
1852 #  endif
1853 # endif
1854
1855 # ifndef yytnamerr
1856 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1857    quotes and backslashes, so that it's suitable for yyerror.  The
1858    heuristic is that double-quoting is unnecessary unless the string
1859    contains an apostrophe, a comma, or backslash (other than
1860    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1861    null, do not copy; instead, return the length of what the result
1862    would have been.  */
1863 static YYSIZE_T
1864 yytnamerr (char *yyres, const char *yystr)
1865 {
1866   if (*yystr == '"')
1867     {
1868       YYSIZE_T yyn = 0;
1869       char const *yyp = yystr;
1870
1871       for (;;)
1872         switch (*++yyp)
1873           {
1874           case '\'':
1875           case ',':
1876             goto do_not_strip_quotes;
1877
1878           case '\\':
1879             if (*++yyp != '\\')
1880               goto do_not_strip_quotes;
1881             /* Fall through.  */
1882           default:
1883             if (yyres)
1884               yyres[yyn] = *yyp;
1885             yyn++;
1886             break;
1887
1888           case '"':
1889             if (yyres)
1890               yyres[yyn] = '\0';
1891             return yyn;
1892           }
1893     do_not_strip_quotes: ;
1894     }
1895
1896   if (! yyres)
1897     return yystrlen (yystr);
1898
1899   return yystpcpy (yyres, yystr) - yyres;
1900 }
1901 # endif
1902
1903 /* Copy into YYRESULT an error message about the unexpected token
1904    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
1905    including the terminating null byte.  If YYRESULT is null, do not
1906    copy anything; just return the number of bytes that would be
1907    copied.  As a special case, return 0 if an ordinary "syntax error"
1908    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
1909    size calculation.  */
1910 static YYSIZE_T
1911 yysyntax_error (char *yyresult, int yystate, int yychar)
1912 {
1913   int yyn = yypact[yystate];
1914
1915   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1916     return 0;
1917   else
1918     {
1919       int yytype = YYTRANSLATE (yychar);
1920       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1921       YYSIZE_T yysize = yysize0;
1922       YYSIZE_T yysize1;
1923       int yysize_overflow = 0;
1924       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1925       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1926       int yyx;
1927
1928 # if 0
1929       /* This is so xgettext sees the translatable formats that are
1930          constructed on the fly.  */
1931       YY_("syntax error, unexpected %s");
1932       YY_("syntax error, unexpected %s, expecting %s");
1933       YY_("syntax error, unexpected %s, expecting %s or %s");
1934       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1935       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1936 # endif
1937       char *yyfmt;
1938       char const *yyf;
1939       static char const yyunexpected[] = "syntax error, unexpected %s";
1940       static char const yyexpecting[] = ", expecting %s";
1941       static char const yyor[] = " or %s";
1942       char yyformat[sizeof yyunexpected
1943                     + sizeof yyexpecting - 1
1944                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1945                        * (sizeof yyor - 1))];
1946       char const *yyprefix = yyexpecting;
1947
1948       /* Start YYX at -YYN if negative to avoid negative indexes in
1949          YYCHECK.  */
1950       int yyxbegin = yyn < 0 ? -yyn : 0;
1951
1952       /* Stay within bounds of both yycheck and yytname.  */
1953       int yychecklim = YYLAST - yyn + 1;
1954       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1955       int yycount = 1;
1956
1957       yyarg[0] = yytname[yytype];
1958       yyfmt = yystpcpy (yyformat, yyunexpected);
1959
1960       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1961         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1962           {
1963             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1964               {
1965                 yycount = 1;
1966                 yysize = yysize0;
1967                 yyformat[sizeof yyunexpected - 1] = '\0';
1968                 break;
1969               }
1970             yyarg[yycount++] = yytname[yyx];
1971             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1972             yysize_overflow |= (yysize1 < yysize);
1973             yysize = yysize1;
1974             yyfmt = yystpcpy (yyfmt, yyprefix);
1975             yyprefix = yyor;
1976           }
1977
1978       yyf = YY_(yyformat);
1979       yysize1 = yysize + yystrlen (yyf);
1980       yysize_overflow |= (yysize1 < yysize);
1981       yysize = yysize1;
1982
1983       if (yysize_overflow)
1984         return YYSIZE_MAXIMUM;
1985
1986       if (yyresult)
1987         {
1988           /* Avoid sprintf, as that infringes on the user's name space.
1989              Don't have undefined behavior even if the translation
1990              produced a string with the wrong number of "%s"s.  */
1991           char *yyp = yyresult;
1992           int yyi = 0;
1993           while ((*yyp = *yyf) != '\0')
1994             {
1995               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1996                 {
1997                   yyp += yytnamerr (yyp, yyarg[yyi++]);
1998                   yyf += 2;
1999                 }
2000               else
2001                 {
2002                   yyp++;
2003                   yyf++;
2004                 }
2005             }
2006         }
2007       return yysize;
2008     }
2009 }
2010 #endif /* YYERROR_VERBOSE */
2011 \f
2012
2013 /*-----------------------------------------------.
2014 | Release the memory associated to this symbol.  |
2015 `-----------------------------------------------*/
2016
2017 /*ARGSUSED*/
2018 #if (defined __STDC__ || defined __C99__FUNC__ \
2019      || defined __cplusplus || defined _MSC_VER)
2020 static void
2021 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2022 #else
2023 static void
2024 yydestruct (yymsg, yytype, yyvaluep)
2025     const char *yymsg;
2026     int yytype;
2027     YYSTYPE *yyvaluep;
2028 #endif
2029 {
2030   YYUSE (yyvaluep);
2031
2032   if (!yymsg)
2033     yymsg = "Deleting";
2034   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2035
2036   switch (yytype)
2037     {
2038
2039       default:
2040         break;
2041     }
2042 }
2043 \f
2044
2045 /* Prevent warnings from -Wmissing-prototypes.  */
2046
2047 #ifdef YYPARSE_PARAM
2048 #if defined __STDC__ || defined __cplusplus
2049 int yyparse (void *YYPARSE_PARAM);
2050 #else
2051 int yyparse ();
2052 #endif
2053 #else /* ! YYPARSE_PARAM */
2054 #if defined __STDC__ || defined __cplusplus
2055 int yyparse (void);
2056 #else
2057 int yyparse ();
2058 #endif
2059 #endif /* ! YYPARSE_PARAM */
2060
2061
2062
2063 /* The look-ahead symbol.  */
2064 int yychar;
2065
2066 /* The semantic value of the look-ahead symbol.  */
2067 YYSTYPE yylval;
2068
2069 /* Number of syntax errors so far.  */
2070 int yynerrs;
2071
2072
2073
2074 /*----------.
2075 | yyparse.  |
2076 `----------*/
2077
2078 #ifdef YYPARSE_PARAM
2079 #if (defined __STDC__ || defined __C99__FUNC__ \
2080      || defined __cplusplus || defined _MSC_VER)
2081 int
2082 yyparse (void *YYPARSE_PARAM)
2083 #else
2084 int
2085 yyparse (YYPARSE_PARAM)
2086     void *YYPARSE_PARAM;
2087 #endif
2088 #else /* ! YYPARSE_PARAM */
2089 #if (defined __STDC__ || defined __C99__FUNC__ \
2090      || defined __cplusplus || defined _MSC_VER)
2091 int
2092 yyparse (void)
2093 #else
2094 int
2095 yyparse ()
2096
2097 #endif
2098 #endif
2099 {
2100   
2101   int yystate;
2102   int yyn;
2103   int yyresult;
2104   /* Number of tokens to shift before error messages enabled.  */
2105   int yyerrstatus;
2106   /* Look-ahead token as an internal (translated) token number.  */
2107   int yytoken = 0;
2108 #if YYERROR_VERBOSE
2109   /* Buffer for error messages, and its allocated size.  */
2110   char yymsgbuf[128];
2111   char *yymsg = yymsgbuf;
2112   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2113 #endif
2114
2115   /* Three stacks and their tools:
2116      `yyss': related to states,
2117      `yyvs': related to semantic values,
2118      `yyls': related to locations.
2119
2120      Refer to the stacks thru separate pointers, to allow yyoverflow
2121      to reallocate them elsewhere.  */
2122
2123   /* The state stack.  */
2124   yytype_int16 yyssa[YYINITDEPTH];
2125   yytype_int16 *yyss = yyssa;
2126   yytype_int16 *yyssp;
2127
2128   /* The semantic value stack.  */
2129   YYSTYPE yyvsa[YYINITDEPTH];
2130   YYSTYPE *yyvs = yyvsa;
2131   YYSTYPE *yyvsp;
2132
2133
2134
2135 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
2136
2137   YYSIZE_T yystacksize = YYINITDEPTH;
2138
2139   /* The variables used to return semantic value and location from the
2140      action routines.  */
2141   YYSTYPE yyval;
2142
2143
2144   /* The number of symbols on the RHS of the reduced rule.
2145      Keep to zero when no symbol should be popped.  */
2146   int yylen = 0;
2147
2148   YYDPRINTF ((stderr, "Starting parse\n"));
2149
2150   yystate = 0;
2151   yyerrstatus = 0;
2152   yynerrs = 0;
2153   yychar = YYEMPTY;             /* Cause a token to be read.  */
2154
2155   /* Initialize stack pointers.
2156      Waste one element of value and location stack
2157      so that they stay on the same level as the state stack.
2158      The wasted elements are never initialized.  */
2159
2160   yyssp = yyss;
2161   yyvsp = yyvs;
2162
2163   goto yysetstate;
2164
2165 /*------------------------------------------------------------.
2166 | yynewstate -- Push a new state, which is found in yystate.  |
2167 `------------------------------------------------------------*/
2168  yynewstate:
2169   /* In all cases, when you get here, the value and location stacks
2170      have just been pushed.  So pushing a state here evens the stacks.  */
2171   yyssp++;
2172
2173  yysetstate:
2174   *yyssp = yystate;
2175
2176   if (yyss + yystacksize - 1 <= yyssp)
2177     {
2178       /* Get the current used size of the three stacks, in elements.  */
2179       YYSIZE_T yysize = yyssp - yyss + 1;
2180
2181 #ifdef yyoverflow
2182       {
2183         /* Give user a chance to reallocate the stack.  Use copies of
2184            these so that the &'s don't force the real ones into
2185            memory.  */
2186         YYSTYPE *yyvs1 = yyvs;
2187         yytype_int16 *yyss1 = yyss;
2188
2189
2190         /* Each stack pointer address is followed by the size of the
2191            data in use in that stack, in bytes.  This used to be a
2192            conditional around just the two extra args, but that might
2193            be undefined if yyoverflow is a macro.  */
2194         yyoverflow (YY_("memory exhausted"),
2195                     &yyss1, yysize * sizeof (*yyssp),
2196                     &yyvs1, yysize * sizeof (*yyvsp),
2197
2198                     &yystacksize);
2199
2200         yyss = yyss1;
2201         yyvs = yyvs1;
2202       }
2203 #else /* no yyoverflow */
2204 # ifndef YYSTACK_RELOCATE
2205       goto yyexhaustedlab;
2206 # else
2207       /* Extend the stack our own way.  */
2208       if (YYMAXDEPTH <= yystacksize)
2209         goto yyexhaustedlab;
2210       yystacksize *= 2;
2211       if (YYMAXDEPTH < yystacksize)
2212         yystacksize = YYMAXDEPTH;
2213
2214       {
2215         yytype_int16 *yyss1 = yyss;
2216         union yyalloc *yyptr =
2217           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2218         if (! yyptr)
2219           goto yyexhaustedlab;
2220         YYSTACK_RELOCATE (yyss);
2221         YYSTACK_RELOCATE (yyvs);
2222
2223 #  undef YYSTACK_RELOCATE
2224         if (yyss1 != yyssa)
2225           YYSTACK_FREE (yyss1);
2226       }
2227 # endif
2228 #endif /* no yyoverflow */
2229
2230       yyssp = yyss + yysize - 1;
2231       yyvsp = yyvs + yysize - 1;
2232
2233
2234       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2235                   (unsigned long int) yystacksize));
2236
2237       if (yyss + yystacksize - 1 <= yyssp)
2238         YYABORT;
2239     }
2240
2241   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2242
2243   goto yybackup;
2244
2245 /*-----------.
2246 | yybackup.  |
2247 `-----------*/
2248 yybackup:
2249
2250   /* Do appropriate processing given the current state.  Read a
2251      look-ahead token if we need one and don't already have one.  */
2252
2253   /* First try to decide what to do without reference to look-ahead token.  */
2254   yyn = yypact[yystate];
2255   if (yyn == YYPACT_NINF)
2256     goto yydefault;
2257
2258   /* Not known => get a look-ahead token if don't already have one.  */
2259
2260   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
2261   if (yychar == YYEMPTY)
2262     {
2263       YYDPRINTF ((stderr, "Reading a token: "));
2264       yychar = YYLEX;
2265     }
2266
2267   if (yychar <= YYEOF)
2268     {
2269       yychar = yytoken = YYEOF;
2270       YYDPRINTF ((stderr, "Now at end of input.\n"));
2271     }
2272   else
2273     {
2274       yytoken = YYTRANSLATE (yychar);
2275       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2276     }
2277
2278   /* If the proper action on seeing token YYTOKEN is to reduce or to
2279      detect an error, take that action.  */
2280   yyn += yytoken;
2281   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2282     goto yydefault;
2283   yyn = yytable[yyn];
2284   if (yyn <= 0)
2285     {
2286       if (yyn == 0 || yyn == YYTABLE_NINF)
2287         goto yyerrlab;
2288       yyn = -yyn;
2289       goto yyreduce;
2290     }
2291
2292   if (yyn == YYFINAL)
2293     YYACCEPT;
2294
2295   /* Count tokens shifted since error; after three, turn off error
2296      status.  */
2297   if (yyerrstatus)
2298     yyerrstatus--;
2299
2300   /* Shift the look-ahead token.  */
2301   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2302
2303   /* Discard the shifted token unless it is eof.  */
2304   if (yychar != YYEOF)
2305     yychar = YYEMPTY;
2306
2307   yystate = yyn;
2308   *++yyvsp = yylval;
2309
2310   goto yynewstate;
2311
2312
2313 /*-----------------------------------------------------------.
2314 | yydefault -- do the default action for the current state.  |
2315 `-----------------------------------------------------------*/
2316 yydefault:
2317   yyn = yydefact[yystate];
2318   if (yyn == 0)
2319     goto yyerrlab;
2320   goto yyreduce;
2321
2322
2323 /*-----------------------------.
2324 | yyreduce -- Do a reduction.  |
2325 `-----------------------------*/
2326 yyreduce:
2327   /* yyn is the number of a rule to reduce with.  */
2328   yylen = yyr2[yyn];
2329
2330   /* If YYLEN is nonzero, implement the default value of the action:
2331      `$$ = $1'.
2332
2333      Otherwise, the following line sets YYVAL to garbage.
2334      This behavior is undocumented and Bison
2335      users should not rely upon it.  Assigning to YYVAL
2336      unconditionally makes the parser a bit smaller, and it avoids a
2337      GCC warning that YYVAL may be used uninitialized.  */
2338   yyval = yyvsp[1-yylen];
2339
2340
2341   YY_REDUCE_PRINT (yyn);
2342   switch (yyn)
2343     {
2344         case 2:
2345 #line 414 "asn1p_y.y"
2346     {
2347                 *(void **)param = (yyvsp[(2) - (2)].a_grammar);
2348         }
2349     break;
2350
2351   case 3:
2352 #line 417 "asn1p_y.y"
2353     {
2354                 *(void **)param = (yyvsp[(1) - (1)].a_grammar);
2355         }
2356     break;
2357
2358   case 4:
2359 #line 423 "asn1p_y.y"
2360     {
2361                 (yyval.a_grammar) = asn1p_new();
2362                 checkmem((yyval.a_grammar));
2363                 TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(1) - (1)].a_module), mod_next);
2364         }
2365     break;
2366
2367   case 5:
2368 #line 428 "asn1p_y.y"
2369     {
2370                 (yyval.a_grammar) = (yyvsp[(1) - (2)].a_grammar);
2371                 TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(2) - (2)].a_module), mod_next);
2372         }
2373     break;
2374
2375   case 6:
2376 #line 445 "asn1p_y.y"
2377     { currentModule = asn1p_module_new(); }
2378     break;
2379
2380   case 7:
2381 #line 450 "asn1p_y.y"
2382     {
2383
2384                 (yyval.a_module) = currentModule;
2385
2386                 if((yyvsp[(8) - (9)].a_module)) {
2387                         asn1p_module_t tmp = *((yyval.a_module));
2388                         *((yyval.a_module)) = *((yyvsp[(8) - (9)].a_module));
2389                         *((yyvsp[(8) - (9)].a_module)) = tmp;
2390                         asn1p_module_free((yyvsp[(8) - (9)].a_module));
2391                 } else {
2392                         /* There's a chance that a module is just plain empty */
2393                 }
2394
2395                 (yyval.a_module)->ModuleName = (yyvsp[(1) - (9)].tv_str);
2396                 (yyval.a_module)->module_oid = (yyvsp[(3) - (9)].a_oid);
2397                 (yyval.a_module)->module_flags = (yyvsp[(5) - (9)].a_module_flags);
2398         }
2399     break;
2400
2401   case 8:
2402 #line 474 "asn1p_y.y"
2403     { (yyval.a_oid) = 0; }
2404     break;
2405
2406   case 9:
2407 #line 475 "asn1p_y.y"
2408     { (yyval.a_oid) = (yyvsp[(1) - (1)].a_oid); }
2409     break;
2410
2411   case 10:
2412 #line 479 "asn1p_y.y"
2413     {
2414                 (yyval.a_oid) = (yyvsp[(2) - (3)].a_oid);
2415         }
2416     break;
2417
2418   case 11:
2419 #line 482 "asn1p_y.y"
2420     {
2421                 (yyval.a_oid) = 0;
2422         }
2423     break;
2424
2425   case 12:
2426 #line 488 "asn1p_y.y"
2427     {
2428                 (yyval.a_oid) = asn1p_oid_new();
2429                 asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(1) - (1)].a_oid_arc));
2430                 if((yyvsp[(1) - (1)].a_oid_arc).name)
2431                         free((yyvsp[(1) - (1)].a_oid_arc).name);
2432         }
2433     break;
2434
2435   case 13:
2436 #line 494 "asn1p_y.y"
2437     {
2438                 (yyval.a_oid) = (yyvsp[(1) - (2)].a_oid);
2439                 asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(2) - (2)].a_oid_arc));
2440                 if((yyvsp[(2) - (2)].a_oid_arc).name)
2441                         free((yyvsp[(2) - (2)].a_oid_arc).name);
2442         }
2443     break;
2444
2445   case 14:
2446 #line 503 "asn1p_y.y"
2447     {                                   /* iso */
2448                 (yyval.a_oid_arc).name = (yyvsp[(1) - (1)].tv_str);
2449                 (yyval.a_oid_arc).number = -1;
2450         }
2451     break;
2452
2453   case 15:
2454 #line 507 "asn1p_y.y"
2455     {           /* iso(1) */
2456                 (yyval.a_oid_arc).name = (yyvsp[(1) - (4)].tv_str);
2457                 (yyval.a_oid_arc).number = (yyvsp[(3) - (4)].a_int);
2458         }
2459     break;
2460
2461   case 16:
2462 #line 511 "asn1p_y.y"
2463     {                                   /* 1 */
2464                 (yyval.a_oid_arc).name = 0;
2465                 (yyval.a_oid_arc).number = (yyvsp[(1) - (1)].a_int);
2466         }
2467     break;
2468
2469   case 17:
2470 #line 521 "asn1p_y.y"
2471     { (yyval.a_module_flags) = MSF_NOFLAGS; }
2472     break;
2473
2474   case 18:
2475 #line 522 "asn1p_y.y"
2476     {
2477                 (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags);
2478         }
2479     break;
2480
2481   case 19:
2482 #line 531 "asn1p_y.y"
2483     {
2484                 (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags);
2485         }
2486     break;
2487
2488   case 20:
2489 #line 534 "asn1p_y.y"
2490     {
2491                 (yyval.a_module_flags) = (yyvsp[(1) - (2)].a_module_flags) | (yyvsp[(2) - (2)].a_module_flags);
2492         }
2493     break;
2494
2495   case 21:
2496 #line 543 "asn1p_y.y"
2497     {
2498                 (yyval.a_module_flags) = MSF_EXPLICIT_TAGS;
2499         }
2500     break;
2501
2502   case 22:
2503 #line 546 "asn1p_y.y"
2504     {
2505                 (yyval.a_module_flags) = MSF_IMPLICIT_TAGS;
2506         }
2507     break;
2508
2509   case 23:
2510 #line 549 "asn1p_y.y"
2511     {
2512                 (yyval.a_module_flags) = MSF_AUTOMATIC_TAGS;
2513         }
2514     break;
2515
2516   case 24:
2517 #line 552 "asn1p_y.y"
2518     {
2519                 (yyval.a_module_flags) = MSF_EXTENSIBILITY_IMPLIED;
2520         }
2521     break;
2522
2523   case 25:
2524 #line 556 "asn1p_y.y"
2525     {
2526                 /* X.680Amd1 specifies TAG and XER */
2527                 if(strcmp((yyvsp[(1) - (2)].tv_str), "TAG") == 0) {
2528                         (yyval.a_module_flags) = MSF_TAG_INSTRUCTIONS;
2529                 } else if(strcmp((yyvsp[(1) - (2)].tv_str), "XER") == 0) {
2530                         (yyval.a_module_flags) = MSF_XER_INSTRUCTIONS;
2531                 } else {
2532                         fprintf(stderr,
2533                                 "WARNING: %s INSTRUCTIONS at %s:%d: "
2534                                 "Unrecognized encoding reference\n",
2535                                 (yyvsp[(1) - (2)].tv_str), ASN_FILENAME, yylineno);
2536                         (yyval.a_module_flags) = MSF_unk_INSTRUCTIONS;
2537                 }
2538                 free((yyvsp[(1) - (2)].tv_str));
2539         }
2540     break;
2541
2542   case 26:
2543 #line 577 "asn1p_y.y"
2544     { (yyval.a_module) = 0; }
2545     break;
2546
2547   case 27:
2548 #line 578 "asn1p_y.y"
2549     {
2550                 (yyval.a_module) = (yyvsp[(1) - (1)].a_module);
2551         }
2552     break;
2553
2554   case 28:
2555 #line 587 "asn1p_y.y"
2556     {
2557                 (yyval.a_module) = asn1p_module_new();
2558                 AL_IMPORT((yyval.a_module), exports, (yyvsp[(1) - (3)].a_module), xp_next);
2559                 AL_IMPORT((yyval.a_module), imports, (yyvsp[(2) - (3)].a_module), xp_next);
2560                 asn1p_module_move_members((yyval.a_module), (yyvsp[(3) - (3)].a_module));
2561
2562                 asn1p_module_free((yyvsp[(1) - (3)].a_module));
2563                 asn1p_module_free((yyvsp[(2) - (3)].a_module));
2564                 asn1p_module_free((yyvsp[(3) - (3)].a_module));
2565         }
2566     break;
2567
2568   case 29:
2569 #line 600 "asn1p_y.y"
2570     {
2571                 (yyval.a_module) = (yyvsp[(1) - (1)].a_module);
2572         }
2573     break;
2574
2575   case 30:
2576 #line 603 "asn1p_y.y"
2577     {
2578                 if((yyvsp[(1) - (2)].a_module)) {
2579                         (yyval.a_module) = (yyvsp[(1) - (2)].a_module);
2580                 } else {
2581                         (yyval.a_module) = (yyvsp[(2) - (2)].a_module);
2582                         break;
2583                 }
2584         asn1p_module_move_members((yyval.a_module), (yyvsp[(2) - (2)].a_module));
2585                 asn1p_module_free((yyvsp[(2) - (2)].a_module));
2586         }
2587     break;
2588
2589   case 31:
2590 #line 620 "asn1p_y.y"
2591     {
2592                 (yyval.a_module) = asn1p_module_new();
2593                 checkmem((yyval.a_module));
2594                 assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID);
2595                 assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID);
2596                 asn1p_module_member_add((yyval.a_module), (yyvsp[(1) - (1)].a_expr));
2597         }
2598     break;
2599
2600   case 32:
2601 #line 627 "asn1p_y.y"
2602     {
2603                 (yyval.a_module) = asn1p_module_new();
2604                 checkmem((yyval.a_module));
2605                 assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID);
2606                 assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID);
2607                 asn1p_module_member_add((yyval.a_module), (yyvsp[(1) - (1)].a_expr));
2608         }
2609     break;
2610
2611   case 33:
2612 #line 641 "asn1p_y.y"
2613     {
2614                 (yyval.a_module) = asn1p_module_new();
2615                 checkmem((yyval.a_module));
2616                 assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID);
2617                 assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID);
2618                 asn1p_module_member_add((yyval.a_module), (yyvsp[(1) - (1)].a_expr));
2619         }
2620     break;
2621
2622   case 34:
2623 #line 649 "asn1p_y.y"
2624     { asn1p_lexer_hack_push_encoding_control(); }
2625     break;
2626
2627   case 35:
2628 #line 650 "asn1p_y.y"
2629     {
2630                 fprintf(stderr,
2631                         "WARNING: ENCODING-CONTROL %s "
2632                         "specification at %s:%d ignored\n",
2633                         (yyvsp[(2) - (3)].tv_str), ASN_FILENAME, yylineno);
2634                 free((yyvsp[(2) - (3)].tv_str));
2635                 (yyval.a_module) = 0;
2636         }
2637     break;
2638
2639   case 36:
2640 #line 662 "asn1p_y.y"
2641     {
2642                 return yyerror(
2643                         "Attempt to redefine a standard basic string type, "
2644                         "please comment out or remove this type redefinition.");
2645         }
2646     break;
2647
2648   case 37:
2649 #line 675 "asn1p_y.y"
2650     { (yyval.a_module) = 0; }
2651     break;
2652
2653   case 39:
2654 #line 679 "asn1p_y.y"
2655     {
2656                 if(!saved_aid && 0)
2657                         return yyerror("Unterminated IMPORTS FROM, "
2658                                         "expected semicolon ';'");
2659                 saved_aid = 0;
2660                 (yyval.a_module) = (yyvsp[(2) - (3)].a_module);
2661         }
2662     break;
2663
2664   case 40:
2665 #line 689 "asn1p_y.y"
2666     {
2667                 return yyerror("Empty IMPORTS list");
2668         }
2669     break;
2670
2671   case 41:
2672 #line 695 "asn1p_y.y"
2673     { (yyval.a_module) = asn1p_module_new(); }
2674     break;
2675
2676   case 43:
2677 #line 699 "asn1p_y.y"
2678     {
2679                 (yyval.a_module) = asn1p_module_new();
2680                 checkmem((yyval.a_module));
2681                 TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(1) - (1)].a_xports), xp_next);
2682         }
2683     break;
2684
2685   case 44:
2686 #line 704 "asn1p_y.y"
2687     {
2688                 (yyval.a_module) = (yyvsp[(1) - (2)].a_module);
2689                 TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(2) - (2)].a_xports), xp_next);
2690         }
2691     break;
2692
2693   case 45:
2694 #line 711 "asn1p_y.y"
2695     { memset(&(yyval.a_aid), 0, sizeof((yyval.a_aid))); }
2696     break;
2697
2698   case 46:
2699 #line 712 "asn1p_y.y"
2700     { (yyval.a_aid).oid = (yyvsp[(1) - (1)].a_oid); }
2701     break;
2702
2703   case 47:
2704 #line 716 "asn1p_y.y"
2705     {
2706                 (yyval.a_xports) = (yyvsp[(1) - (4)].a_xports);
2707                 (yyval.a_xports)->fromModuleName = (yyvsp[(3) - (4)].tv_str);
2708                 (yyval.a_xports)->identifier = (yyvsp[(4) - (4)].a_aid);
2709                 /* This stupid thing is used for look-back hack. */
2710                 saved_aid = (yyval.a_xports)->identifier.oid ? 0 : &((yyval.a_xports)->identifier);
2711                 checkmem((yyval.a_xports));
2712         }
2713     break;
2714
2715   case 48:
2716 #line 727 "asn1p_y.y"
2717     {
2718                 (yyval.a_xports) = asn1p_xports_new();
2719                 checkmem((yyval.a_xports));
2720                 TQ_ADD(&((yyval.a_xports)->xp_members), (yyvsp[(1) - (1)].a_expr), next);
2721         }
2722     break;
2723
2724   case 49:
2725 #line 732 "asn1p_y.y"
2726     {
2727                 (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports);
2728                 TQ_ADD(&((yyval.a_xports)->xp_members), (yyvsp[(3) - (3)].a_expr), next);
2729         }
2730     break;
2731
2732   case 50:
2733 #line 739 "asn1p_y.y"
2734     {
2735                 (yyval.a_expr) = NEW_EXPR();
2736                 checkmem((yyval.a_expr));
2737                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str);
2738                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
2739         }
2740     break;
2741
2742   case 51:
2743 #line 745 "asn1p_y.y"
2744     {           /* Completely equivalent to above */
2745                 (yyval.a_expr) = NEW_EXPR();
2746                 checkmem((yyval.a_expr));
2747                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
2748                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
2749         }
2750     break;
2751
2752   case 52:
2753 #line 751 "asn1p_y.y"
2754     {
2755                 (yyval.a_expr) = NEW_EXPR();
2756                 checkmem((yyval.a_expr));
2757                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str);
2758                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
2759         }
2760     break;
2761
2762   case 53:
2763 #line 761 "asn1p_y.y"
2764     { (yyval.a_module) = 0; }
2765     break;
2766
2767   case 54:
2768 #line 762 "asn1p_y.y"
2769     {
2770                 (yyval.a_module) = asn1p_module_new();
2771                 checkmem((yyval.a_module));
2772                 if((yyvsp[(1) - (1)].a_xports)) {
2773                         TQ_ADD(&((yyval.a_module)->exports), (yyvsp[(1) - (1)].a_xports), xp_next);
2774                 } else {
2775                         /* "EXPORTS ALL;" */
2776                 }
2777         }
2778     break;
2779
2780   case 55:
2781 #line 774 "asn1p_y.y"
2782     {
2783                 (yyval.a_xports) = (yyvsp[(2) - (3)].a_xports);
2784         }
2785     break;
2786
2787   case 56:
2788 #line 777 "asn1p_y.y"
2789     {
2790                 (yyval.a_xports) = 0;
2791         }
2792     break;
2793
2794   case 57:
2795 #line 780 "asn1p_y.y"
2796     {
2797                 /* Empty EXPORTS clause effectively prohibits export. */
2798                 (yyval.a_xports) = asn1p_xports_new();
2799                 checkmem((yyval.a_xports));
2800         }
2801     break;
2802
2803   case 58:
2804 #line 788 "asn1p_y.y"
2805     {
2806                 (yyval.a_xports) = asn1p_xports_new();
2807                 assert((yyval.a_xports));
2808                 TQ_ADD(&((yyval.a_xports)->xp_members), (yyvsp[(1) - (1)].a_expr), next);
2809         }
2810     break;
2811
2812   case 59:
2813 #line 793 "asn1p_y.y"
2814     {
2815                 (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports);
2816                 TQ_ADD(&((yyval.a_xports)->xp_members), (yyvsp[(3) - (3)].a_expr), next);
2817         }
2818     break;
2819
2820   case 60:
2821 #line 800 "asn1p_y.y"
2822     {
2823                 (yyval.a_expr) = NEW_EXPR();
2824                 checkmem((yyval.a_expr));
2825                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str);
2826                 (yyval.a_expr)->expr_type = A1TC_EXPORTVAR;
2827         }
2828     break;
2829
2830   case 61:
2831 #line 806 "asn1p_y.y"
2832     {
2833                 (yyval.a_expr) = NEW_EXPR();
2834                 checkmem((yyval.a_expr));
2835                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
2836                 (yyval.a_expr)->expr_type = A1TC_EXPORTVAR;
2837         }
2838     break;
2839
2840   case 62:
2841 #line 812 "asn1p_y.y"
2842     {
2843                 (yyval.a_expr) = NEW_EXPR();
2844                 checkmem((yyval.a_expr));
2845                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str);
2846                 (yyval.a_expr)->expr_type = A1TC_EXPORTVAR;
2847         }
2848     break;
2849
2850   case 63:
2851 #line 821 "asn1p_y.y"
2852     { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); }
2853     break;
2854
2855   case 64:
2856 #line 824 "asn1p_y.y"
2857     {
2858                 (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr);
2859                 assert((yyval.a_expr)->Identifier == 0);
2860                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
2861                 (yyval.a_expr)->meta_type = AMT_VALUESET;
2862                 (yyval.a_expr)->constraints = (yyvsp[(4) - (4)].a_constr);
2863         }
2864     break;
2865
2866   case 65:
2867 #line 844 "asn1p_y.y"
2868     {
2869                 (yyval.a_expr) = NEW_EXPR();
2870                 checkmem((yyval.a_expr));
2871                 (yyval.a_expr)->reference = (yyvsp[(1) - (1)].a_ref);
2872                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
2873                 (yyval.a_expr)->meta_type = AMT_TYPEREF;
2874         }
2875     break;
2876
2877   case 66:
2878 #line 854 "asn1p_y.y"
2879     {
2880                 (yyval.a_expr) = NEW_EXPR();
2881                 checkmem((yyval.a_expr));
2882                 (yyval.a_expr)->reference = (yyvsp[(1) - (4)].a_ref);
2883                 (yyval.a_expr)->rhs_pspecs = (yyvsp[(3) - (4)].a_expr);
2884                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
2885                 (yyval.a_expr)->meta_type = AMT_TYPEREF;
2886         }
2887     break;
2888
2889   case 67:
2890 #line 874 "asn1p_y.y"
2891     {
2892                 (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr);
2893                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
2894                 assert((yyval.a_expr)->expr_type);
2895                 assert((yyval.a_expr)->meta_type);
2896         }
2897     break;
2898
2899   case 68:
2900 #line 880 "asn1p_y.y"
2901     {
2902                 (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr);
2903                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
2904                 assert((yyval.a_expr)->expr_type == A1TC_CLASSDEF);
2905                 assert((yyval.a_expr)->meta_type == AMT_OBJECTCLASS);
2906         }
2907     break;
2908
2909   case 69:
2910 #line 896 "asn1p_y.y"
2911     {
2912                 (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr);
2913                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str);
2914                 (yyval.a_expr)->lhs_params = (yyvsp[(3) - (6)].a_plist);
2915         }
2916     break;
2917
2918   case 70:
2919 #line 902 "asn1p_y.y"
2920     {
2921                 (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr);
2922                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str);
2923                 (yyval.a_expr)->lhs_params = (yyvsp[(3) - (6)].a_plist);
2924         }
2925     break;
2926
2927   case 71:
2928 #line 910 "asn1p_y.y"
2929     {
2930                 int ret;
2931                 (yyval.a_plist) = asn1p_paramlist_new(yylineno);
2932                 checkmem((yyval.a_plist));
2933                 ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(1) - (1)].a_parg).governor, (yyvsp[(1) - (1)].a_parg).argument);
2934                 checkmem(ret == 0);
2935                 asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor);
2936                 free((yyvsp[(1) - (1)].a_parg).argument);
2937         }
2938     break;
2939
2940   case 72:
2941 #line 919 "asn1p_y.y"
2942     {
2943                 int ret;
2944                 (yyval.a_plist) = (yyvsp[(1) - (3)].a_plist);
2945                 ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(3) - (3)].a_parg).governor, (yyvsp[(3) - (3)].a_parg).argument);
2946                 checkmem(ret == 0);
2947                 asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor);
2948                 free((yyvsp[(3) - (3)].a_parg).argument);
2949         }
2950     break;
2951
2952   case 73:
2953 #line 930 "asn1p_y.y"
2954     {
2955                 (yyval.a_parg).governor = NULL;
2956                 (yyval.a_parg).argument = (yyvsp[(1) - (1)].tv_str);
2957         }
2958     break;
2959
2960   case 74:
2961 #line 934 "asn1p_y.y"
2962     {
2963                 int ret;
2964                 (yyval.a_parg).governor = asn1p_ref_new(yylineno, currentModule);
2965                 ret = asn1p_ref_add_component((yyval.a_parg).governor, (yyvsp[(1) - (3)].tv_str), 0);
2966                 checkmem(ret == 0);
2967                 (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str);
2968                 free((yyvsp[(1) - (3)].tv_str));
2969         }
2970     break;
2971
2972   case 75:
2973 #line 942 "asn1p_y.y"
2974     {
2975                 int ret;
2976                 (yyval.a_parg).governor = asn1p_ref_new(yylineno, currentModule);
2977                 ret = asn1p_ref_add_component((yyval.a_parg).governor, (yyvsp[(1) - (3)].tv_str), 0);
2978                 checkmem(ret == 0);
2979                 (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str);
2980                 free((yyvsp[(1) - (3)].tv_str));
2981         }
2982     break;
2983
2984   case 76:
2985 #line 950 "asn1p_y.y"
2986     {
2987                 int ret;
2988                 (yyval.a_parg).governor = asn1p_ref_new(yylineno, currentModule);
2989                 ret = asn1p_ref_add_component((yyval.a_parg).governor,
2990                         ASN_EXPR_TYPE2STR((yyvsp[(1) - (3)].a_type)), 1);
2991                 checkmem(ret == 0);
2992                 (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str);
2993         }
2994     break;
2995
2996   case 77:
2997 #line 958 "asn1p_y.y"
2998     {
2999                 int ret;
3000                 (yyval.a_parg).governor = asn1p_ref_new(yylineno, currentModule);
3001                 ret = asn1p_ref_add_component((yyval.a_parg).governor,
3002                         ASN_EXPR_TYPE2STR((yyvsp[(1) - (3)].a_type)), 1);
3003                 checkmem(ret == 0);
3004                 (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str);
3005         }
3006     break;
3007
3008   case 78:
3009 #line 969 "asn1p_y.y"
3010     {
3011                 (yyval.a_expr) = NEW_EXPR();
3012                 checkmem((yyval.a_expr));
3013                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
3014         }
3015     break;
3016
3017   case 79:
3018 #line 974 "asn1p_y.y"
3019     {
3020                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
3021                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
3022         }
3023     break;
3024
3025   case 81:
3026 #line 982 "asn1p_y.y"
3027     {
3028                 (yyval.a_expr) = NEW_EXPR();
3029                 checkmem((yyval.a_expr));
3030                 (yyval.a_expr)->Identifier = strdup("?");
3031                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
3032                 (yyval.a_expr)->meta_type = AMT_VALUE;
3033                 (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value);
3034         }
3035     break;
3036
3037   case 82:
3038 #line 990 "asn1p_y.y"
3039     {
3040                 (yyval.a_expr) = NEW_EXPR();
3041                 checkmem((yyval.a_expr));
3042                 (yyval.a_expr)->Identifier = strdup("?");
3043                 (yyval.a_expr)->expr_type = A1TC_REFERENCE;
3044                 (yyval.a_expr)->meta_type = AMT_VALUE;
3045                 (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value);
3046         }
3047     break;
3048
3049   case 83:
3050 #line 998 "asn1p_y.y"
3051     {
3052                 (yyval.a_expr) = NEW_EXPR();
3053                 (yyval.a_expr)->expr_type = A1TC_VALUESET;
3054                 (yyval.a_expr)->meta_type = AMT_VALUESET;
3055                 (yyval.a_expr)->constraints = (yyvsp[(1) - (1)].a_constr);
3056         }
3057     break;
3058
3059   case 84:
3060 #line 1021 "asn1p_y.y"
3061     { (yyval.a_expr) = NEW_EXPR(); }
3062     break;
3063
3064   case 85:
3065 #line 1022 "asn1p_y.y"
3066     { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); }
3067     break;
3068
3069   case 86:
3070 #line 1025 "asn1p_y.y"
3071     {
3072                 (yyval.a_expr) = NEW_EXPR();
3073                 checkmem((yyval.a_expr));
3074                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
3075         }
3076     break;
3077
3078   case 87:
3079 #line 1030 "asn1p_y.y"
3080     {
3081                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
3082                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
3083         }
3084     break;
3085
3086   case 88:
3087 #line 1034 "asn1p_y.y"
3088     {
3089                 (yyval.a_expr) = (yyvsp[(1) - (5)].a_expr);
3090                 (yyvsp[(4) - (5)].a_expr)->meta_type = AMT_TYPE;
3091                 (yyvsp[(4) - (5)].a_expr)->expr_type = ASN_CONSTR_SEQUENCE;
3092                 (yyvsp[(4) - (5)].a_expr)->marker.flags |= EM_OPTIONAL;
3093                 asn1p_expr_add((yyval.a_expr), (yyvsp[(4) - (5)].a_expr));
3094         }
3095     break;
3096
3097   case 89:
3098 #line 1042 "asn1p_y.y"
3099     {
3100                 (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr);
3101                 assert((yyval.a_expr)->Identifier == 0);
3102                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
3103                 (yyvsp[(3) - (3)].a_marker).flags |= (yyval.a_expr)->marker.flags;
3104                 (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker);
3105         }
3106     break;
3107
3108   case 90:
3109 #line 1049 "asn1p_y.y"
3110     {
3111                 (yyval.a_expr) = (yyvsp[(1) - (2)].a_expr);
3112                 (yyvsp[(2) - (2)].a_marker).flags |= (yyval.a_expr)->marker.flags;
3113                 (yyval.a_expr)->marker = (yyvsp[(2) - (2)].a_marker);
3114                 _fixup_anonymous_identifier((yyval.a_expr));
3115         }
3116     break;
3117
3118   case 91:
3119 #line 1055 "asn1p_y.y"
3120     {
3121                 (yyval.a_expr) = NEW_EXPR();
3122                 checkmem((yyval.a_expr));
3123                 (yyval.a_expr)->meta_type = (yyvsp[(3) - (3)].a_expr)->meta_type;
3124                 (yyval.a_expr)->expr_type = A1TC_COMPONENTS_OF;
3125                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
3126         }
3127     break;
3128
3129   case 92:
3130 #line 1062 "asn1p_y.y"
3131     {
3132                 (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr);
3133         }
3134     break;
3135
3136   case 93:
3137 #line 1068 "asn1p_y.y"
3138     {
3139                 (yyval.a_expr) = NEW_EXPR();
3140                 checkmem((yyval.a_expr));
3141                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
3142         }
3143     break;
3144
3145   case 94:
3146 #line 1073 "asn1p_y.y"
3147     {
3148                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
3149                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
3150         }
3151     break;
3152
3153   case 95:
3154 #line 1080 "asn1p_y.y"
3155     {
3156                 (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr);
3157                 assert((yyval.a_expr)->Identifier == 0);
3158                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (2)].tv_str);
3159         }
3160     break;
3161
3162   case 96:
3163 #line 1085 "asn1p_y.y"
3164     {
3165                 (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr);
3166         }
3167     break;
3168
3169   case 97:
3170 #line 1088 "asn1p_y.y"
3171     {
3172                 (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr);
3173                 _fixup_anonymous_identifier((yyval.a_expr));
3174         }
3175     break;
3176
3177   case 98:
3178 #line 1095 "asn1p_y.y"
3179     {
3180                 (yyval.a_expr) = (yyvsp[(3) - (5)].a_expr);
3181                 checkmem((yyval.a_expr));
3182                 (yyval.a_expr)->with_syntax = (yyvsp[(5) - (5)].a_wsynt);
3183                 assert((yyval.a_expr)->expr_type == A1TC_CLASSDEF);
3184                 assert((yyval.a_expr)->meta_type == AMT_OBJECTCLASS);
3185         }
3186     break;
3187
3188   case 99:
3189 #line 1105 "asn1p_y.y"
3190     { (yyval.a_int) = 0; }
3191     break;
3192
3193   case 100:
3194 #line 1106 "asn1p_y.y"
3195     { (yyval.a_int) = 1; }
3196     break;
3197
3198   case 101:
3199 #line 1110 "asn1p_y.y"
3200     {
3201                 (yyval.a_expr) = NEW_EXPR();
3202                 checkmem((yyval.a_expr));
3203                 (yyval.a_expr)->expr_type = A1TC_CLASSDEF;
3204                 (yyval.a_expr)->meta_type = AMT_OBJECTCLASS;
3205                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
3206         }
3207     break;
3208
3209   case 102:
3210 #line 1117 "asn1p_y.y"
3211     {
3212                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
3213                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
3214         }
3215     break;
3216
3217   case 103:
3218 #line 1127 "asn1p_y.y"
3219     {
3220                 (yyval.a_expr) = NEW_EXPR();
3221                 checkmem((yyval.a_expr));
3222                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (2)].tv_str);
3223                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3224                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_TFS;        /* TypeFieldSpec */
3225                 (yyval.a_expr)->marker = (yyvsp[(2) - (2)].a_marker);
3226         }
3227     break;
3228
3229   case 104:
3230 #line 1137 "asn1p_y.y"
3231     {
3232                 (yyval.a_expr) = NEW_EXPR();
3233                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
3234                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3235                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_FTVFS;      /* FixedTypeValueFieldSpec */
3236                 (yyval.a_expr)->unique = (yyvsp[(3) - (4)].a_int);
3237                 (yyval.a_expr)->marker = (yyvsp[(4) - (4)].a_marker);
3238                 asn1p_expr_add((yyval.a_expr), (yyvsp[(2) - (4)].a_expr));
3239         }
3240     break;
3241
3242   case 105:
3243 #line 1148 "asn1p_y.y"
3244     {
3245                 (yyval.a_expr) = NEW_EXPR();
3246                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
3247                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3248                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_VTVFS;
3249                 (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref);
3250                 (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker);
3251         }
3252     break;
3253
3254   case 106:
3255 #line 1158 "asn1p_y.y"
3256     {
3257                 (yyval.a_expr) = NEW_EXPR();
3258                 checkmem((yyval.a_expr));
3259                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
3260                 (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref);
3261                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3262                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_OFS;
3263                 (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker);
3264         }
3265     break;
3266
3267   case 107:
3268 #line 1169 "asn1p_y.y"
3269     {
3270                 (yyval.a_expr) = NEW_EXPR();
3271                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
3272                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3273                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_VTVSFS;
3274                 (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref);
3275                 (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker);
3276         }
3277     break;
3278
3279   case 108:
3280 #line 1179 "asn1p_y.y"
3281     {
3282                 (yyval.a_expr) = NEW_EXPR();
3283                 checkmem((yyval.a_expr));
3284                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
3285                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3286                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_FTVSFS;
3287                 asn1p_expr_add((yyval.a_expr), (yyvsp[(2) - (3)].a_expr));
3288                 (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker);
3289         }
3290     break;
3291
3292   case 109:
3293 #line 1190 "asn1p_y.y"
3294     {
3295                 (yyval.a_expr) = NEW_EXPR();
3296                 checkmem((yyval.a_expr));
3297                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str);
3298                 (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref);
3299                 (yyval.a_expr)->meta_type = AMT_OBJECTFIELD;
3300                 (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_OSFS;
3301                 (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker);
3302         }
3303     break;
3304
3305   case 110:
3306 #line 1202 "asn1p_y.y"
3307     { (yyval.a_wsynt) = 0; }
3308     break;
3309
3310   case 111:
3311 #line 1203 "asn1p_y.y"
3312     {
3313                 (yyval.a_wsynt) = (yyvsp[(1) - (1)].a_wsynt);
3314         }
3315     break;
3316
3317   case 112:
3318 #line 1210 "asn1p_y.y"
3319     { asn1p_lexer_hack_enable_with_syntax(); }
3320     break;
3321
3322   case 113:
3323 #line 1212 "asn1p_y.y"
3324     {
3325                 (yyval.a_wsynt) = (yyvsp[(5) - (6)].a_wsynt);
3326         }
3327     break;
3328
3329   case 114:
3330 #line 1218 "asn1p_y.y"
3331     {
3332                 (yyval.a_wsynt) = asn1p_wsyntx_new();
3333                 TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(1) - (1)].a_wchunk), next);
3334         }
3335     break;
3336
3337   case 115:
3338 #line 1222 "asn1p_y.y"
3339     {
3340                 (yyval.a_wsynt) = (yyvsp[(1) - (2)].a_wsynt);
3341                 TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(2) - (2)].a_wchunk), next);
3342         }
3343     break;
3344
3345   case 116:
3346 #line 1229 "asn1p_y.y"
3347     {
3348                 (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_opaque).buf, 0);
3349                 (yyval.a_wchunk)->type = WC_WHITESPACE;
3350         }
3351     break;
3352
3353   case 117:
3354 #line 1233 "asn1p_y.y"
3355     {
3356                 (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_str), 0);
3357         }
3358     break;
3359
3360   case 118:
3361 #line 1236 "asn1p_y.y"
3362     {
3363                 (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].a_refcomp).name, 0);
3364                 (yyval.a_wchunk)->type = WC_FIELD;
3365         }
3366     break;
3367
3368   case 119:
3369 #line 1240 "asn1p_y.y"
3370     {
3371                 (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromsyntax((yyvsp[(2) - (3)].a_wsynt));
3372         }
3373     break;
3374
3375   case 120:
3376 #line 1246 "asn1p_y.y"
3377     {
3378                 (yyval.a_expr) = NEW_EXPR();
3379                 checkmem((yyval.a_expr));
3380                 (yyval.a_expr)->Identifier = strdup("...");
3381                 checkmem((yyval.a_expr)->Identifier);
3382                 (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE;
3383                 (yyval.a_expr)->meta_type = AMT_TYPE;
3384         }
3385     break;
3386
3387   case 121:
3388 #line 1254 "asn1p_y.y"
3389     {
3390                 (yyval.a_expr) = NEW_EXPR();
3391                 checkmem((yyval.a_expr));
3392                 (yyval.a_expr)->Identifier = strdup("...");
3393                 checkmem((yyval.a_expr)->Identifier);
3394                 (yyval.a_expr)->value = (yyvsp[(3) - (3)].a_value);
3395                 (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE;
3396                 (yyval.a_expr)->meta_type = AMT_TYPE;
3397         }
3398     break;
3399
3400   case 122:
3401 #line 1263 "asn1p_y.y"
3402     {
3403                 (yyval.a_expr) = NEW_EXPR();
3404                 checkmem((yyval.a_expr));
3405                 (yyval.a_expr)->Identifier = strdup("...");
3406                 (yyval.a_expr)->value = (yyvsp[(3) - (3)].a_value);
3407                 checkmem((yyval.a_expr)->Identifier);
3408                 (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE;
3409                 (yyval.a_expr)->meta_type = AMT_TYPE;
3410         }
3411     break;
3412
3413   case 124:
3414 #line 1277 "asn1p_y.y"
3415     {
3416         (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr);
3417         (yyval.a_expr)->tag = (yyvsp[(1) - (2)].a_tag);
3418     }
3419     break;
3420
3421   case 125:
3422 #line 1284 "asn1p_y.y"
3423     {
3424                 (yyval.a_expr) = (yyvsp[(1) - (2)].a_expr);
3425                 /*
3426                  * Outer constraint for SEQUENCE OF and SET OF applies
3427                  * to the inner type.
3428                  */
3429                 if((yyval.a_expr)->expr_type == ASN_CONSTR_SEQUENCE_OF
3430                 || (yyval.a_expr)->expr_type == ASN_CONSTR_SET_OF) {
3431                         assert(!TQ_FIRST(&((yyval.a_expr)->members))->constraints);
3432                         TQ_FIRST(&((yyval.a_expr)->members))->constraints = (yyvsp[(2) - (2)].a_constr);
3433                 } else {
3434                         if((yyval.a_expr)->constraints) {
3435                                 assert(!(yyvsp[(2) - (2)].a_constr));
3436                                 /* Check this : optManyConstraints is not used ?! */
3437                                 asn1p_constraint_free((yyvsp[(2) - (2)].a_constr));
3438                         } else {
3439                                 (yyval.a_expr)->constraints = (yyvsp[(2) - (2)].a_constr);
3440                         }
3441                 }
3442         }
3443     break;
3444
3445   case 126:
3446 #line 1307 "asn1p_y.y"
3447     {
3448                 (yyval.a_expr) = (yyvsp[(1) - (2)].a_expr);
3449                 /*
3450                  * Outer constraint for SEQUENCE OF and SET OF applies
3451                  * to the inner type.
3452                  */
3453                 if((yyval.a_expr)->expr_type == ASN_CONSTR_SEQUENCE_OF
3454                 || (yyval.a_expr)->expr_type == ASN_CONSTR_SET_OF) {
3455                         assert(!TQ_FIRST(&((yyval.a_expr)->members))->constraints);
3456                         TQ_FIRST(&((yyval.a_expr)->members))->constraints = (yyvsp[(2) - (2)].a_constr);
3457                 } else {
3458                         if((yyval.a_expr)->constraints) {
3459                                 assert(!(yyvsp[(2) - (2)].a_constr));
3460                                 /* Check this : optManyConstraints is not used ?! */
3461                                 asn1p_constraint_free((yyvsp[(2) - (2)].a_constr));
3462                         } else {
3463                                 (yyval.a_expr)->constraints = (yyvsp[(2) - (2)].a_constr);
3464                         }
3465                 }
3466         }
3467     break;
3468
3469   case 127:
3470 #line 1330 "asn1p_y.y"
3471     {
3472                 (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr);
3473                 (yyval.a_expr)->tag = (yyvsp[(1) - (3)].a_tag);
3474                 /*
3475                  * Outer constraint for SEQUENCE OF and SET OF applies
3476                  * to the inner type.
3477                  */
3478                 if((yyval.a_expr)->expr_type == ASN_CONSTR_SEQUENCE_OF
3479                 || (yyval.a_expr)->expr_type == ASN_CONSTR_SET_OF) {
3480                         assert(!TQ_FIRST(&((yyval.a_expr)->members))->constraints);
3481                         TQ_FIRST(&((yyval.a_expr)->members))->constraints = (yyvsp[(3) - (3)].a_constr);
3482                 } else {
3483                         if((yyval.a_expr)->constraints) {
3484                                 assert(!(yyvsp[(2) - (3)].a_expr));
3485                                 /* Check this : optManyConstraints is not used ?! */
3486                                 asn1p_constraint_free((yyvsp[(3) - (3)].a_constr));
3487                         } else {
3488                                 (yyval.a_expr)->constraints = (yyvsp[(3) - (3)].a_constr);
3489                         }
3490                 }
3491         }
3492     break;
3493
3494   case 128:
3495 #line 1354 "asn1p_y.y"
3496     {
3497                 (yyval.a_int) = asn1p_as_pointer ? EM_INDIRECT : 0;
3498                 asn1p_as_pointer = 0;
3499         }
3500     break;
3501
3502   case 129:
3503 #line 1361 "asn1p_y.y"
3504     {
3505         (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr);
3506                 (yyval.a_expr)->marker.flags |= (yyvsp[(1) - (2)].a_int);
3507
3508                 if(((yyval.a_expr)->marker.flags & EM_INDIRECT)
3509                 && ((yyval.a_expr)->marker.flags & EM_OPTIONAL) != EM_OPTIONAL) {
3510                         fprintf(stderr,
3511                                 "INFO: Directive <ASN1C:RepresentAsPointer> "
3512                                 "applied to %s at %s:%d\n",
3513                                 ASN_EXPR_TYPE2STR((yyval.a_expr)->expr_type)
3514                                         ?  ASN_EXPR_TYPE2STR((yyval.a_expr)->expr_type)
3515                                         : "member",
3516                                 ASN_FILENAME, (yyval.a_expr)->_lineno
3517                         );
3518                 }
3519     }
3520     break;
3521
3522   case 133:
3523 #line 1385 "asn1p_y.y"
3524     {
3525                 (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr);
3526                 assert((yyval.a_expr)->expr_type == A1TC_INVALID);
3527                 (yyval.a_expr)->expr_type = ASN_CONSTR_CHOICE;
3528                 (yyval.a_expr)->meta_type = AMT_TYPE;
3529         }
3530     break;
3531
3532   case 134:
3533 #line 1391 "asn1p_y.y"
3534     {
3535                 (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr);
3536                 assert((yyval.a_expr)->expr_type == A1TC_INVALID);
3537                 (yyval.a_expr)->expr_type = ASN_CONSTR_SEQUENCE;
3538                 (yyval.a_expr)->meta_type = AMT_TYPE;
3539         }
3540     break;
3541
3542   case 135:
3543 #line 1397 "asn1p_y.y"
3544     {
3545                 (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr);
3546                 assert((yyval.a_expr)->expr_type == A1TC_INVALID);
3547                 (yyval.a_expr)->expr_type = ASN_CONSTR_SET;
3548                 (yyval.a_expr)->meta_type = AMT_TYPE;
3549         }
3550     break;
3551
3552   case 136:
3553 #line 1403 "asn1p_y.y"
3554     {
3555                 (yyval.a_expr) = NEW_EXPR();
3556                 checkmem((yyval.a_expr));
3557                 (yyval.a_expr)->constraints = (yyvsp[(2) - (6)].a_constr);
3558                 (yyval.a_expr)->expr_type = ASN_CONSTR_SEQUENCE_OF;
3559                 (yyval.a_expr)->meta_type = AMT_TYPE;
3560                 (yyvsp[(6) - (6)].a_expr)->Identifier = (yyvsp[(4) - (6)].tv_str);
3561                 (yyvsp[(6) - (6)].a_expr)->tag = (yyvsp[(5) - (6)].a_tag);
3562                 asn1p_expr_add((yyval.a_expr), (yyvsp[(6) - (6)].a_expr));
3563         }
3564     break;
3565
3566   case 137:
3567 #line 1413 "asn1p_y.y"
3568     {
3569                 (yyval.a_expr) = NEW_EXPR();
3570                 checkmem((yyval.a_expr));
3571                 (yyval.a_expr)->constraints = (yyvsp[(2) - (6)].a_constr);
3572                 (yyval.a_expr)->expr_type = ASN_CONSTR_SET_OF;
3573                 (yyval.a_expr)->meta_type = AMT_TYPE;
3574                 (yyvsp[(6) - (6)].a_expr)->Identifier = (yyvsp[(4) - (6)].tv_str);
3575                 (yyvsp[(6) - (6)].a_expr)->tag = (yyvsp[(5) - (6)].a_tag);
3576                 asn1p_expr_add((yyval.a_expr), (yyvsp[(6) - (6)].a_expr));
3577         }
3578     break;
3579
3580   case 138:
3581 #line 1423 "asn1p_y.y"
3582     {
3583                 (yyval.a_expr) = NEW_EXPR();
3584                 checkmem((yyval.a_expr));
3585                 (yyval.a_expr)->expr_type = ASN_TYPE_ANY;
3586                 (yyval.a_expr)->meta_type = AMT_TYPE;
3587         }
3588     break;
3589
3590   case 139:
3591 #line 1429 "asn1p_y.y"
3592     {
3593                 int ret;
3594                 (yyval.a_expr) = NEW_EXPR();
3595                 checkmem((yyval.a_expr));
3596                 (yyval.a_expr)->reference = asn1p_ref_new(yylineno, currentModule);
3597                 ret = asn1p_ref_add_component((yyval.a_expr)->reference,
3598                         (yyvsp[(4) - (4)].tv_str), RLT_lowercase);
3599                 checkmem(ret == 0);
3600                 (yyval.a_expr)->expr_type = ASN_TYPE_ANY;
3601                 (yyval.a_expr)->meta_type = AMT_TYPE;
3602                 free((yyvsp[(4) - (4)].tv_str));
3603         }
3604     break;
3605
3606   case 140:
3607 #line 1441 "asn1p_y.y"
3608     {
3609                 (yyval.a_expr) = NEW_EXPR();
3610                 checkmem((yyval.a_expr));
3611                 (yyval.a_expr)->reference = (yyvsp[(3) - (3)].a_ref);
3612                 (yyval.a_expr)->expr_type = A1TC_INSTANCE;
3613                 (yyval.a_expr)->meta_type = AMT_TYPE;
3614         }
3615     break;
3616
3617   case 141:
3618 #line 1456 "asn1p_y.y"
3619     {
3620                 int ret;
3621                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3622                 checkmem((yyval.a_ref));
3623                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_UNKNOWN);
3624                 checkmem(ret == 0);
3625                 free((yyvsp[(1) - (1)].tv_str));
3626         }
3627     break;
3628
3629   case 142:
3630 #line 1464 "asn1p_y.y"
3631     {
3632                 int ret;
3633                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3634                 checkmem((yyval.a_ref));
3635                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS);
3636                 free((yyvsp[(1) - (1)].tv_str));
3637                 checkmem(ret == 0);
3638         }
3639     break;
3640
3641   case 143:
3642 #line 1472 "asn1p_y.y"
3643     {
3644                 int ret;
3645                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3646                 checkmem((yyval.a_ref));
3647                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN);
3648                 checkmem(ret == 0);
3649                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_UNKNOWN);
3650                 checkmem(ret == 0);
3651                 free((yyvsp[(1) - (3)].tv_str));
3652                 free((yyvsp[(3) - (3)].tv_str));
3653         }
3654     break;
3655
3656   case 144:
3657 #line 1483 "asn1p_y.y"
3658     {
3659                 int ret;
3660                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3661                 checkmem((yyval.a_ref));
3662                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN);
3663                 checkmem(ret == 0);
3664                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_UNKNOWN);
3665                 checkmem(ret == 0);
3666                 free((yyvsp[(1) - (3)].tv_str));
3667                 free((yyvsp[(3) - (3)].tv_str));
3668         }
3669     break;
3670
3671   case 145:
3672 #line 1494 "asn1p_y.y"
3673     {
3674                 int ret;
3675                 (yyval.a_ref) = (yyvsp[(3) - (3)].a_ref);
3676                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_CAPITALS);
3677                 free((yyvsp[(1) - (3)].tv_str));
3678                 checkmem(ret == 0);
3679                 /*
3680                  * Move the last element infront.
3681                  */
3682                 {
3683                         struct asn1p_ref_component_s tmp_comp;
3684                         tmp_comp = (yyval.a_ref)->components[(yyval.a_ref)->comp_count-1];
3685                         memmove(&(yyval.a_ref)->components[1],
3686                                 &(yyval.a_ref)->components[0],
3687                                 sizeof((yyval.a_ref)->components[0])
3688                                 * ((yyval.a_ref)->comp_count - 1));
3689                         (yyval.a_ref)->components[0] = tmp_comp;
3690                 }
3691         }
3692     break;
3693
3694   case 146:
3695 #line 1516 "asn1p_y.y"
3696     {
3697                 int ret;
3698                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3699                 checkmem((yyval.a_ref));
3700                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].a_refcomp).name, (yyvsp[(1) - (1)].a_refcomp).lex_type);
3701                 free((yyvsp[(1) - (1)].a_refcomp).name);
3702                 checkmem(ret == 0);
3703         }
3704     break;
3705
3706   case 147:
3707 #line 1524 "asn1p_y.y"
3708     {
3709                 int ret;
3710                 (yyval.a_ref) = (yyvsp[(1) - (3)].a_ref);
3711                 ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].a_refcomp).name, (yyvsp[(3) - (3)].a_refcomp).lex_type);
3712                 free((yyvsp[(3) - (3)].a_refcomp).name);
3713                 checkmem(ret == 0);
3714         }
3715     break;
3716
3717   case 149:
3718 #line 1537 "asn1p_y.y"
3719     {
3720                 (yyval.a_refcomp).lex_type = RLT_AmpUppercase;
3721                 (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str);
3722         }
3723     break;
3724
3725   case 150:
3726 #line 1542 "asn1p_y.y"
3727     {
3728                 (yyval.a_refcomp).lex_type = RLT_Amplowercase;
3729                 (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str);
3730         }
3731     break;
3732
3733   case 151:
3734 #line 1551 "asn1p_y.y"
3735     {
3736                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3737                 asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_AmpUppercase);
3738                 free((yyvsp[(1) - (1)].tv_str));
3739         }
3740     break;
3741
3742   case 152:
3743 #line 1556 "asn1p_y.y"
3744     {
3745                 (yyval.a_ref) = (yyval.a_ref);
3746                 asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_AmpUppercase);
3747                 free((yyvsp[(3) - (3)].tv_str));
3748         }
3749     break;
3750
3751   case 153:
3752 #line 1561 "asn1p_y.y"
3753     {
3754                 (yyval.a_ref) = (yyval.a_ref);
3755                 asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_Amplowercase);
3756                 free((yyvsp[(3) - (3)].tv_str));
3757         }
3758     break;
3759
3760   case 154:
3761 #line 1569 "asn1p_y.y"
3762     {
3763                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
3764                 asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS);
3765                 free((yyvsp[(1) - (1)].tv_str));
3766         }
3767     break;
3768
3769   case 155:
3770 #line 1592 "asn1p_y.y"
3771     {
3772                 (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr);
3773                 assert((yyval.a_expr)->Identifier == NULL);
3774                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
3775                 (yyval.a_expr)->meta_type = AMT_VALUE;
3776                 (yyval.a_expr)->value = (yyvsp[(4) - (4)].a_value);
3777         }
3778     break;
3779
3780   case 158:
3781 #line 1604 "asn1p_y.y"
3782     { asn1p_lexer_hack_push_opaque_state(); }
3783     break;
3784
3785   case 159:
3786 #line 1604 "asn1p_y.y"
3787     {
3788                 (yyval.a_value) = asn1p_value_frombuf((yyvsp[(3) - (3)].tv_opaque).buf, (yyvsp[(3) - (3)].tv_opaque).len, 0);
3789                 checkmem((yyval.a_value));
3790                 (yyval.a_value)->type = ATV_UNPARSED;
3791         }
3792     break;
3793
3794   case 160:
3795 #line 1612 "asn1p_y.y"
3796     {
3797                 (yyval.a_value) = asn1p_value_fromint(0);
3798                 checkmem((yyval.a_value));
3799                 (yyval.a_value)->type = ATV_NULL;
3800         }
3801     break;
3802
3803   case 161:
3804 #line 1617 "asn1p_y.y"
3805     {
3806                 (yyval.a_value) = asn1p_value_fromint(0);
3807                 checkmem((yyval.a_value));
3808                 (yyval.a_value)->type = ATV_FALSE;
3809         }
3810     break;
3811
3812   case 162:
3813 #line 1622 "asn1p_y.y"
3814     {
3815                 (yyval.a_value) = asn1p_value_fromint(1);
3816                 checkmem((yyval.a_value));
3817                 (yyval.a_value)->type = ATV_TRUE;
3818         }
3819     break;
3820
3821   case 168:
3822 #line 1635 "asn1p_y.y"
3823     {
3824                 asn1p_ref_t *ref;
3825                 int ret;
3826                 ref = asn1p_ref_new(yylineno, currentModule);
3827                 checkmem(ref);
3828                 ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN);
3829                 checkmem(ret == 0);
3830                 ret = asn1p_ref_add_component(ref, (yyvsp[(3) - (3)].tv_str), RLT_lowercase);
3831                 checkmem(ret == 0);
3832                 (yyval.a_value) = asn1p_value_fromref(ref, 0);
3833                 checkmem((yyval.a_value));
3834                 free((yyvsp[(1) - (3)].tv_str));
3835                 free((yyvsp[(3) - (3)].tv_str));
3836         }
3837     break;
3838
3839   case 169:
3840 #line 1653 "asn1p_y.y"
3841     {
3842                 (yyval.a_value) = asn1p_value_frombuf((yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len, 0);
3843                 checkmem((yyval.a_value));
3844         }
3845     break;
3846
3847   case 170:
3848 #line 1657 "asn1p_y.y"
3849     {
3850                 (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int));
3851                 checkmem((yyval.a_value));
3852                 (yyval.a_value)->type = ATV_TUPLE;
3853         }
3854     break;
3855
3856   case 171:
3857 #line 1662 "asn1p_y.y"
3858     {
3859                 (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int));
3860                 checkmem((yyval.a_value));
3861                 (yyval.a_value)->type = ATV_QUADRUPLE;
3862         }
3863     break;
3864
3865   case 172:
3866 #line 1670 "asn1p_y.y"
3867     {
3868                 (yyval.tv_opaque).len = (yyvsp[(1) - (1)].tv_opaque).len + 1;
3869                 (yyval.tv_opaque).buf = malloc(1 + (yyval.tv_opaque).len + 1);
3870                 checkmem((yyval.tv_opaque).buf);
3871                 (yyval.tv_opaque).buf[0] = '{';
3872                 memcpy((yyval.tv_opaque).buf + 1, (yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len);
3873                 (yyval.tv_opaque).buf[(yyval.tv_opaque).len] = '\0';
3874                 free((yyvsp[(1) - (1)].tv_opaque).buf);
3875     }
3876     break;
3877
3878   case 173:
3879 #line 1679 "asn1p_y.y"
3880     {
3881                 int newsize = (yyvsp[(1) - (2)].tv_opaque).len + (yyvsp[(2) - (2)].tv_opaque).len;
3882                 char *p = malloc(newsize + 1);
3883                 checkmem(p);
3884                 memcpy(p         , (yyvsp[(1) - (2)].tv_opaque).buf, (yyvsp[(1) - (2)].tv_opaque).len);
3885                 memcpy(p + (yyvsp[(1) - (2)].tv_opaque).len, (yyvsp[(2) - (2)].tv_opaque).buf, (yyvsp[(2) - (2)].tv_opaque).len);
3886                 p[newsize] = '\0';
3887                 free((yyvsp[(1) - (2)].tv_opaque).buf);
3888                 free((yyvsp[(2) - (2)].tv_opaque).buf);
3889                 (yyval.tv_opaque).buf = p;
3890                 (yyval.tv_opaque).len = newsize;
3891         }
3892     break;
3893
3894   case 175:
3895 #line 1695 "asn1p_y.y"
3896     {
3897         (yyval.tv_opaque).len = strlen((yyvsp[(1) - (1)].tv_str));
3898         (yyval.tv_opaque).buf = (yyvsp[(1) - (1)].tv_str);
3899     }
3900     break;
3901
3902   case 176:
3903 #line 1701 "asn1p_y.y"
3904     { (yyval.a_type) = ASN_BASIC_BOOLEAN; }
3905     break;
3906
3907   case 177:
3908 #line 1702 "asn1p_y.y"
3909     { (yyval.a_type) = ASN_BASIC_NULL; }
3910     break;
3911
3912   case 178:
3913 #line 1703 "asn1p_y.y"
3914     { (yyval.a_type) = ASN_BASIC_REAL; }
3915     break;
3916
3917   case 179:
3918 #line 1704 "asn1p_y.y"
3919     { (yyval.a_type) = ASN_BASIC_OCTET_STRING; }
3920     break;
3921
3922   case 180:
3923 #line 1705 "asn1p_y.y"
3924     { (yyval.a_type) = ASN_BASIC_OBJECT_IDENTIFIER; }
3925     break;
3926
3927   case 181:
3928 #line 1706 "asn1p_y.y"
3929     { (yyval.a_type) = ASN_BASIC_RELATIVE_OID; }
3930     break;
3931
3932   case 182:
3933 #line 1707 "asn1p_y.y"
3934     { (yyval.a_type) = ASN_BASIC_EXTERNAL; }
3935     break;
3936
3937   case 183:
3938 #line 1708 "asn1p_y.y"
3939     { (yyval.a_type) = ASN_BASIC_EMBEDDED_PDV; }
3940     break;
3941
3942   case 184:
3943 #line 1709 "asn1p_y.y"
3944     { (yyval.a_type) = ASN_BASIC_CHARACTER_STRING; }
3945     break;
3946
3947   case 185:
3948 #line 1710 "asn1p_y.y"
3949     { (yyval.a_type) = ASN_BASIC_UTCTime; }
3950     break;
3951
3952   case 186:
3953 #line 1711 "asn1p_y.y"
3954     { (yyval.a_type) = ASN_BASIC_GeneralizedTime; }
3955     break;
3956
3957   case 189:
3958 #line 1720 "asn1p_y.y"
3959     { (yyval.a_type) = ASN_BASIC_INTEGER; }
3960     break;
3961
3962   case 190:
3963 #line 1721 "asn1p_y.y"
3964     { (yyval.a_type) = ASN_BASIC_ENUMERATED; }
3965     break;
3966
3967   case 191:
3968 #line 1722 "asn1p_y.y"
3969     { (yyval.a_type) = ASN_BASIC_BIT_STRING; }
3970     break;
3971
3972   case 192:
3973 #line 1726 "asn1p_y.y"
3974     {
3975                 (yyval.a_expr) = NEW_EXPR();
3976                 checkmem((yyval.a_expr));
3977                 (yyval.a_expr)->expr_type = (yyvsp[(1) - (1)].a_type);
3978                 (yyval.a_expr)->meta_type = AMT_TYPE;
3979         }
3980     break;
3981
3982   case 193:
3983 #line 1732 "asn1p_y.y"
3984     {
3985         (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr);
3986         (yyval.a_expr)->expr_type = ASN_BASIC_INTEGER;
3987         (yyval.a_expr)->meta_type = AMT_TYPE;
3988     }
3989     break;
3990
3991   case 194:
3992 #line 1737 "asn1p_y.y"
3993     {
3994         (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr);
3995         (yyval.a_expr)->expr_type = ASN_BASIC_ENUMERATED;
3996         (yyval.a_expr)->meta_type = AMT_TYPE;
3997     }
3998     break;
3999
4000   case 195:
4001 #line 1742 "asn1p_y.y"
4002     {
4003         (yyval.a_expr) = (yyvsp[(4) - (5)].a_expr);
4004         (yyval.a_expr)->expr_type = ASN_BASIC_BIT_STRING;
4005         (yyval.a_expr)->meta_type = AMT_TYPE;
4006     }
4007     break;
4008
4009   case 196:
4010 #line 1747 "asn1p_y.y"
4011     {
4012         (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr);
4013         (yyval.a_expr)->expr_type = ASN_BASIC_BIT_STRING;
4014         (yyval.a_expr)->meta_type = AMT_TYPE;
4015     }
4016     break;
4017
4018   case 197:
4019 #line 1752 "asn1p_y.y"
4020     {
4021                 (yyval.a_expr) = NEW_EXPR();
4022                 checkmem((yyval.a_expr));
4023         (yyval.a_expr)->expr_type = ASN_BASIC_BIT_STRING;
4024         (yyval.a_expr)->meta_type = AMT_TYPE;
4025     }
4026     break;
4027
4028   case 198:
4029 #line 1761 "asn1p_y.y"
4030     { (yyval.a_type) = ASN_STRING_BMPString; }
4031     break;
4032
4033   case 199:
4034 #line 1762 "asn1p_y.y"
4035     {
4036                 (yyval.a_type) = ASN_STRING_GeneralString;
4037                 fprintf(stderr, "WARNING: GeneralString is not fully supported\n");
4038         }
4039     break;
4040
4041   case 200:
4042 #line 1766 "asn1p_y.y"
4043     {
4044                 (yyval.a_type) = ASN_STRING_GraphicString;
4045                 fprintf(stderr, "WARNING: GraphicString is not fully supported\n");
4046         }
4047     break;
4048
4049   case 201:
4050 #line 1770 "asn1p_y.y"
4051     { (yyval.a_type) = ASN_STRING_IA5String; }
4052     break;
4053
4054   case 202:
4055 #line 1771 "asn1p_y.y"
4056     { (yyval.a_type) = ASN_STRING_ISO646String; }
4057     break;
4058
4059   case 203:
4060 #line 1772 "asn1p_y.y"
4061     { (yyval.a_type) = ASN_STRING_NumericString; }
4062     break;
4063
4064   case 204:
4065 #line 1773 "asn1p_y.y"
4066     { (yyval.a_type) = ASN_STRING_PrintableString; }
4067     break;
4068
4069   case 205:
4070 #line 1774 "asn1p_y.y"
4071     {
4072                 (yyval.a_type) = ASN_STRING_T61String;
4073                 fprintf(stderr, "WARNING: T61String is not fully supported\n");
4074         }
4075     break;
4076
4077   case 206:
4078 #line 1778 "asn1p_y.y"
4079     { (yyval.a_type) = ASN_STRING_TeletexString; }
4080     break;
4081
4082   case 207:
4083 #line 1779 "asn1p_y.y"
4084     { (yyval.a_type) = ASN_STRING_UniversalString; }
4085     break;
4086
4087   case 208:
4088 #line 1780 "asn1p_y.y"
4089     { (yyval.a_type) = ASN_STRING_UTF8String; }
4090     break;
4091
4092   case 209:
4093 #line 1781 "asn1p_y.y"
4094     {
4095                 (yyval.a_type) = ASN_STRING_VideotexString;
4096                 fprintf(stderr, "WARNING: VideotexString is not fully supported\n");
4097         }
4098     break;
4099
4100   case 210:
4101 #line 1785 "asn1p_y.y"
4102     { (yyval.a_type) = ASN_STRING_VisibleString; }
4103     break;
4104
4105   case 211:
4106 #line 1786 "asn1p_y.y"
4107     { (yyval.a_type) = ASN_STRING_ObjectDescriptor; }
4108     break;
4109
4110   case 216:
4111 #line 1798 "asn1p_y.y"
4112     { (yyval.a_constr) = 0; }
4113     break;
4114
4115   case 218:
4116 #line 1803 "asn1p_y.y"
4117     { (yyval.a_constr) = 0; }
4118     break;
4119
4120   case 220:
4121 #line 1808 "asn1p_y.y"
4122     { (yyval.a_constr) = 0; }
4123     break;
4124
4125   case 223:
4126 #line 1814 "asn1p_y.y"
4127     {
4128                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(2) - (3)].a_constr), 0);
4129     }
4130     break;
4131
4132   case 225:
4133 #line 1821 "asn1p_y.y"
4134     {
4135         if((yyvsp[(2) - (2)].a_constr)->type == ACT_CA_SET && (yyvsp[(2) - (2)].a_constr)->el_count == 1) {
4136             CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (2)].a_constr), (yyvsp[(2) - (2)].a_constr)->elements[0]);
4137         } else {
4138             CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (2)].a_constr), (yyvsp[(2) - (2)].a_constr));
4139         }
4140         }
4141     break;
4142
4143   case 229:
4144 #line 1835 "asn1p_y.y"
4145     {
4146                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4147                 (yyval.a_constr)->type = ACT_EL_EXT;
4148         }
4149     break;
4150
4151   case 231:
4152 #line 1840 "asn1p_y.y"
4153     {
4154        asn1p_constraint_t *ct;
4155        ct = asn1p_constraint_new(yylineno, currentModule);
4156        ct->type = ACT_EL_EXT;
4157        CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (3)].a_constr), ct);
4158    }
4159     break;
4160
4161   case 232:
4162 #line 1846 "asn1p_y.y"
4163     {
4164        asn1p_constraint_t *ct;
4165        ct = asn1p_constraint_new(yylineno, currentModule);
4166        ct->type = ACT_EL_EXT;
4167        CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (5)].a_constr), ct);
4168        ct = (yyval.a_constr);
4169        CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, ct, (yyvsp[(5) - (5)].a_constr));
4170    }
4171     break;
4172
4173   case 234:
4174 #line 1858 "asn1p_y.y"
4175     {
4176                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_AEX, (yyvsp[(3) - (3)].a_constr), 0);
4177         }
4178     break;
4179
4180   case 236:
4181 #line 1865 "asn1p_y.y"
4182     {
4183                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_UNI, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr));
4184         }
4185     break;
4186
4187   case 238:
4188 #line 1872 "asn1p_y.y"
4189     {
4190                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_INT, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr));
4191         }
4192     break;
4193
4194   case 240:
4195 #line 1880 "asn1p_y.y"
4196     {
4197                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_EXC, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr));
4198         }
4199     break;
4200
4201   case 242:
4202 #line 1887 "asn1p_y.y"
4203     {
4204         int ret;
4205         (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4206         checkmem((yyval.a_constr));
4207         (yyval.a_constr)->type = ACT_CA_SET;
4208         ret = asn1p_constraint_insert((yyval.a_constr), (yyvsp[(2) - (3)].a_constr));
4209         checkmem(ret == 0);
4210     }
4211     break;
4212
4213   case 243:
4214 #line 1898 "asn1p_y.y"
4215     {
4216                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4217                 checkmem((yyval.a_constr));
4218                 (yyval.a_constr)->type = ACT_EL_VALUE;
4219                 (yyval.a_constr)->value = (yyvsp[(1) - (1)].a_value);
4220         }
4221     break;
4222
4223   case 244:
4224 #line 1904 "asn1p_y.y"
4225     {
4226                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4227                 checkmem((yyval.a_constr));
4228                 (yyval.a_constr)->type = ACT_EL_TYPE;
4229                 (yyval.a_constr)->containedSubtype = (yyvsp[(1) - (1)].a_value);
4230         }
4231     break;
4232
4233   case 250:
4234 #line 1920 "asn1p_y.y"
4235     {
4236                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_FROM, (yyvsp[(2) - (2)].a_constr), 0);
4237         }
4238     break;
4239
4240   case 251:
4241 #line 1925 "asn1p_y.y"
4242     {
4243                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_SIZE, (yyvsp[(2) - (2)].a_constr), 0);
4244         }
4245     break;
4246
4247   case 252:
4248 #line 1930 "asn1p_y.y"
4249     {
4250                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4251                 (yyval.a_constr)->type = ACT_CT_PATTERN;
4252                 (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(2) - (2)].tv_opaque).buf, (yyvsp[(2) - (2)].tv_opaque).len, 0);
4253         }
4254     break;
4255
4256   case 253:
4257 #line 1935 "asn1p_y.y"
4258     {
4259                 asn1p_ref_t *ref;
4260                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4261                 (yyval.a_constr)->type = ACT_CT_PATTERN;
4262                 ref = asn1p_ref_new(yylineno, currentModule);
4263                 asn1p_ref_add_component(ref, (yyvsp[(2) - (2)].tv_str), RLT_lowercase);
4264                 (yyval.a_constr)->value = asn1p_value_fromref(ref, 0);
4265                 free((yyvsp[(2) - (2)].tv_str));
4266         }
4267     break;
4268
4269   case 254:
4270 #line 1947 "asn1p_y.y"
4271     {
4272                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4273                 checkmem((yyval.a_constr));
4274                 (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype);
4275                 (yyval.a_constr)->range_start = (yyvsp[(1) - (3)].a_value);
4276                 (yyval.a_constr)->range_stop = (yyvsp[(3) - (3)].a_value);
4277     }
4278     break;
4279
4280   case 256:
4281 #line 1957 "asn1p_y.y"
4282     {
4283                 (yyval.a_value) = asn1p_value_fromint(-123);
4284                 (yyval.a_value)->type = ATV_MIN;
4285     }
4286     break;
4287
4288   case 258:
4289 #line 1964 "asn1p_y.y"
4290     {
4291                 (yyval.a_value) = asn1p_value_fromint(321);
4292                 (yyval.a_value)->type = ATV_MAX;
4293     }
4294     break;
4295
4296   case 260:
4297 #line 1972 "asn1p_y.y"
4298     {
4299                 (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B');
4300                 checkmem((yyval.a_value));
4301                 free((yyvsp[(1) - (1)].tv_str));
4302         }
4303     break;
4304
4305   case 261:
4306 #line 1977 "asn1p_y.y"
4307     {
4308                 (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H');
4309                 checkmem((yyval.a_value));
4310                 free((yyvsp[(1) - (1)].tv_str));
4311         }
4312     break;
4313
4314   case 262:
4315 #line 1985 "asn1p_y.y"
4316     {
4317                 (yyval.a_value) = asn1p_value_fromtype((yyvsp[(2) - (2)].a_expr));
4318                 checkmem((yyval.a_value));
4319                 asn1p_expr_free((yyvsp[(2) - (2)].a_expr));
4320     }
4321     break;
4322
4323   case 263:
4324 #line 1991 "asn1p_y.y"
4325     {
4326                 (yyval.a_value) = asn1p_value_fromtype((yyvsp[(1) - (1)].a_expr));
4327                 checkmem((yyval.a_value));
4328                 asn1p_expr_free((yyvsp[(1) - (1)].a_expr));
4329     }
4330     break;
4331
4332   case 264:
4333 #line 2003 "asn1p_y.y"
4334     {
4335                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMP, (yyvsp[(3) - (3)].a_constr), 0);
4336         }
4337     break;
4338
4339   case 265:
4340 #line 2006 "asn1p_y.y"
4341     {
4342         assert((yyvsp[(3) - (3)].a_constr)->type == ACT_CA_CSV);
4343         (yyvsp[(3) - (3)].a_constr)->type = ACT_CT_WCOMPS;
4344         (yyval.a_constr) = (yyvsp[(3) - (3)].a_constr);
4345         }
4346     break;
4347
4348   case 269:
4349 #line 2014 "asn1p_y.y"
4350     { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); }
4351     break;
4352
4353   case 270:
4354 #line 2016 "asn1p_y.y"
4355     {
4356         assert((yyvsp[(4) - (5)].a_constr)->type == ACT_CA_CSV);
4357                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4358         (yyval.a_constr)->type = ACT_CA_CSV;
4359                 asn1p_constraint_t *ct = asn1p_constraint_new(yylineno, currentModule);
4360                 checkmem((yyval.a_constr));
4361                 ct->type = ACT_EL_EXT;
4362         asn1p_constraint_insert((yyval.a_constr), ct);
4363         for(unsigned i = 0; i < (yyvsp[(4) - (5)].a_constr)->el_count; i++) {
4364             asn1p_constraint_insert((yyval.a_constr), (yyvsp[(4) - (5)].a_constr)->elements[i]);
4365         }
4366     }
4367     break;
4368
4369   case 271:
4370 #line 2029 "asn1p_y.y"
4371     {
4372         (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4373         (yyval.a_constr)->type = ACT_CA_CSV;
4374         asn1p_constraint_insert((yyval.a_constr), (yyvsp[(1) - (1)].a_constr));
4375     }
4376     break;
4377
4378   case 272:
4379 #line 2034 "asn1p_y.y"
4380     {
4381         (yyval.a_constr) = (yyvsp[(1) - (3)].a_constr);
4382         asn1p_constraint_insert((yyval.a_constr), (yyvsp[(3) - (3)].a_constr));
4383         }
4384     break;
4385
4386   case 273:
4387 #line 2040 "asn1p_y.y"
4388     {
4389         (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4390         checkmem((yyval.a_constr));
4391         (yyval.a_constr)->type = ACT_EL_VALUE;
4392         (yyval.a_constr)->value = (yyvsp[(1) - (3)].a_value);
4393         if((yyvsp[(2) - (3)].a_constr)) asn1p_constraint_insert((yyval.a_constr), (yyvsp[(2) - (3)].a_constr));
4394         (yyval.a_constr)->presence = (yyvsp[(3) - (3)].a_pres);
4395     }
4396     break;
4397
4398   case 274:
4399 #line 2054 "asn1p_y.y"
4400     { (yyval.a_pres) = ACPRES_DEFAULT; }
4401     break;
4402
4403   case 275:
4404 #line 2055 "asn1p_y.y"
4405     { (yyval.a_pres) = (yyvsp[(1) - (1)].a_pres); }
4406     break;
4407
4408   case 276:
4409 #line 2059 "asn1p_y.y"
4410     {
4411                 (yyval.a_pres) = ACPRES_PRESENT;
4412         }
4413     break;
4414
4415   case 277:
4416 #line 2062 "asn1p_y.y"
4417     {
4418                 (yyval.a_pres) = ACPRES_ABSENT;
4419         }
4420     break;
4421
4422   case 278:
4423 #line 2065 "asn1p_y.y"
4424     {
4425                 (yyval.a_pres) = ACPRES_OPTIONAL;
4426         }
4427     break;
4428
4429   case 282:
4430 #line 2080 "asn1p_y.y"
4431     { asn1p_lexer_hack_push_opaque_state(); }
4432     break;
4433
4434   case 283:
4435 #line 2080 "asn1p_y.y"
4436     {
4437                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4438                 checkmem((yyval.a_constr));
4439                 (yyval.a_constr)->type = ACT_CT_CTDBY;
4440                 (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(5) - (5)].tv_opaque).buf, (yyvsp[(5) - (5)].tv_opaque).len, 0);
4441                 checkmem((yyval.a_constr)->value);
4442                 (yyval.a_constr)->value->type = ATV_UNPARSED;
4443         }
4444     break;
4445
4446   case 284:
4447 #line 2091 "asn1p_y.y"
4448     {
4449                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4450                 (yyval.a_constr)->type = ACT_CT_CTNG;
4451                 (yyval.a_constr)->value = asn1p_value_fromtype((yyvsp[(2) - (2)].a_expr));
4452                 asn1p_expr_free((yyvsp[(2) - (2)].a_expr));
4453         }
4454     break;
4455
4456   case 285:
4457 #line 2100 "asn1p_y.y"
4458     { (yyval.a_ctype) = ACT_EL_RANGE; }
4459     break;
4460
4461   case 286:
4462 #line 2101 "asn1p_y.y"
4463     { (yyval.a_ctype) = ACT_EL_RLRANGE; }
4464     break;
4465
4466   case 287:
4467 #line 2102 "asn1p_y.y"
4468     { (yyval.a_ctype) = ACT_EL_LLRANGE; }
4469     break;
4470
4471   case 288:
4472 #line 2103 "asn1p_y.y"
4473     { (yyval.a_ctype) = ACT_EL_ULRANGE; }
4474     break;
4475
4476   case 289:
4477 #line 2106 "asn1p_y.y"
4478     {
4479                 (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr);
4480         }
4481     break;
4482
4483   case 290:
4484 #line 2109 "asn1p_y.y"
4485     {
4486                 (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr);
4487         }
4488     break;
4489
4490   case 291:
4491 #line 2118 "asn1p_y.y"
4492     {
4493                 asn1p_ref_t *ref = asn1p_ref_new(yylineno, currentModule);
4494                 asn1p_constraint_t *ct;
4495                 int ret;
4496                 ret = asn1p_ref_add_component(ref, (yyvsp[(2) - (3)].tv_str), 0);
4497                 checkmem(ret == 0);
4498                 ct = asn1p_constraint_new(yylineno, currentModule);
4499                 checkmem((yyval.a_constr));
4500                 ct->type = ACT_EL_VALUE;
4501                 ct->value = asn1p_value_fromref(ref, 0);
4502                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, ct, 0);
4503                 free((yyvsp[(2) - (3)].tv_str));
4504         }
4505     break;
4506
4507   case 292:
4508 #line 2134 "asn1p_y.y"
4509     {
4510                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr));
4511         }
4512     break;
4513
4514   case 293:
4515 #line 2140 "asn1p_y.y"
4516     {
4517                 (yyval.a_constr) = asn1p_constraint_new(yylineno, currentModule);
4518                 checkmem((yyval.a_constr));
4519                 (yyval.a_constr)->type = ACT_EL_VALUE;
4520                 (yyval.a_constr)->value = asn1p_value_fromref((yyvsp[(1) - (1)].a_ref), 0);
4521         }
4522     break;
4523
4524   case 294:
4525 #line 2146 "asn1p_y.y"
4526     {
4527                 asn1p_constraint_t *ct;
4528                 ct = asn1p_constraint_new(yylineno, currentModule);
4529                 checkmem(ct);
4530                 ct->type = ACT_EL_VALUE;
4531                 ct->value = asn1p_value_fromref((yyvsp[(3) - (3)].a_ref), 0);
4532                 CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (3)].a_constr), ct);
4533         }
4534     break;
4535
4536   case 295:
4537 #line 2160 "asn1p_y.y"
4538     {
4539                 char *p = malloc(strlen((yyvsp[(2) - (2)].tv_str)) + 2);
4540                 int ret;
4541                 *p = '@';
4542                 strcpy(p + 1, (yyvsp[(2) - (2)].tv_str));
4543                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
4544                 ret = asn1p_ref_add_component((yyval.a_ref), p, 0);
4545                 checkmem(ret == 0);
4546                 free(p);
4547                 free((yyvsp[(2) - (2)].tv_str));
4548         }
4549     break;
4550
4551   case 296:
4552 #line 2171 "asn1p_y.y"
4553     {
4554                 char *p = malloc(strlen((yyvsp[(3) - (3)].tv_str)) + 3);
4555                 int ret;
4556                 p[0] = '@';
4557                 p[1] = '.';
4558                 strcpy(p + 2, (yyvsp[(3) - (3)].tv_str));
4559                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
4560                 ret = asn1p_ref_add_component((yyval.a_ref), p, 0);
4561                 checkmem(ret == 0);
4562                 free(p);
4563                 free((yyvsp[(3) - (3)].tv_str));
4564         }
4565     break;
4566
4567   case 297:
4568 #line 2187 "asn1p_y.y"
4569     {
4570                 (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str);
4571         }
4572     break;
4573
4574   case 298:
4575 #line 2190 "asn1p_y.y"
4576     {
4577                 int l1 = strlen((yyvsp[(1) - (3)].tv_str));
4578                 int l3 = strlen((yyvsp[(3) - (3)].tv_str));
4579                 (yyval.tv_str) = malloc(l1 + 1 + l3 + 1);
4580                 memcpy((yyval.tv_str), (yyvsp[(1) - (3)].tv_str), l1);
4581                 (yyval.tv_str)[l1] = '.';
4582                 memcpy((yyval.tv_str) + l1 + 1, (yyvsp[(3) - (3)].tv_str), l3);
4583                 (yyval.tv_str)[l1 + 1 + l3] = '\0';
4584                 free((yyvsp[(1) - (3)].tv_str));
4585                 free((yyvsp[(3) - (3)].tv_str));
4586         }
4587     break;
4588
4589   case 299:
4590 #line 2210 "asn1p_y.y"
4591     {
4592                 (yyval.a_marker).flags = EM_NOMARK;
4593                 (yyval.a_marker).default_value = 0;
4594         }
4595     break;
4596
4597   case 300:
4598 #line 2214 "asn1p_y.y"
4599     { (yyval.a_marker) = (yyvsp[(1) - (1)].a_marker); }
4600     break;
4601
4602   case 301:
4603 #line 2218 "asn1p_y.y"
4604     {
4605                 (yyval.a_marker).flags = EM_OPTIONAL | EM_INDIRECT;
4606                 (yyval.a_marker).default_value = 0;
4607         }
4608     break;
4609
4610   case 302:
4611 #line 2222 "asn1p_y.y"
4612     {
4613                 (yyval.a_marker).flags = EM_DEFAULT;
4614                 (yyval.a_marker).default_value = (yyvsp[(2) - (2)].a_value);
4615         }
4616     break;
4617
4618   case 303:
4619 #line 2229 "asn1p_y.y"
4620     {
4621                 (yyval.a_expr) = NEW_EXPR();
4622                 checkmem((yyval.a_expr));
4623                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
4624     }
4625     break;
4626
4627   case 304:
4628 #line 2234 "asn1p_y.y"
4629     {
4630                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
4631                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
4632     }
4633     break;
4634
4635   case 305:
4636 #line 2240 "asn1p_y.y"
4637     {
4638                 (yyval.a_expr) = NEW_EXPR();
4639                 checkmem((yyval.a_expr));
4640                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4641                 (yyval.a_expr)->meta_type = AMT_VALUE;
4642                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str);
4643     }
4644     break;
4645
4646   case 306:
4647 #line 2249 "asn1p_y.y"
4648     {
4649                 (yyval.a_expr) = NEW_EXPR();
4650                 checkmem((yyval.a_expr));
4651                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
4652         }
4653     break;
4654
4655   case 307:
4656 #line 2254 "asn1p_y.y"
4657     {
4658                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
4659                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
4660         }
4661     break;
4662
4663   case 308:
4664 #line 2261 "asn1p_y.y"
4665     {
4666                 (yyval.a_expr) = NEW_EXPR();
4667                 checkmem((yyval.a_expr));
4668                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4669                 (yyval.a_expr)->meta_type = AMT_VALUE;
4670                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
4671                 (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value);
4672         }
4673     break;
4674
4675   case 309:
4676 #line 2269 "asn1p_y.y"
4677     {
4678                 (yyval.a_expr) = NEW_EXPR();
4679                 checkmem((yyval.a_expr));
4680                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4681                 (yyval.a_expr)->meta_type = AMT_VALUE;
4682                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
4683                 (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value);
4684         }
4685     break;
4686
4687   case 310:
4688 #line 2279 "asn1p_y.y"
4689     {
4690                 (yyval.a_expr) = NEW_EXPR();
4691                 checkmem((yyval.a_expr));
4692                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
4693         }
4694     break;
4695
4696   case 311:
4697 #line 2284 "asn1p_y.y"
4698     {
4699                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
4700                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
4701         }
4702     break;
4703
4704   case 312:
4705 #line 2291 "asn1p_y.y"
4706     {
4707                 (yyval.a_expr) = NEW_EXPR();
4708                 checkmem((yyval.a_expr));
4709                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4710                 (yyval.a_expr)->meta_type = AMT_VALUE;
4711                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
4712                 (yyval.a_expr)->value = asn1p_value_fromint((yyvsp[(3) - (4)].a_int));
4713         }
4714     break;
4715
4716   case 313:
4717 #line 2299 "asn1p_y.y"
4718     {
4719                 (yyval.a_expr) = NEW_EXPR();
4720                 checkmem((yyval.a_expr));
4721                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4722                 (yyval.a_expr)->meta_type = AMT_VALUE;
4723                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
4724                 (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value);
4725         }
4726     break;
4727
4728   case 314:
4729 #line 2309 "asn1p_y.y"
4730     {
4731                 (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr);
4732         asn1p_expr_t *first_memb = TQ_FIRST(&((yyval.a_expr)->members));
4733         if(first_memb) {
4734             if(first_memb->expr_type == A1TC_EXTENSIBLE) {
4735                 return yyerror(
4736                     "The ENUMERATION cannot start with extension (...).");
4737             }
4738         } else {
4739             return yyerror(
4740                 "The ENUMERATION list cannot be empty.");
4741         }
4742     }
4743     break;
4744
4745   case 315:
4746 #line 2324 "asn1p_y.y"
4747     {
4748                 (yyval.a_expr) = NEW_EXPR();
4749                 checkmem((yyval.a_expr));
4750                 asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr));
4751         }
4752     break;
4753
4754   case 316:
4755 #line 2329 "asn1p_y.y"
4756     {
4757                 (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr);
4758                 asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr));
4759         }
4760     break;
4761
4762   case 317:
4763 #line 2336 "asn1p_y.y"
4764     {
4765                 (yyval.a_expr) = NEW_EXPR();
4766                 checkmem((yyval.a_expr));
4767                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4768                 (yyval.a_expr)->meta_type = AMT_VALUE;
4769                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str);
4770         }
4771     break;
4772
4773   case 318:
4774 #line 2343 "asn1p_y.y"
4775     {
4776                 (yyval.a_expr) = NEW_EXPR();
4777                 checkmem((yyval.a_expr));
4778                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4779                 (yyval.a_expr)->meta_type = AMT_VALUE;
4780                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
4781                 (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value);
4782         }
4783     break;
4784
4785   case 319:
4786 #line 2351 "asn1p_y.y"
4787     {
4788                 (yyval.a_expr) = NEW_EXPR();
4789                 checkmem((yyval.a_expr));
4790                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4791                 (yyval.a_expr)->meta_type = AMT_VALUE;
4792                 (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str);
4793                 (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value);
4794         }
4795     break;
4796
4797   case 320:
4798 #line 2359 "asn1p_y.y"
4799     {
4800                 (yyval.a_expr) = NEW_EXPR();
4801                 checkmem((yyval.a_expr));
4802                 (yyval.a_expr)->expr_type = A1TC_UNIVERVAL;
4803                 (yyval.a_expr)->meta_type = AMT_VALUE;
4804                 (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value);
4805         }
4806     break;
4807
4808   case 321:
4809 #line 2366 "asn1p_y.y"
4810     {
4811                 (yyval.a_expr) = NEW_EXPR();
4812                 checkmem((yyval.a_expr));
4813                 (yyval.a_expr)->Identifier = strdup("...");
4814                 checkmem((yyval.a_expr)->Identifier);
4815                 (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE;
4816                 (yyval.a_expr)->meta_type = AMT_VALUE;
4817         }
4818     break;
4819
4820   case 322:
4821 #line 2377 "asn1p_y.y"
4822     {
4823                 (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int));
4824                 checkmem((yyval.a_value));
4825         }
4826     break;
4827
4828   case 323:
4829 #line 2381 "asn1p_y.y"
4830     {
4831                 (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int));
4832                 checkmem((yyval.a_value));
4833         }
4834     break;
4835
4836   case 324:
4837 #line 2388 "asn1p_y.y"
4838     {
4839                 (yyval.a_value) = asn1p_value_fromdouble((yyvsp[(1) - (1)].a_dbl));
4840                 checkmem((yyval.a_value));
4841         }
4842     break;
4843
4844   case 325:
4845 #line 2419 "asn1p_y.y"
4846     { memset(&(yyval.a_tag), 0, sizeof((yyval.a_tag))); }
4847     break;
4848
4849   case 326:
4850 #line 2420 "asn1p_y.y"
4851     { (yyval.a_tag) = (yyvsp[(1) - (1)].a_tag); }
4852     break;
4853
4854   case 327:
4855 #line 2424 "asn1p_y.y"
4856     {
4857                 (yyval.a_tag) = (yyvsp[(1) - (2)].a_tag);
4858                 (yyval.a_tag).tag_mode = (yyvsp[(2) - (2)].a_tag).tag_mode;
4859         }
4860     break;
4861
4862   case 328:
4863 #line 2431 "asn1p_y.y"
4864     {
4865                 (yyval.a_tag) = (yyvsp[(2) - (4)].a_tag);
4866                 (yyval.a_tag).tag_value = (yyvsp[(3) - (4)].a_int);
4867         }
4868     break;
4869
4870   case 329:
4871 #line 2437 "asn1p_y.y"
4872     { (yyval.a_tag).tag_class = TC_CONTEXT_SPECIFIC; }
4873     break;
4874
4875   case 330:
4876 #line 2438 "asn1p_y.y"
4877     { (yyval.a_tag).tag_class = TC_UNIVERSAL; }
4878     break;
4879
4880   case 331:
4881 #line 2439 "asn1p_y.y"
4882     { (yyval.a_tag).tag_class = TC_APPLICATION; }
4883     break;
4884
4885   case 332:
4886 #line 2440 "asn1p_y.y"
4887     { (yyval.a_tag).tag_class = TC_PRIVATE; }
4888     break;
4889
4890   case 333:
4891 #line 2444 "asn1p_y.y"
4892     { (yyval.a_tag).tag_mode = TM_DEFAULT; }
4893     break;
4894
4895   case 334:
4896 #line 2445 "asn1p_y.y"
4897     { (yyval.a_tag).tag_mode = TM_IMPLICIT; }
4898     break;
4899
4900   case 335:
4901 #line 2446 "asn1p_y.y"
4902     { (yyval.a_tag).tag_mode = TM_EXPLICIT; }
4903     break;
4904
4905   case 336:
4906 #line 2450 "asn1p_y.y"
4907     {
4908                 checkmem((yyvsp[(1) - (1)].tv_str));
4909                 (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str);
4910         }
4911     break;
4912
4913   case 337:
4914 #line 2454 "asn1p_y.y"
4915     {
4916                 checkmem((yyvsp[(1) - (1)].tv_str));
4917                 (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str);
4918         }
4919     break;
4920
4921   case 338:
4922 #line 2462 "asn1p_y.y"
4923     { (yyval.tv_str) = 0; }
4924     break;
4925
4926   case 339:
4927 #line 2463 "asn1p_y.y"
4928     {
4929                 (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str);
4930         }
4931     break;
4932
4933   case 340:
4934 #line 2469 "asn1p_y.y"
4935     {
4936                 checkmem((yyvsp[(1) - (1)].tv_str));
4937                 (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str);
4938         }
4939     break;
4940
4941   case 341:
4942 #line 2476 "asn1p_y.y"
4943     {
4944                 (yyval.a_ref) = asn1p_ref_new(yylineno, currentModule);
4945                 asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_lowercase);
4946                 free((yyvsp[(1) - (1)].tv_str));
4947     }
4948     break;
4949
4950   case 342:
4951 #line 2483 "asn1p_y.y"
4952     {
4953                 (yyval.a_value) = asn1p_value_fromref((yyvsp[(1) - (1)].a_ref), 0);
4954     }
4955     break;
4956
4957
4958 /* Line 1267 of yacc.c.  */
4959 #line 4957 "asn1p_y.c"
4960       default: break;
4961     }
4962   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4963
4964   YYPOPSTACK (yylen);
4965   yylen = 0;
4966   YY_STACK_PRINT (yyss, yyssp);
4967
4968   *++yyvsp = yyval;
4969
4970
4971   /* Now `shift' the result of the reduction.  Determine what state
4972      that goes to, based on the state we popped back to and the rule
4973      number reduced by.  */
4974
4975   yyn = yyr1[yyn];
4976
4977   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4978   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4979     yystate = yytable[yystate];
4980   else
4981     yystate = yydefgoto[yyn - YYNTOKENS];
4982
4983   goto yynewstate;
4984
4985
4986 /*------------------------------------.
4987 | yyerrlab -- here on detecting error |
4988 `------------------------------------*/
4989 yyerrlab:
4990   /* If not already recovering from an error, report this error.  */
4991   if (!yyerrstatus)
4992     {
4993       ++yynerrs;
4994 #if ! YYERROR_VERBOSE
4995       yyerror (YY_("syntax error"));
4996 #else
4997       {
4998         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
4999         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
5000           {
5001             YYSIZE_T yyalloc = 2 * yysize;
5002             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
5003               yyalloc = YYSTACK_ALLOC_MAXIMUM;
5004             if (yymsg != yymsgbuf)
5005               YYSTACK_FREE (yymsg);
5006             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
5007             if (yymsg)
5008               yymsg_alloc = yyalloc;
5009             else
5010               {
5011                 yymsg = yymsgbuf;
5012                 yymsg_alloc = sizeof yymsgbuf;
5013               }
5014           }
5015
5016         if (0 < yysize && yysize <= yymsg_alloc)
5017           {
5018             (void) yysyntax_error (yymsg, yystate, yychar);
5019             yyerror (yymsg);
5020           }
5021         else
5022           {
5023             yyerror (YY_("syntax error"));
5024             if (yysize != 0)
5025               goto yyexhaustedlab;
5026           }
5027       }
5028 #endif
5029     }
5030
5031
5032
5033   if (yyerrstatus == 3)
5034     {
5035       /* If just tried and failed to reuse look-ahead token after an
5036          error, discard it.  */
5037
5038       if (yychar <= YYEOF)
5039         {
5040           /* Return failure if at end of input.  */
5041           if (yychar == YYEOF)
5042             YYABORT;
5043         }
5044       else
5045         {
5046           yydestruct ("Error: discarding",
5047                       yytoken, &yylval);
5048           yychar = YYEMPTY;
5049         }
5050     }
5051
5052   /* Else will try to reuse look-ahead token after shifting the error
5053      token.  */
5054   goto yyerrlab1;
5055
5056
5057 /*---------------------------------------------------.
5058 | yyerrorlab -- error raised explicitly by YYERROR.  |
5059 `---------------------------------------------------*/
5060 yyerrorlab:
5061
5062   /* Pacify compilers like GCC when the user code never invokes
5063      YYERROR and the label yyerrorlab therefore never appears in user
5064      code.  */
5065   if (/*CONSTCOND*/ 0)
5066      goto yyerrorlab;
5067
5068   /* Do not reclaim the symbols of the rule which action triggered
5069      this YYERROR.  */
5070   YYPOPSTACK (yylen);
5071   yylen = 0;
5072   YY_STACK_PRINT (yyss, yyssp);
5073   yystate = *yyssp;
5074   goto yyerrlab1;
5075
5076
5077 /*-------------------------------------------------------------.
5078 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
5079 `-------------------------------------------------------------*/
5080 yyerrlab1:
5081   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
5082
5083   for (;;)
5084     {
5085       yyn = yypact[yystate];
5086       if (yyn != YYPACT_NINF)
5087         {
5088           yyn += YYTERROR;
5089           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5090             {
5091               yyn = yytable[yyn];
5092               if (0 < yyn)
5093                 break;
5094             }
5095         }
5096
5097       /* Pop the current state because it cannot handle the error token.  */
5098       if (yyssp == yyss)
5099         YYABORT;
5100
5101
5102       yydestruct ("Error: popping",
5103                   yystos[yystate], yyvsp);
5104       YYPOPSTACK (1);
5105       yystate = *yyssp;
5106       YY_STACK_PRINT (yyss, yyssp);
5107     }
5108
5109   if (yyn == YYFINAL)
5110     YYACCEPT;
5111
5112   *++yyvsp = yylval;
5113
5114
5115   /* Shift the error token.  */
5116   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5117
5118   yystate = yyn;
5119   goto yynewstate;
5120
5121
5122 /*-------------------------------------.
5123 | yyacceptlab -- YYACCEPT comes here.  |
5124 `-------------------------------------*/
5125 yyacceptlab:
5126   yyresult = 0;
5127   goto yyreturn;
5128
5129 /*-----------------------------------.
5130 | yyabortlab -- YYABORT comes here.  |
5131 `-----------------------------------*/
5132 yyabortlab:
5133   yyresult = 1;
5134   goto yyreturn;
5135
5136 #ifndef yyoverflow
5137 /*-------------------------------------------------.
5138 | yyexhaustedlab -- memory exhaustion comes here.  |
5139 `-------------------------------------------------*/
5140 yyexhaustedlab:
5141   yyerror (YY_("memory exhausted"));
5142   yyresult = 2;
5143   /* Fall through.  */
5144 #endif
5145
5146 yyreturn:
5147   if (yychar != YYEOF && yychar != YYEMPTY)
5148      yydestruct ("Cleanup: discarding lookahead",
5149                  yytoken, &yylval);
5150   /* Do not reclaim the symbols of the rule which action triggered
5151      this YYABORT or YYACCEPT.  */
5152   YYPOPSTACK (yylen);
5153   YY_STACK_PRINT (yyss, yyssp);
5154   while (yyssp != yyss)
5155     {
5156       yydestruct ("Cleanup: popping",
5157                   yystos[*yyssp], yyvsp);
5158       YYPOPSTACK (1);
5159     }
5160 #ifndef yyoverflow
5161   if (yyss != yyssa)
5162     YYSTACK_FREE (yyss);
5163 #endif
5164 #if YYERROR_VERBOSE
5165   if (yymsg != yymsgbuf)
5166     YYSTACK_FREE (yymsg);
5167 #endif
5168   /* Make sure YYID is used.  */
5169   return YYID (yyresult);
5170 }
5171
5172
5173 #line 2487 "asn1p_y.y"
5174
5175
5176
5177 /*
5178  * Convert Xstring ('0101'B or '5'H) to the binary vector.
5179  */
5180 static asn1p_value_t *
5181 _convert_bitstring2binary(char *str, int base) {
5182         asn1p_value_t *val;
5183         int slen;
5184         int memlen;
5185         int baselen;
5186         int bits;
5187         uint8_t *binary_vector;
5188         uint8_t *bv_ptr;
5189         uint8_t cur_val;
5190
5191         assert(str);
5192         assert(str[0] == '\'');
5193
5194         switch(base) {
5195         case 'B':
5196                 baselen = 1;
5197                 break;
5198         case 'H':
5199                 baselen = 4;
5200                 break;
5201         default:
5202                 assert(base == 'B' || base == 'H');
5203                 errno = EINVAL;
5204                 return NULL;
5205         }
5206
5207         slen = strlen(str);
5208         assert(str[slen - 1] == base);
5209         assert(str[slen - 2] == '\'');
5210
5211         memlen = slen / (8 / baselen);  /* Conservative estimate */
5212
5213         bv_ptr = binary_vector = malloc(memlen + 1);
5214         if(bv_ptr == NULL)
5215                 /* ENOMEM */
5216                 return NULL;
5217
5218         cur_val = 0;
5219         bits = 0;
5220         while(*(++str) != '\'') {
5221                 switch(baselen) {
5222                 case 1:
5223                         switch(*str) {
5224                         case '1':
5225                                 cur_val |= 1 << (7 - (bits % 8));
5226                         case '0':
5227                                 break;
5228                         default:
5229                                 assert(!"_y UNREACH1");
5230                         case ' ': case '\r': case '\n':
5231                                 continue;
5232                         }
5233                         break;
5234                 case 4:
5235                         switch(*str) {
5236                         case '0': case '1': case '2': case '3': case '4':
5237                         case '5': case '6': case '7': case '8': case '9':
5238                                 cur_val |= (*str - '0') << (4 - (bits % 8));
5239                                 break;
5240                         case 'A': case 'B': case 'C':
5241                         case 'D': case 'E': case 'F':
5242                                 cur_val |= ((*str - 'A') + 10)
5243                                         << (4 - (bits % 8));
5244                                 break;
5245                         default:
5246                                 assert(!"_y UNREACH2");
5247                         case ' ': case '\r': case '\n':
5248                                 continue;
5249                         }
5250                         break;
5251                 }
5252
5253                 bits += baselen;
5254                 if((bits % 8) == 0) {
5255                         *bv_ptr++ = cur_val;
5256                         cur_val = 0;
5257                 }
5258         }
5259
5260         *bv_ptr = cur_val;
5261         assert((bv_ptr - binary_vector) <= memlen);
5262
5263         val = asn1p_value_frombits(binary_vector, bits, 0);
5264         if(val == NULL) {
5265                 free(binary_vector);
5266         }
5267
5268         return val;
5269 }
5270
5271 /*
5272  * For unnamed types (used in old X.208 compliant modules)
5273  * generate some sort of interim names, to not to force human being to fix
5274  * the specification's compliance to modern ASN.1 standards.
5275  */
5276 static void
5277 _fixup_anonymous_identifier(asn1p_expr_t *expr) {
5278         char *p;
5279         assert(expr->Identifier == 0);
5280
5281         /*
5282          * Try to figure out the type name
5283          * without going too much into details
5284          */
5285         expr->Identifier = ASN_EXPR_TYPE2STR(expr->expr_type);
5286         if(expr->reference && expr->reference->comp_count > 0)
5287                 expr->Identifier = expr->reference->components[0].name;
5288
5289         fprintf(stderr,
5290                 "WARNING: Line %d: expected lower-case member identifier, "
5291                 "found an unnamed %s.\n"
5292                 "WARNING: Obsolete X.208 syntax detected, "
5293                 "please give the member a name.\n",
5294                 yylineno, expr->Identifier ? expr->Identifier : "type");
5295
5296         if(!expr->Identifier)
5297                 expr->Identifier = "unnamed";
5298         expr->Identifier = strdup(expr->Identifier);
5299         assert(expr->Identifier);
5300         /* Make a lowercase identifier from the type name */
5301         for(p = expr->Identifier; *p; p++) {
5302                 switch(*p) {
5303                 case 'A' ... 'Z': *p += 32; break;
5304                 case ' ': *p = '_'; break;
5305                 case '-': *p = '_'; break;
5306                 }
5307         }
5308         fprintf(stderr, "NOTE: Assigning temporary identifier \"%s\". "
5309                         "Name clash may occur later.\n",
5310                 expr->Identifier);
5311 }
5312
5313 static int
5314 yyerror(const char *msg) {
5315         extern char *asn1p_text;
5316         fprintf(stderr,
5317                 "ASN.1 grammar parse error "
5318                 "near %s:%d (token \"%s\"): %s\n",
5319                 ASN_FILENAME, yylineno, asn1p_text, msg);
5320         return -1;
5321 }
5322
5323