LCOV - code coverage report
Current view: top level - lib/asn1 - asn1parse.c (source / functions) Hit Total Coverage
Test: samba_4_0_test.lcov.info Lines: 342 465 73.5 %
Date: 2014-04-02 Functions: 9 11 81.8 %
Branches: 138 236 58.5 %

           Branch data     Line data    Source code
       1                 :            : #ifndef lint
       2                 :            : static const char yysccsid[] = "@(#)yaccpar        1.9 (Berkeley) 02/21/93";
       3                 :            : #endif
       4                 :            : 
       5                 :            : #define YYBYACC 1
       6                 :            : #define YYMAJOR 1
       7                 :            : #define YYMINOR 9
       8                 :            : #define YYPATCH 20101229
       9                 :            : 
      10                 :            : #define YYEMPTY        (-1)
      11                 :            : #define yyclearin      (yychar = YYEMPTY)
      12                 :            : #define yyerrok        (yyerrflag = 0)
      13                 :            : #define YYRECOVERING() (yyerrflag != 0)
      14                 :            : 
      15                 :            : #define YYPREFIX "yy"
      16                 :            : 
      17                 :            : #define YYPURE 0
      18                 :            : 
      19                 :            : 
      20                 :            : #include <config.h>
      21                 :            : 
      22                 :            : #include <stdio.h>
      23                 :            : #include <stdlib.h>
      24                 :            : #include <string.h>
      25                 :            : #include "symbol.h"
      26                 :            : #include "lex.h"
      27                 :            : #include "gen_locl.h"
      28                 :            : #include "der.h"
      29                 :            : 
      30                 :            : RCSID("$Id$");
      31                 :            : 
      32                 :            : static Type *new_type (Typetype t);
      33                 :            : static struct constraint_spec *new_constraint_spec(enum ctype);
      34                 :            : static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
      35                 :            : void yyerror (const char *);
      36                 :            : static struct objid *new_objid(const char *label, int value);
      37                 :            : static void add_oid_to_tail(struct objid *, struct objid *);
      38                 :            : static void fix_labels(Symbol *s);
      39                 :            : 
      40                 :            : struct string_list {
      41                 :            :     char *string;
      42                 :            :     struct string_list *next;
      43                 :            : };
      44                 :            : 
      45                 :            : /* Declarations for Bison */
      46                 :            : #define YYMALLOC malloc
      47                 :            : #define YYFREE   free
      48                 :            : 
      49                 :            : #ifdef YYSTYPE
      50                 :            : #undef  YYSTYPE_IS_DECLARED
      51                 :            : #define YYSTYPE_IS_DECLARED 1
      52                 :            : #endif
      53                 :            : #ifndef YYSTYPE_IS_DECLARED
      54                 :            : #define YYSTYPE_IS_DECLARED 1
      55                 :            : typedef union {
      56                 :            :     int constant;
      57                 :            :     struct value *value;
      58                 :            :     struct range *range;
      59                 :            :     char *name;
      60                 :            :     Type *type;
      61                 :            :     Member *member;
      62                 :            :     struct objid *objid;
      63                 :            :     char *defval;
      64                 :            :     struct string_list *sl;
      65                 :            :     struct tagtype tag;
      66                 :            :     struct memhead *members;
      67                 :            :     struct constraint_spec *constraint_spec;
      68                 :            : } YYSTYPE;
      69                 :            : #endif /* !YYSTYPE_IS_DECLARED */
      70                 :            : /* compatibility with bison */
      71                 :            : #ifdef YYPARSE_PARAM
      72                 :            : /* compatibility with FreeBSD */
      73                 :            : # ifdef YYPARSE_PARAM_TYPE
      74                 :            : #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
      75                 :            : # else
      76                 :            : #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
      77                 :            : # endif
      78                 :            : #else
      79                 :            : # define YYPARSE_DECL() yyparse(void)
      80                 :            : #endif
      81                 :            : 
      82                 :            : /* Parameters sent to lex. */
      83                 :            : #ifdef YYLEX_PARAM
      84                 :            : # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
      85                 :            : # define YYLEX yylex(YYLEX_PARAM)
      86                 :            : #else
      87                 :            : # define YYLEX_DECL() yylex(void)
      88                 :            : # define YYLEX yylex()
      89                 :            : #endif
      90                 :            : 
      91                 :            : /* Parameters sent to yyerror. */
      92                 :            : #define YYERROR_DECL() yyerror(const char *s)
      93                 :            : #define YYERROR_CALL(msg) yyerror(msg)
      94                 :            : 
      95                 :            : extern int YYPARSE_DECL();
      96                 :            : 
      97                 :            : #define kw_ABSENT 257
      98                 :            : #define kw_ABSTRACT_SYNTAX 258
      99                 :            : #define kw_ALL 259
     100                 :            : #define kw_APPLICATION 260
     101                 :            : #define kw_AUTOMATIC 261
     102                 :            : #define kw_BEGIN 262
     103                 :            : #define kw_BIT 263
     104                 :            : #define kw_BMPString 264
     105                 :            : #define kw_BOOLEAN 265
     106                 :            : #define kw_BY 266
     107                 :            : #define kw_CHARACTER 267
     108                 :            : #define kw_CHOICE 268
     109                 :            : #define kw_CLASS 269
     110                 :            : #define kw_COMPONENT 270
     111                 :            : #define kw_COMPONENTS 271
     112                 :            : #define kw_CONSTRAINED 272
     113                 :            : #define kw_CONTAINING 273
     114                 :            : #define kw_DEFAULT 274
     115                 :            : #define kw_DEFINITIONS 275
     116                 :            : #define kw_EMBEDDED 276
     117                 :            : #define kw_ENCODED 277
     118                 :            : #define kw_END 278
     119                 :            : #define kw_ENUMERATED 279
     120                 :            : #define kw_EXCEPT 280
     121                 :            : #define kw_EXPLICIT 281
     122                 :            : #define kw_EXPORTS 282
     123                 :            : #define kw_EXTENSIBILITY 283
     124                 :            : #define kw_EXTERNAL 284
     125                 :            : #define kw_FALSE 285
     126                 :            : #define kw_FROM 286
     127                 :            : #define kw_GeneralString 287
     128                 :            : #define kw_GeneralizedTime 288
     129                 :            : #define kw_GraphicString 289
     130                 :            : #define kw_IA5String 290
     131                 :            : #define kw_IDENTIFIER 291
     132                 :            : #define kw_IMPLICIT 292
     133                 :            : #define kw_IMPLIED 293
     134                 :            : #define kw_IMPORTS 294
     135                 :            : #define kw_INCLUDES 295
     136                 :            : #define kw_INSTANCE 296
     137                 :            : #define kw_INTEGER 297
     138                 :            : #define kw_INTERSECTION 298
     139                 :            : #define kw_ISO646String 299
     140                 :            : #define kw_MAX 300
     141                 :            : #define kw_MIN 301
     142                 :            : #define kw_MINUS_INFINITY 302
     143                 :            : #define kw_NULL 303
     144                 :            : #define kw_NumericString 304
     145                 :            : #define kw_OBJECT 305
     146                 :            : #define kw_OCTET 306
     147                 :            : #define kw_OF 307
     148                 :            : #define kw_OPTIONAL 308
     149                 :            : #define kw_ObjectDescriptor 309
     150                 :            : #define kw_PATTERN 310
     151                 :            : #define kw_PDV 311
     152                 :            : #define kw_PLUS_INFINITY 312
     153                 :            : #define kw_PRESENT 313
     154                 :            : #define kw_PRIVATE 314
     155                 :            : #define kw_PrintableString 315
     156                 :            : #define kw_REAL 316
     157                 :            : #define kw_RELATIVE_OID 317
     158                 :            : #define kw_SEQUENCE 318
     159                 :            : #define kw_SET 319
     160                 :            : #define kw_SIZE 320
     161                 :            : #define kw_STRING 321
     162                 :            : #define kw_SYNTAX 322
     163                 :            : #define kw_T61String 323
     164                 :            : #define kw_TAGS 324
     165                 :            : #define kw_TRUE 325
     166                 :            : #define kw_TYPE_IDENTIFIER 326
     167                 :            : #define kw_TeletexString 327
     168                 :            : #define kw_UNION 328
     169                 :            : #define kw_UNIQUE 329
     170                 :            : #define kw_UNIVERSAL 330
     171                 :            : #define kw_UTCTime 331
     172                 :            : #define kw_UTF8String 332
     173                 :            : #define kw_UniversalString 333
     174                 :            : #define kw_VideotexString 334
     175                 :            : #define kw_VisibleString 335
     176                 :            : #define kw_WITH 336
     177                 :            : #define RANGE 337
     178                 :            : #define EEQUAL 338
     179                 :            : #define ELLIPSIS 339
     180                 :            : #define IDENTIFIER 340
     181                 :            : #define referencename 341
     182                 :            : #define STRING 342
     183                 :            : #define NUMBER 343
     184                 :            : #define YYERRCODE 256
     185                 :            : static const short yylhs[] = {                           -1,
     186                 :            :     0,   56,   56,   56,   56,   57,   57,   58,   58,   60,
     187                 :            :    60,   62,   62,   63,   63,   64,   59,   59,   59,   61,
     188                 :            :    61,   65,   65,   50,   50,   66,   14,   14,   14,   15,
     189                 :            :    15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
     190                 :            :    15,   15,   15,   17,   48,   48,   48,   48,   21,   21,
     191                 :            :    21,   43,   43,   43,   38,   20,   41,   16,   16,   32,
     192                 :            :    23,   22,   49,   49,   24,   24,   25,   26,   26,   27,
     193                 :            :    18,   29,   29,   30,   31,   31,   19,   51,   52,   53,
     194                 :            :    53,   54,   54,   54,   55,   28,   35,    2,    2,    2,
     195                 :            :     2,    3,    3,    3,   67,   33,   34,   34,   34,   34,
     196                 :            :    34,   34,   34,   34,   40,   40,   40,   39,   36,   36,
     197                 :            :    36,   42,   42,   37,   47,   47,   44,   45,   45,   46,
     198                 :            :    46,   46,    4,    4,    5,    5,    5,    5,    5,   12,
     199                 :            :    11,   13,    9,    7,    7,    6,    1,   10,    8,
     200                 :            : };
     201                 :            : static const short yylen[] = {                            2,
     202                 :            :     9,    2,    2,    2,    0,    2,    0,    3,    0,    3,
     203                 :            :     0,    1,    0,    1,    2,    4,    3,    2,    0,    1,
     204                 :            :     2,    1,    1,    3,    1,    3,    1,    1,    1,    1,
     205                 :            :     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
     206                 :            :     1,    1,    1,    1,    5,    5,    5,    3,    1,    2,
     207                 :            :     4,    1,    3,    3,    4,    4,    1,    2,    5,    2,
     208                 :            :     3,    1,    0,    2,    4,    3,    4,    4,    3,    3,
     209                 :            :     4,    1,    1,    1,    1,    1,    2,    3,    1,    1,
     210                 :            :     1,    2,    3,    5,    4,    3,    4,    0,    1,    1,
     211                 :            :     1,    0,    1,    1,    4,    1,    1,    1,    1,    1,
     212                 :            :     1,    1,    1,    1,    1,    3,    3,    2,    1,    2,
     213                 :            :     3,    1,    3,    4,    1,    0,    3,    0,    2,    4,
     214                 :            :     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
     215                 :            :     1,    1,    1,    1,    1,    1,    1,    1,    1,
     216                 :            : };
     217                 :            : static const short yydefred[] = {                         0,
     218                 :            :     0,    0,    0,  115,    0,    0,  122,    0,    0,    0,
     219                 :            :     0,  117,  119,    0,    0,    0,    0,    0,    4,    2,
     220                 :            :     3,    0,    0,  120,    6,    0,    0,    0,    0,    0,
     221                 :            :    18,    0,    0,    1,    0,    0,    0,   17,    0,    0,
     222                 :            :     0,   14,    0,    8,    0,   22,   23,   24,    0,   10,
     223                 :            :    15,    0,  103,   44,    0,    0,   97,   75,  102,    0,
     224                 :            :    62,    0,    0,  100,    0,    0,   98,   76,   99,  104,
     225                 :            :   101,    0,   74,    0,    0,   27,   30,   31,   33,   29,
     226                 :            :    34,   35,   36,   38,   39,   40,   41,   42,   43,   28,
     227                 :            :    72,   73,   37,   32,   96,    0,   21,    0,    0,    0,
     228                 :            :     0,    0,    0,   50,   60,    0,    0,    0,    0,    0,
     229                 :            :     0,    0,   90,   91,   89,    0,    0,    0,   77,   93,
     230                 :            :    94,    0,   16,    0,    0,  105,    0,    0,    0,   52,
     231                 :            :     0,    0,  135,    0,  138,  134,  132,  133,  137,  136,
     232                 :            :     0,  123,  127,  125,  128,  126,  129,  130,  124,  131,
     233                 :            :   139,    0,   61,   64,   66,    0,    0,    0,   69,    0,
     234                 :            :     0,   95,    0,    0,    0,    0,   79,   80,   81,    0,
     235                 :            :     0,  112,    0,    0,    0,  110,    0,   71,    0,   56,
     236                 :            :     0,    0,    0,   48,   51,   65,    0,   68,   87,    0,
     237                 :            :     0,    0,   78,    0,    0,   59,  111,  107,  106,    0,
     238                 :            :    54,   53,    0,    0,    0,    0,    0,   83,    0,  113,
     239                 :            :    55,   47,   46,   45,   85,    0,  114,   84,
     240                 :            : };
     241                 :            : static const short yydgoto[] = {                          2,
     242                 :            :   140,  116,  122,  141,  142,  143,  144,  145,  146,  147,
     243                 :            :   148,  149,  150,   75,   76,   77,   78,   79,   80,   81,
     244                 :            :    82,   83,   84,   85,   86,   87,   88,   89,   90,   91,
     245                 :            :    92,   93,   94,   95,   96,  126,  172,  130,  127,  128,
     246                 :            :   131,  173,  132,  151,    8,    9,    5,  104,  109,   39,
     247                 :            :   119,  166,  167,  168,  169,   17,   23,   29,   30,   36,
     248                 :            :    44,   40,   41,   42,   45,   46,   47,
     249                 :            : };
     250                 :            : static const short yysindex[] = {                      -295,
     251                 :            :   -74,    0, -289,    0, -216,   23,    0,  -61, -289, -221,
     252                 :            :  -277,    0,    0, -259, -257, -256, -214,   31,    0,    0,
     253                 :            :     0, -220, -264,    0,    0, -187, -206, -232, -201, -213,
     254                 :            :     0,   34,   25,    0, -258, -251, -258,    0, -188,   40,
     255                 :            :  -258,    0,   63,    0, -251,    0,    0,    0, -239,    0,
     256                 :            :     0, -218,    0,    0,  -19,  -17,    0,    0,    0,  -12,
     257                 :            :     0, -184, -212,    0, -106, -111,    0,    0,    0,    0,
     258                 :            :     0,  112,    0, -228,  -37,    0,    0,    0,    0,    0,
     259                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     260                 :            :     0,    0,    0,    0,    0, -242,    0,  -74,  -10, -223,
     261                 :            :  -215, -116, -215,    0,    0, -198,   87, -105, -179,  112,
     262                 :            :  -100,   89,    0,    0,    0, -211,   -4, -225,    0,    0,
     263                 :            :     0,  112,    0, -210,  112,    0, -238,  -13,   91,    0,
     264                 :            :     9,   92,    0, -202,    0,    0,    0,    0,    0,    0,
     265                 :            :   -33,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     266                 :            :     0,  -11,    0,    0,    0,   -9,  112,   89,    0,   -7,
     267                 :            :    44,    0, -128,  112, -127,   99,    0,    0,    0,   89,
     268                 :            :   101,    0,   -2,   89,   -4,    0, -283,    0, -200,    0,
     269                 :            :  -278,   -4,   -8,    0,    0,    0,   89,    0,    0,   19,
     270                 :            :   -27,   -4,    0, -199, -210,    0,    0,    0,    0,  104,
     271                 :            :     0,    0,  105,  106,  107,   24, -115,    0,  109,    0,
     272                 :            :     0,    0,    0,    0,    0,   -4,    0,    0,
     273                 :            : };
     274                 :            : static const short yyrindex[] = {                         0,
     275                 :            :  -123,    0,   28,    0,    0, -110,    0,    0,   28, -245,
     276                 :            :     0,    0,    0,    0,    0,    0, -183,    0,    0,    0,
     277                 :            :     0,    0,    0,    0,    0,    0, -248,    0,    0, -182,
     278                 :            :     0,  -41,    0,    0,   97,    0,    0,    0,    0,    0,
     279                 :            :    98,    0,    0,    0, -119,    0,    0,    0,    0,    0,
     280                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,  -30,
     281                 :            :     0,    0,    0,    0, -147,    0,    0,    0,    0,    0,
     282                 :            :     0,    0,    0, -181,    0,    0,    0,    0,    0,    0,
     283                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     284                 :            :     0,    0,    0,    0,    0,  169,    0,  -49,  -40,    0,
     285                 :            :     0,    0,    0,    0,    0,  -35,    0,    0,    0,    0,
     286                 :            :     0, -244,    0,    0,    0,    0,    0,    0,    0,    0,
     287                 :            :     0,    0,    0,    0,    0,    0,   -1,    0,    0,    0,
     288                 :            :     0,   36,    0,    0,    0,    0,    0,    0,    0,    0,
     289                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     290                 :            :     0,    0,    0,    0,    0,    0,    0,  -25,    0,    0,
     291                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,  -20,
     292                 :            :     0,    0,    0,  -42,    0,    0,    0,    0,    0,    0,
     293                 :            :     0,    0,    0,    0,    0,    0,  -15,    0,    0,    0,
     294                 :            :   122,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     295                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     296                 :            :     0,    0,    0,    0,    0,    0,    0,    0,
     297                 :            : };
     298                 :            : static const short yygindex[] = {                         0,
     299                 :            :   -14,    0,    0,  -95,    0,    0,    0,    0,    0,    0,
     300                 :            :     0,    0,    0,  -31,    0,    0,    0,    0,    0,    0,
     301                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     302                 :            :     0,    0,    0,    0,    0,   -6,  -29,   -5,    0,  -53,
     303                 :            :     0,    0,   61,   22,  158,    0,   70,   65,   64,   16,
     304                 :            :     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     305                 :            :   128,    0,    0,  133,    0,    0,    0,
     306                 :            : };
     307                 :            : #define YYTABLESIZE 509
     308                 :            : static const short yytable[] = {                         58,
     309                 :            :    58,  108,  118,   58,   63,   63,    3,  184,   63,  116,
     310                 :            :    49,  111,  118,   49,  121,   70,  108,   25,   70,  155,
     311                 :            :    86,  162,    4,   86,  159,   67,   31,  102,   67,    9,
     312                 :            :   177,  113,  181,   26,  177,  175,  177,    5,  120,   14,
     313                 :            :   112,  195,  109,   33,    1,   19,  163,  164,    3,  121,
     314                 :            :     6,  165,   48,    7,  156,  198,  125,  160,   10,   15,
     315                 :            :   201,  129,   11,   12,   19,   18,   20,   21,   22,  176,
     316                 :            :    16,   24,   25,   26,   27,   28,   34,   37,  158,  197,
     317                 :            :    35,   32,  108,   38,   58,  114,  203,  205,   43,   63,
     318                 :            :   170,   19,    5,  174,   49,   26,  208,   49,   50,   70,
     319                 :            :    98,  115,   99,  100,   86,  101,  105,   32,  106,   67,
     320                 :            :   103,  178,  124,  185,    3,  186,  125,  188,    3,    4,
     321                 :            :   218,  107,  196,  109,  129,  187,  102,  157,  118,  171,
     322                 :            :   179,  161,  191,  180,  182,  181,  189,  190,  192,  193,
     323                 :            :   194,  206,  139,  209,  211,  212,  213,  214,  215,  217,
     324                 :            :   216,  116,  118,   74,    7,   13,   12,   11,   20,   63,
     325                 :            :    57,   88,   82,  152,  200,  210,   13,  123,  133,  153,
     326                 :            :   199,  154,   97,   51,    0,  202,    0,    0,    0,    0,
     327                 :            :     0,    0,    0,    0,  134,    0,  135,    0,    0,    0,
     328                 :            :     0,    0,    0,    0,    0,  110,    0,    0,    0,    0,
     329                 :            :     0,    0,   74,    0,    0,    0,    0,    0,  136,    0,
     330                 :            :     0,    0,    0,  107,    0,    0,    0,    0,    0,    0,
     331                 :            :     0,    0,    0,  137,    0,  138,  139,    0,    0,  121,
     332                 :            :     0,  108,  121,   58,  125,    0,   58,   58,   63,  125,
     333                 :            :     0,   63,   63,   49,   25,    0,   49,   49,   70,  207,
     334                 :            :     0,   70,   70,   86,    0,    0,   86,   86,   67,   92,
     335                 :            :     0,   67,   67,    0,    0,  108,    0,   58,    0,    0,
     336                 :            :     0,    0,   63,    0,    0,    0,  133,   49,    0,    0,
     337                 :            :   133,    0,   70,    0,    0,    0,    0,   86,    0,    0,
     338                 :            :   116,  204,   67,    0,  135,    0,    0,   58,  135,   58,
     339                 :            :   117,    0,   63,  183,   63,    0,    0,   49,    0,   49,
     340                 :            :     0,    0,   70,    0,   70,    0,  136,   86,    0,   86,
     341                 :            :   136,    0,   67,    0,   67,   52,   53,   54,    0,    0,
     342                 :            :    55,  137,    0,  138,  139,  137,    0,  138,  139,    0,
     343                 :            :     0,   56,    0,    0,    0,    0,    0,    0,    0,   57,
     344                 :            :    58,    0,   59,    0,    0,    0,    0,    0,    0,   60,
     345                 :            :     0,    0,    0,    0,    0,   61,    0,   62,   63,    0,
     346                 :            :     0,    0,    0,    0,   52,   53,   54,   64,    0,   55,
     347                 :            :    65,   66,    0,    0,    0,    0,    0,    0,    0,   67,
     348                 :            :    56,    0,    0,   68,   69,   70,    0,   71,   57,   58,
     349                 :            :    72,   59,   73,    0,    0,    0,    0,    0,   60,    0,
     350                 :            :     0,    0,    0,    0,   61,    0,   62,   63,    0,    0,
     351                 :            :     0,    0,    0,    0,    0,    0,   64,    0,    0,   65,
     352                 :            :    66,   92,   92,   92,    0,    0,   92,    0,   67,    0,
     353                 :            :     0,    0,   68,   69,   70,    0,   71,   92,    0,    0,
     354                 :            :     0,   73,    0,    0,    0,   92,   92,    0,   92,    0,
     355                 :            :     0,    0,    0,    0,    0,   92,    0,    0,    0,    0,
     356                 :            :     0,   92,    0,   92,   92,    0,    0,    0,    0,    0,
     357                 :            :     0,    0,    0,   92,    0,    0,   92,   92,    0,    0,
     358                 :            :     0,    0,    0,    0,    0,   92,    0,    0,    0,   92,
     359                 :            :    92,   92,    0,   92,    0,    0,    0,    0,   92,
     360                 :            : };
     361                 :            : static const short yycheck[] = {                         40,
     362                 :            :    41,   44,   40,   44,   40,   41,  123,   41,   44,   59,
     363                 :            :    41,  123,   40,   44,  125,   41,  123,   59,   44,  125,
     364                 :            :    41,  117,    1,   44,  125,   41,  259,   40,   44,  278,
     365                 :            :    44,  260,   44,  278,   44,  274,   44,  283,  281,  261,
     366                 :            :    72,   44,   44,   28,  340,  294,  272,  273,  123,  292,
     367                 :            :   340,  277,   37,  343,  108,  339,  340,  111,  275,  281,
     368                 :            :   339,  340,   40,  125,  324,  343,  324,  324,  283,  308,
     369                 :            :   292,   41,  293,  338,  262,  282,  278,   44,  110,  175,
     370                 :            :   294,  340,  125,   59,  125,  314,  182,  183,  340,  125,
     371                 :            :   122,  340,  338,  125,  125,  340,  192,  286,   59,  125,
     372                 :            :   340,  330,  321,  123,  125,  123,  291,  340,  321,  125,
     373                 :            :   123,  125,  123,  125,  123,  125,  340,  125,  123,   98,
     374                 :            :   216,  320,  125,  125,  340,  157,   40,  307,   40,  340,
     375                 :            :    40,  343,  164,  125,  337,   44,   93,  266,  266,   41,
     376                 :            :    40,  123,  343,  343,   41,   41,   41,   41,  125,   41,
     377                 :            :   266,  275,  125,   91,  338,   59,   59,  340,  278,  307,
     378                 :            :   125,  343,   41,  103,  179,  195,    9,   98,  285,  106,
     379                 :            :   177,  107,   45,   41,   -1,  181,   -1,   -1,   -1,   -1,
     380                 :            :    -1,   -1,   -1,   -1,  301,   -1,  303,   -1,   -1,   -1,
     381                 :            :    -1,   -1,   -1,   -1,   -1,  307,   -1,   -1,   -1,   -1,
     382                 :            :    -1,   -1,   91,   -1,   -1,   -1,   -1,   -1,  325,   -1,
     383                 :            :    -1,   -1,   -1,  320,   -1,   -1,   -1,   -1,   -1,   -1,
     384                 :            :    -1,   -1,   -1,  340,   -1,  342,  343,   -1,   -1,  340,
     385                 :            :    -1,  274,  343,  274,  340,   -1,  277,  278,  274,  340,
     386                 :            :    -1,  277,  278,  274,  286,   -1,  277,  278,  274,  277,
     387                 :            :    -1,  277,  278,  274,   -1,   -1,  277,  278,  274,   91,
     388                 :            :    -1,  277,  278,   -1,   -1,  308,   -1,  308,   -1,   -1,
     389                 :            :    -1,   -1,  308,   -1,   -1,   -1,  285,  308,   -1,   -1,
     390                 :            :   285,   -1,  308,   -1,   -1,   -1,   -1,  308,   -1,   -1,
     391                 :            :   340,  300,  308,   -1,  303,   -1,   -1,  338,  303,  340,
     392                 :            :   338,   -1,  338,  337,  340,   -1,   -1,  338,   -1,  340,
     393                 :            :    -1,   -1,  338,   -1,  340,   -1,  325,  338,   -1,  340,
     394                 :            :   325,   -1,  338,   -1,  340,  263,  264,  265,   -1,   -1,
     395                 :            :   268,  340,   -1,  342,  343,  340,   -1,  342,  343,   -1,
     396                 :            :    -1,  279,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  287,
     397                 :            :   288,   -1,  290,   -1,   -1,   -1,   -1,   -1,   -1,  297,
     398                 :            :    -1,   -1,   -1,   -1,   -1,  303,   -1,  305,  306,   -1,
     399                 :            :    -1,   -1,   -1,   -1,  263,  264,  265,  315,   -1,  268,
     400                 :            :   318,  319,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  327,
     401                 :            :   279,   -1,   -1,  331,  332,  333,   -1,  335,  287,  288,
     402                 :            :   338,  290,  340,   -1,   -1,   -1,   -1,   -1,  297,   -1,
     403                 :            :    -1,   -1,   -1,   -1,  303,   -1,  305,  306,   -1,   -1,
     404                 :            :    -1,   -1,   -1,   -1,   -1,   -1,  315,   -1,   -1,  318,
     405                 :            :   319,  263,  264,  265,   -1,   -1,  268,   -1,  327,   -1,
     406                 :            :    -1,   -1,  331,  332,  333,   -1,  335,  279,   -1,   -1,
     407                 :            :    -1,  340,   -1,   -1,   -1,  287,  288,   -1,  290,   -1,
     408                 :            :    -1,   -1,   -1,   -1,   -1,  297,   -1,   -1,   -1,   -1,
     409                 :            :    -1,  303,   -1,  305,  306,   -1,   -1,   -1,   -1,   -1,
     410                 :            :    -1,   -1,   -1,  315,   -1,   -1,  318,  319,   -1,   -1,
     411                 :            :    -1,   -1,   -1,   -1,   -1,  327,   -1,   -1,   -1,  331,
     412                 :            :   332,  333,   -1,  335,   -1,   -1,   -1,   -1,  340,
     413                 :            : };
     414                 :            : #define YYFINAL 2
     415                 :            : #ifndef YYDEBUG
     416                 :            : #define YYDEBUG 0
     417                 :            : #endif
     418                 :            : #define YYMAXTOKEN 343
     419                 :            : #if YYDEBUG
     420                 :            : static const char *yyname[] = {
     421                 :            : 
     422                 :            : "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     423                 :            : 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,
     424                 :            : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,
     425                 :            : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,
     426                 :            : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     427                 :            : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     428                 :            : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     429                 :            : "kw_ABSENT","kw_ABSTRACT_SYNTAX","kw_ALL","kw_APPLICATION","kw_AUTOMATIC",
     430                 :            : "kw_BEGIN","kw_BIT","kw_BMPString","kw_BOOLEAN","kw_BY","kw_CHARACTER",
     431                 :            : "kw_CHOICE","kw_CLASS","kw_COMPONENT","kw_COMPONENTS","kw_CONSTRAINED",
     432                 :            : "kw_CONTAINING","kw_DEFAULT","kw_DEFINITIONS","kw_EMBEDDED","kw_ENCODED",
     433                 :            : "kw_END","kw_ENUMERATED","kw_EXCEPT","kw_EXPLICIT","kw_EXPORTS",
     434                 :            : "kw_EXTENSIBILITY","kw_EXTERNAL","kw_FALSE","kw_FROM","kw_GeneralString",
     435                 :            : "kw_GeneralizedTime","kw_GraphicString","kw_IA5String","kw_IDENTIFIER",
     436                 :            : "kw_IMPLICIT","kw_IMPLIED","kw_IMPORTS","kw_INCLUDES","kw_INSTANCE",
     437                 :            : "kw_INTEGER","kw_INTERSECTION","kw_ISO646String","kw_MAX","kw_MIN",
     438                 :            : "kw_MINUS_INFINITY","kw_NULL","kw_NumericString","kw_OBJECT","kw_OCTET","kw_OF",
     439                 :            : "kw_OPTIONAL","kw_ObjectDescriptor","kw_PATTERN","kw_PDV","kw_PLUS_INFINITY",
     440                 :            : "kw_PRESENT","kw_PRIVATE","kw_PrintableString","kw_REAL","kw_RELATIVE_OID",
     441                 :            : "kw_SEQUENCE","kw_SET","kw_SIZE","kw_STRING","kw_SYNTAX","kw_T61String",
     442                 :            : "kw_TAGS","kw_TRUE","kw_TYPE_IDENTIFIER","kw_TeletexString","kw_UNION",
     443                 :            : "kw_UNIQUE","kw_UNIVERSAL","kw_UTCTime","kw_UTF8String","kw_UniversalString",
     444                 :            : "kw_VideotexString","kw_VisibleString","kw_WITH","RANGE","EEQUAL","ELLIPSIS",
     445                 :            : "IDENTIFIER","referencename","STRING","NUMBER",
     446                 :            : };
     447                 :            : static const char *yyrule[] = {
     448                 :            : "$accept : ModuleDefinition",
     449                 :            : "ModuleDefinition : IDENTIFIER objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END",
     450                 :            : "TagDefault : kw_EXPLICIT kw_TAGS",
     451                 :            : "TagDefault : kw_IMPLICIT kw_TAGS",
     452                 :            : "TagDefault : kw_AUTOMATIC kw_TAGS",
     453                 :            : "TagDefault :",
     454                 :            : "ExtensionDefault : kw_EXTENSIBILITY kw_IMPLIED",
     455                 :            : "ExtensionDefault :",
     456                 :            : "ModuleBody : Exports Imports AssignmentList",
     457                 :            : "ModuleBody :",
     458                 :            : "Imports : kw_IMPORTS SymbolsImported ';'",
     459                 :            : "Imports :",
     460                 :            : "SymbolsImported : SymbolsFromModuleList",
     461                 :            : "SymbolsImported :",
     462                 :            : "SymbolsFromModuleList : SymbolsFromModule",
     463                 :            : "SymbolsFromModuleList : SymbolsFromModuleList SymbolsFromModule",
     464                 :            : "SymbolsFromModule : referencenames kw_FROM IDENTIFIER objid_opt",
     465                 :            : "Exports : kw_EXPORTS referencenames ';'",
     466                 :            : "Exports : kw_EXPORTS kw_ALL",
     467                 :            : "Exports :",
     468                 :            : "AssignmentList : Assignment",
     469                 :            : "AssignmentList : Assignment AssignmentList",
     470                 :            : "Assignment : TypeAssignment",
     471                 :            : "Assignment : ValueAssignment",
     472                 :            : "referencenames : IDENTIFIER ',' referencenames",
     473                 :            : "referencenames : IDENTIFIER",
     474                 :            : "TypeAssignment : IDENTIFIER EEQUAL Type",
     475                 :            : "Type : BuiltinType",
     476                 :            : "Type : ReferencedType",
     477                 :            : "Type : ConstrainedType",
     478                 :            : "BuiltinType : BitStringType",
     479                 :            : "BuiltinType : BooleanType",
     480                 :            : "BuiltinType : CharacterStringType",
     481                 :            : "BuiltinType : ChoiceType",
     482                 :            : "BuiltinType : EnumeratedType",
     483                 :            : "BuiltinType : IntegerType",
     484                 :            : "BuiltinType : NullType",
     485                 :            : "BuiltinType : ObjectIdentifierType",
     486                 :            : "BuiltinType : OctetStringType",
     487                 :            : "BuiltinType : SequenceType",
     488                 :            : "BuiltinType : SequenceOfType",
     489                 :            : "BuiltinType : SetType",
     490                 :            : "BuiltinType : SetOfType",
     491                 :            : "BuiltinType : TaggedType",
     492                 :            : "BooleanType : kw_BOOLEAN",
     493                 :            : "range : '(' Value RANGE Value ')'",
     494                 :            : "range : '(' Value RANGE kw_MAX ')'",
     495                 :            : "range : '(' kw_MIN RANGE Value ')'",
     496                 :            : "range : '(' Value ')'",
     497                 :            : "IntegerType : kw_INTEGER",
     498                 :            : "IntegerType : kw_INTEGER range",
     499                 :            : "IntegerType : kw_INTEGER '{' NamedNumberList '}'",
     500                 :            : "NamedNumberList : NamedNumber",
     501                 :            : "NamedNumberList : NamedNumberList ',' NamedNumber",
     502                 :            : "NamedNumberList : NamedNumberList ',' ELLIPSIS",
     503                 :            : "NamedNumber : IDENTIFIER '(' SignedNumber ')'",
     504                 :            : "EnumeratedType : kw_ENUMERATED '{' Enumerations '}'",
     505                 :            : "Enumerations : NamedNumberList",
     506                 :            : "BitStringType : kw_BIT kw_STRING",
     507                 :            : "BitStringType : kw_BIT kw_STRING '{' NamedBitList '}'",
     508                 :            : "ObjectIdentifierType : kw_OBJECT kw_IDENTIFIER",
     509                 :            : "OctetStringType : kw_OCTET kw_STRING size",
     510                 :            : "NullType : kw_NULL",
     511                 :            : "size :",
     512                 :            : "size : kw_SIZE range",
     513                 :            : "SequenceType : kw_SEQUENCE '{' ComponentTypeList '}'",
     514                 :            : "SequenceType : kw_SEQUENCE '{' '}'",
     515                 :            : "SequenceOfType : kw_SEQUENCE size kw_OF Type",
     516                 :            : "SetType : kw_SET '{' ComponentTypeList '}'",
     517                 :            : "SetType : kw_SET '{' '}'",
     518                 :            : "SetOfType : kw_SET kw_OF Type",
     519                 :            : "ChoiceType : kw_CHOICE '{' ComponentTypeList '}'",
     520                 :            : "ReferencedType : DefinedType",
     521                 :            : "ReferencedType : UsefulType",
     522                 :            : "DefinedType : IDENTIFIER",
     523                 :            : "UsefulType : kw_GeneralizedTime",
     524                 :            : "UsefulType : kw_UTCTime",
     525                 :            : "ConstrainedType : Type Constraint",
     526                 :            : "Constraint : '(' ConstraintSpec ')'",
     527                 :            : "ConstraintSpec : GeneralConstraint",
     528                 :            : "GeneralConstraint : ContentsConstraint",
     529                 :            : "GeneralConstraint : UserDefinedConstraint",
     530                 :            : "ContentsConstraint : kw_CONTAINING Type",
     531                 :            : "ContentsConstraint : kw_ENCODED kw_BY Value",
     532                 :            : "ContentsConstraint : kw_CONTAINING Type kw_ENCODED kw_BY Value",
     533                 :            : "UserDefinedConstraint : kw_CONSTRAINED kw_BY '{' '}'",
     534                 :            : "TaggedType : Tag tagenv Type",
     535                 :            : "Tag : '[' Class NUMBER ']'",
     536                 :            : "Class :",
     537                 :            : "Class : kw_UNIVERSAL",
     538                 :            : "Class : kw_APPLICATION",
     539                 :            : "Class : kw_PRIVATE",
     540                 :            : "tagenv :",
     541                 :            : "tagenv : kw_EXPLICIT",
     542                 :            : "tagenv : kw_IMPLICIT",
     543                 :            : "ValueAssignment : IDENTIFIER Type EEQUAL Value",
     544                 :            : "CharacterStringType : RestrictedCharactedStringType",
     545                 :            : "RestrictedCharactedStringType : kw_GeneralString",
     546                 :            : "RestrictedCharactedStringType : kw_TeletexString",
     547                 :            : "RestrictedCharactedStringType : kw_UTF8String",
     548                 :            : "RestrictedCharactedStringType : kw_PrintableString",
     549                 :            : "RestrictedCharactedStringType : kw_VisibleString",
     550                 :            : "RestrictedCharactedStringType : kw_IA5String",
     551                 :            : "RestrictedCharactedStringType : kw_BMPString",
     552                 :            : "RestrictedCharactedStringType : kw_UniversalString",
     553                 :            : "ComponentTypeList : ComponentType",
     554                 :            : "ComponentTypeList : ComponentTypeList ',' ComponentType",
     555                 :            : "ComponentTypeList : ComponentTypeList ',' ELLIPSIS",
     556                 :            : "NamedType : IDENTIFIER Type",
     557                 :            : "ComponentType : NamedType",
     558                 :            : "ComponentType : NamedType kw_OPTIONAL",
     559                 :            : "ComponentType : NamedType kw_DEFAULT Value",
     560                 :            : "NamedBitList : NamedBit",
     561                 :            : "NamedBitList : NamedBitList ',' NamedBit",
     562                 :            : "NamedBit : IDENTIFIER '(' NUMBER ')'",
     563                 :            : "objid_opt : objid",
     564                 :            : "objid_opt :",
     565                 :            : "objid : '{' objid_list '}'",
     566                 :            : "objid_list :",
     567                 :            : "objid_list : objid_element objid_list",
     568                 :            : "objid_element : IDENTIFIER '(' NUMBER ')'",
     569                 :            : "objid_element : IDENTIFIER",
     570                 :            : "objid_element : NUMBER",
     571                 :            : "Value : BuiltinValue",
     572                 :            : "Value : ReferencedValue",
     573                 :            : "BuiltinValue : BooleanValue",
     574                 :            : "BuiltinValue : CharacterStringValue",
     575                 :            : "BuiltinValue : IntegerValue",
     576                 :            : "BuiltinValue : ObjectIdentifierValue",
     577                 :            : "BuiltinValue : NullValue",
     578                 :            : "ReferencedValue : DefinedValue",
     579                 :            : "DefinedValue : Valuereference",
     580                 :            : "Valuereference : IDENTIFIER",
     581                 :            : "CharacterStringValue : STRING",
     582                 :            : "BooleanValue : kw_TRUE",
     583                 :            : "BooleanValue : kw_FALSE",
     584                 :            : "IntegerValue : SignedNumber",
     585                 :            : "SignedNumber : NUMBER",
     586                 :            : "NullValue : kw_NULL",
     587                 :            : "ObjectIdentifierValue : objid",
     588                 :            : 
     589                 :            : };
     590                 :            : #endif
     591                 :            : /* define the initial stack-sizes */
     592                 :            : #ifdef YYSTACKSIZE
     593                 :            : #undef YYMAXDEPTH
     594                 :            : #define YYMAXDEPTH  YYSTACKSIZE
     595                 :            : #else
     596                 :            : #ifdef YYMAXDEPTH
     597                 :            : #define YYSTACKSIZE YYMAXDEPTH
     598                 :            : #else
     599                 :            : #define YYSTACKSIZE 500
     600                 :            : #define YYMAXDEPTH  500
     601                 :            : #endif
     602                 :            : #endif
     603                 :            : 
     604                 :            : #define YYINITSTACKSIZE 500
     605                 :            : 
     606                 :            : int      yydebug;
     607                 :            : int      yynerrs;
     608                 :            : 
     609                 :            : typedef struct {
     610                 :            :     unsigned stacksize;
     611                 :            :     short    *s_base;
     612                 :            :     short    *s_mark;
     613                 :            :     short    *s_last;
     614                 :            :     YYSTYPE  *l_base;
     615                 :            :     YYSTYPE  *l_mark;
     616                 :            : } YYSTACKDATA;
     617                 :            : int      yyerrflag;
     618                 :            : int      yychar;
     619                 :            : YYSTYPE  yyval;
     620                 :            : YYSTYPE  yylval;
     621                 :            : 
     622                 :            : /* variables for the parser stack */
     623                 :            : static YYSTACKDATA yystack;
     624                 :            : 
     625                 :            : void
     626                 :          0 : yyerror (const char *s)
     627                 :            : {
     628                 :          0 :      lex_error_message ("%s\n", s);
     629                 :          0 : }
     630                 :            : 
     631                 :            : static Type *
     632                 :        716 : new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
     633                 :            : {
     634                 :            :     Type *t;
     635 [ -  + ][ #  # ]:        716 :     if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
     636                 :          0 :         t = oldtype;
     637                 :          0 :         oldtype = oldtype->subtype; /* XXX */
     638                 :            :     } else
     639                 :        716 :         t = new_type (TTag);
     640                 :            : 
     641                 :        716 :     t->tag.tagclass = tagclass;
     642                 :        716 :     t->tag.tagvalue = tagvalue;
     643                 :        716 :     t->tag.tagenv = tagenv;
     644                 :        716 :     t->subtype = oldtype;
     645                 :        716 :     return t;
     646                 :            : }
     647                 :            : 
     648                 :            : static struct objid *
     649                 :        363 : new_objid(const char *label, int value)
     650                 :            : {
     651                 :            :     struct objid *s;
     652                 :        363 :     s = emalloc(sizeof(*s));
     653                 :        363 :     s->label = label;
     654                 :        363 :     s->value = value;
     655                 :        363 :     s->next = NULL;
     656                 :        363 :     return s;
     657                 :            : }
     658                 :            : 
     659                 :            : static void
     660                 :        326 : add_oid_to_tail(struct objid *head, struct objid *tail)
     661                 :            : {
     662                 :            :     struct objid *o;
     663                 :        326 :     o = head;
     664         [ +  + ]:        823 :     while (o->next)
     665                 :        497 :         o = o->next;
     666                 :        326 :     o->next = tail;
     667                 :        326 : }
     668                 :            : 
     669                 :            : static Type *
     670                 :       2426 : new_type (Typetype tt)
     671                 :            : {
     672                 :       2426 :     Type *t = ecalloc(1, sizeof(*t));
     673                 :       2426 :     t->type = tt;
     674                 :       2426 :     return t;
     675                 :            : }
     676                 :            : 
     677                 :            : static struct constraint_spec *
     678                 :          0 : new_constraint_spec(enum ctype ct)
     679                 :            : {
     680                 :          0 :     struct constraint_spec *c = ecalloc(1, sizeof(*c));
     681                 :          0 :     c->ctype = ct;
     682                 :          0 :     return c;
     683                 :            : }
     684                 :            : 
     685                 :            : static void fix_labels2(Type *t, const char *prefix);
     686                 :       2048 : static void fix_labels1(struct memhead *members, const char *prefix)
     687                 :            : {
     688                 :            :     Member *m;
     689                 :            : 
     690         [ +  + ]:       2048 :     if(members == NULL)
     691                 :       1821 :         return;
     692         [ +  + ]:       3031 :     ASN1_TAILQ_FOREACH(m, members, members) {
     693         [ -  + ]:        983 :         if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
     694                 :          0 :             errx(1, "malloc");
     695         [ -  + ]:        983 :         if (m->label == NULL)
     696                 :          0 :             errx(1, "malloc");
     697         [ +  + ]:        983 :         if(m->type != NULL)
     698                 :        666 :             fix_labels2(m->type, m->label);
     699                 :            :     }
     700                 :            : }
     701                 :            : 
     702                 :        962 : static void fix_labels2(Type *t, const char *prefix)
     703                 :            : {
     704         [ +  + ]:       3010 :     for(; t; t = t->subtype)
     705                 :       2048 :         fix_labels1(t->members, prefix);
     706                 :        962 : }
     707                 :            : 
     708                 :            : static void
     709                 :        296 : fix_labels(Symbol *s)
     710                 :            : {
     711                 :        296 :     char *p = NULL;
     712 [ +  - ][ -  + ]:        296 :     if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
     713                 :          0 :         errx(1, "malloc");
     714                 :        296 :     fix_labels2(s->type, p);
     715                 :        296 :     free(p);
     716                 :        296 : }
     717                 :            : 
     718                 :            : #if YYDEBUG
     719                 :            : #include <stdio.h>                /* needed for printf */
     720                 :            : #endif
     721                 :            : 
     722                 :            : #include <stdlib.h>       /* needed for malloc, etc */
     723                 :            : #include <string.h>       /* needed for memset */
     724                 :            : 
     725                 :            : /* allocate initial stack or double stack size, up to YYMAXDEPTH */
     726                 :         14 : static int yygrowstack(YYSTACKDATA *data)
     727                 :            : {
     728                 :            :     int i;
     729                 :            :     unsigned newsize;
     730                 :            :     short *newss;
     731                 :            :     YYSTYPE *newvs;
     732                 :            : 
     733         [ +  - ]:         14 :     if ((newsize = data->stacksize) == 0)
     734                 :         14 :         newsize = YYINITSTACKSIZE;
     735         [ #  # ]:          0 :     else if (newsize >= YYMAXDEPTH)
     736                 :          0 :         return -1;
     737         [ #  # ]:          0 :     else if ((newsize *= 2) > YYMAXDEPTH)
     738                 :          0 :         newsize = YYMAXDEPTH;
     739                 :            : 
     740                 :         14 :     i = data->s_mark - data->s_base;
     741                 :         14 :     newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
     742         [ -  + ]:         14 :     if (newss == 0)
     743                 :          0 :         return -1;
     744                 :            : 
     745                 :         14 :     data->s_base = newss;
     746                 :         14 :     data->s_mark = newss + i;
     747                 :            : 
     748                 :         14 :     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
     749         [ -  + ]:         14 :     if (newvs == 0)
     750                 :          0 :         return -1;
     751                 :            : 
     752                 :         14 :     data->l_base = newvs;
     753                 :         14 :     data->l_mark = newvs + i;
     754                 :            : 
     755                 :         14 :     data->stacksize = newsize;
     756                 :         14 :     data->s_last = data->s_base + newsize - 1;
     757                 :         14 :     return 0;
     758                 :            : }
     759                 :            : 
     760                 :            : #if YYPURE || defined(YY_NO_LEAKS)
     761                 :            : static void yyfreestack(YYSTACKDATA *data)
     762                 :            : {
     763                 :            :     free(data->s_base);
     764                 :            :     free(data->l_base);
     765                 :            :     memset(data, 0, sizeof(*data));
     766                 :            : }
     767                 :            : #else
     768                 :            : #define yyfreestack(data) /* nothing */
     769                 :            : #endif
     770                 :            : 
     771                 :            : #define YYABORT  goto yyabort
     772                 :            : #define YYREJECT goto yyabort
     773                 :            : #define YYACCEPT goto yyaccept
     774                 :            : #define YYERROR  goto yyerrlab
     775                 :            : 
     776                 :            : int
     777                 :         14 : YYPARSE_DECL()
     778                 :            : {
     779                 :            :     int yym, yyn, yystate;
     780                 :            : #if YYDEBUG
     781                 :            :     const char *yys;
     782                 :            : 
     783                 :            :     if ((yys = getenv("YYDEBUG")) != 0)
     784                 :            :     {
     785                 :            :         yyn = *yys;
     786                 :            :         if (yyn >= '0' && yyn <= '9')
     787                 :            :             yydebug = yyn - '0';
     788                 :            :     }
     789                 :            : #endif
     790                 :            : 
     791                 :         14 :     yynerrs = 0;
     792                 :         14 :     yyerrflag = 0;
     793                 :         14 :     yychar = YYEMPTY;
     794                 :         14 :     yystate = 0;
     795                 :            : 
     796                 :            : #if YYPURE
     797                 :            :     memset(&yystack, 0, sizeof(yystack));
     798                 :            : #endif
     799                 :            : 
     800 [ +  - ][ -  + ]:         14 :     if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
     801                 :         14 :     yystack.s_mark = yystack.s_base;
     802                 :         14 :     yystack.l_mark = yystack.l_base;
     803                 :         14 :     yystate = 0;
     804                 :         14 :     *yystack.s_mark = 0;
     805                 :            : 
     806                 :            : yyloop:
     807         [ +  + ]:      22708 :     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
     808         [ +  + ]:      12720 :     if (yychar < 0)
     809                 :            :     {
     810         [ -  + ]:       9219 :         if ((yychar = YYLEX) < 0) yychar = 0;
     811                 :            : #if YYDEBUG
     812                 :            :         if (yydebug)
     813                 :            :         {
     814                 :            :             yys = 0;
     815                 :            :             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
     816                 :            :             if (!yys) yys = "illegal-symbol";
     817                 :            :             printf("%sdebug: state %d, reading %d (%s)\n",
     818                 :            :                     YYPREFIX, yystate, yychar, yys);
     819                 :            :         }
     820                 :            : #endif
     821                 :            :     }
     822 [ +  - ][ +  + ]:      12720 :     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
         [ +  - ][ +  + ]
     823                 :      12057 :             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
     824                 :            :     {
     825                 :            : #if YYDEBUG
     826                 :            :         if (yydebug)
     827                 :            :             printf("%sdebug: state %d, shifting to state %d\n",
     828                 :            :                     YYPREFIX, yystate, yytable[yyn]);
     829                 :            : #endif
     830 [ -  + ][ #  # ]:       9219 :         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
     831                 :            :         {
     832                 :          0 :             goto yyoverflow;
     833                 :            :         }
     834                 :       9219 :         yystate = yytable[yyn];
     835                 :       9219 :         *++yystack.s_mark = yytable[yyn];
     836                 :       9219 :         *++yystack.l_mark = yylval;
     837                 :       9219 :         yychar = YYEMPTY;
     838         [ -  + ]:       9219 :         if (yyerrflag > 0)  --yyerrflag;
     839                 :       9219 :         goto yyloop;
     840                 :            :     }
     841 [ +  - ][ +  - ]:       3501 :     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
         [ +  - ][ +  - ]
     842                 :       3501 :             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
     843                 :            :     {
     844                 :       3501 :         yyn = yytable[yyn];
     845                 :       3501 :         goto yyreduce;
     846                 :            :     }
     847         [ #  # ]:          0 :     if (yyerrflag) goto yyinrecovery;
     848                 :            : 
     849                 :          0 :     yyerror("syntax error");
     850                 :            : 
     851                 :            :     goto yyerrlab;
     852                 :            : 
     853                 :            : yyerrlab:
     854                 :          0 :     ++yynerrs;
     855                 :            : 
     856                 :            : yyinrecovery:
     857         [ #  # ]:          0 :     if (yyerrflag < 3)
     858                 :            :     {
     859                 :          0 :         yyerrflag = 3;
     860                 :            :         for (;;)
     861                 :            :         {
     862 [ #  # ][ #  # ]:          0 :             if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
         [ #  # ][ #  # ]
     863                 :          0 :                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
     864                 :            :             {
     865                 :            : #if YYDEBUG
     866                 :            :                 if (yydebug)
     867                 :            :                     printf("%sdebug: state %d, error recovery shifting\
     868                 :            :  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
     869                 :            : #endif
     870 [ #  # ][ #  # ]:          0 :                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
     871                 :            :                 {
     872                 :          0 :                     goto yyoverflow;
     873                 :            :                 }
     874                 :          0 :                 yystate = yytable[yyn];
     875                 :          0 :                 *++yystack.s_mark = yytable[yyn];
     876                 :          0 :                 *++yystack.l_mark = yylval;
     877                 :          0 :                 goto yyloop;
     878                 :            :             }
     879                 :            :             else
     880                 :            :             {
     881                 :            : #if YYDEBUG
     882                 :            :                 if (yydebug)
     883                 :            :                     printf("%sdebug: error recovery discarding state %d\n",
     884                 :            :                             YYPREFIX, *yystack.s_mark);
     885                 :            : #endif
     886         [ #  # ]:          0 :                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
     887                 :          0 :                 --yystack.s_mark;
     888                 :          0 :                 --yystack.l_mark;
     889                 :            :             }
     890                 :          0 :         }
     891                 :            :     }
     892                 :            :     else
     893                 :            :     {
     894         [ #  # ]:          0 :         if (yychar == 0) goto yyabort;
     895                 :            : #if YYDEBUG
     896                 :            :         if (yydebug)
     897                 :            :         {
     898                 :            :             yys = 0;
     899                 :            :             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
     900                 :            :             if (!yys) yys = "illegal-symbol";
     901                 :            :             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
     902                 :            :                     YYPREFIX, yystate, yychar, yys);
     903                 :            :         }
     904                 :            : #endif
     905                 :          0 :         yychar = YYEMPTY;
     906                 :          0 :         goto yyloop;
     907                 :            :     }
     908                 :            : 
     909                 :            : yyreduce:
     910                 :            : #if YYDEBUG
     911                 :            :     if (yydebug)
     912                 :            :         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
     913                 :            :                 YYPREFIX, yystate, yyn, yyrule[yyn]);
     914                 :            : #endif
     915                 :      13489 :     yym = yylen[yyn];
     916         [ +  + ]:      13489 :     if (yym)
     917                 :      12190 :         yyval = yystack.l_mark[1-yym];
     918                 :            :     else
     919                 :       1299 :         memset(&yyval, 0, sizeof yyval);
     920   [ +  -  -  -  :      13489 :     switch (yyn)
          +  +  +  +  +  
          +  +  +  -  +  
          +  +  +  +  +  
          -  +  +  +  +  
          +  +  +  +  +  
          +  -  +  -  -  
          +  +  +  +  +  
          -  -  -  -  -  
          -  +  +  +  -  
          +  -  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          -  +  +  +  +  
          +  +  +  +  +  
          +  -  -  -  -  
             +  -  +  + ]
     921                 :            :     {
     922                 :            : case 1:
     923                 :            :         {
     924                 :         14 :                         checkundefined();
     925                 :            :                 }
     926                 :         14 : break;
     927                 :            : case 3:
     928                 :          0 :         { lex_error_message("implicit tagging is not supported"); }
     929                 :          0 : break;
     930                 :            : case 4:
     931                 :          0 :         { lex_error_message("automatic tagging is not supported"); }
     932                 :          0 : break;
     933                 :            : case 6:
     934                 :          0 :         { lex_error_message("no extensibility options supported"); }
     935                 :          0 : break;
     936                 :            : case 16:
     937                 :            :         {
     938                 :            :                     struct string_list *sl;
     939         [ +  + ]:         62 :                     for(sl = yystack.l_mark[-3].sl; sl != NULL; sl = sl->next) {
     940                 :         45 :                         Symbol *s = addsym(sl->string);
     941                 :         45 :                         s->stype = Stype;
     942                 :         45 :                         gen_template_import(s);
     943                 :            :                     }
     944                 :         17 :                     add_import(yystack.l_mark[-1].name);
     945                 :            :                 }
     946                 :         17 : break;
     947                 :            : case 17:
     948                 :            :         {
     949                 :            :                     struct string_list *sl;
     950         [ +  + ]:         71 :                     for(sl = yystack.l_mark[-1].sl; sl != NULL; sl = sl->next)
     951                 :         70 :                         add_export(sl->string);
     952                 :            :                 }
     953                 :          1 : break;
     954                 :            : case 24:
     955                 :            :         {
     956                 :         97 :                     yyval.sl = emalloc(sizeof(*yyval.sl));
     957                 :         97 :                     yyval.sl->string = yystack.l_mark[-2].name;
     958                 :         97 :                     yyval.sl->next = yystack.l_mark[0].sl;
     959                 :            :                 }
     960                 :         97 : break;
     961                 :            : case 25:
     962                 :            :         {
     963                 :         18 :                     yyval.sl = emalloc(sizeof(*yyval.sl));
     964                 :         18 :                     yyval.sl->string = yystack.l_mark[0].name;
     965                 :         18 :                     yyval.sl->next = NULL;
     966                 :            :                 }
     967                 :         18 : break;
     968                 :            : case 26:
     969                 :            :         {
     970                 :        296 :                     Symbol *s = addsym (yystack.l_mark[-2].name);
     971                 :        296 :                     s->stype = Stype;
     972                 :        296 :                     s->type = yystack.l_mark[0].type;
     973                 :        296 :                     fix_labels(s);
     974                 :        296 :                     generate_type (s);
     975                 :            :                 }
     976                 :        296 : break;
     977                 :            : case 44:
     978                 :            :         {
     979                 :          8 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_Boolean,
     980                 :            :                                      TE_EXPLICIT, new_type(TBoolean));
     981                 :            :                 }
     982                 :          8 : break;
     983                 :            : case 45:
     984                 :            :         {
     985         [ -  + ]:         34 :                     if(yystack.l_mark[-3].value->type != integervalue)
     986                 :          0 :                         lex_error_message("Non-integer used in first part of range");
     987         [ -  + ]:         34 :                     if(yystack.l_mark[-3].value->type != integervalue)
     988                 :          0 :                         lex_error_message("Non-integer in second part of range");
     989                 :         34 :                     yyval.range = ecalloc(1, sizeof(*yyval.range));
     990                 :         34 :                     yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
     991                 :         34 :                     yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
     992                 :            :                 }
     993                 :         34 : break;
     994                 :            : case 46:
     995                 :            :         {
     996         [ -  + ]:          7 :                     if(yystack.l_mark[-3].value->type != integervalue)
     997                 :          0 :                         lex_error_message("Non-integer in first part of range");
     998                 :          7 :                     yyval.range = ecalloc(1, sizeof(*yyval.range));
     999                 :          7 :                     yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
    1000                 :          7 :                     yyval.range->max = yystack.l_mark[-3].value->u.integervalue - 1;
    1001                 :            :                 }
    1002                 :          7 : break;
    1003                 :            : case 47:
    1004                 :            :         {
    1005         [ #  # ]:          0 :                     if(yystack.l_mark[-1].value->type != integervalue)
    1006                 :          0 :                         lex_error_message("Non-integer in second part of range");
    1007                 :          0 :                     yyval.range = ecalloc(1, sizeof(*yyval.range));
    1008                 :          0 :                     yyval.range->min = yystack.l_mark[-1].value->u.integervalue + 2;
    1009                 :          0 :                     yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
    1010                 :            :                 }
    1011                 :          0 : break;
    1012                 :            : case 48:
    1013                 :            :         {
    1014         [ -  + ]:          1 :                     if(yystack.l_mark[-1].value->type != integervalue)
    1015                 :          0 :                         lex_error_message("Non-integer used in limit");
    1016                 :          1 :                     yyval.range = ecalloc(1, sizeof(*yyval.range));
    1017                 :          1 :                     yyval.range->min = yystack.l_mark[-1].value->u.integervalue;
    1018                 :          1 :                     yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
    1019                 :            :                 }
    1020                 :          1 : break;
    1021                 :            : case 49:
    1022                 :            :         {
    1023                 :         46 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_Integer,
    1024                 :            :                                      TE_EXPLICIT, new_type(TInteger));
    1025                 :            :                 }
    1026                 :         46 : break;
    1027                 :            : case 50:
    1028                 :            :         {
    1029                 :         34 :                         yyval.type = new_type(TInteger);
    1030                 :         34 :                         yyval.type->range = yystack.l_mark[0].range;
    1031                 :         34 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
    1032                 :            :                 }
    1033                 :         34 : break;
    1034                 :            : case 51:
    1035                 :            :         {
    1036                 :         13 :                   yyval.type = new_type(TInteger);
    1037                 :         13 :                   yyval.type->members = yystack.l_mark[-1].members;
    1038                 :         13 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
    1039                 :            :                 }
    1040                 :         13 : break;
    1041                 :            : case 52:
    1042                 :            :         {
    1043                 :         16 :                         yyval.members = emalloc(sizeof(*yyval.members));
    1044                 :         16 :                         ASN1_TAILQ_INIT(yyval.members);
    1045         [ -  + ]:         16 :                         ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
    1046                 :            :                 }
    1047                 :         16 : break;
    1048                 :            : case 53:
    1049                 :            :         {
    1050                 :        178 :                         ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
    1051                 :        178 :                         yyval.members = yystack.l_mark[-2].members;
    1052                 :            :                 }
    1053                 :        178 : break;
    1054                 :            : case 54:
    1055                 :          0 :         { yyval.members = yystack.l_mark[-2].members; }
    1056                 :          0 : break;
    1057                 :            : case 55:
    1058                 :            :         {
    1059                 :        194 :                         yyval.member = emalloc(sizeof(*yyval.member));
    1060                 :        194 :                         yyval.member->name = yystack.l_mark[-3].name;
    1061                 :        194 :                         yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
    1062                 :        194 :                         output_name (yyval.member->gen_name);
    1063                 :        194 :                         yyval.member->val = yystack.l_mark[-1].constant;
    1064                 :        194 :                         yyval.member->optional = 0;
    1065                 :        194 :                         yyval.member->ellipsis = 0;
    1066                 :        194 :                         yyval.member->type = NULL;
    1067                 :            :                 }
    1068                 :        194 : break;
    1069                 :            : case 56:
    1070                 :            :         {
    1071                 :          3 :                   yyval.type = new_type(TInteger);
    1072                 :          3 :                   yyval.type->members = yystack.l_mark[-1].members;
    1073                 :          3 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, yyval.type);
    1074                 :            :                 }
    1075                 :          3 : break;
    1076                 :            : case 58:
    1077                 :            :         {
    1078                 :         12 :                   yyval.type = new_type(TBitString);
    1079                 :         12 :                   yyval.type->members = emalloc(sizeof(*yyval.type->members));
    1080                 :         12 :                   ASN1_TAILQ_INIT(yyval.type->members);
    1081                 :         12 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
    1082                 :            :                 }
    1083                 :         12 : break;
    1084                 :            : case 59:
    1085                 :            :         {
    1086                 :         10 :                   yyval.type = new_type(TBitString);
    1087                 :         10 :                   yyval.type->members = yystack.l_mark[-1].members;
    1088                 :         10 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
    1089                 :            :                 }
    1090                 :         10 : break;
    1091                 :            : case 60:
    1092                 :            :         {
    1093                 :        179 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_OID,
    1094                 :            :                                      TE_EXPLICIT, new_type(TOID));
    1095                 :            :                 }
    1096                 :        179 : break;
    1097                 :            : case 61:
    1098                 :            :         {
    1099                 :         96 :                     Type *t = new_type(TOctetString);
    1100                 :         96 :                     t->range = yystack.l_mark[0].range;
    1101                 :         96 :                     yyval.type = new_tag(ASN1_C_UNIV, UT_OctetString,
    1102                 :            :                                  TE_EXPLICIT, t);
    1103                 :            :                 }
    1104                 :         96 : break;
    1105                 :            : case 62:
    1106                 :            :         {
    1107                 :          3 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_Null,
    1108                 :            :                                      TE_EXPLICIT, new_type(TNull));
    1109                 :            :                 }
    1110                 :          3 : break;
    1111                 :            : case 63:
    1112                 :        142 :         { yyval.range = NULL; }
    1113                 :        142 : break;
    1114                 :            : case 64:
    1115                 :          8 :         { yyval.range = yystack.l_mark[0].range; }
    1116                 :          8 : break;
    1117                 :            : case 65:
    1118                 :            :         {
    1119                 :        169 :                   yyval.type = new_type(TSequence);
    1120                 :        169 :                   yyval.type->members = yystack.l_mark[-1].members;
    1121                 :        169 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
    1122                 :            :                 }
    1123                 :        169 : break;
    1124                 :            : case 66:
    1125                 :            :         {
    1126                 :          0 :                   yyval.type = new_type(TSequence);
    1127                 :          0 :                   yyval.type->members = NULL;
    1128                 :          0 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
    1129                 :            :                 }
    1130                 :          0 : break;
    1131                 :            : case 67:
    1132                 :            :         {
    1133                 :         54 :                   yyval.type = new_type(TSequenceOf);
    1134                 :         54 :                   yyval.type->range = yystack.l_mark[-2].range;
    1135                 :         54 :                   yyval.type->subtype = yystack.l_mark[0].type;
    1136                 :         54 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
    1137                 :            :                 }
    1138                 :         54 : break;
    1139                 :            : case 68:
    1140                 :            :         {
    1141                 :          0 :                   yyval.type = new_type(TSet);
    1142                 :          0 :                   yyval.type->members = yystack.l_mark[-1].members;
    1143                 :          0 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
    1144                 :            :                 }
    1145                 :          0 : break;
    1146                 :            : case 69:
    1147                 :            :         {
    1148                 :          0 :                   yyval.type = new_type(TSet);
    1149                 :          0 :                   yyval.type->members = NULL;
    1150                 :          0 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
    1151                 :            :                 }
    1152                 :          0 : break;
    1153                 :            : case 70:
    1154                 :            :         {
    1155                 :         18 :                   yyval.type = new_type(TSetOf);
    1156                 :         18 :                   yyval.type->subtype = yystack.l_mark[0].type;
    1157                 :         18 :                   yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
    1158                 :            :                 }
    1159                 :         18 : break;
    1160                 :            : case 71:
    1161                 :            :         {
    1162                 :         20 :                   yyval.type = new_type(TChoice);
    1163                 :         20 :                   yyval.type->members = yystack.l_mark[-1].members;
    1164                 :            :                 }
    1165                 :         20 : break;
    1166                 :            : case 74:
    1167                 :            :         {
    1168                 :        468 :                   Symbol *s = addsym(yystack.l_mark[0].name);
    1169                 :        468 :                   yyval.type = new_type(TType);
    1170 [ -  + ][ #  # ]:        468 :                   if(s->stype != Stype && s->stype != SUndefined)
    1171                 :          0 :                     lex_error_message ("%s is not a type\n", yystack.l_mark[0].name);
    1172                 :            :                   else
    1173                 :        468 :                     yyval.type->symbol = s;
    1174                 :            :                 }
    1175                 :        468 : break;
    1176                 :            : case 75:
    1177                 :            :         {
    1178                 :          6 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
    1179                 :            :                                      TE_EXPLICIT, new_type(TGeneralizedTime));
    1180                 :            :                 }
    1181                 :          6 : break;
    1182                 :            : case 76:
    1183                 :            :         {
    1184                 :          1 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_UTCTime,
    1185                 :            :                                      TE_EXPLICIT, new_type(TUTCTime));
    1186                 :            :                 }
    1187                 :          1 : break;
    1188                 :            : case 77:
    1189                 :            :         {
    1190                 :            :                     /* if (Constraint.type == contentConstrant) {
    1191                 :            :                        assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
    1192                 :            :                        if (Constraint.u.constraint.type) {
    1193                 :            :                          assert((Constraint.u.constraint.type.length % 8) == 0);
    1194                 :            :                        }
    1195                 :            :                       }
    1196                 :            :                       if (Constraint.u.constraint.encoding) {
    1197                 :            :                         type == der-oid|ber-oid
    1198                 :            :                       }
    1199                 :            :                     */
    1200                 :            :                 }
    1201                 :          0 : break;
    1202                 :            : case 78:
    1203                 :            :         {
    1204                 :          0 :                     yyval.constraint_spec = yystack.l_mark[-1].constraint_spec;
    1205                 :            :                 }
    1206                 :          0 : break;
    1207                 :            : case 82:
    1208                 :            :         {
    1209                 :          0 :                     yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
    1210                 :          0 :                     yyval.constraint_spec->u.content.type = yystack.l_mark[0].type;
    1211                 :          0 :                     yyval.constraint_spec->u.content.encoding = NULL;
    1212                 :            :                 }
    1213                 :          0 : break;
    1214                 :            : case 83:
    1215                 :            :         {
    1216         [ #  # ]:          0 :                     if (yystack.l_mark[0].value->type != objectidentifiervalue)
    1217                 :          0 :                         lex_error_message("Non-OID used in ENCODED BY constraint");
    1218                 :          0 :                     yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
    1219                 :          0 :                     yyval.constraint_spec->u.content.type = NULL;
    1220                 :          0 :                     yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
    1221                 :            :                 }
    1222                 :          0 : break;
    1223                 :            : case 84:
    1224                 :            :         {
    1225         [ #  # ]:          0 :                     if (yystack.l_mark[0].value->type != objectidentifiervalue)
    1226                 :          0 :                         lex_error_message("Non-OID used in ENCODED BY constraint");
    1227                 :          0 :                     yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
    1228                 :          0 :                     yyval.constraint_spec->u.content.type = yystack.l_mark[-3].type;
    1229                 :          0 :                     yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
    1230                 :            :                 }
    1231                 :          0 : break;
    1232                 :            : case 85:
    1233                 :            :         {
    1234                 :          0 :                     yyval.constraint_spec = new_constraint_spec(CT_USER);
    1235                 :            :                 }
    1236                 :          0 : break;
    1237                 :            : case 86:
    1238                 :            :         {
    1239                 :        506 :                         yyval.type = new_type(TTag);
    1240                 :        506 :                         yyval.type->tag = yystack.l_mark[-2].tag;
    1241                 :        506 :                         yyval.type->tag.tagenv = yystack.l_mark[-1].constant;
    1242 [ +  + ][ +  + ]:        506 :                         if(yystack.l_mark[0].type->type == TTag && yystack.l_mark[-1].constant == TE_IMPLICIT) {
    1243                 :         40 :                                 yyval.type->subtype = yystack.l_mark[0].type->subtype;
    1244                 :         40 :                                 free(yystack.l_mark[0].type);
    1245                 :            :                         } else
    1246                 :        466 :                                 yyval.type->subtype = yystack.l_mark[0].type;
    1247                 :            :                 }
    1248                 :        506 : break;
    1249                 :            : case 87:
    1250                 :            :         {
    1251                 :        506 :                         yyval.tag.tagclass = yystack.l_mark[-2].constant;
    1252                 :        506 :                         yyval.tag.tagvalue = yystack.l_mark[-1].constant;
    1253                 :        506 :                         yyval.tag.tagenv = TE_EXPLICIT;
    1254                 :            :                 }
    1255                 :        506 : break;
    1256                 :            : case 88:
    1257                 :            :         {
    1258                 :        484 :                         yyval.constant = ASN1_C_CONTEXT;
    1259                 :            :                 }
    1260                 :        484 : break;
    1261                 :            : case 89:
    1262                 :            :         {
    1263                 :          0 :                         yyval.constant = ASN1_C_UNIV;
    1264                 :            :                 }
    1265                 :          0 : break;
    1266                 :            : case 90:
    1267                 :            :         {
    1268                 :         22 :                         yyval.constant = ASN1_C_APPL;
    1269                 :            :                 }
    1270                 :         22 : break;
    1271                 :            : case 91:
    1272                 :            :         {
    1273                 :          0 :                         yyval.constant = ASN1_C_PRIVATE;
    1274                 :            :                 }
    1275                 :          0 : break;
    1276                 :            : case 92:
    1277                 :            :         {
    1278                 :        438 :                         yyval.constant = TE_EXPLICIT;
    1279                 :            :                 }
    1280                 :        438 : break;
    1281                 :            : case 93:
    1282                 :            :         {
    1283                 :         19 :                         yyval.constant = TE_EXPLICIT;
    1284                 :            :                 }
    1285                 :         19 : break;
    1286                 :            : case 94:
    1287                 :            :         {
    1288                 :         49 :                         yyval.constant = TE_IMPLICIT;
    1289                 :            :                 }
    1290                 :         49 : break;
    1291                 :            : case 95:
    1292                 :            :         {
    1293                 :            :                         Symbol *s;
    1294                 :        170 :                         s = addsym (yystack.l_mark[-3].name);
    1295                 :            : 
    1296                 :        170 :                         s->stype = SValue;
    1297                 :        170 :                         s->value = yystack.l_mark[0].value;
    1298                 :        170 :                         generate_constant (s);
    1299                 :            :                 }
    1300                 :        170 : break;
    1301                 :            : case 97:
    1302                 :            :         {
    1303                 :         14 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralString,
    1304                 :            :                                      TE_EXPLICIT, new_type(TGeneralString));
    1305                 :            :                 }
    1306                 :         14 : break;
    1307                 :            : case 98:
    1308                 :            :         {
    1309                 :          1 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_TeletexString,
    1310                 :            :                                      TE_EXPLICIT, new_type(TTeletexString));
    1311                 :            :                 }
    1312                 :          1 : break;
    1313                 :            : case 99:
    1314                 :            :         {
    1315                 :         40 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_UTF8String,
    1316                 :            :                                      TE_EXPLICIT, new_type(TUTF8String));
    1317                 :            :                 }
    1318                 :         40 : break;
    1319                 :            : case 100:
    1320                 :            :         {
    1321                 :          1 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_PrintableString,
    1322                 :            :                                      TE_EXPLICIT, new_type(TPrintableString));
    1323                 :            :                 }
    1324                 :          1 : break;
    1325                 :            : case 101:
    1326                 :            :         {
    1327                 :          1 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_VisibleString,
    1328                 :            :                                      TE_EXPLICIT, new_type(TVisibleString));
    1329                 :            :                 }
    1330                 :          1 : break;
    1331                 :            : case 102:
    1332                 :            :         {
    1333                 :          4 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_IA5String,
    1334                 :            :                                      TE_EXPLICIT, new_type(TIA5String));
    1335                 :            :                 }
    1336                 :          4 : break;
    1337                 :            : case 103:
    1338                 :            :         {
    1339                 :          2 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_BMPString,
    1340                 :            :                                      TE_EXPLICIT, new_type(TBMPString));
    1341                 :            :                 }
    1342                 :          2 : break;
    1343                 :            : case 104:
    1344                 :            :         {
    1345                 :          1 :                         yyval.type = new_tag(ASN1_C_UNIV, UT_UniversalString,
    1346                 :            :                                      TE_EXPLICIT, new_type(TUniversalString));
    1347                 :            :                 }
    1348                 :          1 : break;
    1349                 :            : case 105:
    1350                 :            :         {
    1351                 :        189 :                         yyval.members = emalloc(sizeof(*yyval.members));
    1352                 :        189 :                         ASN1_TAILQ_INIT(yyval.members);
    1353         [ -  + ]:        189 :                         ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
    1354                 :            :                 }
    1355                 :        189 : break;
    1356                 :            : case 106:
    1357                 :            :         {
    1358                 :        477 :                         ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
    1359                 :        477 :                         yyval.members = yystack.l_mark[-2].members;
    1360                 :            :                 }
    1361                 :        477 : break;
    1362                 :            : case 107:
    1363                 :            :         {
    1364                 :         32 :                         struct member *m = ecalloc(1, sizeof(*m));
    1365                 :         32 :                         m->name = estrdup("...");
    1366                 :         32 :                         m->gen_name = estrdup("asn1_ellipsis");
    1367                 :         32 :                         m->ellipsis = 1;
    1368                 :         32 :                         ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, m, members);
    1369                 :         32 :                         yyval.members = yystack.l_mark[-2].members;
    1370                 :            :                 }
    1371                 :         32 : break;
    1372                 :            : case 108:
    1373                 :            :         {
    1374                 :        666 :                   yyval.member = emalloc(sizeof(*yyval.member));
    1375                 :        666 :                   yyval.member->name = yystack.l_mark[-1].name;
    1376                 :        666 :                   yyval.member->gen_name = estrdup(yystack.l_mark[-1].name);
    1377                 :        666 :                   output_name (yyval.member->gen_name);
    1378                 :        666 :                   yyval.member->type = yystack.l_mark[0].type;
    1379                 :        666 :                   yyval.member->ellipsis = 0;
    1380                 :            :                 }
    1381                 :        666 : break;
    1382                 :            : case 109:
    1383                 :            :         {
    1384                 :        436 :                         yyval.member = yystack.l_mark[0].member;
    1385                 :        436 :                         yyval.member->optional = 0;
    1386                 :        436 :                         yyval.member->defval = NULL;
    1387                 :            :                 }
    1388                 :        436 : break;
    1389                 :            : case 110:
    1390                 :            :         {
    1391                 :        230 :                         yyval.member = yystack.l_mark[-1].member;
    1392                 :        230 :                         yyval.member->optional = 1;
    1393                 :        230 :                         yyval.member->defval = NULL;
    1394                 :            :                 }
    1395                 :        230 : break;
    1396                 :            : case 111:
    1397                 :            :         {
    1398                 :          0 :                         yyval.member = yystack.l_mark[-2].member;
    1399                 :          0 :                         yyval.member->optional = 0;
    1400                 :          0 :                         yyval.member->defval = yystack.l_mark[0].value;
    1401                 :            :                 }
    1402                 :          0 : break;
    1403                 :            : case 112:
    1404                 :            :         {
    1405                 :         10 :                         yyval.members = emalloc(sizeof(*yyval.members));
    1406                 :         10 :                         ASN1_TAILQ_INIT(yyval.members);
    1407         [ -  + ]:         10 :                         ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
    1408                 :            :                 }
    1409                 :         10 : break;
    1410                 :            : case 113:
    1411                 :            :         {
    1412                 :         81 :                         ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
    1413                 :         81 :                         yyval.members = yystack.l_mark[-2].members;
    1414                 :            :                 }
    1415                 :         81 : break;
    1416                 :            : case 114:
    1417                 :            :         {
    1418                 :         91 :                   yyval.member = emalloc(sizeof(*yyval.member));
    1419                 :         91 :                   yyval.member->name = yystack.l_mark[-3].name;
    1420                 :         91 :                   yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
    1421                 :         91 :                   output_name (yyval.member->gen_name);
    1422                 :         91 :                   yyval.member->val = yystack.l_mark[-1].constant;
    1423                 :         91 :                   yyval.member->optional = 0;
    1424                 :         91 :                   yyval.member->ellipsis = 0;
    1425                 :         91 :                   yyval.member->type = NULL;
    1426                 :            :                 }
    1427                 :         91 : break;
    1428                 :            : case 116:
    1429                 :         31 :         { yyval.objid = NULL; }
    1430                 :         31 : break;
    1431                 :            : case 117:
    1432                 :            :         {
    1433                 :        160 :                         yyval.objid = yystack.l_mark[-1].objid;
    1434                 :            :                 }
    1435                 :        160 : break;
    1436                 :            : case 118:
    1437                 :            :         {
    1438                 :        160 :                         yyval.objid = NULL;
    1439                 :            :                 }
    1440                 :        160 : break;
    1441                 :            : case 119:
    1442                 :            :         {
    1443         [ +  + ]:        486 :                         if (yystack.l_mark[0].objid) {
    1444                 :        326 :                                 yyval.objid = yystack.l_mark[0].objid;
    1445                 :        326 :                                 add_oid_to_tail(yystack.l_mark[0].objid, yystack.l_mark[-1].objid);
    1446                 :            :                         } else {
    1447                 :        160 :                                 yyval.objid = yystack.l_mark[-1].objid;
    1448                 :            :                         }
    1449                 :            :                 }
    1450                 :        486 : break;
    1451                 :            : case 120:
    1452                 :            :         {
    1453                 :        156 :                         yyval.objid = new_objid(yystack.l_mark[-3].name, yystack.l_mark[-1].constant);
    1454                 :            :                 }
    1455                 :        156 : break;
    1456                 :            : case 121:
    1457                 :            :         {
    1458                 :        123 :                     Symbol *s = addsym(yystack.l_mark[0].name);
    1459 [ +  - ][ -  + ]:        123 :                     if(s->stype != SValue ||
    1460                 :        123 :                        s->value->type != objectidentifiervalue) {
    1461                 :          0 :                         lex_error_message("%s is not an object identifier\n",
    1462                 :            :                                       s->name);
    1463                 :          0 :                         exit(1);
    1464                 :            :                     }
    1465                 :        123 :                     yyval.objid = s->value->u.objectidentifiervalue;
    1466                 :            :                 }
    1467                 :        123 : break;
    1468                 :            : case 122:
    1469                 :            :         {
    1470                 :        207 :                     yyval.objid = new_objid(NULL, yystack.l_mark[0].constant);
    1471                 :            :                 }
    1472                 :        207 : break;
    1473                 :            : case 132:
    1474                 :            :         {
    1475                 :          0 :                         Symbol *s = addsym(yystack.l_mark[0].name);
    1476         [ #  # ]:          0 :                         if(s->stype != SValue)
    1477                 :          0 :                                 lex_error_message ("%s is not a value\n",
    1478                 :            :                                                 s->name);
    1479                 :            :                         else
    1480                 :          0 :                                 yyval.value = s->value;
    1481                 :            :                 }
    1482                 :          0 : break;
    1483                 :            : case 133:
    1484                 :            :         {
    1485                 :          0 :                         yyval.value = emalloc(sizeof(*yyval.value));
    1486                 :          0 :                         yyval.value->type = stringvalue;
    1487                 :          0 :                         yyval.value->u.stringvalue = yystack.l_mark[0].name;
    1488                 :            :                 }
    1489                 :          0 : break;
    1490                 :            : case 134:
    1491                 :            :         {
    1492                 :          0 :                         yyval.value = emalloc(sizeof(*yyval.value));
    1493                 :          0 :                         yyval.value->type = booleanvalue;
    1494                 :          0 :                         yyval.value->u.booleanvalue = 0;
    1495                 :            :                 }
    1496                 :          0 : break;
    1497                 :            : case 135:
    1498                 :            :         {
    1499                 :          0 :                         yyval.value = emalloc(sizeof(*yyval.value));
    1500                 :          0 :                         yyval.value->type = booleanvalue;
    1501                 :          0 :                         yyval.value->u.booleanvalue = 0;
    1502                 :            :                 }
    1503                 :          0 : break;
    1504                 :            : case 136:
    1505                 :            :         {
    1506                 :         86 :                         yyval.value = emalloc(sizeof(*yyval.value));
    1507                 :         86 :                         yyval.value->type = integervalue;
    1508                 :         86 :                         yyval.value->u.integervalue = yystack.l_mark[0].constant;
    1509                 :            :                 }
    1510                 :         86 : break;
    1511                 :            : case 138:
    1512                 :            :         {
    1513                 :            :                 }
    1514                 :          0 : break;
    1515                 :            : case 139:
    1516                 :            :         {
    1517                 :        160 :                         yyval.value = emalloc(sizeof(*yyval.value));
    1518                 :        160 :                         yyval.value->type = objectidentifiervalue;
    1519                 :        160 :                         yyval.value->u.objectidentifiervalue = yystack.l_mark[0].objid;
    1520                 :            :                 }
    1521                 :            : break;
    1522                 :            :     }
    1523                 :      13489 :     yystack.s_mark -= yym;
    1524                 :      13489 :     yystate = *yystack.s_mark;
    1525                 :      13489 :     yystack.l_mark -= yym;
    1526                 :      13489 :     yym = yylhs[yyn];
    1527 [ +  + ][ +  - ]:      13489 :     if (yystate == 0 && yym == 0)
    1528                 :            :     {
    1529                 :            : #if YYDEBUG
    1530                 :            :         if (yydebug)
    1531                 :            :             printf("%sdebug: after reduction, shifting from state 0 to\
    1532                 :            :  state %d\n", YYPREFIX, YYFINAL);
    1533                 :            : #endif
    1534                 :         14 :         yystate = YYFINAL;
    1535                 :         14 :         *++yystack.s_mark = YYFINAL;
    1536                 :         14 :         *++yystack.l_mark = yyval;
    1537         [ +  - ]:         14 :         if (yychar < 0)
    1538                 :            :         {
    1539         [ -  + ]:         14 :             if ((yychar = YYLEX) < 0) yychar = 0;
    1540                 :            : #if YYDEBUG
    1541                 :            :             if (yydebug)
    1542                 :            :             {
    1543                 :            :                 yys = 0;
    1544                 :            :                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
    1545                 :            :                 if (!yys) yys = "illegal-symbol";
    1546                 :            :                 printf("%sdebug: state %d, reading %d (%s)\n",
    1547                 :            :                         YYPREFIX, YYFINAL, yychar, yys);
    1548                 :            :             }
    1549                 :            : #endif
    1550                 :            :         }
    1551         [ +  - ]:         14 :         if (yychar == 0) goto yyaccept;
    1552                 :          0 :         goto yyloop;
    1553                 :            :     }
    1554 [ +  + ][ +  - ]:      13475 :     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
         [ +  - ][ +  + ]
    1555                 :       5706 :             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
    1556                 :       4644 :         yystate = yytable[yyn];
    1557                 :            :     else
    1558                 :       8831 :         yystate = yydgoto[yym];
    1559                 :            : #if YYDEBUG
    1560                 :            :     if (yydebug)
    1561                 :            :         printf("%sdebug: after reduction, shifting from state %d \
    1562                 :            : to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
    1563                 :            : #endif
    1564 [ -  + ][ #  # ]:      13475 :     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
    1565                 :            :     {
    1566                 :          0 :         goto yyoverflow;
    1567                 :            :     }
    1568                 :      13475 :     *++yystack.s_mark = (short) yystate;
    1569                 :      13475 :     *++yystack.l_mark = yyval;
    1570                 :      13475 :     goto yyloop;
    1571                 :            : 
    1572                 :            : yyoverflow:
    1573                 :          0 :     yyerror("yacc stack overflow");
    1574                 :            : 
    1575                 :            : yyabort:
    1576                 :            :     yyfreestack(&yystack);
    1577                 :          0 :     return (1);
    1578                 :            : 
    1579                 :            : yyaccept:
    1580                 :            :     yyfreestack(&yystack);
    1581                 :         14 :     return (0);
    1582                 :            : }

Generated by: LCOV version 1.9