Path: blob/main/crypto/heimdal/lib/asn1/asn1parse.c
34879 views
/* A Bison parser, made by GNU Bison 2.3. */12/* Skeleton implementation for Bison's Yacc-like parsers in C34Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 20065Free Software Foundation, Inc.67This program is free software; you can redistribute it and/or modify8it under the terms of the GNU General Public License as published by9the Free Software Foundation; either version 2, or (at your option)10any later version.1112This program is distributed in the hope that it will be useful,13but WITHOUT ANY WARRANTY; without even the implied warranty of14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15GNU General Public License for more details.1617You should have received a copy of the GNU General Public License18along with this program; if not, write to the Free Software19Foundation, Inc., 51 Franklin Street, Fifth Floor,20Boston, MA 02110-1301, USA. */2122/* As a special exception, you may create a larger work that contains23part or all of the Bison parser skeleton and distribute that work24under terms of your choice, so long as that work isn't itself a25parser generator using the skeleton or a modified version thereof26as a parser skeleton. Alternatively, if you modify or redistribute27the parser skeleton itself, you may (at your option) remove this28special exception, which will cause the skeleton and the resulting29Bison output files to be licensed under the GNU General Public30License without this special exception.3132This special exception was added by the Free Software Foundation in33version 2.2 of Bison. */3435/* C LALR(1) parser skeleton written by Richard Stallman, by36simplifying the original so-called "semantic" parser. */3738/* All symbols defined below should begin with yy or YY, to avoid39infringing on user name space. This should be done even for local40variables, as they might otherwise be expanded by user macros.41There are some unavoidable exceptions within include files to42define necessary library symbols; they are noted "INFRINGES ON43USER NAME SPACE" below. */4445/* Identify Bison output. */46#define YYBISON 14748/* Bison version. */49#define YYBISON_VERSION "2.3"5051/* Skeleton name. */52#define YYSKELETON_NAME "yacc.c"5354/* Pure parsers. */55#define YYPURE 05657/* Using locations. */58#define YYLSP_NEEDED 059606162/* Tokens. */63#ifndef YYTOKENTYPE64# define YYTOKENTYPE65/* Put the tokens into the symbol table, so that GDB and other debuggers66know about them. */67enum yytokentype {68kw_ABSENT = 258,69kw_ABSTRACT_SYNTAX = 259,70kw_ALL = 260,71kw_APPLICATION = 261,72kw_AUTOMATIC = 262,73kw_BEGIN = 263,74kw_BIT = 264,75kw_BMPString = 265,76kw_BOOLEAN = 266,77kw_BY = 267,78kw_CHARACTER = 268,79kw_CHOICE = 269,80kw_CLASS = 270,81kw_COMPONENT = 271,82kw_COMPONENTS = 272,83kw_CONSTRAINED = 273,84kw_CONTAINING = 274,85kw_DEFAULT = 275,86kw_DEFINITIONS = 276,87kw_EMBEDDED = 277,88kw_ENCODED = 278,89kw_END = 279,90kw_ENUMERATED = 280,91kw_EXCEPT = 281,92kw_EXPLICIT = 282,93kw_EXPORTS = 283,94kw_EXTENSIBILITY = 284,95kw_EXTERNAL = 285,96kw_FALSE = 286,97kw_FROM = 287,98kw_GeneralString = 288,99kw_GeneralizedTime = 289,100kw_GraphicString = 290,101kw_IA5String = 291,102kw_IDENTIFIER = 292,103kw_IMPLICIT = 293,104kw_IMPLIED = 294,105kw_IMPORTS = 295,106kw_INCLUDES = 296,107kw_INSTANCE = 297,108kw_INTEGER = 298,109kw_INTERSECTION = 299,110kw_ISO646String = 300,111kw_MAX = 301,112kw_MIN = 302,113kw_MINUS_INFINITY = 303,114kw_NULL = 304,115kw_NumericString = 305,116kw_OBJECT = 306,117kw_OCTET = 307,118kw_OF = 308,119kw_OPTIONAL = 309,120kw_ObjectDescriptor = 310,121kw_PATTERN = 311,122kw_PDV = 312,123kw_PLUS_INFINITY = 313,124kw_PRESENT = 314,125kw_PRIVATE = 315,126kw_PrintableString = 316,127kw_REAL = 317,128kw_RELATIVE_OID = 318,129kw_SEQUENCE = 319,130kw_SET = 320,131kw_SIZE = 321,132kw_STRING = 322,133kw_SYNTAX = 323,134kw_T61String = 324,135kw_TAGS = 325,136kw_TRUE = 326,137kw_TYPE_IDENTIFIER = 327,138kw_TeletexString = 328,139kw_UNION = 329,140kw_UNIQUE = 330,141kw_UNIVERSAL = 331,142kw_UTCTime = 332,143kw_UTF8String = 333,144kw_UniversalString = 334,145kw_VideotexString = 335,146kw_VisibleString = 336,147kw_WITH = 337,148RANGE = 338,149EEQUAL = 339,150ELLIPSIS = 340,151IDENTIFIER = 341,152referencename = 342,153STRING = 343,154NUMBER = 344155};156#endif157/* Tokens. */158#define kw_ABSENT 258159#define kw_ABSTRACT_SYNTAX 259160#define kw_ALL 260161#define kw_APPLICATION 261162#define kw_AUTOMATIC 262163#define kw_BEGIN 263164#define kw_BIT 264165#define kw_BMPString 265166#define kw_BOOLEAN 266167#define kw_BY 267168#define kw_CHARACTER 268169#define kw_CHOICE 269170#define kw_CLASS 270171#define kw_COMPONENT 271172#define kw_COMPONENTS 272173#define kw_CONSTRAINED 273174#define kw_CONTAINING 274175#define kw_DEFAULT 275176#define kw_DEFINITIONS 276177#define kw_EMBEDDED 277178#define kw_ENCODED 278179#define kw_END 279180#define kw_ENUMERATED 280181#define kw_EXCEPT 281182#define kw_EXPLICIT 282183#define kw_EXPORTS 283184#define kw_EXTENSIBILITY 284185#define kw_EXTERNAL 285186#define kw_FALSE 286187#define kw_FROM 287188#define kw_GeneralString 288189#define kw_GeneralizedTime 289190#define kw_GraphicString 290191#define kw_IA5String 291192#define kw_IDENTIFIER 292193#define kw_IMPLICIT 293194#define kw_IMPLIED 294195#define kw_IMPORTS 295196#define kw_INCLUDES 296197#define kw_INSTANCE 297198#define kw_INTEGER 298199#define kw_INTERSECTION 299200#define kw_ISO646String 300201#define kw_MAX 301202#define kw_MIN 302203#define kw_MINUS_INFINITY 303204#define kw_NULL 304205#define kw_NumericString 305206#define kw_OBJECT 306207#define kw_OCTET 307208#define kw_OF 308209#define kw_OPTIONAL 309210#define kw_ObjectDescriptor 310211#define kw_PATTERN 311212#define kw_PDV 312213#define kw_PLUS_INFINITY 313214#define kw_PRESENT 314215#define kw_PRIVATE 315216#define kw_PrintableString 316217#define kw_REAL 317218#define kw_RELATIVE_OID 318219#define kw_SEQUENCE 319220#define kw_SET 320221#define kw_SIZE 321222#define kw_STRING 322223#define kw_SYNTAX 323224#define kw_T61String 324225#define kw_TAGS 325226#define kw_TRUE 326227#define kw_TYPE_IDENTIFIER 327228#define kw_TeletexString 328229#define kw_UNION 329230#define kw_UNIQUE 330231#define kw_UNIVERSAL 331232#define kw_UTCTime 332233#define kw_UTF8String 333234#define kw_UniversalString 334235#define kw_VideotexString 335236#define kw_VisibleString 336237#define kw_WITH 337238#define RANGE 338239#define EEQUAL 339240#define ELLIPSIS 340241#define IDENTIFIER 341242#define referencename 342243#define STRING 343244#define NUMBER 344245246247248249/* Copy the first part of user declarations. */250#line 38 "asn1parse.y"251252253#include <config.h>254255#include <stdio.h>256#include <stdlib.h>257#include <string.h>258#include "symbol.h"259#include "lex.h"260#include "gen_locl.h"261#include "der.h"262263RCSID("$Id$");264265static Type *new_type (Typetype t);266static struct constraint_spec *new_constraint_spec(enum ctype);267static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);268void yyerror (const char *);269static struct objid *new_objid(const char *label, int value);270static void add_oid_to_tail(struct objid *, struct objid *);271static void fix_labels(Symbol *s);272273struct string_list {274char *string;275struct string_list *next;276};277278/* Declarations for Bison */279#define YYMALLOC malloc280#define YYFREE free281282283284/* Enabling traces. */285#ifndef YYDEBUG286# define YYDEBUG 1287#endif288289/* Enabling verbose error messages. */290#ifdef YYERROR_VERBOSE291# undef YYERROR_VERBOSE292# define YYERROR_VERBOSE 1293#else294# define YYERROR_VERBOSE 0295#endif296297/* Enabling the token table. */298#ifndef YYTOKEN_TABLE299# define YYTOKEN_TABLE 0300#endif301302#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED303typedef union YYSTYPE304#line 71 "asn1parse.y"305{306int64_t constant;307struct value *value;308struct range *range;309char *name;310Type *type;311Member *member;312struct objid *objid;313char *defval;314struct string_list *sl;315struct tagtype tag;316struct memhead *members;317struct constraint_spec *constraint_spec;318}319/* Line 193 of yacc.c. */320#line 322 "asn1parse.c"321YYSTYPE;322# define yystype YYSTYPE /* obsolescent; will be withdrawn */323# define YYSTYPE_IS_DECLARED 1324# define YYSTYPE_IS_TRIVIAL 1325#endif326327328329/* Copy the second part of user declarations. */330331332/* Line 216 of yacc.c. */333#line 335 "asn1parse.c"334335#ifdef short336# undef short337#endif338339#ifdef YYTYPE_UINT8340typedef YYTYPE_UINT8 yytype_uint8;341#else342typedef unsigned char yytype_uint8;343#endif344345#ifdef YYTYPE_INT8346typedef YYTYPE_INT8 yytype_int8;347#elif (defined __STDC__ || defined __C99__FUNC__ \348|| defined __cplusplus || defined _MSC_VER)349typedef signed char yytype_int8;350#else351typedef short int yytype_int8;352#endif353354#ifdef YYTYPE_UINT16355typedef YYTYPE_UINT16 yytype_uint16;356#else357typedef unsigned short int yytype_uint16;358#endif359360#ifdef YYTYPE_INT16361typedef YYTYPE_INT16 yytype_int16;362#else363typedef short int yytype_int16;364#endif365366#ifndef YYSIZE_T367# ifdef __SIZE_TYPE__368# define YYSIZE_T __SIZE_TYPE__369# elif defined size_t370# define YYSIZE_T size_t371# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \372|| defined __cplusplus || defined _MSC_VER)373# include <stddef.h> /* INFRINGES ON USER NAME SPACE */374# define YYSIZE_T size_t375# else376# define YYSIZE_T unsigned int377# endif378#endif379380#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)381382#ifndef YY_383# if defined YYENABLE_NLS && YYENABLE_NLS384# if ENABLE_NLS385# include <libintl.h> /* INFRINGES ON USER NAME SPACE */386# define YY_(msgid) dgettext ("bison-runtime", msgid)387# endif388# endif389# ifndef YY_390# define YY_(msgid) msgid391# endif392#endif393394/* Suppress unused-variable warnings by "using" E. */395#if ! defined lint || defined __GNUC__396# define YYUSE(e) ((void) (e))397#else398# define YYUSE(e) /* empty */399#endif400401/* Identity function, used to suppress warnings about constant conditions. */402#ifndef lint403# define YYID(n) (n)404#else405#if (defined __STDC__ || defined __C99__FUNC__ \406|| defined __cplusplus || defined _MSC_VER)407static int408YYID (int i)409#else410static int411YYID (i)412int i;413#endif414{415return i;416}417#endif418419#if ! defined yyoverflow || YYERROR_VERBOSE420421/* The parser invokes alloca or malloc; define the necessary symbols. */422423# ifdef YYSTACK_USE_ALLOCA424# if YYSTACK_USE_ALLOCA425# ifdef __GNUC__426# define YYSTACK_ALLOC __builtin_alloca427# elif defined __BUILTIN_VA_ARG_INCR428# include <alloca.h> /* INFRINGES ON USER NAME SPACE */429# elif defined _AIX430# define YYSTACK_ALLOC __alloca431# elif defined _MSC_VER432# include <malloc.h> /* INFRINGES ON USER NAME SPACE */433# define alloca _alloca434# else435# define YYSTACK_ALLOC alloca436# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \437|| defined __cplusplus || defined _MSC_VER)438# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */439# ifndef _STDLIB_H440# define _STDLIB_H 1441# endif442# endif443# endif444# endif445# endif446447# ifdef YYSTACK_ALLOC448/* Pacify GCC's `empty if-body' warning. */449# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))450# ifndef YYSTACK_ALLOC_MAXIMUM451/* The OS might guarantee only one guard page at the bottom of the stack,452and a page size can be as small as 4096 bytes. So we cannot safely453invoke alloca (N) if N exceeds 4096. Use a slightly smaller number454to allow for a few compiler-allocated temporary stack slots. */455# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */456# endif457# else458# define YYSTACK_ALLOC YYMALLOC459# define YYSTACK_FREE YYFREE460# ifndef YYSTACK_ALLOC_MAXIMUM461# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM462# endif463# if (defined __cplusplus && ! defined _STDLIB_H \464&& ! ((defined YYMALLOC || defined malloc) \465&& (defined YYFREE || defined free)))466# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */467# ifndef _STDLIB_H468# define _STDLIB_H 1469# endif470# endif471# ifndef YYMALLOC472# define YYMALLOC malloc473# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \474|| defined __cplusplus || defined _MSC_VER)475void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */476# endif477# endif478# ifndef YYFREE479# define YYFREE free480# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \481|| defined __cplusplus || defined _MSC_VER)482void free (void *); /* INFRINGES ON USER NAME SPACE */483# endif484# endif485# endif486#endif /* ! defined yyoverflow || YYERROR_VERBOSE */487488489#if (! defined yyoverflow \490&& (! defined __cplusplus \491|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))492493/* A type that is properly aligned for any stack member. */494union yyalloc495{496yytype_int16 yyss;497YYSTYPE yyvs;498};499500/* The size of the maximum gap between one aligned stack and the next. */501# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)502503/* The size of an array large to enough to hold all stacks, each with504N elements. */505# define YYSTACK_BYTES(N) \506((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \507+ YYSTACK_GAP_MAXIMUM)508509/* Copy COUNT objects from FROM to TO. The source and destination do510not overlap. */511# ifndef YYCOPY512# if defined __GNUC__ && 1 < __GNUC__513# define YYCOPY(To, From, Count) \514__builtin_memcpy (To, From, (Count) * sizeof (*(From)))515# else516# define YYCOPY(To, From, Count) \517do \518{ \519YYSIZE_T yyi; \520for (yyi = 0; yyi < (Count); yyi++) \521(To)[yyi] = (From)[yyi]; \522} \523while (YYID (0))524# endif525# endif526527/* Relocate STACK from its old location to the new one. The528local variables YYSIZE and YYSTACKSIZE give the old and new number of529elements in the stack, and YYPTR gives the new location of the530stack. Advance YYPTR to a properly aligned location for the next531stack. */532# define YYSTACK_RELOCATE(Stack) \533do \534{ \535YYSIZE_T yynewbytes; \536YYCOPY (&yyptr->Stack, Stack, yysize); \537Stack = &yyptr->Stack; \538yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \539yyptr += yynewbytes / sizeof (*yyptr); \540} \541while (YYID (0))542543#endif544545/* YYFINAL -- State number of the termination state. */546#define YYFINAL 6547/* YYLAST -- Last index in YYTABLE. */548#define YYLAST 203549550/* YYNTOKENS -- Number of terminals. */551#define YYNTOKENS 98552/* YYNNTS -- Number of nonterminals. */553#define YYNNTS 69554/* YYNRULES -- Number of rules. */555#define YYNRULES 140556/* YYNRULES -- Number of states. */557#define YYNSTATES 220558559/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */560#define YYUNDEFTOK 2561#define YYMAXUTOK 344562563#define YYTRANSLATE(YYX) \564((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)565566/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */567static const yytype_uint8 yytranslate[] =568{5690, 2, 2, 2, 2, 2, 2, 2, 2, 2,5702, 2, 2, 2, 2, 2, 2, 2, 2, 2,5712, 2, 2, 2, 2, 2, 2, 2, 2, 2,5722, 2, 2, 2, 2, 2, 2, 2, 2, 2,57392, 93, 2, 2, 91, 2, 2, 2, 2, 2,5742, 2, 2, 2, 2, 2, 2, 2, 2, 90,5752, 2, 2, 2, 2, 2, 2, 2, 2, 2,5762, 2, 2, 2, 2, 2, 2, 2, 2, 2,5772, 2, 2, 2, 2, 2, 2, 2, 2, 2,5782, 96, 2, 97, 2, 2, 2, 2, 2, 2,5792, 2, 2, 2, 2, 2, 2, 2, 2, 2,5802, 2, 2, 2, 2, 2, 2, 2, 2, 2,5812, 2, 2, 94, 2, 95, 2, 2, 2, 2,5822, 2, 2, 2, 2, 2, 2, 2, 2, 2,5832, 2, 2, 2, 2, 2, 2, 2, 2, 2,5842, 2, 2, 2, 2, 2, 2, 2, 2, 2,5852, 2, 2, 2, 2, 2, 2, 2, 2, 2,5862, 2, 2, 2, 2, 2, 2, 2, 2, 2,5872, 2, 2, 2, 2, 2, 2, 2, 2, 2,5882, 2, 2, 2, 2, 2, 2, 2, 2, 2,5892, 2, 2, 2, 2, 2, 2, 2, 2, 2,5902, 2, 2, 2, 2, 2, 2, 2, 2, 2,5912, 2, 2, 2, 2, 2, 2, 2, 2, 2,5922, 2, 2, 2, 2, 2, 2, 2, 2, 2,5932, 2, 2, 2, 2, 2, 2, 2, 2, 2,5942, 2, 2, 2, 2, 2, 1, 2, 3, 4,5955, 6, 7, 8, 9, 10, 11, 12, 13, 14,59615, 16, 17, 18, 19, 20, 21, 22, 23, 24,59725, 26, 27, 28, 29, 30, 31, 32, 33, 34,59835, 36, 37, 38, 39, 40, 41, 42, 43, 44,59945, 46, 47, 48, 49, 50, 51, 52, 53, 54,60055, 56, 57, 58, 59, 60, 61, 62, 63, 64,60165, 66, 67, 68, 69, 70, 71, 72, 73, 74,60275, 76, 77, 78, 79, 80, 81, 82, 83, 84,60385, 86, 87, 88, 89604};605606#if YYDEBUG607/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in608YYRHS. */609static const yytype_uint16 yyprhs[] =610{6110, 0, 3, 13, 16, 19, 22, 23, 26, 27,61231, 32, 36, 37, 39, 40, 42, 45, 50, 54,61357, 58, 60, 63, 65, 67, 71, 73, 77, 79,61481, 83, 85, 87, 89, 91, 93, 95, 97, 99,615101, 103, 105, 107, 109, 111, 113, 119, 125, 131,616135, 137, 140, 145, 147, 151, 155, 160, 165, 167,617170, 176, 179, 183, 185, 186, 189, 194, 198, 203,618208, 212, 216, 221, 223, 225, 227, 229, 231, 234,619238, 240, 242, 244, 247, 251, 257, 262, 266, 271,620272, 274, 276, 278, 279, 281, 283, 288, 290, 292,621294, 296, 298, 300, 302, 304, 306, 308, 312, 316,622319, 321, 324, 328, 330, 334, 339, 341, 342, 346,623347, 350, 355, 357, 359, 361, 363, 365, 367, 369,624371, 373, 375, 377, 379, 381, 383, 385, 387, 389,625391626};627628/* YYRHS -- A `-1'-separated list of the rules' RHS. */629static const yytype_int16 yyrhs[] =630{63199, 0, -1, 86, 152, 21, 100, 101, 84, 8,632102, 24, -1, 27, 70, -1, 38, 70, -1, 7,63370, -1, -1, 29, 39, -1, -1, 107, 103, 108,634-1, -1, 40, 104, 90, -1, -1, 105, -1, -1,635106, -1, 105, 106, -1, 110, 32, 86, 152, -1,63628, 110, 90, -1, 28, 5, -1, -1, 109, -1,637109, 108, -1, 111, -1, 144, -1, 86, 91, 110,638-1, 86, -1, 86, 84, 112, -1, 113, -1, 131,639-1, 134, -1, 121, -1, 114, -1, 145, -1, 130,640-1, 119, -1, 116, -1, 124, -1, 122, -1, 123,641-1, 126, -1, 127, -1, 128, -1, 129, -1, 140,642-1, 11, -1, 92, 156, 83, 156, 93, -1, 92,643156, 83, 46, 93, -1, 92, 47, 83, 156, 93,644-1, 92, 156, 93, -1, 43, -1, 43, 115, -1,64543, 94, 117, 95, -1, 118, -1, 117, 91, 118,646-1, 117, 91, 85, -1, 86, 92, 164, 93, -1,64725, 94, 120, 95, -1, 117, -1, 9, 67, -1,6489, 67, 94, 150, 95, -1, 51, 37, -1, 52,64967, 125, -1, 49, -1, -1, 66, 115, -1, 64,65094, 147, 95, -1, 64, 94, 95, -1, 64, 125,65153, 112, -1, 65, 94, 147, 95, -1, 65, 94,65295, -1, 65, 53, 112, -1, 14, 94, 147, 95,653-1, 132, -1, 133, -1, 86, -1, 34, -1, 77,654-1, 112, 135, -1, 92, 136, 93, -1, 137, -1,655138, -1, 139, -1, 19, 112, -1, 23, 12, 156,656-1, 19, 112, 23, 12, 156, -1, 18, 12, 94,65795, -1, 141, 143, 112, -1, 96, 142, 89, 97,658-1, -1, 76, -1, 6, -1, 60, -1, -1, 27,659-1, 38, -1, 86, 112, 84, 156, -1, 146, -1,66033, -1, 73, -1, 78, -1, 61, -1, 81, -1,66136, -1, 10, -1, 79, -1, 149, -1, 147, 91,662149, -1, 147, 91, 85, -1, 86, 112, -1, 148,663-1, 148, 54, -1, 148, 20, 156, -1, 151, -1,664150, 91, 151, -1, 86, 92, 89, 93, -1, 153,665-1, -1, 94, 154, 95, -1, -1, 155, 154, -1,66686, 92, 89, 93, -1, 86, -1, 89, -1, 157,667-1, 158, -1, 162, -1, 161, -1, 163, -1, 166,668-1, 165, -1, 159, -1, 160, -1, 86, -1, 88,669-1, 71, -1, 31, -1, 164, -1, 89, -1, 49,670-1, 153, -1671};672673/* YYRLINE[YYN] -- source line where rule number YYN was defined. */674static const yytype_uint16 yyrline[] =675{6760, 239, 239, 246, 247, 249, 251, 254, 256, 259,677260, 263, 264, 267, 268, 271, 272, 275, 287, 293,678294, 297, 298, 301, 302, 305, 311, 319, 329, 330,679331, 334, 335, 336, 337, 338, 339, 340, 341, 342,680343, 344, 345, 346, 347, 350, 357, 367, 375, 383,681394, 399, 405, 413, 419, 424, 428, 441, 449, 452,682459, 467, 473, 482, 490, 491, 496, 502, 510, 519,683525, 533, 541, 548, 549, 552, 563, 568, 575, 591,684597, 600, 601, 604, 610, 618, 628, 634, 647, 656,685659, 663, 667, 674, 677, 681, 688, 699, 702, 707,686712, 717, 722, 727, 732, 737, 745, 751, 756, 767,687778, 784, 790, 798, 804, 811, 824, 825, 828, 835,688838, 849, 853, 864, 870, 871, 874, 875, 876, 877,689878, 881, 884, 887, 898, 906, 912, 920, 928, 931,690936691};692#endif693694#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE695/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.696First, the terminals, then, starting at YYNTOKENS, nonterminals. */697static const char *const yytname[] =698{699"$end", "error", "$undefined", "kw_ABSENT", "kw_ABSTRACT_SYNTAX",700"kw_ALL", "kw_APPLICATION", "kw_AUTOMATIC", "kw_BEGIN", "kw_BIT",701"kw_BMPString", "kw_BOOLEAN", "kw_BY", "kw_CHARACTER", "kw_CHOICE",702"kw_CLASS", "kw_COMPONENT", "kw_COMPONENTS", "kw_CONSTRAINED",703"kw_CONTAINING", "kw_DEFAULT", "kw_DEFINITIONS", "kw_EMBEDDED",704"kw_ENCODED", "kw_END", "kw_ENUMERATED", "kw_EXCEPT", "kw_EXPLICIT",705"kw_EXPORTS", "kw_EXTENSIBILITY", "kw_EXTERNAL", "kw_FALSE", "kw_FROM",706"kw_GeneralString", "kw_GeneralizedTime", "kw_GraphicString",707"kw_IA5String", "kw_IDENTIFIER", "kw_IMPLICIT", "kw_IMPLIED",708"kw_IMPORTS", "kw_INCLUDES", "kw_INSTANCE", "kw_INTEGER",709"kw_INTERSECTION", "kw_ISO646String", "kw_MAX", "kw_MIN",710"kw_MINUS_INFINITY", "kw_NULL", "kw_NumericString", "kw_OBJECT",711"kw_OCTET", "kw_OF", "kw_OPTIONAL", "kw_ObjectDescriptor", "kw_PATTERN",712"kw_PDV", "kw_PLUS_INFINITY", "kw_PRESENT", "kw_PRIVATE",713"kw_PrintableString", "kw_REAL", "kw_RELATIVE_OID", "kw_SEQUENCE",714"kw_SET", "kw_SIZE", "kw_STRING", "kw_SYNTAX", "kw_T61String", "kw_TAGS",715"kw_TRUE", "kw_TYPE_IDENTIFIER", "kw_TeletexString", "kw_UNION",716"kw_UNIQUE", "kw_UNIVERSAL", "kw_UTCTime", "kw_UTF8String",717"kw_UniversalString", "kw_VideotexString", "kw_VisibleString", "kw_WITH",718"RANGE", "EEQUAL", "ELLIPSIS", "IDENTIFIER", "referencename", "STRING",719"NUMBER", "';'", "','", "'('", "')'", "'{'", "'}'", "'['", "']'",720"$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",721"ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList",722"SymbolsFromModule", "Exports", "AssignmentList", "Assignment",723"referencenames", "TypeAssignment", "Type", "BuiltinType", "BooleanType",724"range", "IntegerType", "NamedNumberList", "NamedNumber",725"EnumeratedType", "Enumerations", "BitStringType",726"ObjectIdentifierType", "OctetStringType", "NullType", "size",727"SequenceType", "SequenceOfType", "SetType", "SetOfType", "ChoiceType",728"ReferencedType", "DefinedType", "UsefulType", "ConstrainedType",729"Constraint", "ConstraintSpec", "GeneralConstraint",730"ContentsConstraint", "UserDefinedConstraint", "TaggedType", "Tag",731"Class", "tagenv", "ValueAssignment", "CharacterStringType",732"RestrictedCharactedStringType", "ComponentTypeList", "NamedType",733"ComponentType", "NamedBitList", "NamedBit", "objid_opt", "objid",734"objid_list", "objid_element", "Value", "BuiltinValue",735"ReferencedValue", "DefinedValue", "Valuereference",736"CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",737"NullValue", "ObjectIdentifierValue", 0738};739#endif740741# ifdef YYPRINT742/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to743token YYLEX-NUM. */744static const yytype_uint16 yytoknum[] =745{7460, 256, 257, 258, 259, 260, 261, 262, 263, 264,747265, 266, 267, 268, 269, 270, 271, 272, 273, 274,748275, 276, 277, 278, 279, 280, 281, 282, 283, 284,749285, 286, 287, 288, 289, 290, 291, 292, 293, 294,750295, 296, 297, 298, 299, 300, 301, 302, 303, 304,751305, 306, 307, 308, 309, 310, 311, 312, 313, 314,752315, 316, 317, 318, 319, 320, 321, 322, 323, 324,753325, 326, 327, 328, 329, 330, 331, 332, 333, 334,754335, 336, 337, 338, 339, 340, 341, 342, 343, 344,75559, 44, 40, 41, 123, 125, 91, 93756};757# endif758759/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */760static const yytype_uint8 yyr1[] =761{7620, 98, 99, 100, 100, 100, 100, 101, 101, 102,763102, 103, 103, 104, 104, 105, 105, 106, 107, 107,764107, 108, 108, 109, 109, 110, 110, 111, 112, 112,765112, 113, 113, 113, 113, 113, 113, 113, 113, 113,766113, 113, 113, 113, 113, 114, 115, 115, 115, 115,767116, 116, 116, 117, 117, 117, 118, 119, 120, 121,768121, 122, 123, 124, 125, 125, 126, 126, 127, 128,769128, 129, 130, 131, 131, 132, 133, 133, 134, 135,770136, 137, 137, 138, 138, 138, 139, 140, 141, 142,771142, 142, 142, 143, 143, 143, 144, 145, 146, 146,772146, 146, 146, 146, 146, 146, 147, 147, 147, 148,773149, 149, 149, 150, 150, 151, 152, 152, 153, 154,774154, 155, 155, 155, 156, 156, 157, 157, 157, 157,775157, 158, 159, 160, 161, 162, 162, 163, 164, 165,776166777};778779/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */780static const yytype_uint8 yyr2[] =781{7820, 2, 9, 2, 2, 2, 0, 2, 0, 3,7830, 3, 0, 1, 0, 1, 2, 4, 3, 2,7840, 1, 2, 1, 1, 3, 1, 3, 1, 1,7851, 1, 1, 1, 1, 1, 1, 1, 1, 1,7861, 1, 1, 1, 1, 1, 5, 5, 5, 3,7871, 2, 4, 1, 3, 3, 4, 4, 1, 2,7885, 2, 3, 1, 0, 2, 4, 3, 4, 4,7893, 3, 4, 1, 1, 1, 1, 1, 2, 3,7901, 1, 1, 2, 3, 5, 4, 3, 4, 0,7911, 1, 1, 0, 1, 1, 4, 1, 1, 1,7921, 1, 1, 1, 1, 1, 1, 3, 3, 2,7931, 2, 3, 1, 3, 4, 1, 0, 3, 0,7942, 4, 1, 1, 1, 1, 1, 1, 1, 1,7951, 1, 1, 1, 1, 1, 1, 1, 1, 1,7961797};798799/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state800STATE-NUM when YYTABLE doesn't specify something else to do. Zero801means the default is an error. */802static const yytype_uint8 yydefact[] =803{8040, 117, 0, 119, 0, 116, 1, 122, 123, 0,805119, 6, 0, 118, 120, 0, 0, 0, 8, 0,8065, 3, 4, 0, 0, 121, 7, 0, 20, 0,8070, 12, 19, 26, 0, 2, 14, 0, 0, 18,8080, 13, 15, 0, 0, 9, 21, 23, 24, 25,80911, 16, 0, 0, 104, 45, 0, 0, 98, 76,810103, 50, 63, 0, 0, 101, 64, 0, 99, 77,811100, 105, 102, 0, 75, 89, 0, 28, 32, 36,81235, 31, 38, 39, 37, 40, 41, 42, 43, 34,81329, 73, 74, 30, 44, 93, 33, 97, 22, 117,81459, 0, 0, 0, 0, 51, 61, 64, 0, 0,8150, 0, 0, 27, 91, 92, 90, 0, 0, 0,81678, 94, 95, 0, 17, 0, 0, 0, 110, 106,8170, 58, 53, 0, 136, 0, 139, 135, 133, 134,818138, 140, 0, 124, 125, 131, 132, 127, 126, 128,819137, 130, 129, 0, 62, 65, 67, 0, 0, 71,82070, 0, 0, 96, 0, 0, 0, 0, 80, 81,82182, 87, 0, 0, 113, 109, 0, 72, 0, 111,8220, 0, 57, 0, 0, 49, 52, 66, 68, 69,82388, 0, 83, 0, 79, 0, 0, 60, 108, 107,824112, 0, 55, 54, 0, 0, 0, 0, 0, 84,8250, 114, 56, 48, 47, 46, 86, 0, 115, 85826};827828/* YYDEFGOTO[NTERM-NUM]. */829static const yytype_int16 yydefgoto[] =830{831-1, 2, 18, 24, 30, 37, 40, 41, 42, 31,83245, 46, 43, 47, 76, 77, 78, 105, 79, 131,833132, 80, 133, 81, 82, 83, 84, 110, 85, 86,83487, 88, 89, 90, 91, 92, 93, 120, 167, 168,835169, 170, 94, 95, 117, 123, 48, 96, 97, 127,836128, 129, 173, 174, 4, 141, 9, 10, 142, 143,837144, 145, 146, 147, 148, 149, 150, 151, 152838};839840/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing841STATE-NUM. */842#define YYPACT_NINF -119843static const yytype_int16 yypact[] =844{845-43, -56, 47, -65, 29, -119, -119, -31, -119, -25,846-65, 4, -1, -119, -119, 17, 20, 26, 50, 13,847-119, -119, -119, 63, 24, -119, -119, 104, 8, -2,84889, 74, -119, 33, 25, -119, 34, 39, 34, -119,84937, 34, -119, 98, 58, -119, 39, -119, -119, -119,850-119, -119, 52, 66, -119, -119, 51, 53, -119, -119,851-119, -79, -119, 109, 81, -119, -60, -48, -119, -119,852-119, -119, -119, 107, -119, 2, -74, -119, -119, -119,853-119, -119, -119, -119, -119, -119, -119, -119, -119, -119,854-119, -119, -119, -119, -119, -18, -119, -119, -119, -56,85555, 65, 67, -12, 67, -119, -119, 86, 68, -70,856102, 107, -69, 69, -119, -119, -119, 73, 40, 10,857-119, -119, -119, 107, -119, 71, 107, -47, -13, -119,85872, 75, -119, 70, -119, 80, -119, -119, -119, -119,859-119, -119, -71, -119, -119, -119, -119, -119, -119, -119,860-119, -119, -119, -46, -119, -119, -119, -39, 107, 69,861-119, -38, 76, -119, 155, 107, 157, 77, -119, -119,862-119, 69, 82, -10, -119, 69, -22, -119, 40, -119,86387, 19, -119, 40, 9, -119, -119, -119, 69, -119,864-119, 83, -19, 40, -119, 90, 71, -119, -119, -119,865-119, 85, -119, -119, 88, 94, 96, 95, 163, -119,86699, -119, -119, -119, -119, -119, -119, 40, -119, -119867};868869/* YYPGOTO[NTERM-NUM]. */870static const yytype_int16 yypgoto[] =871{872-119, -119, -119, -119, -119, -119, -119, -119, 141, -119,873137, -119, -15, -119, -72, -119, -119, 91, -119, 92,87414, -119, -119, -119, -119, -119, -119, 84, -119, -119,875-119, -119, -119, -119, -119, -119, -119, -119, -119, -119,876-119, -119, -119, -119, -119, -119, -119, -119, -119, -82,877-119, 18, -119, 5, 101, 1, 187, -119, -118, -119,878-119, -119, -119, -119, -119, -119, 22, -119, -119879};880881/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If882positive, shift that token. If negative, reduce the rule which883number is the opposite. If zero, do what YYDEFACT says.884If YYTABLE_NINF, syntax error. */885#define YYTABLE_NINF -11886static const yytype_int16 yytable[] =887{888163, 113, 5, 32, 208, 111, 108, 178, 114, 121,889118, 15, 184, 103, 34, 104, 126, 126, 119, 134,890122, 7, 185, 49, 8, 156, 160, 157, 164, 165,891161, 16, -10, 166, 109, 135, 29, 136, 3, 159,892134, 179, 17, 1, 176, 181, 112, 6, 177, 186,89311, 171, 176, 176, 175, 205, 187, 189, 136, 137,894200, 12, 115, 198, 126, 204, 206, 53, 54, 55,89513, 134, 56, 119, 138, 209, 139, 140, 116, 23,896137, 196, 3, 57, 33, 197, 188, 20, 19, 136,89721, 58, 59, 192, 60, 138, 22, 139, 140, 219,8985, 61, 26, 3, 202, 130, 25, 62, 27, 63,89964, 137, 28, 35, 36, 39, 53, 54, 55, 65,90033, 56, 66, 67, 38, 44, 138, 50, 139, 140,90152, 68, 57, 100, 3, 69, 70, 71, 99, 72,90258, 59, 73, 60, 74, 101, 106, 102, 107, 125,90361, 126, 108, 130, 75, 158, 62, 172, 63, 64,904103, 119, 162, 183, 180, 182, 181, 191, 65, 193,905194, 66, 67, 190, 195, 217, 140, 207, 212, 210,90668, 213, 51, 98, 69, 70, 71, 214, 72, 215,907216, 154, 218, 74, 199, 203, 153, 14, 0, 155,908124, 211, 201, 75909};910911static const yytype_int16 yycheck[] =912{913118, 73, 1, 5, 23, 53, 66, 20, 6, 27,91484, 7, 83, 92, 29, 94, 86, 86, 92, 31,91538, 86, 93, 38, 89, 95, 95, 109, 18, 19,916112, 27, 24, 23, 94, 47, 28, 49, 94, 111,91731, 54, 38, 86, 91, 91, 94, 0, 95, 95,91821, 123, 91, 91, 126, 46, 95, 95, 49, 71,919178, 92, 60, 85, 86, 183, 184, 9, 10, 11,92095, 31, 14, 92, 86, 193, 88, 89, 76, 29,92171, 91, 94, 25, 86, 95, 158, 70, 89, 49,92270, 33, 34, 165, 36, 86, 70, 88, 89, 217,92399, 43, 39, 94, 85, 86, 93, 49, 84, 51,92452, 71, 8, 24, 40, 90, 9, 10, 11, 61,92586, 14, 64, 65, 91, 86, 86, 90, 88, 89,92632, 73, 25, 67, 94, 77, 78, 79, 86, 81,92733, 34, 84, 36, 86, 94, 37, 94, 67, 94,92843, 86, 66, 86, 96, 53, 49, 86, 51, 52,92992, 92, 89, 83, 92, 95, 91, 12, 61, 12,93093, 64, 65, 97, 92, 12, 89, 94, 93, 89,93173, 93, 41, 46, 77, 78, 79, 93, 81, 93,93295, 107, 93, 86, 176, 181, 104, 10, -1, 108,93399, 196, 180, 96934};935936/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing937symbol of state STATE-NUM. */938static const yytype_uint8 yystos[] =939{9400, 86, 99, 94, 152, 153, 0, 86, 89, 154,941155, 21, 92, 95, 154, 7, 27, 38, 100, 89,94270, 70, 70, 29, 101, 93, 39, 84, 8, 28,943102, 107, 5, 86, 110, 24, 40, 103, 91, 90,944104, 105, 106, 110, 86, 108, 109, 111, 144, 110,94590, 106, 32, 9, 10, 11, 14, 25, 33, 34,94636, 43, 49, 51, 52, 61, 64, 65, 73, 77,94778, 79, 81, 84, 86, 96, 112, 113, 114, 116,948119, 121, 122, 123, 124, 126, 127, 128, 129, 130,949131, 132, 133, 134, 140, 141, 145, 146, 108, 86,95067, 94, 94, 92, 94, 115, 37, 67, 66, 94,951125, 53, 94, 112, 6, 60, 76, 142, 84, 92,952135, 27, 38, 143, 152, 94, 86, 147, 148, 149,95386, 117, 118, 120, 31, 47, 49, 71, 86, 88,95489, 153, 156, 157, 158, 159, 160, 161, 162, 163,955164, 165, 166, 117, 125, 115, 95, 147, 53, 112,95695, 147, 89, 156, 18, 19, 23, 136, 137, 138,957139, 112, 86, 150, 151, 112, 91, 95, 20, 54,95892, 91, 95, 83, 83, 93, 95, 95, 112, 95,95997, 12, 112, 12, 93, 92, 91, 95, 85, 149,960156, 164, 85, 118, 156, 46, 156, 94, 23, 156,96189, 151, 93, 93, 93, 93, 95, 12, 93, 156962};963964#define yyerrok (yyerrstatus = 0)965#define yyclearin (yychar = YYEMPTY)966#define YYEMPTY (-2)967#define YYEOF 0968969#define YYACCEPT goto yyacceptlab970#define YYABORT goto yyabortlab971#define YYERROR goto yyerrorlab972973974/* Like YYERROR except do call yyerror. This remains here temporarily975to ease the transition to the new meaning of YYERROR, for GCC.976Once GCC version 2 has supplanted version 1, this can go. */977978#define YYFAIL goto yyerrlab979980#define YYRECOVERING() (!!yyerrstatus)981982#define YYBACKUP(Token, Value) \983do \984if (yychar == YYEMPTY && yylen == 1) \985{ \986yychar = (Token); \987yylval = (Value); \988yytoken = YYTRANSLATE (yychar); \989YYPOPSTACK (1); \990goto yybackup; \991} \992else \993{ \994yyerror (YY_("syntax error: cannot back up")); \995YYERROR; \996} \997while (YYID (0))9989991000#define YYTERROR 11001#define YYERRCODE 256100210031004/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].1005If N is 0, then set CURRENT to the empty location which ends1006the previous symbol: RHS[0] (always defined). */10071008#define YYRHSLOC(Rhs, K) ((Rhs)[K])1009#ifndef YYLLOC_DEFAULT1010# define YYLLOC_DEFAULT(Current, Rhs, N) \1011do \1012if (YYID (N)) \1013{ \1014(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \1015(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \1016(Current).last_line = YYRHSLOC (Rhs, N).last_line; \1017(Current).last_column = YYRHSLOC (Rhs, N).last_column; \1018} \1019else \1020{ \1021(Current).first_line = (Current).last_line = \1022YYRHSLOC (Rhs, 0).last_line; \1023(Current).first_column = (Current).last_column = \1024YYRHSLOC (Rhs, 0).last_column; \1025} \1026while (YYID (0))1027#endif102810291030/* YY_LOCATION_PRINT -- Print the location on the stream.1031This macro was not mandated originally: define only if we know1032we won't break user code: when these are the locations we know. */10331034#ifndef YY_LOCATION_PRINT1035# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL1036# define YY_LOCATION_PRINT(File, Loc) \1037fprintf (File, "%d.%d-%d.%d", \1038(Loc).first_line, (Loc).first_column, \1039(Loc).last_line, (Loc).last_column)1040# else1041# define YY_LOCATION_PRINT(File, Loc) ((void) 0)1042# endif1043#endif104410451046/* YYLEX -- calling `yylex' with the right arguments. */10471048#ifdef YYLEX_PARAM1049# define YYLEX yylex (YYLEX_PARAM)1050#else1051# define YYLEX yylex ()1052#endif10531054/* Enable debugging if requested. */1055#if YYDEBUG10561057# ifndef YYFPRINTF1058# include <stdio.h> /* INFRINGES ON USER NAME SPACE */1059# define YYFPRINTF fprintf1060# endif10611062# define YYDPRINTF(Args) \1063do { \1064if (yydebug) \1065YYFPRINTF Args; \1066} while (YYID (0))10671068# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \1069do { \1070if (yydebug) \1071{ \1072YYFPRINTF (stderr, "%s ", Title); \1073yy_symbol_print (stderr, \1074Type, Value); \1075YYFPRINTF (stderr, "\n"); \1076} \1077} while (YYID (0))107810791080/*--------------------------------.1081| Print this symbol on YYOUTPUT. |1082`--------------------------------*/10831084/*ARGSUSED*/1085#if (defined __STDC__ || defined __C99__FUNC__ \1086|| defined __cplusplus || defined _MSC_VER)1087static void1088yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)1089#else1090static void1091yy_symbol_value_print (yyoutput, yytype, yyvaluep)1092FILE *yyoutput;1093int yytype;1094YYSTYPE const * const yyvaluep;1095#endif1096{1097if (!yyvaluep)1098return;1099# ifdef YYPRINT1100if (yytype < YYNTOKENS)1101YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);1102# else1103YYUSE (yyoutput);1104# endif1105switch (yytype)1106{1107default:1108break;1109}1110}111111121113/*--------------------------------.1114| Print this symbol on YYOUTPUT. |1115`--------------------------------*/11161117#if (defined __STDC__ || defined __C99__FUNC__ \1118|| defined __cplusplus || defined _MSC_VER)1119static void1120yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)1121#else1122static void1123yy_symbol_print (yyoutput, yytype, yyvaluep)1124FILE *yyoutput;1125int yytype;1126YYSTYPE const * const yyvaluep;1127#endif1128{1129if (yytype < YYNTOKENS)1130YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);1131else1132YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);11331134yy_symbol_value_print (yyoutput, yytype, yyvaluep);1135YYFPRINTF (yyoutput, ")");1136}11371138/*------------------------------------------------------------------.1139| yy_stack_print -- Print the state stack from its BOTTOM up to its |1140| TOP (included). |1141`------------------------------------------------------------------*/11421143#if (defined __STDC__ || defined __C99__FUNC__ \1144|| defined __cplusplus || defined _MSC_VER)1145static void1146yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)1147#else1148static void1149yy_stack_print (bottom, top)1150yytype_int16 *bottom;1151yytype_int16 *top;1152#endif1153{1154YYFPRINTF (stderr, "Stack now");1155for (; bottom <= top; ++bottom)1156YYFPRINTF (stderr, " %d", *bottom);1157YYFPRINTF (stderr, "\n");1158}11591160# define YY_STACK_PRINT(Bottom, Top) \1161do { \1162if (yydebug) \1163yy_stack_print ((Bottom), (Top)); \1164} while (YYID (0))116511661167/*------------------------------------------------.1168| Report that the YYRULE is going to be reduced. |1169`------------------------------------------------*/11701171#if (defined __STDC__ || defined __C99__FUNC__ \1172|| defined __cplusplus || defined _MSC_VER)1173static void1174yy_reduce_print (YYSTYPE *yyvsp, int yyrule)1175#else1176static void1177yy_reduce_print (yyvsp, yyrule)1178YYSTYPE *yyvsp;1179int yyrule;1180#endif1181{1182int yynrhs = yyr2[yyrule];1183int yyi;1184unsigned long int yylno = yyrline[yyrule];1185YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",1186yyrule - 1, yylno);1187/* The symbols being reduced. */1188for (yyi = 0; yyi < yynrhs; yyi++)1189{1190fprintf (stderr, " $%d = ", yyi + 1);1191yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],1192&(yyvsp[(yyi + 1) - (yynrhs)])1193);1194fprintf (stderr, "\n");1195}1196}11971198# define YY_REDUCE_PRINT(Rule) \1199do { \1200if (yydebug) \1201yy_reduce_print (yyvsp, Rule); \1202} while (YYID (0))12031204/* Nonzero means print parse trace. It is left uninitialized so that1205multiple parsers can coexist. */1206int yydebug;1207#else /* !YYDEBUG */1208# define YYDPRINTF(Args)1209# define YY_SYMBOL_PRINT(Title, Type, Value, Location)1210# define YY_STACK_PRINT(Bottom, Top)1211# define YY_REDUCE_PRINT(Rule)1212#endif /* !YYDEBUG */121312141215/* YYINITDEPTH -- initial size of the parser's stacks. */1216#ifndef YYINITDEPTH1217# define YYINITDEPTH 2001218#endif12191220/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only1221if the built-in stack extension method is used).12221223Do not make this value too large; the results are undefined if1224YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)1225evaluated with infinite-precision integer arithmetic. */12261227#ifndef YYMAXDEPTH1228# define YYMAXDEPTH 100001229#endif1230123112321233#if YYERROR_VERBOSE12341235# ifndef yystrlen1236# if defined __GLIBC__ && defined _STRING_H1237# define yystrlen strlen1238# else1239/* Return the length of YYSTR. */1240#if (defined __STDC__ || defined __C99__FUNC__ \1241|| defined __cplusplus || defined _MSC_VER)1242static YYSIZE_T1243yystrlen (const char *yystr)1244#else1245static YYSIZE_T1246yystrlen (yystr)1247const char *yystr;1248#endif1249{1250YYSIZE_T yylen;1251for (yylen = 0; yystr[yylen]; yylen++)1252continue;1253return yylen;1254}1255# endif1256# endif12571258# ifndef yystpcpy1259# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE1260# define yystpcpy stpcpy1261# else1262/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in1263YYDEST. */1264#if (defined __STDC__ || defined __C99__FUNC__ \1265|| defined __cplusplus || defined _MSC_VER)1266static char *1267yystpcpy (char *yydest, const char *yysrc)1268#else1269static char *1270yystpcpy (yydest, yysrc)1271char *yydest;1272const char *yysrc;1273#endif1274{1275char *yyd = yydest;1276const char *yys = yysrc;12771278while ((*yyd++ = *yys++) != '\0')1279continue;12801281return yyd - 1;1282}1283# endif1284# endif12851286# ifndef yytnamerr1287/* Copy to YYRES the contents of YYSTR after stripping away unnecessary1288quotes and backslashes, so that it's suitable for yyerror. The1289heuristic is that double-quoting is unnecessary unless the string1290contains an apostrophe, a comma, or backslash (other than1291backslash-backslash). YYSTR is taken from yytname. If YYRES is1292null, do not copy; instead, return the length of what the result1293would have been. */1294static YYSIZE_T1295yytnamerr (char *yyres, const char *yystr)1296{1297if (*yystr == '"')1298{1299YYSIZE_T yyn = 0;1300char const *yyp = yystr;13011302for (;;)1303switch (*++yyp)1304{1305case '\'':1306case ',':1307goto do_not_strip_quotes;13081309case '\\':1310if (*++yyp != '\\')1311goto do_not_strip_quotes;1312/* Fall through. */1313default:1314if (yyres)1315yyres[yyn] = *yyp;1316yyn++;1317break;13181319case '"':1320if (yyres)1321yyres[yyn] = '\0';1322return yyn;1323}1324do_not_strip_quotes: ;1325}13261327if (! yyres)1328return yystrlen (yystr);13291330return yystpcpy (yyres, yystr) - yyres;1331}1332# endif13331334/* Copy into YYRESULT an error message about the unexpected token1335YYCHAR while in state YYSTATE. Return the number of bytes copied,1336including the terminating null byte. If YYRESULT is null, do not1337copy anything; just return the number of bytes that would be1338copied. As a special case, return 0 if an ordinary "syntax error"1339message will do. Return YYSIZE_MAXIMUM if overflow occurs during1340size calculation. */1341static YYSIZE_T1342yysyntax_error (char *yyresult, int yystate, int yychar)1343{1344int yyn = yypact[yystate];13451346if (! (YYPACT_NINF < yyn && yyn <= YYLAST))1347return 0;1348else1349{1350int yytype = YYTRANSLATE (yychar);1351YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);1352YYSIZE_T yysize = yysize0;1353YYSIZE_T yysize1;1354int yysize_overflow = 0;1355enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };1356char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];1357int yyx;13581359# if 01360/* This is so xgettext sees the translatable formats that are1361constructed on the fly. */1362YY_("syntax error, unexpected %s");1363YY_("syntax error, unexpected %s, expecting %s");1364YY_("syntax error, unexpected %s, expecting %s or %s");1365YY_("syntax error, unexpected %s, expecting %s or %s or %s");1366YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");1367# endif1368char *yyfmt;1369char const *yyf;1370static char const yyunexpected[] = "syntax error, unexpected %s";1371static char const yyexpecting[] = ", expecting %s";1372static char const yyor[] = " or %s";1373char yyformat[sizeof yyunexpected1374+ sizeof yyexpecting - 11375+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)1376* (sizeof yyor - 1))];1377char const *yyprefix = yyexpecting;13781379/* Start YYX at -YYN if negative to avoid negative indexes in1380YYCHECK. */1381int yyxbegin = yyn < 0 ? -yyn : 0;13821383/* Stay within bounds of both yycheck and yytname. */1384int yychecklim = YYLAST - yyn + 1;1385int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;1386int yycount = 1;13871388yyarg[0] = yytname[yytype];1389yyfmt = yystpcpy (yyformat, yyunexpected);13901391for (yyx = yyxbegin; yyx < yyxend; ++yyx)1392if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)1393{1394if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)1395{1396yycount = 1;1397yysize = yysize0;1398yyformat[sizeof yyunexpected - 1] = '\0';1399break;1400}1401yyarg[yycount++] = yytname[yyx];1402yysize1 = yysize + yytnamerr (0, yytname[yyx]);1403yysize_overflow |= (yysize1 < yysize);1404yysize = yysize1;1405yyfmt = yystpcpy (yyfmt, yyprefix);1406yyprefix = yyor;1407}14081409yyf = YY_(yyformat);1410yysize1 = yysize + yystrlen (yyf);1411yysize_overflow |= (yysize1 < yysize);1412yysize = yysize1;14131414if (yysize_overflow)1415return YYSIZE_MAXIMUM;14161417if (yyresult)1418{1419/* Avoid sprintf, as that infringes on the user's name space.1420Don't have undefined behavior even if the translation1421produced a string with the wrong number of "%s"s. */1422char *yyp = yyresult;1423int yyi = 0;1424while ((*yyp = *yyf) != '\0')1425{1426if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)1427{1428yyp += yytnamerr (yyp, yyarg[yyi++]);1429yyf += 2;1430}1431else1432{1433yyp++;1434yyf++;1435}1436}1437}1438return yysize;1439}1440}1441#endif /* YYERROR_VERBOSE */144214431444/*-----------------------------------------------.1445| Release the memory associated to this symbol. |1446`-----------------------------------------------*/14471448/*ARGSUSED*/1449#if (defined __STDC__ || defined __C99__FUNC__ \1450|| defined __cplusplus || defined _MSC_VER)1451static void1452yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)1453#else1454static void1455yydestruct (yymsg, yytype, yyvaluep)1456const char *yymsg;1457int yytype;1458YYSTYPE *yyvaluep;1459#endif1460{1461YYUSE (yyvaluep);14621463if (!yymsg)1464yymsg = "Deleting";1465YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);14661467switch (yytype)1468{14691470default:1471break;1472}1473}147414751476/* Prevent warnings from -Wmissing-prototypes. */14771478#ifdef YYPARSE_PARAM1479#if defined __STDC__ || defined __cplusplus1480int yyparse (void *YYPARSE_PARAM);1481#else1482int yyparse ();1483#endif1484#else /* ! YYPARSE_PARAM */1485#if defined __STDC__ || defined __cplusplus1486int yyparse (void);1487#else1488int yyparse ();1489#endif1490#endif /* ! YYPARSE_PARAM */1491149214931494/* The look-ahead symbol. */1495int yychar;14961497/* The semantic value of the look-ahead symbol. */1498YYSTYPE yylval;14991500/* Number of syntax errors so far. */1501int yynerrs;1502150315041505/*----------.1506| yyparse. |1507`----------*/15081509#ifdef YYPARSE_PARAM1510#if (defined __STDC__ || defined __C99__FUNC__ \1511|| defined __cplusplus || defined _MSC_VER)1512int1513yyparse (void *YYPARSE_PARAM)1514#else1515int1516yyparse (YYPARSE_PARAM)1517void *YYPARSE_PARAM;1518#endif1519#else /* ! YYPARSE_PARAM */1520#if (defined __STDC__ || defined __C99__FUNC__ \1521|| defined __cplusplus || defined _MSC_VER)1522int1523yyparse (void)1524#else1525int1526yyparse ()15271528#endif1529#endif1530{15311532int yystate;1533int yyn;1534int yyresult;1535/* Number of tokens to shift before error messages enabled. */1536int yyerrstatus;1537/* Look-ahead token as an internal (translated) token number. */1538int yytoken = 0;1539#if YYERROR_VERBOSE1540/* Buffer for error messages, and its allocated size. */1541char yymsgbuf[128];1542char *yymsg = yymsgbuf;1543YYSIZE_T yymsg_alloc = sizeof yymsgbuf;1544#endif15451546/* Three stacks and their tools:1547`yyss': related to states,1548`yyvs': related to semantic values,1549`yyls': related to locations.15501551Refer to the stacks thru separate pointers, to allow yyoverflow1552to reallocate them elsewhere. */15531554/* The state stack. */1555yytype_int16 yyssa[YYINITDEPTH];1556yytype_int16 *yyss = yyssa;1557yytype_int16 *yyssp;15581559/* The semantic value stack. */1560YYSTYPE yyvsa[YYINITDEPTH];1561YYSTYPE *yyvs = yyvsa;1562YYSTYPE *yyvsp;1563156415651566#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))15671568YYSIZE_T yystacksize = YYINITDEPTH;15691570/* The variables used to return semantic value and location from the1571action routines. */1572YYSTYPE yyval;157315741575/* The number of symbols on the RHS of the reduced rule.1576Keep to zero when no symbol should be popped. */1577int yylen = 0;15781579YYDPRINTF ((stderr, "Starting parse\n"));15801581yystate = 0;1582yyerrstatus = 0;1583yynerrs = 0;1584yychar = YYEMPTY; /* Cause a token to be read. */15851586/* Initialize stack pointers.1587Waste one element of value and location stack1588so that they stay on the same level as the state stack.1589The wasted elements are never initialized. */15901591yyssp = yyss;1592yyvsp = yyvs;15931594goto yysetstate;15951596/*------------------------------------------------------------.1597| yynewstate -- Push a new state, which is found in yystate. |1598`------------------------------------------------------------*/1599yynewstate:1600/* In all cases, when you get here, the value and location stacks1601have just been pushed. So pushing a state here evens the stacks. */1602yyssp++;16031604yysetstate:1605*yyssp = yystate;16061607if (yyss + yystacksize - 1 <= yyssp)1608{1609/* Get the current used size of the three stacks, in elements. */1610YYSIZE_T yysize = yyssp - yyss + 1;16111612#ifdef yyoverflow1613{1614/* Give user a chance to reallocate the stack. Use copies of1615these so that the &'s don't force the real ones into1616memory. */1617YYSTYPE *yyvs1 = yyvs;1618yytype_int16 *yyss1 = yyss;161916201621/* Each stack pointer address is followed by the size of the1622data in use in that stack, in bytes. This used to be a1623conditional around just the two extra args, but that might1624be undefined if yyoverflow is a macro. */1625yyoverflow (YY_("memory exhausted"),1626&yyss1, yysize * sizeof (*yyssp),1627&yyvs1, yysize * sizeof (*yyvsp),16281629&yystacksize);16301631yyss = yyss1;1632yyvs = yyvs1;1633}1634#else /* no yyoverflow */1635# ifndef YYSTACK_RELOCATE1636goto yyexhaustedlab;1637# else1638/* Extend the stack our own way. */1639if (YYMAXDEPTH <= yystacksize)1640goto yyexhaustedlab;1641yystacksize *= 2;1642if (YYMAXDEPTH < yystacksize)1643yystacksize = YYMAXDEPTH;16441645{1646yytype_int16 *yyss1 = yyss;1647union yyalloc *yyptr =1648(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));1649if (! yyptr)1650goto yyexhaustedlab;1651YYSTACK_RELOCATE (yyss);1652YYSTACK_RELOCATE (yyvs);16531654# undef YYSTACK_RELOCATE1655if (yyss1 != yyssa)1656YYSTACK_FREE (yyss1);1657}1658# endif1659#endif /* no yyoverflow */16601661yyssp = yyss + yysize - 1;1662yyvsp = yyvs + yysize - 1;166316641665YYDPRINTF ((stderr, "Stack size increased to %lu\n",1666(unsigned long int) yystacksize));16671668if (yyss + yystacksize - 1 <= yyssp)1669YYABORT;1670}16711672YYDPRINTF ((stderr, "Entering state %d\n", yystate));16731674goto yybackup;16751676/*-----------.1677| yybackup. |1678`-----------*/1679yybackup:16801681/* Do appropriate processing given the current state. Read a1682look-ahead token if we need one and don't already have one. */16831684/* First try to decide what to do without reference to look-ahead token. */1685yyn = yypact[yystate];1686if (yyn == YYPACT_NINF)1687goto yydefault;16881689/* Not known => get a look-ahead token if don't already have one. */16901691/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */1692if (yychar == YYEMPTY)1693{1694YYDPRINTF ((stderr, "Reading a token: "));1695yychar = YYLEX;1696}16971698if (yychar <= YYEOF)1699{1700yychar = yytoken = YYEOF;1701YYDPRINTF ((stderr, "Now at end of input.\n"));1702}1703else1704{1705yytoken = YYTRANSLATE (yychar);1706YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);1707}17081709/* If the proper action on seeing token YYTOKEN is to reduce or to1710detect an error, take that action. */1711yyn += yytoken;1712if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)1713goto yydefault;1714yyn = yytable[yyn];1715if (yyn <= 0)1716{1717if (yyn == 0 || yyn == YYTABLE_NINF)1718goto yyerrlab;1719yyn = -yyn;1720goto yyreduce;1721}17221723if (yyn == YYFINAL)1724YYACCEPT;17251726/* Count tokens shifted since error; after three, turn off error1727status. */1728if (yyerrstatus)1729yyerrstatus--;17301731/* Shift the look-ahead token. */1732YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);17331734/* Discard the shifted token unless it is eof. */1735if (yychar != YYEOF)1736yychar = YYEMPTY;17371738yystate = yyn;1739*++yyvsp = yylval;17401741goto yynewstate;174217431744/*-----------------------------------------------------------.1745| yydefault -- do the default action for the current state. |1746`-----------------------------------------------------------*/1747yydefault:1748yyn = yydefact[yystate];1749if (yyn == 0)1750goto yyerrlab;1751goto yyreduce;175217531754/*-----------------------------.1755| yyreduce -- Do a reduction. |1756`-----------------------------*/1757yyreduce:1758/* yyn is the number of a rule to reduce with. */1759yylen = yyr2[yyn];17601761/* If YYLEN is nonzero, implement the default value of the action:1762`$$ = $1'.17631764Otherwise, the following line sets YYVAL to garbage.1765This behavior is undocumented and Bison1766users should not rely upon it. Assigning to YYVAL1767unconditionally makes the parser a bit smaller, and it avoids a1768GCC warning that YYVAL may be used uninitialized. */1769yyval = yyvsp[1-yylen];177017711772YY_REDUCE_PRINT (yyn);1773switch (yyn)1774{1775case 2:1776#line 241 "asn1parse.y"1777{1778checkundefined();1779}1780break;17811782case 4:1783#line 248 "asn1parse.y"1784{ lex_error_message("implicit tagging is not supported"); }1785break;17861787case 5:1788#line 250 "asn1parse.y"1789{ lex_error_message("automatic tagging is not supported"); }1790break;17911792case 7:1793#line 255 "asn1parse.y"1794{ lex_error_message("no extensibility options supported"); }1795break;17961797case 17:1798#line 276 "asn1parse.y"1799{1800struct string_list *sl;1801for(sl = (yyvsp[(1) - (4)].sl); sl != NULL; sl = sl->next) {1802Symbol *s = addsym(sl->string);1803s->stype = Stype;1804gen_template_import(s);1805}1806add_import((yyvsp[(3) - (4)].name));1807}1808break;18091810case 18:1811#line 288 "asn1parse.y"1812{1813struct string_list *sl;1814for(sl = (yyvsp[(2) - (3)].sl); sl != NULL; sl = sl->next)1815add_export(sl->string);1816}1817break;18181819case 25:1820#line 306 "asn1parse.y"1821{1822(yyval.sl) = emalloc(sizeof(*(yyval.sl)));1823(yyval.sl)->string = (yyvsp[(1) - (3)].name);1824(yyval.sl)->next = (yyvsp[(3) - (3)].sl);1825}1826break;18271828case 26:1829#line 312 "asn1parse.y"1830{1831(yyval.sl) = emalloc(sizeof(*(yyval.sl)));1832(yyval.sl)->string = (yyvsp[(1) - (1)].name);1833(yyval.sl)->next = NULL;1834}1835break;18361837case 27:1838#line 320 "asn1parse.y"1839{1840Symbol *s = addsym ((yyvsp[(1) - (3)].name));1841s->stype = Stype;1842s->type = (yyvsp[(3) - (3)].type);1843fix_labels(s);1844generate_type (s);1845}1846break;18471848case 45:1849#line 351 "asn1parse.y"1850{1851(yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,1852TE_EXPLICIT, new_type(TBoolean));1853}1854break;18551856case 46:1857#line 358 "asn1parse.y"1858{1859if((yyvsp[(2) - (5)].value)->type != integervalue)1860lex_error_message("Non-integer used in first part of range");1861if((yyvsp[(2) - (5)].value)->type != integervalue)1862lex_error_message("Non-integer in second part of range");1863(yyval.range) = ecalloc(1, sizeof(*(yyval.range)));1864(yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;1865(yyval.range)->max = (yyvsp[(4) - (5)].value)->u.integervalue;1866}1867break;18681869case 47:1870#line 368 "asn1parse.y"1871{1872if((yyvsp[(2) - (5)].value)->type != integervalue)1873lex_error_message("Non-integer in first part of range");1874(yyval.range) = ecalloc(1, sizeof(*(yyval.range)));1875(yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;1876(yyval.range)->max = INT_MAX;1877}1878break;18791880case 48:1881#line 376 "asn1parse.y"1882{1883if((yyvsp[(4) - (5)].value)->type != integervalue)1884lex_error_message("Non-integer in second part of range");1885(yyval.range) = ecalloc(1, sizeof(*(yyval.range)));1886(yyval.range)->min = INT_MIN;1887(yyval.range)->max = (yyvsp[(4) - (5)].value)->u.integervalue;1888}1889break;18901891case 49:1892#line 384 "asn1parse.y"1893{1894if((yyvsp[(2) - (3)].value)->type != integervalue)1895lex_error_message("Non-integer used in limit");1896(yyval.range) = ecalloc(1, sizeof(*(yyval.range)));1897(yyval.range)->min = (yyvsp[(2) - (3)].value)->u.integervalue;1898(yyval.range)->max = (yyvsp[(2) - (3)].value)->u.integervalue;1899}1900break;19011902case 50:1903#line 395 "asn1parse.y"1904{1905(yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,1906TE_EXPLICIT, new_type(TInteger));1907}1908break;19091910case 51:1911#line 400 "asn1parse.y"1912{1913(yyval.type) = new_type(TInteger);1914(yyval.type)->range = (yyvsp[(2) - (2)].range);1915(yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));1916}1917break;19181919case 52:1920#line 406 "asn1parse.y"1921{1922(yyval.type) = new_type(TInteger);1923(yyval.type)->members = (yyvsp[(3) - (4)].members);1924(yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, (yyval.type));1925}1926break;19271928case 53:1929#line 414 "asn1parse.y"1930{1931(yyval.members) = emalloc(sizeof(*(yyval.members)));1932ASN1_TAILQ_INIT((yyval.members));1933ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);1934}1935break;19361937case 54:1938#line 420 "asn1parse.y"1939{1940ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);1941(yyval.members) = (yyvsp[(1) - (3)].members);1942}1943break;19441945case 55:1946#line 425 "asn1parse.y"1947{ (yyval.members) = (yyvsp[(1) - (3)].members); }1948break;19491950case 56:1951#line 429 "asn1parse.y"1952{1953(yyval.member) = emalloc(sizeof(*(yyval.member)));1954(yyval.member)->name = (yyvsp[(1) - (4)].name);1955(yyval.member)->gen_name = estrdup((yyvsp[(1) - (4)].name));1956output_name ((yyval.member)->gen_name);1957(yyval.member)->val = (yyvsp[(3) - (4)].constant);1958(yyval.member)->optional = 0;1959(yyval.member)->ellipsis = 0;1960(yyval.member)->type = NULL;1961}1962break;19631964case 57:1965#line 442 "asn1parse.y"1966{1967(yyval.type) = new_type(TInteger);1968(yyval.type)->members = (yyvsp[(3) - (4)].members);1969(yyval.type) = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, (yyval.type));1970}1971break;19721973case 59:1974#line 453 "asn1parse.y"1975{1976(yyval.type) = new_type(TBitString);1977(yyval.type)->members = emalloc(sizeof(*(yyval.type)->members));1978ASN1_TAILQ_INIT((yyval.type)->members);1979(yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));1980}1981break;19821983case 60:1984#line 460 "asn1parse.y"1985{1986(yyval.type) = new_type(TBitString);1987(yyval.type)->members = (yyvsp[(4) - (5)].members);1988(yyval.type) = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, (yyval.type));1989}1990break;19911992case 61:1993#line 468 "asn1parse.y"1994{1995(yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,1996TE_EXPLICIT, new_type(TOID));1997}1998break;19992000case 62:2001#line 474 "asn1parse.y"2002{2003Type *t = new_type(TOctetString);2004t->range = (yyvsp[(3) - (3)].range);2005(yyval.type) = new_tag(ASN1_C_UNIV, UT_OctetString,2006TE_EXPLICIT, t);2007}2008break;20092010case 63:2011#line 483 "asn1parse.y"2012{2013(yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,2014TE_EXPLICIT, new_type(TNull));2015}2016break;20172018case 64:2019#line 490 "asn1parse.y"2020{ (yyval.range) = NULL; }2021break;20222023case 65:2024#line 492 "asn1parse.y"2025{ (yyval.range) = (yyvsp[(2) - (2)].range); }2026break;20272028case 66:2029#line 497 "asn1parse.y"2030{2031(yyval.type) = new_type(TSequence);2032(yyval.type)->members = (yyvsp[(3) - (4)].members);2033(yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));2034}2035break;20362037case 67:2038#line 503 "asn1parse.y"2039{2040(yyval.type) = new_type(TSequence);2041(yyval.type)->members = NULL;2042(yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));2043}2044break;20452046case 68:2047#line 511 "asn1parse.y"2048{2049(yyval.type) = new_type(TSequenceOf);2050(yyval.type)->range = (yyvsp[(2) - (4)].range);2051(yyval.type)->subtype = (yyvsp[(4) - (4)].type);2052(yyval.type) = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, (yyval.type));2053}2054break;20552056case 69:2057#line 520 "asn1parse.y"2058{2059(yyval.type) = new_type(TSet);2060(yyval.type)->members = (yyvsp[(3) - (4)].members);2061(yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));2062}2063break;20642065case 70:2066#line 526 "asn1parse.y"2067{2068(yyval.type) = new_type(TSet);2069(yyval.type)->members = NULL;2070(yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));2071}2072break;20732074case 71:2075#line 534 "asn1parse.y"2076{2077(yyval.type) = new_type(TSetOf);2078(yyval.type)->subtype = (yyvsp[(3) - (3)].type);2079(yyval.type) = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, (yyval.type));2080}2081break;20822083case 72:2084#line 542 "asn1parse.y"2085{2086(yyval.type) = new_type(TChoice);2087(yyval.type)->members = (yyvsp[(3) - (4)].members);2088}2089break;20902091case 75:2092#line 553 "asn1parse.y"2093{2094Symbol *s = addsym((yyvsp[(1) - (1)].name));2095(yyval.type) = new_type(TType);2096if(s->stype != Stype && s->stype != SUndefined)2097lex_error_message ("%s is not a type\n", (yyvsp[(1) - (1)].name));2098else2099(yyval.type)->symbol = s;2100}2101break;21022103case 76:2104#line 564 "asn1parse.y"2105{2106(yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,2107TE_EXPLICIT, new_type(TGeneralizedTime));2108}2109break;21102111case 77:2112#line 569 "asn1parse.y"2113{2114(yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,2115TE_EXPLICIT, new_type(TUTCTime));2116}2117break;21182119case 78:2120#line 576 "asn1parse.y"2121{2122/* if (Constraint.type == contentConstrant) {2123assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too2124if (Constraint.u.constraint.type) {2125assert((Constraint.u.constraint.type.length % 8) == 0);2126}2127}2128if (Constraint.u.constraint.encoding) {2129type == der-oid|ber-oid2130}2131*/2132}2133break;21342135case 79:2136#line 592 "asn1parse.y"2137{2138(yyval.constraint_spec) = (yyvsp[(2) - (3)].constraint_spec);2139}2140break;21412142case 83:2143#line 605 "asn1parse.y"2144{2145(yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);2146(yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (2)].type);2147(yyval.constraint_spec)->u.content.encoding = NULL;2148}2149break;21502151case 84:2152#line 611 "asn1parse.y"2153{2154if ((yyvsp[(3) - (3)].value)->type != objectidentifiervalue)2155lex_error_message("Non-OID used in ENCODED BY constraint");2156(yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);2157(yyval.constraint_spec)->u.content.type = NULL;2158(yyval.constraint_spec)->u.content.encoding = (yyvsp[(3) - (3)].value);2159}2160break;21612162case 85:2163#line 619 "asn1parse.y"2164{2165if ((yyvsp[(5) - (5)].value)->type != objectidentifiervalue)2166lex_error_message("Non-OID used in ENCODED BY constraint");2167(yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);2168(yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (5)].type);2169(yyval.constraint_spec)->u.content.encoding = (yyvsp[(5) - (5)].value);2170}2171break;21722173case 86:2174#line 629 "asn1parse.y"2175{2176(yyval.constraint_spec) = new_constraint_spec(CT_USER);2177}2178break;21792180case 87:2181#line 635 "asn1parse.y"2182{2183(yyval.type) = new_type(TTag);2184(yyval.type)->tag = (yyvsp[(1) - (3)].tag);2185(yyval.type)->tag.tagenv = (yyvsp[(2) - (3)].constant);2186if((yyvsp[(3) - (3)].type)->type == TTag && (yyvsp[(2) - (3)].constant) == TE_IMPLICIT) {2187(yyval.type)->subtype = (yyvsp[(3) - (3)].type)->subtype;2188free((yyvsp[(3) - (3)].type));2189} else2190(yyval.type)->subtype = (yyvsp[(3) - (3)].type);2191}2192break;21932194case 88:2195#line 648 "asn1parse.y"2196{2197(yyval.tag).tagclass = (yyvsp[(2) - (4)].constant);2198(yyval.tag).tagvalue = (yyvsp[(3) - (4)].constant);2199(yyval.tag).tagenv = TE_EXPLICIT;2200}2201break;22022203case 89:2204#line 656 "asn1parse.y"2205{2206(yyval.constant) = ASN1_C_CONTEXT;2207}2208break;22092210case 90:2211#line 660 "asn1parse.y"2212{2213(yyval.constant) = ASN1_C_UNIV;2214}2215break;22162217case 91:2218#line 664 "asn1parse.y"2219{2220(yyval.constant) = ASN1_C_APPL;2221}2222break;22232224case 92:2225#line 668 "asn1parse.y"2226{2227(yyval.constant) = ASN1_C_PRIVATE;2228}2229break;22302231case 93:2232#line 674 "asn1parse.y"2233{2234(yyval.constant) = TE_EXPLICIT;2235}2236break;22372238case 94:2239#line 678 "asn1parse.y"2240{2241(yyval.constant) = TE_EXPLICIT;2242}2243break;22442245case 95:2246#line 682 "asn1parse.y"2247{2248(yyval.constant) = TE_IMPLICIT;2249}2250break;22512252case 96:2253#line 689 "asn1parse.y"2254{2255Symbol *s;2256s = addsym ((yyvsp[(1) - (4)].name));22572258s->stype = SValue;2259s->value = (yyvsp[(4) - (4)].value);2260generate_constant (s);2261}2262break;22632264case 98:2265#line 703 "asn1parse.y"2266{2267(yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,2268TE_EXPLICIT, new_type(TGeneralString));2269}2270break;22712272case 99:2273#line 708 "asn1parse.y"2274{2275(yyval.type) = new_tag(ASN1_C_UNIV, UT_TeletexString,2276TE_EXPLICIT, new_type(TTeletexString));2277}2278break;22792280case 100:2281#line 713 "asn1parse.y"2282{2283(yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,2284TE_EXPLICIT, new_type(TUTF8String));2285}2286break;22872288case 101:2289#line 718 "asn1parse.y"2290{2291(yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,2292TE_EXPLICIT, new_type(TPrintableString));2293}2294break;22952296case 102:2297#line 723 "asn1parse.y"2298{2299(yyval.type) = new_tag(ASN1_C_UNIV, UT_VisibleString,2300TE_EXPLICIT, new_type(TVisibleString));2301}2302break;23032304case 103:2305#line 728 "asn1parse.y"2306{2307(yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,2308TE_EXPLICIT, new_type(TIA5String));2309}2310break;23112312case 104:2313#line 733 "asn1parse.y"2314{2315(yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,2316TE_EXPLICIT, new_type(TBMPString));2317}2318break;23192320case 105:2321#line 738 "asn1parse.y"2322{2323(yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,2324TE_EXPLICIT, new_type(TUniversalString));2325}2326break;23272328case 106:2329#line 746 "asn1parse.y"2330{2331(yyval.members) = emalloc(sizeof(*(yyval.members)));2332ASN1_TAILQ_INIT((yyval.members));2333ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);2334}2335break;23362337case 107:2338#line 752 "asn1parse.y"2339{2340ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);2341(yyval.members) = (yyvsp[(1) - (3)].members);2342}2343break;23442345case 108:2346#line 757 "asn1parse.y"2347{2348struct member *m = ecalloc(1, sizeof(*m));2349m->name = estrdup("...");2350m->gen_name = estrdup("asn1_ellipsis");2351m->ellipsis = 1;2352ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), m, members);2353(yyval.members) = (yyvsp[(1) - (3)].members);2354}2355break;23562357case 109:2358#line 768 "asn1parse.y"2359{2360(yyval.member) = emalloc(sizeof(*(yyval.member)));2361(yyval.member)->name = (yyvsp[(1) - (2)].name);2362(yyval.member)->gen_name = estrdup((yyvsp[(1) - (2)].name));2363output_name ((yyval.member)->gen_name);2364(yyval.member)->type = (yyvsp[(2) - (2)].type);2365(yyval.member)->ellipsis = 0;2366}2367break;23682369case 110:2370#line 779 "asn1parse.y"2371{2372(yyval.member) = (yyvsp[(1) - (1)].member);2373(yyval.member)->optional = 0;2374(yyval.member)->defval = NULL;2375}2376break;23772378case 111:2379#line 785 "asn1parse.y"2380{2381(yyval.member) = (yyvsp[(1) - (2)].member);2382(yyval.member)->optional = 1;2383(yyval.member)->defval = NULL;2384}2385break;23862387case 112:2388#line 791 "asn1parse.y"2389{2390(yyval.member) = (yyvsp[(1) - (3)].member);2391(yyval.member)->optional = 0;2392(yyval.member)->defval = (yyvsp[(3) - (3)].value);2393}2394break;23952396case 113:2397#line 799 "asn1parse.y"2398{2399(yyval.members) = emalloc(sizeof(*(yyval.members)));2400ASN1_TAILQ_INIT((yyval.members));2401ASN1_TAILQ_INSERT_HEAD((yyval.members), (yyvsp[(1) - (1)].member), members);2402}2403break;24042405case 114:2406#line 805 "asn1parse.y"2407{2408ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);2409(yyval.members) = (yyvsp[(1) - (3)].members);2410}2411break;24122413case 115:2414#line 812 "asn1parse.y"2415{2416(yyval.member) = emalloc(sizeof(*(yyval.member)));2417(yyval.member)->name = (yyvsp[(1) - (4)].name);2418(yyval.member)->gen_name = estrdup((yyvsp[(1) - (4)].name));2419output_name ((yyval.member)->gen_name);2420(yyval.member)->val = (yyvsp[(3) - (4)].constant);2421(yyval.member)->optional = 0;2422(yyval.member)->ellipsis = 0;2423(yyval.member)->type = NULL;2424}2425break;24262427case 117:2428#line 825 "asn1parse.y"2429{ (yyval.objid) = NULL; }2430break;24312432case 118:2433#line 829 "asn1parse.y"2434{2435(yyval.objid) = (yyvsp[(2) - (3)].objid);2436}2437break;24382439case 119:2440#line 835 "asn1parse.y"2441{2442(yyval.objid) = NULL;2443}2444break;24452446case 120:2447#line 839 "asn1parse.y"2448{2449if ((yyvsp[(2) - (2)].objid)) {2450(yyval.objid) = (yyvsp[(2) - (2)].objid);2451add_oid_to_tail((yyvsp[(2) - (2)].objid), (yyvsp[(1) - (2)].objid));2452} else {2453(yyval.objid) = (yyvsp[(1) - (2)].objid);2454}2455}2456break;24572458case 121:2459#line 850 "asn1parse.y"2460{2461(yyval.objid) = new_objid((yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].constant));2462}2463break;24642465case 122:2466#line 854 "asn1parse.y"2467{2468Symbol *s = addsym((yyvsp[(1) - (1)].name));2469if(s->stype != SValue ||2470s->value->type != objectidentifiervalue) {2471lex_error_message("%s is not an object identifier\n",2472s->name);2473exit(1);2474}2475(yyval.objid) = s->value->u.objectidentifiervalue;2476}2477break;24782479case 123:2480#line 865 "asn1parse.y"2481{2482(yyval.objid) = new_objid(NULL, (yyvsp[(1) - (1)].constant));2483}2484break;24852486case 133:2487#line 888 "asn1parse.y"2488{2489Symbol *s = addsym((yyvsp[(1) - (1)].name));2490if(s->stype != SValue)2491lex_error_message ("%s is not a value\n",2492s->name);2493else2494(yyval.value) = s->value;2495}2496break;24972498case 134:2499#line 899 "asn1parse.y"2500{2501(yyval.value) = emalloc(sizeof(*(yyval.value)));2502(yyval.value)->type = stringvalue;2503(yyval.value)->u.stringvalue = (yyvsp[(1) - (1)].name);2504}2505break;25062507case 135:2508#line 907 "asn1parse.y"2509{2510(yyval.value) = emalloc(sizeof(*(yyval.value)));2511(yyval.value)->type = booleanvalue;2512(yyval.value)->u.booleanvalue = 0;2513}2514break;25152516case 136:2517#line 913 "asn1parse.y"2518{2519(yyval.value) = emalloc(sizeof(*(yyval.value)));2520(yyval.value)->type = booleanvalue;2521(yyval.value)->u.booleanvalue = 0;2522}2523break;25242525case 137:2526#line 921 "asn1parse.y"2527{2528(yyval.value) = emalloc(sizeof(*(yyval.value)));2529(yyval.value)->type = integervalue;2530(yyval.value)->u.integervalue = (yyvsp[(1) - (1)].constant);2531}2532break;25332534case 139:2535#line 932 "asn1parse.y"2536{2537}2538break;25392540case 140:2541#line 937 "asn1parse.y"2542{2543(yyval.value) = emalloc(sizeof(*(yyval.value)));2544(yyval.value)->type = objectidentifiervalue;2545(yyval.value)->u.objectidentifiervalue = (yyvsp[(1) - (1)].objid);2546}2547break;254825492550/* Line 1267 of yacc.c. */2551#line 2553 "asn1parse.c"2552default: break;2553}2554YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);25552556YYPOPSTACK (yylen);2557yylen = 0;2558YY_STACK_PRINT (yyss, yyssp);25592560*++yyvsp = yyval;256125622563/* Now `shift' the result of the reduction. Determine what state2564that goes to, based on the state we popped back to and the rule2565number reduced by. */25662567yyn = yyr1[yyn];25682569yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;2570if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)2571yystate = yytable[yystate];2572else2573yystate = yydefgoto[yyn - YYNTOKENS];25742575goto yynewstate;257625772578/*------------------------------------.2579| yyerrlab -- here on detecting error |2580`------------------------------------*/2581yyerrlab:2582/* If not already recovering from an error, report this error. */2583if (!yyerrstatus)2584{2585++yynerrs;2586#if ! YYERROR_VERBOSE2587yyerror (YY_("syntax error"));2588#else2589{2590YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);2591if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)2592{2593YYSIZE_T yyalloc = 2 * yysize;2594if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))2595yyalloc = YYSTACK_ALLOC_MAXIMUM;2596if (yymsg != yymsgbuf)2597YYSTACK_FREE (yymsg);2598yymsg = (char *) YYSTACK_ALLOC (yyalloc);2599if (yymsg)2600yymsg_alloc = yyalloc;2601else2602{2603yymsg = yymsgbuf;2604yymsg_alloc = sizeof yymsgbuf;2605}2606}26072608if (0 < yysize && yysize <= yymsg_alloc)2609{2610(void) yysyntax_error (yymsg, yystate, yychar);2611yyerror (yymsg);2612}2613else2614{2615yyerror (YY_("syntax error"));2616if (yysize != 0)2617goto yyexhaustedlab;2618}2619}2620#endif2621}2622262326242625if (yyerrstatus == 3)2626{2627/* If just tried and failed to reuse look-ahead token after an2628error, discard it. */26292630if (yychar <= YYEOF)2631{2632/* Return failure if at end of input. */2633if (yychar == YYEOF)2634YYABORT;2635}2636else2637{2638yydestruct ("Error: discarding",2639yytoken, &yylval);2640yychar = YYEMPTY;2641}2642}26432644/* Else will try to reuse look-ahead token after shifting the error2645token. */2646goto yyerrlab1;264726482649/*---------------------------------------------------.2650| yyerrorlab -- error raised explicitly by YYERROR. |2651`---------------------------------------------------*/2652yyerrorlab:26532654/* Pacify compilers like GCC when the user code never invokes2655YYERROR and the label yyerrorlab therefore never appears in user2656code. */2657if (/*CONSTCOND*/ 0)2658goto yyerrorlab;26592660/* Do not reclaim the symbols of the rule which action triggered2661this YYERROR. */2662YYPOPSTACK (yylen);2663yylen = 0;2664YY_STACK_PRINT (yyss, yyssp);2665yystate = *yyssp;2666goto yyerrlab1;266726682669/*-------------------------------------------------------------.2670| yyerrlab1 -- common code for both syntax error and YYERROR. |2671`-------------------------------------------------------------*/2672yyerrlab1:2673yyerrstatus = 3; /* Each real token shifted decrements this. */26742675for (;;)2676{2677yyn = yypact[yystate];2678if (yyn != YYPACT_NINF)2679{2680yyn += YYTERROR;2681if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)2682{2683yyn = yytable[yyn];2684if (0 < yyn)2685break;2686}2687}26882689/* Pop the current state because it cannot handle the error token. */2690if (yyssp == yyss)2691YYABORT;269226932694yydestruct ("Error: popping",2695yystos[yystate], yyvsp);2696YYPOPSTACK (1);2697yystate = *yyssp;2698YY_STACK_PRINT (yyss, yyssp);2699}27002701if (yyn == YYFINAL)2702YYACCEPT;27032704*++yyvsp = yylval;270527062707/* Shift the error token. */2708YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);27092710yystate = yyn;2711goto yynewstate;271227132714/*-------------------------------------.2715| yyacceptlab -- YYACCEPT comes here. |2716`-------------------------------------*/2717yyacceptlab:2718yyresult = 0;2719goto yyreturn;27202721/*-----------------------------------.2722| yyabortlab -- YYABORT comes here. |2723`-----------------------------------*/2724yyabortlab:2725yyresult = 1;2726goto yyreturn;27272728#ifndef yyoverflow2729/*-------------------------------------------------.2730| yyexhaustedlab -- memory exhaustion comes here. |2731`-------------------------------------------------*/2732yyexhaustedlab:2733yyerror (YY_("memory exhausted"));2734yyresult = 2;2735/* Fall through. */2736#endif27372738yyreturn:2739if (yychar != YYEOF && yychar != YYEMPTY)2740yydestruct ("Cleanup: discarding lookahead",2741yytoken, &yylval);2742/* Do not reclaim the symbols of the rule which action triggered2743this YYABORT or YYACCEPT. */2744YYPOPSTACK (yylen);2745YY_STACK_PRINT (yyss, yyssp);2746while (yyssp != yyss)2747{2748yydestruct ("Cleanup: popping",2749yystos[*yyssp], yyvsp);2750YYPOPSTACK (1);2751}2752#ifndef yyoverflow2753if (yyss != yyssa)2754YYSTACK_FREE (yyss);2755#endif2756#if YYERROR_VERBOSE2757if (yymsg != yymsgbuf)2758YYSTACK_FREE (yymsg);2759#endif2760/* Make sure YYID is used. */2761return YYID (yyresult);2762}276327642765#line 944 "asn1parse.y"276627672768void2769yyerror (const char *s)2770{2771lex_error_message ("%s\n", s);2772}27732774static Type *2775new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)2776{2777Type *t;2778if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {2779t = oldtype;2780oldtype = oldtype->subtype; /* XXX */2781} else2782t = new_type (TTag);27832784t->tag.tagclass = tagclass;2785t->tag.tagvalue = tagvalue;2786t->tag.tagenv = tagenv;2787t->subtype = oldtype;2788return t;2789}27902791static struct objid *2792new_objid(const char *label, int value)2793{2794struct objid *s;2795s = emalloc(sizeof(*s));2796s->label = label;2797s->value = value;2798s->next = NULL;2799return s;2800}28012802static void2803add_oid_to_tail(struct objid *head, struct objid *tail)2804{2805struct objid *o;2806o = head;2807while (o->next)2808o = o->next;2809o->next = tail;2810}28112812static Type *2813new_type (Typetype tt)2814{2815Type *t = ecalloc(1, sizeof(*t));2816t->type = tt;2817return t;2818}28192820static struct constraint_spec *2821new_constraint_spec(enum ctype ct)2822{2823struct constraint_spec *c = ecalloc(1, sizeof(*c));2824c->ctype = ct;2825return c;2826}28272828static void fix_labels2(Type *t, const char *prefix);2829static void fix_labels1(struct memhead *members, const char *prefix)2830{2831Member *m;28322833if(members == NULL)2834return;2835ASN1_TAILQ_FOREACH(m, members, members) {2836if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)2837errx(1, "malloc");2838if (m->label == NULL)2839errx(1, "malloc");2840if(m->type != NULL)2841fix_labels2(m->type, m->label);2842}2843}28442845static void fix_labels2(Type *t, const char *prefix)2846{2847for(; t; t = t->subtype)2848fix_labels1(t->members, prefix);2849}28502851static void2852fix_labels(Symbol *s)2853{2854char *p = NULL;2855if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)2856errx(1, "malloc");2857fix_labels2(s->type, p);2858free(p);2859}2860286128622863