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