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