LCOV - code coverage report
Current view: top level - bin/default/third_party/heimdal/lib/asn1 - asn1parse.tab.c (source / functions) Hit Total Coverage
Test: coverage report for recycleplus df22b230 Lines: 765 950 80.5 %
Date: 2024-02-14 10:14:15 Functions: 19 20 95.0 %

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

Generated by: LCOV version 1.14