| 1 |
/* A Bison parser, made by GNU Bison 3.8.2. */ |
| 2 |
|
| 3 |
/* Bison implementation for Yacc-like parsers in C |
| 4 |
|
| 5 |
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, |
| 6 |
Inc. |
| 7 |
|
| 8 |
This program is free software: you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation, either version 3 of the License, or |
| 11 |
(at your option) any later version. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 20 |
|
| 21 |
/* As a special exception, you may create a larger work that contains |
| 22 |
part or all of the Bison parser skeleton and distribute that work |
| 23 |
under terms of your choice, so long as that work isn't itself a |
| 24 |
parser generator using the skeleton or a modified version thereof |
| 25 |
as a parser skeleton. Alternatively, if you modify or redistribute |
| 26 |
the parser skeleton itself, you may (at your option) remove this |
| 27 |
special exception, which will cause the skeleton and the resulting |
| 28 |
Bison output files to be licensed under the GNU General Public |
| 29 |
License without this special exception. |
| 30 |
|
| 31 |
This special exception was added by the Free Software Foundation in |
| 32 |
version 2.2 of Bison. */ |
| 33 |
|
| 34 |
/* C LALR(1) parser skeleton written by Richard Stallman, by |
| 35 |
simplifying the original so-called "semantic" parser. */ |
| 36 |
|
| 37 |
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, |
| 38 |
especially those whose name start with YY_ or yy_. They are |
| 39 |
private implementation details that can be changed or removed. */ |
| 40 |
|
| 41 |
/* All symbols defined below should begin with yy or YY, to avoid |
| 42 |
infringing on user name space. This should be done even for local |
| 43 |
variables, as they might otherwise be expanded by user macros. |
| 44 |
There are some unavoidable exceptions within include files to |
| 45 |
define necessary library symbols; they are noted "INFRINGES ON |
| 46 |
USER NAME SPACE" below. */ |
| 47 |
|
| 48 |
/* Identify Bison output, and Bison version. */ |
| 49 |
#define YYBISON 30802 |
| 50 |
|
| 51 |
/* Bison version string. */ |
| 52 |
#define YYBISON_VERSION "3.8.2" |
| 53 |
|
| 54 |
/* Skeleton name. */ |
| 55 |
#define YYSKELETON_NAME "yacc.c" |
| 56 |
|
| 57 |
/* Pure parsers. */ |
| 58 |
#define YYPURE 2 |
| 59 |
|
| 60 |
/* Push parsers. */ |
| 61 |
#define YYPUSH 0 |
| 62 |
|
| 63 |
/* Pull parsers. */ |
| 64 |
#define YYPULL 1 |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
/* First part of user prologue. */ |
| 70 |
#line 42 "/home/wk/s/libksba/src/asn1-parse.y" |
| 71 |
|
| 72 |
#ifndef BUILD_GENTOOLS |
| 73 |
# include <config.h> |
| 74 |
#endif |
| 75 |
#include <stdlib.h> |
| 76 |
#include <stdio.h> |
| 77 |
#include <string.h> |
| 78 |
#include <assert.h> |
| 79 |
#include <ctype.h> |
| 80 |
#include <errno.h> |
| 81 |
|
| 82 |
#ifdef BUILD_GENTOOLS |
| 83 |
# include "gen-help.h" |
| 84 |
#else |
| 85 |
# include "util.h" |
| 86 |
# include "ksba.h" |
| 87 |
#endif |
| 88 |
|
| 89 |
#include "asn1-func.h" |
| 90 |
|
| 91 |
/* It would be better to make yyparse static but there is no way to do |
| 92 |
this. Let's hope that this macros works. */ |
| 93 |
#define yyparse _ksba_asn1_yyparse |
| 94 |
|
| 95 |
/* #define YYDEBUG 1 */ |
| 96 |
#define MAX_STRING_LENGTH 129 |
| 97 |
|
| 98 |
|
| 99 |
/* constants used in the grammar */ |
| 100 |
enum { |
| 101 |
CONST_EXPLICIT = 1, |
| 102 |
CONST_IMPLICIT |
| 103 |
}; |
| 104 |
|
| 105 |
struct parser_control_s { |
| 106 |
FILE *fp; |
| 107 |
int lineno; |
| 108 |
int debug; |
| 109 |
int result_parse; |
| 110 |
AsnNode parse_tree; |
| 111 |
AsnNode all_nodes; |
| 112 |
}; |
| 113 |
#define PARSECTL ((struct parser_control_s *)parm) |
| 114 |
|
| 115 |
|
| 116 |
#line 117 "asn1-parse.c" |
| 117 |
|
| 118 |
# ifndef YY_CAST |
| 119 |
# ifdef __cplusplus |
| 120 |
# define YY_CAST(Type, Val) static_cast<Type> (Val) |
| 121 |
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) |
| 122 |
# else |
| 123 |
# define YY_CAST(Type, Val) ((Type) (Val)) |
| 124 |
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) |
| 125 |
# endif |
| 126 |
# endif |
| 127 |
# ifndef YY_NULLPTR |
| 128 |
# if defined __cplusplus |
| 129 |
# if 201103L <= __cplusplus |
| 130 |
# define YY_NULLPTR nullptr |
| 131 |
# else |
| 132 |
# define YY_NULLPTR 0 |
| 133 |
# endif |
| 134 |
# else |
| 135 |
# define YY_NULLPTR ((void*)0) |
| 136 |
# endif |
| 137 |
# endif |
| 138 |
|
| 139 |
|
| 140 |
/* Debug traces. */ |
| 141 |
#ifndef YYDEBUG |
| 142 |
# define YYDEBUG 0 |
| 143 |
#endif |
| 144 |
#if YYDEBUG |
| 145 |
extern int yydebug; |
| 146 |
#endif |
| 147 |
|
| 148 |
/* Token kinds. */ |
| 149 |
#ifndef YYTOKENTYPE |
| 150 |
# define YYTOKENTYPE |
| 151 |
enum yytokentype |
| 152 |
{ |
| 153 |
YYEMPTY = -2, |
| 154 |
YYEOF = 0, /* "end of file" */ |
| 155 |
YYerror = 256, /* error */ |
| 156 |
YYUNDEF = 257, /* "invalid token" */ |
| 157 |
ASSIG = 258, /* "::=" */ |
| 158 |
NUM = 259, /* NUM */ |
| 159 |
IDENTIFIER = 260, /* IDENTIFIER */ |
| 160 |
OPTIONAL = 261, /* "OPTIONAL" */ |
| 161 |
INTEGER = 262, /* "INTEGER" */ |
| 162 |
SIZE = 263, /* "SIZE" */ |
| 163 |
OCTET = 264, /* "OCTET" */ |
| 164 |
STRING = 265, /* "STRING" */ |
| 165 |
SEQUENCE = 266, /* "SEQUENCE" */ |
| 166 |
BIT = 267, /* "BIT" */ |
| 167 |
UNIVERSAL = 268, /* "UNIVERSAL" */ |
| 168 |
PRIVATE = 269, /* "PRIVATE" */ |
| 169 |
DEFAULT = 270, /* "DEFAULT" */ |
| 170 |
CHOICE = 271, /* "CHOICE" */ |
| 171 |
OF = 272, /* "OF" */ |
| 172 |
OBJECT = 273, /* "OBJECT" */ |
| 173 |
STR_IDENTIFIER = 274, /* "IDENTIFIER" */ |
| 174 |
ksba_BOOLEAN = 275, /* "BOOLEAN" */ |
| 175 |
ksba_TRUE = 276, /* "TRUE" */ |
| 176 |
ksba_FALSE = 277, /* "FALSE" */ |
| 177 |
APPLICATION = 278, /* "APPLICATION" */ |
| 178 |
ANY = 279, /* "ANY" */ |
| 179 |
DEFINED = 280, /* "DEFINED" */ |
| 180 |
SET = 281, /* "SET" */ |
| 181 |
BY = 282, /* "BY" */ |
| 182 |
EXPLICIT = 283, /* "EXPLICIT" */ |
| 183 |
IMPLICIT = 284, /* "IMPLICIT" */ |
| 184 |
DEFINITIONS = 285, /* "DEFINITIONS" */ |
| 185 |
TAGS = 286, /* "TAGS" */ |
| 186 |
ksba_BEGIN = 287, /* "BEGIN" */ |
| 187 |
ksba_END = 288, /* "END" */ |
| 188 |
UTCTime = 289, /* "UTCTime" */ |
| 189 |
GeneralizedTime = 290, /* "GeneralizedTime" */ |
| 190 |
FROM = 291, /* "FROM" */ |
| 191 |
IMPORTS = 292, /* "IMPORTS" */ |
| 192 |
TOKEN_NULL = 293, /* "NULL" */ |
| 193 |
ENUMERATED = 294, /* "ENUMERATED" */ |
| 194 |
UTF8STRING = 295, /* "UTF8String" */ |
| 195 |
NUMERICSTRING = 296, /* "NumericString" */ |
| 196 |
PRINTABLESTRING = 297, /* "PrintableString" */ |
| 197 |
TELETEXSTRING = 298, /* "TeletexString" */ |
| 198 |
IA5STRING = 299, /* "IA5String" */ |
| 199 |
UNIVERSALSTRING = 300, /* "UniversalString" */ |
| 200 |
BMPSTRING = 301 /* "BMPString" */ |
| 201 |
}; |
| 202 |
typedef enum yytokentype yytoken_kind_t; |
| 203 |
#endif |
| 204 |
|
| 205 |
/* Value type. */ |
| 206 |
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 207 |
union YYSTYPE |
| 208 |
{ |
| 209 |
#line 94 "/home/wk/s/libksba/src/asn1-parse.y" |
| 210 |
|
| 211 |
unsigned int constant; |
| 212 |
char str[MAX_STRING_LENGTH]; |
| 213 |
AsnNode node; |
| 214 |
|
| 215 |
#line 216 "asn1-parse.c" |
| 216 |
|
| 217 |
}; |
| 218 |
typedef union YYSTYPE YYSTYPE; |
| 219 |
# define YYSTYPE_IS_TRIVIAL 1 |
| 220 |
# define YYSTYPE_IS_DECLARED 1 |
| 221 |
#endif |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
int yyparse (void *parm); |
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
/* Symbol kind. */ |
| 231 |
enum yysymbol_kind_t |
| 232 |
{ |
| 233 |
YYSYMBOL_YYEMPTY = -2, |
| 234 |
YYSYMBOL_YYEOF = 0, /* "end of file" */ |
| 235 |
YYSYMBOL_YYerror = 1, /* error */ |
| 236 |
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ |
| 237 |
YYSYMBOL_ASSIG = 3, /* "::=" */ |
| 238 |
YYSYMBOL_NUM = 4, /* NUM */ |
| 239 |
YYSYMBOL_IDENTIFIER = 5, /* IDENTIFIER */ |
| 240 |
YYSYMBOL_OPTIONAL = 6, /* "OPTIONAL" */ |
| 241 |
YYSYMBOL_INTEGER = 7, /* "INTEGER" */ |
| 242 |
YYSYMBOL_SIZE = 8, /* "SIZE" */ |
| 243 |
YYSYMBOL_OCTET = 9, /* "OCTET" */ |
| 244 |
YYSYMBOL_STRING = 10, /* "STRING" */ |
| 245 |
YYSYMBOL_SEQUENCE = 11, /* "SEQUENCE" */ |
| 246 |
YYSYMBOL_BIT = 12, /* "BIT" */ |
| 247 |
YYSYMBOL_UNIVERSAL = 13, /* "UNIVERSAL" */ |
| 248 |
YYSYMBOL_PRIVATE = 14, /* "PRIVATE" */ |
| 249 |
YYSYMBOL_DEFAULT = 15, /* "DEFAULT" */ |
| 250 |
YYSYMBOL_CHOICE = 16, /* "CHOICE" */ |
| 251 |
YYSYMBOL_OF = 17, /* "OF" */ |
| 252 |
YYSYMBOL_OBJECT = 18, /* "OBJECT" */ |
| 253 |
YYSYMBOL_STR_IDENTIFIER = 19, /* "IDENTIFIER" */ |
| 254 |
YYSYMBOL_ksba_BOOLEAN = 20, /* "BOOLEAN" */ |
| 255 |
YYSYMBOL_ksba_TRUE = 21, /* "TRUE" */ |
| 256 |
YYSYMBOL_ksba_FALSE = 22, /* "FALSE" */ |
| 257 |
YYSYMBOL_APPLICATION = 23, /* "APPLICATION" */ |
| 258 |
YYSYMBOL_ANY = 24, /* "ANY" */ |
| 259 |
YYSYMBOL_DEFINED = 25, /* "DEFINED" */ |
| 260 |
YYSYMBOL_SET = 26, /* "SET" */ |
| 261 |
YYSYMBOL_BY = 27, /* "BY" */ |
| 262 |
YYSYMBOL_EXPLICIT = 28, /* "EXPLICIT" */ |
| 263 |
YYSYMBOL_IMPLICIT = 29, /* "IMPLICIT" */ |
| 264 |
YYSYMBOL_DEFINITIONS = 30, /* "DEFINITIONS" */ |
| 265 |
YYSYMBOL_TAGS = 31, /* "TAGS" */ |
| 266 |
YYSYMBOL_ksba_BEGIN = 32, /* "BEGIN" */ |
| 267 |
YYSYMBOL_ksba_END = 33, /* "END" */ |
| 268 |
YYSYMBOL_UTCTime = 34, /* "UTCTime" */ |
| 269 |
YYSYMBOL_GeneralizedTime = 35, /* "GeneralizedTime" */ |
| 270 |
YYSYMBOL_FROM = 36, /* "FROM" */ |
| 271 |
YYSYMBOL_IMPORTS = 37, /* "IMPORTS" */ |
| 272 |
YYSYMBOL_TOKEN_NULL = 38, /* "NULL" */ |
| 273 |
YYSYMBOL_ENUMERATED = 39, /* "ENUMERATED" */ |
| 274 |
YYSYMBOL_UTF8STRING = 40, /* "UTF8String" */ |
| 275 |
YYSYMBOL_NUMERICSTRING = 41, /* "NumericString" */ |
| 276 |
YYSYMBOL_PRINTABLESTRING = 42, /* "PrintableString" */ |
| 277 |
YYSYMBOL_TELETEXSTRING = 43, /* "TeletexString" */ |
| 278 |
YYSYMBOL_IA5STRING = 44, /* "IA5String" */ |
| 279 |
YYSYMBOL_UNIVERSALSTRING = 45, /* "UniversalString" */ |
| 280 |
YYSYMBOL_BMPSTRING = 46, /* "BMPString" */ |
| 281 |
YYSYMBOL_47_ = 47, /* '+' */ |
| 282 |
YYSYMBOL_48_ = 48, /* '-' */ |
| 283 |
YYSYMBOL_49_ = 49, /* '(' */ |
| 284 |
YYSYMBOL_50_ = 50, /* ')' */ |
| 285 |
YYSYMBOL_51_ = 51, /* ',' */ |
| 286 |
YYSYMBOL_52_ = 52, /* '[' */ |
| 287 |
YYSYMBOL_53_ = 53, /* ']' */ |
| 288 |
YYSYMBOL_54_ = 54, /* '{' */ |
| 289 |
YYSYMBOL_55_ = 55, /* '}' */ |
| 290 |
YYSYMBOL_56_ = 56, /* '.' */ |
| 291 |
YYSYMBOL_YYACCEPT = 57, /* $accept */ |
| 292 |
YYSYMBOL_input = 58, /* input */ |
| 293 |
YYSYMBOL_pos_num = 59, /* pos_num */ |
| 294 |
YYSYMBOL_neg_num = 60, /* neg_num */ |
| 295 |
YYSYMBOL_pos_neg_num = 61, /* pos_neg_num */ |
| 296 |
YYSYMBOL_num_identifier = 62, /* num_identifier */ |
| 297 |
YYSYMBOL_pos_neg_identifier = 63, /* pos_neg_identifier */ |
| 298 |
YYSYMBOL_constant = 64, /* constant */ |
| 299 |
YYSYMBOL_constant_list = 65, /* constant_list */ |
| 300 |
YYSYMBOL_obj_constant = 66, /* obj_constant */ |
| 301 |
YYSYMBOL_obj_constant_list = 67, /* obj_constant_list */ |
| 302 |
YYSYMBOL_class = 68, /* class */ |
| 303 |
YYSYMBOL_tag_type = 69, /* tag_type */ |
| 304 |
YYSYMBOL_tag = 70, /* tag */ |
| 305 |
YYSYMBOL_default = 71, /* default */ |
| 306 |
YYSYMBOL_integer_def = 72, /* integer_def */ |
| 307 |
YYSYMBOL_boolean_def = 73, /* boolean_def */ |
| 308 |
YYSYMBOL_Time = 74, /* Time */ |
| 309 |
YYSYMBOL_size_def2 = 75, /* size_def2 */ |
| 310 |
YYSYMBOL_size_def = 76, /* size_def */ |
| 311 |
YYSYMBOL_octet_string_def = 77, /* octet_string_def */ |
| 312 |
YYSYMBOL_utf8_string_def = 78, /* utf8_string_def */ |
| 313 |
YYSYMBOL_numeric_string_def = 79, /* numeric_string_def */ |
| 314 |
YYSYMBOL_printable_string_def = 80, /* printable_string_def */ |
| 315 |
YYSYMBOL_teletex_string_def = 81, /* teletex_string_def */ |
| 316 |
YYSYMBOL_ia5_string_def = 82, /* ia5_string_def */ |
| 317 |
YYSYMBOL_universal_string_def = 83, /* universal_string_def */ |
| 318 |
YYSYMBOL_bmp_string_def = 84, /* bmp_string_def */ |
| 319 |
YYSYMBOL_string_def = 85, /* string_def */ |
| 320 |
YYSYMBOL_bit_element = 86, /* bit_element */ |
| 321 |
YYSYMBOL_bit_element_list = 87, /* bit_element_list */ |
| 322 |
YYSYMBOL_bit_string_def = 88, /* bit_string_def */ |
| 323 |
YYSYMBOL_enumerated_def = 89, /* enumerated_def */ |
| 324 |
YYSYMBOL_object_def = 90, /* object_def */ |
| 325 |
YYSYMBOL_type_assig_right = 91, /* type_assig_right */ |
| 326 |
YYSYMBOL_type_assig_right_tag = 92, /* type_assig_right_tag */ |
| 327 |
YYSYMBOL_type_assig_right_tag_default = 93, /* type_assig_right_tag_default */ |
| 328 |
YYSYMBOL_type_assig = 94, /* type_assig */ |
| 329 |
YYSYMBOL_type_assig_list = 95, /* type_assig_list */ |
| 330 |
YYSYMBOL_sequence_def = 96, /* sequence_def */ |
| 331 |
YYSYMBOL_set_def = 97, /* set_def */ |
| 332 |
YYSYMBOL_choise_def = 98, /* choise_def */ |
| 333 |
YYSYMBOL_any_def = 99, /* any_def */ |
| 334 |
YYSYMBOL_type_def = 100, /* type_def */ |
| 335 |
YYSYMBOL_constant_def = 101, /* constant_def */ |
| 336 |
YYSYMBOL_type_constant = 102, /* type_constant */ |
| 337 |
YYSYMBOL_type_constant_list = 103, /* type_constant_list */ |
| 338 |
YYSYMBOL_definitions_id = 104, /* definitions_id */ |
| 339 |
YYSYMBOL_imports_def = 105, /* imports_def */ |
| 340 |
YYSYMBOL_explicit_implicit = 106, /* explicit_implicit */ |
| 341 |
YYSYMBOL_definitions = 107 /* definitions */ |
| 342 |
}; |
| 343 |
typedef enum yysymbol_kind_t yysymbol_kind_t; |
| 344 |
|
| 345 |
|
| 346 |
/* Second part of user prologue. */ |
| 347 |
#line 100 "/home/wk/s/libksba/src/asn1-parse.y" |
| 348 |
|
| 349 |
static AsnNode new_node (struct parser_control_s *parsectl, node_type_t type); |
| 350 |
#define NEW_NODE(a) (new_node (PARSECTL, (a))) |
| 351 |
static void set_name (AsnNode node, const char *name); |
| 352 |
static void set_str_value (AsnNode node, const char *text); |
| 353 |
static void set_ulong_value (AsnNode node, const char *text); |
| 354 |
static void set_right (AsnNode node, AsnNode right); |
| 355 |
static void append_right (AsnNode node, AsnNode right); |
| 356 |
static void set_down (AsnNode node, AsnNode down); |
| 357 |
|
| 358 |
|
| 359 |
static int yylex (YYSTYPE *lvalp, void *parm); |
| 360 |
static void yyerror (void *parm, const char *s); |
| 361 |
|
| 362 |
#line 363 "asn1-parse.c" |
| 363 |
|
| 364 |
|
| 365 |
#ifdef short |
| 366 |
# undef short |
| 367 |
#endif |
| 368 |
|
| 369 |
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure |
| 370 |
<limits.h> and (if available) <stdint.h> are included |
| 371 |
so that the code can choose integer types of a good width. */ |
| 372 |
|
| 373 |
#ifndef __PTRDIFF_MAX__ |
| 374 |
# include <limits.h> /* INFRINGES ON USER NAME SPACE */ |
| 375 |
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
| 376 |
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ |
| 377 |
# define YY_STDINT_H |
| 378 |
# endif |
| 379 |
#endif |
| 380 |
|
| 381 |
/* Narrow types that promote to a signed type and that can represent a |
| 382 |
signed or unsigned integer of at least N bits. In tables they can |
| 383 |
save space and decrease cache pressure. Promoting to a signed type |
| 384 |
helps avoid bugs in integer arithmetic. */ |
| 385 |
|
| 386 |
#ifdef __INT_LEAST8_MAX__ |
| 387 |
typedef __INT_LEAST8_TYPE__ yytype_int8; |
| 388 |
#elif defined YY_STDINT_H |
| 389 |
typedef int_least8_t yytype_int8; |
| 390 |
#else |
| 391 |
typedef signed char yytype_int8; |
| 392 |
#endif |
| 393 |
|
| 394 |
#ifdef __INT_LEAST16_MAX__ |
| 395 |
typedef __INT_LEAST16_TYPE__ yytype_int16; |
| 396 |
#elif defined YY_STDINT_H |
| 397 |
typedef int_least16_t yytype_int16; |
| 398 |
#else |
| 399 |
typedef short yytype_int16; |
| 400 |
#endif |
| 401 |
|
| 402 |
/* Work around bug in HP-UX 11.23, which defines these macros |
| 403 |
incorrectly for preprocessor constants. This workaround can likely |
| 404 |
be removed in 2023, as HPE has promised support for HP-UX 11.23 |
| 405 |
(aka HP-UX 11i v2) only through the end of 2022; see Table 2 of |
| 406 |
<https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ |
| 407 |
#ifdef __hpux |
| 408 |
# undef UINT_LEAST8_MAX |
| 409 |
# undef UINT_LEAST16_MAX |
| 410 |
# define UINT_LEAST8_MAX 255 |
| 411 |
# define UINT_LEAST16_MAX 65535 |
| 412 |
#endif |
| 413 |
|
| 414 |
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ |
| 415 |
typedef __UINT_LEAST8_TYPE__ yytype_uint8; |
| 416 |
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ |
| 417 |
&& UINT_LEAST8_MAX <= INT_MAX) |
| 418 |
typedef uint_least8_t yytype_uint8; |
| 419 |
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX |
| 420 |
typedef unsigned char yytype_uint8; |
| 421 |
#else |
| 422 |
typedef short yytype_uint8; |
| 423 |
#endif |
| 424 |
|
| 425 |
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ |
| 426 |
typedef __UINT_LEAST16_TYPE__ yytype_uint16; |
| 427 |
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ |
| 428 |
&& UINT_LEAST16_MAX <= INT_MAX) |
| 429 |
typedef uint_least16_t yytype_uint16; |
| 430 |
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX |
| 431 |
typedef unsigned short yytype_uint16; |
| 432 |
#else |
| 433 |
typedef int yytype_uint16; |
| 434 |
#endif |
| 435 |
|
| 436 |
#ifndef YYPTRDIFF_T |
| 437 |
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ |
| 438 |
# define YYPTRDIFF_T __PTRDIFF_TYPE__ |
| 439 |
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ |
| 440 |
# elif defined PTRDIFF_MAX |
| 441 |
# ifndef ptrdiff_t |
| 442 |
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 443 |
# endif |
| 444 |
# define YYPTRDIFF_T ptrdiff_t |
| 445 |
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX |
| 446 |
# else |
| 447 |
# define YYPTRDIFF_T long |
| 448 |
# define YYPTRDIFF_MAXIMUM LONG_MAX |
| 449 |
# endif |
| 450 |
#endif |
| 451 |
|
| 452 |
#ifndef YYSIZE_T |
| 453 |
# ifdef __SIZE_TYPE__ |
| 454 |
# define YYSIZE_T __SIZE_TYPE__ |
| 455 |
# elif defined size_t |
| 456 |
# define YYSIZE_T size_t |
| 457 |
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ |
| 458 |
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 459 |
# define YYSIZE_T size_t |
| 460 |
# else |
| 461 |
# define YYSIZE_T unsigned |
| 462 |
# endif |
| 463 |
#endif |
| 464 |
|
| 465 |
#define YYSIZE_MAXIMUM \ |
| 466 |
YY_CAST (YYPTRDIFF_T, \ |
| 467 |
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ |
| 468 |
? YYPTRDIFF_MAXIMUM \ |
| 469 |
: YY_CAST (YYSIZE_T, -1))) |
| 470 |
|
| 471 |
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) |
| 472 |
|
| 473 |
|
| 474 |
/* Stored state numbers (used for stacks). */ |
| 475 |
typedef yytype_uint8 yy_state_t; |
| 476 |
|
| 477 |
/* State numbers in computations. */ |
| 478 |
typedef int yy_state_fast_t; |
| 479 |
|
| 480 |
#ifndef YY_ |
| 481 |
# if defined YYENABLE_NLS && YYENABLE_NLS |
| 482 |
# if ENABLE_NLS |
| 483 |
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 484 |
# define YY_(Msgid) dgettext ("bison-runtime", Msgid) |
| 485 |
# endif |
| 486 |
# endif |
| 487 |
# ifndef YY_ |
| 488 |
# define YY_(Msgid) Msgid |
| 489 |
# endif |
| 490 |
#endif |
| 491 |
|
| 492 |
|
| 493 |
#ifndef YY_ATTRIBUTE_PURE |
| 494 |
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) |
| 495 |
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
| 496 |
# else |
| 497 |
# define YY_ATTRIBUTE_PURE |
| 498 |
# endif |
| 499 |
#endif |
| 500 |
|
| 501 |
#ifndef YY_ATTRIBUTE_UNUSED |
| 502 |
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) |
| 503 |
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 504 |
# else |
| 505 |
# define YY_ATTRIBUTE_UNUSED |
| 506 |
# endif |
| 507 |
#endif |
| 508 |
|
| 509 |
/* Suppress unused-variable warnings by "using" E. */ |
| 510 |
#if ! defined lint || defined __GNUC__ |
| 511 |
# define YY_USE(E) ((void) (E)) |
| 512 |
#else |
| 513 |
# define YY_USE(E) /* empty */ |
| 514 |
#endif |
| 515 |
|
| 516 |
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ |
| 517 |
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ |
| 518 |
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 |
| 519 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 520 |
_Pragma ("GCC diagnostic push") \ |
| 521 |
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") |
| 522 |
# else |
| 523 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ |
| 524 |
_Pragma ("GCC diagnostic push") \ |
| 525 |
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ |
| 526 |
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") |
| 527 |
# endif |
| 528 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ |
| 529 |
_Pragma ("GCC diagnostic pop") |
| 530 |
#else |
| 531 |
# define YY_INITIAL_VALUE(Value) Value |
| 532 |
#endif |
| 533 |
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 534 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 535 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 536 |
#endif |
| 537 |
#ifndef YY_INITIAL_VALUE |
| 538 |
# define YY_INITIAL_VALUE(Value) /* Nothing. */ |
| 539 |
#endif |
| 540 |
|
| 541 |
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ |
| 542 |
# define YY_IGNORE_USELESS_CAST_BEGIN \ |
| 543 |
_Pragma ("GCC diagnostic push") \ |
| 544 |
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") |
| 545 |
# define YY_IGNORE_USELESS_CAST_END \ |
| 546 |
_Pragma ("GCC diagnostic pop") |
| 547 |
#endif |
| 548 |
#ifndef YY_IGNORE_USELESS_CAST_BEGIN |
| 549 |
# define YY_IGNORE_USELESS_CAST_BEGIN |
| 550 |
# define YY_IGNORE_USELESS_CAST_END |
| 551 |
#endif |
| 552 |
|
| 553 |
|
| 554 |
#define YY_ASSERT(E) ((void) (0 && (E))) |
| 555 |
|
| 556 |
#if 1 |
| 557 |
|
| 558 |
/* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 559 |
|
| 560 |
# ifdef YYSTACK_USE_ALLOCA |
| 561 |
# if YYSTACK_USE_ALLOCA |
| 562 |
# ifdef __GNUC__ |
| 563 |
# define YYSTACK_ALLOC __builtin_alloca |
| 564 |
# elif defined __BUILTIN_VA_ARG_INCR |
| 565 |
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 566 |
# elif defined _AIX |
| 567 |
# define YYSTACK_ALLOC __alloca |
| 568 |
# elif defined _MSC_VER |
| 569 |
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 570 |
# define alloca _alloca |
| 571 |
# else |
| 572 |
# define YYSTACK_ALLOC alloca |
| 573 |
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS |
| 574 |
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 575 |
/* Use EXIT_SUCCESS as a witness for stdlib.h. */ |
| 576 |
# ifndef EXIT_SUCCESS |
| 577 |
# define EXIT_SUCCESS 0 |
| 578 |
# endif |
| 579 |
# endif |
| 580 |
# endif |
| 581 |
# endif |
| 582 |
# endif |
| 583 |
|
| 584 |
# ifdef YYSTACK_ALLOC |
| 585 |
/* Pacify GCC's 'empty if-body' warning. */ |
| 586 |
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 587 |
# ifndef YYSTACK_ALLOC_MAXIMUM |
| 588 |
/* The OS might guarantee only one guard page at the bottom of the stack, |
| 589 |
and a page size can be as small as 4096 bytes. So we cannot safely |
| 590 |
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 591 |
to allow for a few compiler-allocated temporary stack slots. */ |
| 592 |
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 593 |
# endif |
| 594 |
# else |
| 595 |
# define YYSTACK_ALLOC YYMALLOC |
| 596 |
# define YYSTACK_FREE YYFREE |
| 597 |
# ifndef YYSTACK_ALLOC_MAXIMUM |
| 598 |
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 599 |
# endif |
| 600 |
# if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
| 601 |
&& ! ((defined YYMALLOC || defined malloc) \ |
| 602 |
&& (defined YYFREE || defined free))) |
| 603 |
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 604 |
# ifndef EXIT_SUCCESS |
| 605 |
# define EXIT_SUCCESS 0 |
| 606 |
# endif |
| 607 |
# endif |
| 608 |
# ifndef YYMALLOC |
| 609 |
# define YYMALLOC malloc |
| 610 |
# if ! defined malloc && ! defined EXIT_SUCCESS |
| 611 |
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 612 |
# endif |
| 613 |
# endif |
| 614 |
# ifndef YYFREE |
| 615 |
# define YYFREE free |
| 616 |
# if ! defined free && ! defined EXIT_SUCCESS |
| 617 |
void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 618 |
# endif |
| 619 |
# endif |
| 620 |
# endif |
| 621 |
#endif /* 1 */ |
| 622 |
|
| 623 |
#if (! defined yyoverflow \ |
| 624 |
&& (! defined __cplusplus \ |
| 625 |
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 626 |
|
| 627 |
/* A type that is properly aligned for any stack member. */ |
| 628 |
union yyalloc |
| 629 |
{ |
| 630 |
yy_state_t yyss_alloc; |
| 631 |
YYSTYPE yyvs_alloc; |
| 632 |
}; |
| 633 |
|
| 634 |
/* The size of the maximum gap between one aligned stack and the next. */ |
| 635 |
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) |
| 636 |
|
| 637 |
/* The size of an array large to enough to hold all stacks, each with |
| 638 |
N elements. */ |
| 639 |
# define YYSTACK_BYTES(N) \ |
| 640 |
((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ |
| 641 |
+ YYSTACK_GAP_MAXIMUM) |
| 642 |
|
| 643 |
# define YYCOPY_NEEDED 1 |
| 644 |
|
| 645 |
/* Relocate STACK from its old location to the new one. The |
| 646 |
local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 647 |
elements in the stack, and YYPTR gives the new location of the |
| 648 |
stack. Advance YYPTR to a properly aligned location for the next |
| 649 |
stack. */ |
| 650 |
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
| 651 |
do \ |
| 652 |
{ \ |
| 653 |
YYPTRDIFF_T yynewbytes; \ |
| 654 |
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
| 655 |
Stack = &yyptr->Stack_alloc; \ |
| 656 |
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 657 |
yyptr += yynewbytes / YYSIZEOF (*yyptr); \ |
| 658 |
} \ |
| 659 |
while (0) |
| 660 |
|
| 661 |
#endif |
| 662 |
|
| 663 |
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED |
| 664 |
/* Copy COUNT objects from SRC to DST. The source and destination do |
| 665 |
not overlap. */ |
| 666 |
# ifndef YYCOPY |
| 667 |
# if defined __GNUC__ && 1 < __GNUC__ |
| 668 |
# define YYCOPY(Dst, Src, Count) \ |
| 669 |
__builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) |
| 670 |
# else |
| 671 |
# define YYCOPY(Dst, Src, Count) \ |
| 672 |
do \ |
| 673 |
{ \ |
| 674 |
YYPTRDIFF_T yyi; \ |
| 675 |
for (yyi = 0; yyi < (Count); yyi++) \ |
| 676 |
(Dst)[yyi] = (Src)[yyi]; \ |
| 677 |
} \ |
| 678 |
while (0) |
| 679 |
# endif |
| 680 |
# endif |
| 681 |
#endif /* !YYCOPY_NEEDED */ |
| 682 |
|
| 683 |
/* YYFINAL -- State number of the termination state. */ |
| 684 |
#define YYFINAL 2 |
| 685 |
/* YYLAST -- Last index in YYTABLE. */ |
| 686 |
#define YYLAST 195 |
| 687 |
|
| 688 |
/* YYNTOKENS -- Number of terminals. */ |
| 689 |
#define YYNTOKENS 57 |
| 690 |
/* YYNNTS -- Number of nonterminals. */ |
| 691 |
#define YYNNTS 51 |
| 692 |
/* YYNRULES -- Number of rules. */ |
| 693 |
#define YYNRULES 116 |
| 694 |
/* YYNSTATES -- Number of states. */ |
| 695 |
#define YYNSTATES 203 |
| 696 |
|
| 697 |
/* YYMAXUTOK -- Last valid token kind. */ |
| 698 |
#define YYMAXUTOK 301 |
| 699 |
|
| 700 |
|
| 701 |
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM |
| 702 |
as returned by yylex, with out-of-bounds checking. */ |
| 703 |
#define YYTRANSLATE(YYX) \ |
| 704 |
(0 <= (YYX) && (YYX) <= YYMAXUTOK \ |
| 705 |
? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ |
| 706 |
: YYSYMBOL_YYUNDEF) |
| 707 |
|
| 708 |
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM |
| 709 |
as returned by yylex. */ |
| 710 |
static const yytype_int8 yytranslate[] = |
| 711 |
{ |
| 712 |
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 713 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 714 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 715 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 716 |
49, 50, 2, 47, 51, 48, 56, 2, 2, 2, |
| 717 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 718 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 719 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 720 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 721 |
2, 52, 2, 53, 2, 2, 2, 2, 2, 2, |
| 722 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 723 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 724 |
2, 2, 2, 54, 2, 55, 2, 2, 2, 2, |
| 725 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 726 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 727 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 728 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 729 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 730 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 731 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 732 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 733 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 734 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 735 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 736 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 737 |
2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 738 |
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 739 |
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 740 |
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 741 |
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 742 |
45, 46 |
| 743 |
}; |
| 744 |
|
| 745 |
#if YYDEBUG |
| 746 |
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
| 747 |
static const yytype_int16 yyrline[] = |
| 748 |
{ |
| 749 |
0, 179, 179, 180, 183, 184, 187, 194, 195, 198, |
| 750 |
199, 202, 203, 206, 211, 219, 220, 245, 250, 258, |
| 751 |
260, 267, 268, 269, 272, 278, 286, 288, 293, 300, |
| 752 |
305, 310, 317, 321, 327, 338, 344, 348, 354, 360, |
| 753 |
369, 373, 379, 383, 391, 392, 399, 400, 407, 409, |
| 754 |
416, 418, 425, 426, 433, 435, 442, 443, 452, 453, |
| 755 |
454, 455, 456, 457, 458, 464, 472, 476, 483, 487, |
| 756 |
495, 503, 509, 514, 521, 522, 523, 524, 525, 526, |
| 757 |
527, 528, 529, 530, 531, 532, 533, 539, 543, 554, |
| 758 |
558, 565, 572, 579, 581, 588, 593, 598, 607, 612, |
| 759 |
617, 626, 633, 637, 649, 656, 663, 672, 681, 682, |
| 760 |
685, 687, 694, 703, 719, 720, 723 |
| 761 |
}; |
| 762 |
#endif |
| 763 |
|
| 764 |
/** Accessing symbol of state STATE. */ |
| 765 |
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) |
| 766 |
|
| 767 |
#if 1 |
| 768 |
/* The user-facing name of the symbol whose (internal) number is |
| 769 |
YYSYMBOL. No bounds checking. */ |
| 770 |
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; |
| 771 |
|
| 772 |
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 773 |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 774 |
static const char *const yytname[] = |
| 775 |
{ |
| 776 |
"\"end of file\"", "error", "\"invalid token\"", "\"::=\"", "NUM", |
| 777 |
"IDENTIFIER", "\"OPTIONAL\"", "\"INTEGER\"", "\"SIZE\"", "\"OCTET\"", |
| 778 |
"\"STRING\"", "\"SEQUENCE\"", "\"BIT\"", "\"UNIVERSAL\"", "\"PRIVATE\"", |
| 779 |
"\"DEFAULT\"", "\"CHOICE\"", "\"OF\"", "\"OBJECT\"", "\"IDENTIFIER\"", |
| 780 |
"\"BOOLEAN\"", "\"TRUE\"", "\"FALSE\"", "\"APPLICATION\"", "\"ANY\"", |
| 781 |
"\"DEFINED\"", "\"SET\"", "\"BY\"", "\"EXPLICIT\"", "\"IMPLICIT\"", |
| 782 |
"\"DEFINITIONS\"", "\"TAGS\"", "\"BEGIN\"", "\"END\"", "\"UTCTime\"", |
| 783 |
"\"GeneralizedTime\"", "\"FROM\"", "\"IMPORTS\"", "\"NULL\"", |
| 784 |
"\"ENUMERATED\"", "\"UTF8String\"", "\"NumericString\"", |
| 785 |
"\"PrintableString\"", "\"TeletexString\"", "\"IA5String\"", |
| 786 |
"\"UniversalString\"", "\"BMPString\"", "'+'", "'-'", "'('", "')'", |
| 787 |
"','", "'['", "']'", "'{'", "'}'", "'.'", "$accept", "input", "pos_num", |
| 788 |
"neg_num", "pos_neg_num", "num_identifier", "pos_neg_identifier", |
| 789 |
"constant", "constant_list", "obj_constant", "obj_constant_list", |
| 790 |
"class", "tag_type", "tag", "default", "integer_def", "boolean_def", |
| 791 |
"Time", "size_def2", "size_def", "octet_string_def", "utf8_string_def", |
| 792 |
"numeric_string_def", "printable_string_def", "teletex_string_def", |
| 793 |
"ia5_string_def", "universal_string_def", "bmp_string_def", "string_def", |
| 794 |
"bit_element", "bit_element_list", "bit_string_def", "enumerated_def", |
| 795 |
"object_def", "type_assig_right", "type_assig_right_tag", |
| 796 |
"type_assig_right_tag_default", "type_assig", "type_assig_list", |
| 797 |
"sequence_def", "set_def", "choise_def", "any_def", "type_def", |
| 798 |
"constant_def", "type_constant", "type_constant_list", "definitions_id", |
| 799 |
"imports_def", "explicit_implicit", "definitions", YY_NULLPTR |
| 800 |
}; |
| 801 |
|
| 802 |
static const char * |
| 803 |
yysymbol_name (yysymbol_kind_t yysymbol) |
| 804 |
{ |
| 805 |
return yytname[yysymbol]; |
| 806 |
} |
| 807 |
#endif |
| 808 |
|
| 809 |
#define YYPACT_NINF (-137) |
| 810 |
|
| 811 |
#define yypact_value_is_default(Yyn) \ |
| 812 |
((Yyn) == YYPACT_NINF) |
| 813 |
|
| 814 |
#define YYTABLE_NINF (-1) |
| 815 |
|
| 816 |
#define yytable_value_is_error(Yyn) \ |
| 817 |
0 |
| 818 |
|
| 819 |
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 820 |
STATE-NUM. */ |
| 821 |
static const yytype_int16 yypact[] = |
| 822 |
{ |
| 823 |
-137, 33, -137, -39, 0, -137, 76, 115, -137, 4, |
| 824 |
-137, -137, -1, -137, -137, 15, 63, -137, -137, 59, |
| 825 |
77, 86, -137, -137, 105, 24, -137, -137, -137, 18, |
| 826 |
52, 126, 129, 128, -137, -137, 16, 94, 139, 17, |
| 827 |
140, 97, 133, -137, 130, 20, -137, -137, -137, 99, |
| 828 |
16, 16, 16, 16, 16, 16, 16, 22, 117, 96, |
| 829 |
107, -137, -137, -137, -137, -137, -137, -137, -137, -137, |
| 830 |
-137, -137, -137, -137, -137, -137, -137, -137, -137, -137, |
| 831 |
-137, 100, 153, 155, 110, 152, -137, -137, 7, 16, |
| 832 |
96, 156, 146, 111, 156, -137, 137, 96, 156, 149, |
| 833 |
162, -137, -137, -137, -137, -137, -137, -137, 116, -137, |
| 834 |
-137, -137, 164, -137, -137, -137, 84, 76, -137, 118, |
| 835 |
84, 120, 122, 37, -137, -3, -137, -137, 52, -137, |
| 836 |
51, 96, 162, 58, 168, -137, 60, 96, 125, -137, |
| 837 |
66, -137, 123, -137, 119, 3, 76, -6, -137, 37, |
| 838 |
-137, 173, 174, -137, -137, 131, 7, -137, 34, -137, |
| 839 |
156, -137, -137, 68, -137, -137, -137, -137, 175, 162, |
| 840 |
-137, -137, 124, -137, 5, -137, 127, 132, -137, -137, |
| 841 |
-137, -137, -137, 78, -137, -137, -137, 134, -137, 84, |
| 842 |
-137, 84, -137, -137, -137, -137, -137, -137, -137, 135, |
| 843 |
136, -137, -137 |
| 844 |
}; |
| 845 |
|
| 846 |
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. |
| 847 |
Performed when YYTABLE does not specify something else to do. Zero |
| 848 |
means the default is an error. */ |
| 849 |
static const yytype_int8 yydefact[] = |
| 850 |
{ |
| 851 |
2, 0, 1, 0, 0, 3, 0, 0, 9, 10, |
| 852 |
17, 19, 0, 114, 115, 0, 0, 112, 20, 0, |
| 853 |
0, 0, 18, 113, 0, 0, 108, 109, 110, 0, |
| 854 |
0, 0, 0, 0, 116, 111, 72, 32, 0, 0, |
| 855 |
0, 0, 0, 35, 102, 0, 36, 37, 86, 0, |
| 856 |
44, 46, 48, 50, 52, 54, 56, 0, 26, 0, |
| 857 |
74, 76, 78, 79, 58, 59, 60, 61, 62, 63, |
| 858 |
64, 77, 80, 75, 82, 87, 104, 81, 85, 83, |
| 859 |
84, 0, 0, 0, 0, 0, 40, 73, 0, 42, |
| 860 |
0, 0, 0, 68, 0, 71, 0, 0, 0, 0, |
| 861 |
0, 45, 47, 49, 51, 53, 55, 57, 0, 21, |
| 862 |
22, 23, 0, 27, 28, 88, 0, 0, 107, 0, |
| 863 |
0, 0, 0, 0, 15, 0, 43, 96, 0, 93, |
| 864 |
0, 0, 0, 0, 0, 99, 0, 0, 0, 66, |
| 865 |
0, 24, 0, 10, 0, 0, 0, 0, 41, 0, |
| 866 |
4, 0, 0, 7, 8, 0, 0, 33, 89, 92, |
| 867 |
0, 95, 97, 0, 101, 103, 98, 100, 0, 0, |
| 868 |
70, 25, 0, 106, 0, 38, 0, 0, 5, 6, |
| 869 |
13, 16, 91, 0, 90, 94, 69, 0, 67, 0, |
| 870 |
105, 0, 14, 12, 30, 31, 11, 29, 65, 0, |
| 871 |
0, 34, 39 |
| 872 |
}; |
| 873 |
|
| 874 |
/* YYPGOTO[NTERM-NUM]. */ |
| 875 |
static const yytype_int16 yypgoto[] = |
| 876 |
{ |
| 877 |
-137, -137, -137, -137, -136, -114, -137, 31, -137, -12, |
| 878 |
-103, -137, -137, -137, -137, -137, -137, -137, 103, -34, |
| 879 |
-137, -137, -137, -137, -137, -137, -137, -137, -137, 21, |
| 880 |
57, -137, -137, -137, -58, 64, -137, 35, 30, -137, |
| 881 |
-137, -137, -137, -137, -137, 165, -137, -137, -137, -137, |
| 882 |
-137 |
| 883 |
}; |
| 884 |
|
| 885 |
/* YYDEFGOTO[NTERM-NUM]. */ |
| 886 |
static const yytype_uint8 yydefgoto[] = |
| 887 |
{ |
| 888 |
0, 1, 153, 154, 155, 10, 197, 124, 125, 11, |
| 889 |
12, 112, 58, 59, 184, 60, 61, 62, 86, 87, |
| 890 |
63, 64, 65, 66, 67, 68, 69, 70, 71, 139, |
| 891 |
140, 72, 73, 74, 75, 76, 159, 129, 130, 77, |
| 892 |
78, 79, 80, 26, 27, 28, 29, 4, 24, 15, |
| 893 |
5 |
| 894 |
}; |
| 895 |
|
| 896 |
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If |
| 897 |
positive, shift that token. If negative, reduce the rule whose |
| 898 |
number is the opposite. If YYTABLE_NINF, syntax error. */ |
| 899 |
static const yytype_uint8 yytable[] = |
| 900 |
{ |
| 901 |
18, 115, 144, 8, 9, 92, 147, 8, 9, 8, |
| 902 |
9, 99, 122, 177, 145, 6, 101, 102, 103, 104, |
| 903 |
105, 106, 107, 25, 84, 84, 108, 30, 84, 31, |
| 904 |
7, 32, 127, 2, 90, 109, 110, 97, 3, 135, |
| 905 |
182, 150, 33, 174, 175, 111, 19, 196, 156, 183, |
| 906 |
176, 34, 157, 16, 17, 126, 123, 36, 173, 37, |
| 907 |
190, 38, 21, 39, 40, 85, 85, 20, 41, 85, |
| 908 |
42, 91, 43, 162, 98, 199, 44, 200, 45, 167, |
| 909 |
8, 9, 150, 193, 151, 152, 46, 47, 8, 143, |
| 910 |
48, 49, 50, 51, 52, 53, 54, 55, 56, 194, |
| 911 |
195, 36, 160, 37, 57, 38, 161, 39, 40, 160, |
| 912 |
25, 160, 41, 164, 42, 166, 43, 169, 23, 169, |
| 913 |
44, 170, 45, 186, 133, 151, 152, 22, 136, 81, |
| 914 |
46, 47, 82, 18, 48, 49, 50, 51, 52, 53, |
| 915 |
54, 55, 56, 13, 14, 113, 114, 83, 88, 89, |
| 916 |
93, 94, 95, 100, 117, 96, 116, 118, 119, 120, |
| 917 |
84, 128, 18, 131, 134, 132, 137, 138, 142, 141, |
| 918 |
148, 149, 146, 165, 168, 172, 171, 178, 179, 187, |
| 919 |
189, 180, 192, 191, 198, 201, 202, 181, 121, 163, |
| 920 |
188, 0, 158, 0, 35, 185 |
| 921 |
}; |
| 922 |
|
| 923 |
static const yytype_int16 yycheck[] = |
| 924 |
{ |
| 925 |
12, 59, 116, 4, 5, 39, 120, 4, 5, 4, |
| 926 |
5, 45, 5, 149, 117, 54, 50, 51, 52, 53, |
| 927 |
54, 55, 56, 5, 8, 8, 4, 3, 8, 5, |
| 928 |
30, 7, 90, 0, 17, 13, 14, 17, 5, 97, |
| 929 |
6, 4, 18, 146, 50, 23, 31, 183, 51, 15, |
| 930 |
56, 33, 55, 49, 55, 89, 49, 5, 55, 7, |
| 931 |
55, 9, 3, 11, 12, 49, 49, 4, 16, 49, |
| 932 |
18, 54, 20, 131, 54, 189, 24, 191, 26, 137, |
| 933 |
4, 5, 4, 5, 47, 48, 34, 35, 4, 5, |
| 934 |
38, 39, 40, 41, 42, 43, 44, 45, 46, 21, |
| 935 |
22, 5, 51, 7, 52, 9, 55, 11, 12, 51, |
| 936 |
5, 51, 16, 55, 18, 55, 20, 51, 32, 51, |
| 937 |
24, 55, 26, 55, 94, 47, 48, 50, 98, 3, |
| 938 |
34, 35, 3, 145, 38, 39, 40, 41, 42, 43, |
| 939 |
44, 45, 46, 28, 29, 28, 29, 19, 54, 10, |
| 940 |
10, 54, 19, 54, 54, 25, 49, 4, 3, 49, |
| 941 |
8, 5, 174, 17, 27, 54, 17, 5, 4, 53, |
| 942 |
50, 49, 54, 5, 49, 56, 53, 4, 4, 4, |
| 943 |
56, 50, 50, 56, 50, 50, 50, 156, 85, 132, |
| 944 |
169, -1, 128, -1, 29, 160 |
| 945 |
}; |
| 946 |
|
| 947 |
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of |
| 948 |
state STATE-NUM. */ |
| 949 |
static const yytype_int8 yystos[] = |
| 950 |
{ |
| 951 |
0, 58, 0, 5, 104, 107, 54, 30, 4, 5, |
| 952 |
62, 66, 67, 28, 29, 106, 49, 55, 66, 31, |
| 953 |
4, 3, 50, 32, 105, 5, 100, 101, 102, 103, |
| 954 |
3, 5, 7, 18, 33, 102, 5, 7, 9, 11, |
| 955 |
12, 16, 18, 20, 24, 26, 34, 35, 38, 39, |
| 956 |
40, 41, 42, 43, 44, 45, 46, 52, 69, 70, |
| 957 |
72, 73, 74, 77, 78, 79, 80, 81, 82, 83, |
| 958 |
84, 85, 88, 89, 90, 91, 92, 96, 97, 98, |
| 959 |
99, 3, 3, 19, 8, 49, 75, 76, 54, 10, |
| 960 |
17, 54, 76, 10, 54, 19, 25, 17, 54, 76, |
| 961 |
54, 76, 76, 76, 76, 76, 76, 76, 4, 13, |
| 962 |
14, 23, 68, 28, 29, 91, 49, 54, 4, 3, |
| 963 |
49, 75, 5, 49, 64, 65, 76, 91, 5, 94, |
| 964 |
95, 17, 54, 95, 27, 91, 95, 17, 5, 86, |
| 965 |
87, 53, 4, 5, 62, 67, 54, 62, 50, 49, |
| 966 |
4, 47, 48, 59, 60, 61, 51, 55, 92, 93, |
| 967 |
51, 55, 91, 87, 55, 5, 55, 91, 49, 51, |
| 968 |
55, 53, 56, 55, 67, 50, 56, 61, 4, 4, |
| 969 |
50, 64, 6, 15, 71, 94, 55, 4, 86, 56, |
| 970 |
55, 56, 50, 5, 21, 22, 61, 63, 50, 62, |
| 971 |
62, 50, 50 |
| 972 |
}; |
| 973 |
|
| 974 |
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ |
| 975 |
static const yytype_int8 yyr1[] = |
| 976 |
{ |
| 977 |
0, 57, 58, 58, 59, 59, 60, 61, 61, 62, |
| 978 |
62, 63, 63, 64, 64, 65, 65, 66, 66, 67, |
| 979 |
67, 68, 68, 68, 69, 69, 70, 70, 70, 71, |
| 980 |
71, 71, 72, 72, 72, 73, 74, 74, 75, 75, |
| 981 |
76, 76, 77, 77, 78, 78, 79, 79, 80, 80, |
| 982 |
81, 81, 82, 82, 83, 83, 84, 84, 85, 85, |
| 983 |
85, 85, 85, 85, 85, 86, 87, 87, 88, 88, |
| 984 |
89, 90, 91, 91, 91, 91, 91, 91, 91, 91, |
| 985 |
91, 91, 91, 91, 91, 91, 91, 92, 92, 93, |
| 986 |
93, 93, 94, 95, 95, 96, 96, 96, 97, 97, |
| 987 |
97, 98, 99, 99, 100, 101, 101, 101, 102, 102, |
| 988 |
103, 103, 104, 105, 106, 106, 107 |
| 989 |
}; |
| 990 |
|
| 991 |
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ |
| 992 |
static const yytype_int8 yyr2[] = |
| 993 |
{ |
| 994 |
0, 2, 0, 2, 1, 2, 2, 1, 1, 1, |
| 995 |
1, 1, 1, 3, 4, 1, 3, 1, 4, 1, |
| 996 |
2, 1, 1, 1, 3, 4, 1, 2, 2, 2, |
| 997 |
2, 2, 1, 4, 7, 1, 1, 1, 4, 7, |
| 998 |
1, 3, 2, 3, 1, 2, 1, 2, 1, 2, |
| 999 |
1, 2, 1, 2, 1, 2, 1, 2, 1, 1, |
| 1000 |
1, 1, 1, 1, 1, 4, 1, 3, 2, 5, |
| 1001 |
4, 2, 1, 2, 1, 1, 1, 1, 1, 1, |
| 1002 |
1, 1, 1, 1, 1, 1, 1, 1, 2, 1, |
| 1003 |
2, 2, 2, 1, 3, 4, 3, 4, 4, 3, |
| 1004 |
4, 4, 1, 4, 3, 7, 6, 4, 1, 1, |
| 1005 |
1, 2, 4, 0, 1, 1, 9 |
| 1006 |
}; |
| 1007 |
|
| 1008 |
|
| 1009 |
enum { YYENOMEM = -2 }; |
| 1010 |
|
| 1011 |
#define yyerrok (yyerrstatus = 0) |
| 1012 |
#define yyclearin (yychar = YYEMPTY) |
| 1013 |
|
| 1014 |
#define YYACCEPT goto yyacceptlab |
| 1015 |
#define YYABORT goto yyabortlab |
| 1016 |
#define YYERROR goto yyerrorlab |
| 1017 |
#define YYNOMEM goto yyexhaustedlab |
| 1018 |
|
| 1019 |
|
| 1020 |
#define YYRECOVERING() (!!yyerrstatus) |
| 1021 |
|
| 1022 |
#define YYBACKUP(Token, Value) \ |
| 1023 |
do \ |
| 1024 |
if (yychar == YYEMPTY) \ |
| 1025 |
{ \ |
| 1026 |
yychar = (Token); \ |
| 1027 |
yylval = (Value); \ |
| 1028 |
YYPOPSTACK (yylen); \ |
| 1029 |
yystate = *yyssp; \ |
| 1030 |
goto yybackup; \ |
| 1031 |
} \ |
| 1032 |
else \ |
| 1033 |
{ \ |
| 1034 |
yyerror (parm, YY_("syntax error: cannot back up")); \ |
| 1035 |
YYERROR; \ |
| 1036 |
} \ |
| 1037 |
while (0) |
| 1038 |
|
| 1039 |
/* Backward compatibility with an undocumented macro. |
| 1040 |
Use YYerror or YYUNDEF. */ |
| 1041 |
#define YYERRCODE YYUNDEF |
| 1042 |
|
| 1043 |
|
| 1044 |
/* Enable debugging if requested. */ |
| 1045 |
#if YYDEBUG |
| 1046 |
|
| 1047 |
# ifndef YYFPRINTF |
| 1048 |
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 1049 |
# define YYFPRINTF fprintf |
| 1050 |
# endif |
| 1051 |
|
| 1052 |
# define YYDPRINTF(Args) \ |
| 1053 |
do { \ |
| 1054 |
if (yydebug) \ |
| 1055 |
YYFPRINTF Args; \ |
| 1056 |
} while (0) |
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
|
| 1061 |
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ |
| 1062 |
do { \ |
| 1063 |
if (yydebug) \ |
| 1064 |
{ \ |
| 1065 |
YYFPRINTF (stderr, "%s ", Title); \ |
| 1066 |
yy_symbol_print (stderr, \ |
| 1067 |
Kind, Value, parm); \ |
| 1068 |
YYFPRINTF (stderr, "\n"); \ |
| 1069 |
} \ |
| 1070 |
} while (0) |
| 1071 |
|
| 1072 |
|
| 1073 |
/*-----------------------------------. |
| 1074 |
| Print this symbol's value on YYO. | |
| 1075 |
`-----------------------------------*/ |
| 1076 |
|
| 1077 |
static void |
| 1078 |
yy_symbol_value_print (FILE *yyo, |
| 1079 |
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *parm) |
| 1080 |
{ |
| 1081 |
FILE *yyoutput = yyo; |
| 1082 |
YY_USE (yyoutput); |
| 1083 |
YY_USE (parm); |
| 1084 |
if (!yyvaluep) |
| 1085 |
return; |
| 1086 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1087 |
YY_USE (yykind); |
| 1088 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1089 |
} |
| 1090 |
|
| 1091 |
|
| 1092 |
/*---------------------------. |
| 1093 |
| Print this symbol on YYO. | |
| 1094 |
`---------------------------*/ |
| 1095 |
|
| 1096 |
static void |
| 1097 |
yy_symbol_print (FILE *yyo, |
| 1098 |
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *parm) |
| 1099 |
{ |
| 1100 |
YYFPRINTF (yyo, "%s %s (", |
| 1101 |
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); |
| 1102 |
|
| 1103 |
yy_symbol_value_print (yyo, yykind, yyvaluep, parm); |
| 1104 |
YYFPRINTF (yyo, ")"); |
| 1105 |
} |
| 1106 |
|
| 1107 |
/*------------------------------------------------------------------. |
| 1108 |
| yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 1109 |
| TOP (included). | |
| 1110 |
`------------------------------------------------------------------*/ |
| 1111 |
|
| 1112 |
static void |
| 1113 |
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) |
| 1114 |
{ |
| 1115 |
YYFPRINTF (stderr, "Stack now"); |
| 1116 |
for (; yybottom <= yytop; yybottom++) |
| 1117 |
{ |
| 1118 |
int yybot = *yybottom; |
| 1119 |
YYFPRINTF (stderr, " %d", yybot); |
| 1120 |
} |
| 1121 |
YYFPRINTF (stderr, "\n"); |
| 1122 |
} |
| 1123 |
|
| 1124 |
# define YY_STACK_PRINT(Bottom, Top) \ |
| 1125 |
do { \ |
| 1126 |
if (yydebug) \ |
| 1127 |
yy_stack_print ((Bottom), (Top)); \ |
| 1128 |
} while (0) |
| 1129 |
|
| 1130 |
|
| 1131 |
/*------------------------------------------------. |
| 1132 |
| Report that the YYRULE is going to be reduced. | |
| 1133 |
`------------------------------------------------*/ |
| 1134 |
|
| 1135 |
static void |
| 1136 |
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, |
| 1137 |
int yyrule, void *parm) |
| 1138 |
{ |
| 1139 |
int yylno = yyrline[yyrule]; |
| 1140 |
int yynrhs = yyr2[yyrule]; |
| 1141 |
int yyi; |
| 1142 |
YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", |
| 1143 |
yyrule - 1, yylno); |
| 1144 |
/* The symbols being reduced. */ |
| 1145 |
for (yyi = 0; yyi < yynrhs; yyi++) |
| 1146 |
{ |
| 1147 |
YYFPRINTF (stderr, " $%d = ", yyi + 1); |
| 1148 |
yy_symbol_print (stderr, |
| 1149 |
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), |
| 1150 |
&yyvsp[(yyi + 1) - (yynrhs)], parm); |
| 1151 |
YYFPRINTF (stderr, "\n"); |
| 1152 |
} |
| 1153 |
} |
| 1154 |
|
| 1155 |
# define YY_REDUCE_PRINT(Rule) \ |
| 1156 |
do { \ |
| 1157 |
if (yydebug) \ |
| 1158 |
yy_reduce_print (yyssp, yyvsp, Rule, parm); \ |
| 1159 |
} while (0) |
| 1160 |
|
| 1161 |
/* Nonzero means print parse trace. It is left uninitialized so that |
| 1162 |
multiple parsers can coexist. */ |
| 1163 |
int yydebug; |
| 1164 |
#else /* !YYDEBUG */ |
| 1165 |
# define YYDPRINTF(Args) ((void) 0) |
| 1166 |
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) |
| 1167 |
# define YY_STACK_PRINT(Bottom, Top) |
| 1168 |
# define YY_REDUCE_PRINT(Rule) |
| 1169 |
#endif /* !YYDEBUG */ |
| 1170 |
|
| 1171 |
|
| 1172 |
/* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 1173 |
#ifndef YYINITDEPTH |
| 1174 |
# define YYINITDEPTH 200 |
| 1175 |
#endif |
| 1176 |
|
| 1177 |
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 1178 |
if the built-in stack extension method is used). |
| 1179 |
|
| 1180 |
Do not make this value too large; the results are undefined if |
| 1181 |
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 1182 |
evaluated with infinite-precision integer arithmetic. */ |
| 1183 |
|
| 1184 |
#ifndef YYMAXDEPTH |
| 1185 |
# define YYMAXDEPTH 10000 |
| 1186 |
#endif |
| 1187 |
|
| 1188 |
|
| 1189 |
/* Context of a parse error. */ |
| 1190 |
typedef struct |
| 1191 |
{ |
| 1192 |
yy_state_t *yyssp; |
| 1193 |
yysymbol_kind_t yytoken; |
| 1194 |
} yypcontext_t; |
| 1195 |
|
| 1196 |
/* Put in YYARG at most YYARGN of the expected tokens given the |
| 1197 |
current YYCTX, and return the number of tokens stored in YYARG. If |
| 1198 |
YYARG is null, return the number of expected tokens (guaranteed to |
| 1199 |
be less than YYNTOKENS). Return YYENOMEM on memory exhaustion. |
| 1200 |
Return 0 if there are more than YYARGN expected tokens, yet fill |
| 1201 |
YYARG up to YYARGN. */ |
| 1202 |
static int |
| 1203 |
yypcontext_expected_tokens (const yypcontext_t *yyctx, |
| 1204 |
yysymbol_kind_t yyarg[], int yyargn) |
| 1205 |
{ |
| 1206 |
/* Actual size of YYARG. */ |
| 1207 |
int yycount = 0; |
| 1208 |
int yyn = yypact[+*yyctx->yyssp]; |
| 1209 |
if (!yypact_value_is_default (yyn)) |
| 1210 |
{ |
| 1211 |
/* Start YYX at -YYN if negative to avoid negative indexes in |
| 1212 |
YYCHECK. In other words, skip the first -YYN actions for |
| 1213 |
this state because they are default actions. */ |
| 1214 |
int yyxbegin = yyn < 0 ? -yyn : 0; |
| 1215 |
/* Stay within bounds of both yycheck and yytname. */ |
| 1216 |
int yychecklim = YYLAST - yyn + 1; |
| 1217 |
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 1218 |
int yyx; |
| 1219 |
for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 1220 |
if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror |
| 1221 |
&& !yytable_value_is_error (yytable[yyx + yyn])) |
| 1222 |
{ |
| 1223 |
if (!yyarg) |
| 1224 |
++yycount; |
| 1225 |
else if (yycount == yyargn) |
| 1226 |
return 0; |
| 1227 |
else |
| 1228 |
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx); |
| 1229 |
} |
| 1230 |
} |
| 1231 |
if (yyarg && yycount == 0 && 0 < yyargn) |
| 1232 |
yyarg[0] = YYSYMBOL_YYEMPTY; |
| 1233 |
return yycount; |
| 1234 |
} |
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
#ifndef yystrlen |
| 1240 |
# if defined __GLIBC__ && defined _STRING_H |
| 1241 |
# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) |
| 1242 |
# else |
| 1243 |
/* Return the length of YYSTR. */ |
| 1244 |
static YYPTRDIFF_T |
| 1245 |
yystrlen (const char *yystr) |
| 1246 |
{ |
| 1247 |
YYPTRDIFF_T yylen; |
| 1248 |
for (yylen = 0; yystr[yylen]; yylen++) |
| 1249 |
continue; |
| 1250 |
return yylen; |
| 1251 |
} |
| 1252 |
# endif |
| 1253 |
#endif |
| 1254 |
|
| 1255 |
#ifndef yystpcpy |
| 1256 |
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 1257 |
# define yystpcpy stpcpy |
| 1258 |
# else |
| 1259 |
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 1260 |
YYDEST. */ |
| 1261 |
static char * |
| 1262 |
yystpcpy (char *yydest, const char *yysrc) |
| 1263 |
{ |
| 1264 |
char *yyd = yydest; |
| 1265 |
const char *yys = yysrc; |
| 1266 |
|
| 1267 |
while ((*yyd++ = *yys++) != '\0') |
| 1268 |
continue; |
| 1269 |
|
| 1270 |
return yyd - 1; |
| 1271 |
} |
| 1272 |
# endif |
| 1273 |
#endif |
| 1274 |
|
| 1275 |
#ifndef yytnamerr |
| 1276 |
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 1277 |
quotes and backslashes, so that it's suitable for yyerror. The |
| 1278 |
heuristic is that double-quoting is unnecessary unless the string |
| 1279 |
contains an apostrophe, a comma, or backslash (other than |
| 1280 |
backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 1281 |
null, do not copy; instead, return the length of what the result |
| 1282 |
would have been. */ |
| 1283 |
static YYPTRDIFF_T |
| 1284 |
yytnamerr (char *yyres, const char *yystr) |
| 1285 |
{ |
| 1286 |
if (*yystr == '"') |
| 1287 |
{ |
| 1288 |
YYPTRDIFF_T yyn = 0; |
| 1289 |
char const *yyp = yystr; |
| 1290 |
for (;;) |
| 1291 |
switch (*++yyp) |
| 1292 |
{ |
| 1293 |
case '\'': |
| 1294 |
case ',': |
| 1295 |
goto do_not_strip_quotes; |
| 1296 |
|
| 1297 |
case '\\': |
| 1298 |
if (*++yyp != '\\') |
| 1299 |
goto do_not_strip_quotes; |
| 1300 |
else |
| 1301 |
goto append; |
| 1302 |
|
| 1303 |
append: |
| 1304 |
default: |
| 1305 |
if (yyres) |
| 1306 |
yyres[yyn] = *yyp; |
| 1307 |
yyn++; |
| 1308 |
break; |
| 1309 |
|
| 1310 |
case '"': |
| 1311 |
if (yyres) |
| 1312 |
yyres[yyn] = '\0'; |
| 1313 |
return yyn; |
| 1314 |
} |
| 1315 |
do_not_strip_quotes: ; |
| 1316 |
} |
| 1317 |
|
| 1318 |
if (yyres) |
| 1319 |
return yystpcpy (yyres, yystr) - yyres; |
| 1320 |
else |
| 1321 |
return yystrlen (yystr); |
| 1322 |
} |
| 1323 |
#endif |
| 1324 |
|
| 1325 |
|
| 1326 |
static int |
| 1327 |
yy_syntax_error_arguments (const yypcontext_t *yyctx, |
| 1328 |
yysymbol_kind_t yyarg[], int yyargn) |
| 1329 |
{ |
| 1330 |
/* Actual size of YYARG. */ |
| 1331 |
int yycount = 0; |
| 1332 |
/* There are many possibilities here to consider: |
| 1333 |
- If this state is a consistent state with a default action, then |
| 1334 |
the only way this function was invoked is if the default action |
| 1335 |
is an error action. In that case, don't check for expected |
| 1336 |
tokens because there are none. |
| 1337 |
- The only way there can be no lookahead present (in yychar) is if |
| 1338 |
this state is a consistent state with a default action. Thus, |
| 1339 |
detecting the absence of a lookahead is sufficient to determine |
| 1340 |
that there is no unexpected or expected token to report. In that |
| 1341 |
case, just report a simple "syntax error". |
| 1342 |
- Don't assume there isn't a lookahead just because this state is a |
| 1343 |
consistent state with a default action. There might have been a |
| 1344 |
previous inconsistent state, consistent state with a non-default |
| 1345 |
action, or user semantic action that manipulated yychar. |
| 1346 |
- Of course, the expected token list depends on states to have |
| 1347 |
correct lookahead information, and it depends on the parser not |
| 1348 |
to perform extra reductions after fetching a lookahead from the |
| 1349 |
scanner and before detecting a syntax error. Thus, state merging |
| 1350 |
(from LALR or IELR) and default reductions corrupt the expected |
| 1351 |
token list. However, the list is correct for canonical LR with |
| 1352 |
one exception: it will still contain any token that will not be |
| 1353 |
accepted due to an error action in a later state. |
| 1354 |
*/ |
| 1355 |
if (yyctx->yytoken != YYSYMBOL_YYEMPTY) |
| 1356 |
{ |
| 1357 |
int yyn; |
| 1358 |
if (yyarg) |
| 1359 |
yyarg[yycount] = yyctx->yytoken; |
| 1360 |
++yycount; |
| 1361 |
yyn = yypcontext_expected_tokens (yyctx, |
| 1362 |
yyarg ? yyarg + 1 : yyarg, yyargn - 1); |
| 1363 |
if (yyn == YYENOMEM) |
| 1364 |
return YYENOMEM; |
| 1365 |
else |
| 1366 |
yycount += yyn; |
| 1367 |
} |
| 1368 |
return yycount; |
| 1369 |
} |
| 1370 |
|
| 1371 |
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message |
| 1372 |
about the unexpected token YYTOKEN for the state stack whose top is |
| 1373 |
YYSSP. |
| 1374 |
|
| 1375 |
Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is |
| 1376 |
not large enough to hold the message. In that case, also set |
| 1377 |
*YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the |
| 1378 |
required number of bytes is too large to store. */ |
| 1379 |
static int |
| 1380 |
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, |
| 1381 |
const yypcontext_t *yyctx) |
| 1382 |
{ |
| 1383 |
enum { YYARGS_MAX = 5 }; |
| 1384 |
/* Internationalized format string. */ |
| 1385 |
const char *yyformat = YY_NULLPTR; |
| 1386 |
/* Arguments of yyformat: reported tokens (one for the "unexpected", |
| 1387 |
one per "expected"). */ |
| 1388 |
yysymbol_kind_t yyarg[YYARGS_MAX]; |
| 1389 |
/* Cumulated lengths of YYARG. */ |
| 1390 |
YYPTRDIFF_T yysize = 0; |
| 1391 |
|
| 1392 |
/* Actual size of YYARG. */ |
| 1393 |
int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX); |
| 1394 |
if (yycount == YYENOMEM) |
| 1395 |
return YYENOMEM; |
| 1396 |
|
| 1397 |
switch (yycount) |
| 1398 |
{ |
| 1399 |
#define YYCASE_(N, S) \ |
| 1400 |
case N: \ |
| 1401 |
yyformat = S; \ |
| 1402 |
break |
| 1403 |
default: /* Avoid compiler warnings. */ |
| 1404 |
YYCASE_(0, YY_("syntax error")); |
| 1405 |
YYCASE_(1, YY_("syntax error, unexpected %s")); |
| 1406 |
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
| 1407 |
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
| 1408 |
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
| 1409 |
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
| 1410 |
#undef YYCASE_ |
| 1411 |
} |
| 1412 |
|
| 1413 |
/* Compute error message size. Don't count the "%s"s, but reserve |
| 1414 |
room for the terminator. */ |
| 1415 |
yysize = yystrlen (yyformat) - 2 * yycount + 1; |
| 1416 |
{ |
| 1417 |
int yyi; |
| 1418 |
for (yyi = 0; yyi < yycount; ++yyi) |
| 1419 |
{ |
| 1420 |
YYPTRDIFF_T yysize1 |
| 1421 |
= yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]); |
| 1422 |
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) |
| 1423 |
yysize = yysize1; |
| 1424 |
else |
| 1425 |
return YYENOMEM; |
| 1426 |
} |
| 1427 |
} |
| 1428 |
|
| 1429 |
if (*yymsg_alloc < yysize) |
| 1430 |
{ |
| 1431 |
*yymsg_alloc = 2 * yysize; |
| 1432 |
if (! (yysize <= *yymsg_alloc |
| 1433 |
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 1434 |
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; |
| 1435 |
return -1; |
| 1436 |
} |
| 1437 |
|
| 1438 |
/* Avoid sprintf, as that infringes on the user's name space. |
| 1439 |
Don't have undefined behavior even if the translation |
| 1440 |
produced a string with the wrong number of "%s"s. */ |
| 1441 |
{ |
| 1442 |
char *yyp = *yymsg; |
| 1443 |
int yyi = 0; |
| 1444 |
while ((*yyp = *yyformat) != '\0') |
| 1445 |
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) |
| 1446 |
{ |
| 1447 |
yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]); |
| 1448 |
yyformat += 2; |
| 1449 |
} |
| 1450 |
else |
| 1451 |
{ |
| 1452 |
++yyp; |
| 1453 |
++yyformat; |
| 1454 |
} |
| 1455 |
} |
| 1456 |
return 0; |
| 1457 |
} |
| 1458 |
|
| 1459 |
|
| 1460 |
/*-----------------------------------------------. |
| 1461 |
| Release the memory associated to this symbol. | |
| 1462 |
`-----------------------------------------------*/ |
| 1463 |
|
| 1464 |
static void |
| 1465 |
yydestruct (const char *yymsg, |
| 1466 |
yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *parm) |
| 1467 |
{ |
| 1468 |
YY_USE (yyvaluep); |
| 1469 |
YY_USE (parm); |
| 1470 |
if (!yymsg) |
| 1471 |
yymsg = "Deleting"; |
| 1472 |
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); |
| 1473 |
|
| 1474 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1475 |
YY_USE (yykind); |
| 1476 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1477 |
} |
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
/*----------. |
| 1485 |
| yyparse. | |
| 1486 |
`----------*/ |
| 1487 |
|
| 1488 |
int |
| 1489 |
yyparse (void *parm) |
| 1490 |
{ |
| 1491 |
/* Lookahead token kind. */ |
| 1492 |
int yychar; |
| 1493 |
|
| 1494 |
|
| 1495 |
/* The semantic value of the lookahead symbol. */ |
| 1496 |
/* Default value used for initialization, for pacifying older GCCs |
| 1497 |
or non-GCC compilers. */ |
| 1498 |
YY_INITIAL_VALUE (static YYSTYPE yyval_default;) |
| 1499 |
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); |
| 1500 |
|
| 1501 |
/* Number of syntax errors so far. */ |
| 1502 |
int yynerrs = 0; |
| 1503 |
|
| 1504 |
yy_state_fast_t yystate = 0; |
| 1505 |
/* Number of tokens to shift before error messages enabled. */ |
| 1506 |
int yyerrstatus = 0; |
| 1507 |
|
| 1508 |
/* Refer to the stacks through separate pointers, to allow yyoverflow |
| 1509 |
to reallocate them elsewhere. */ |
| 1510 |
|
| 1511 |
/* Their size. */ |
| 1512 |
YYPTRDIFF_T yystacksize = YYINITDEPTH; |
| 1513 |
|
| 1514 |
/* The state stack: array, bottom, top. */ |
| 1515 |
yy_state_t yyssa[YYINITDEPTH]; |
| 1516 |
yy_state_t *yyss = yyssa; |
| 1517 |
yy_state_t *yyssp = yyss; |
| 1518 |
|
| 1519 |
/* The semantic value stack: array, bottom, top. */ |
| 1520 |
YYSTYPE yyvsa[YYINITDEPTH]; |
| 1521 |
YYSTYPE *yyvs = yyvsa; |
| 1522 |
YYSTYPE *yyvsp = yyvs; |
| 1523 |
|
| 1524 |
int yyn; |
| 1525 |
/* The return value of yyparse. */ |
| 1526 |
int yyresult; |
| 1527 |
/* Lookahead symbol kind. */ |
| 1528 |
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; |
| 1529 |
/* The variables used to return semantic value and location from the |
| 1530 |
action routines. */ |
| 1531 |
YYSTYPE yyval; |
| 1532 |
|
| 1533 |
/* Buffer for error messages, and its allocated size. */ |
| 1534 |
char yymsgbuf[128]; |
| 1535 |
char *yymsg = yymsgbuf; |
| 1536 |
YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; |
| 1537 |
|
| 1538 |
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 1539 |
|
| 1540 |
/* The number of symbols on the RHS of the reduced rule. |
| 1541 |
Keep to zero when no symbol should be popped. */ |
| 1542 |
int yylen = 0; |
| 1543 |
|
| 1544 |
YYDPRINTF ((stderr, "Starting parse\n")); |
| 1545 |
|
| 1546 |
yychar = YYEMPTY; /* Cause a token to be read. */ |
| 1547 |
|
| 1548 |
goto yysetstate; |
| 1549 |
|
| 1550 |
|
| 1551 |
/*------------------------------------------------------------. |
| 1552 |
| yynewstate -- push a new state, which is found in yystate. | |
| 1553 |
`------------------------------------------------------------*/ |
| 1554 |
yynewstate: |
| 1555 |
/* In all cases, when you get here, the value and location stacks |
| 1556 |
have just been pushed. So pushing a state here evens the stacks. */ |
| 1557 |
yyssp++; |
| 1558 |
|
| 1559 |
|
| 1560 |
/*--------------------------------------------------------------------. |
| 1561 |
| yysetstate -- set current state (the top of the stack) to yystate. | |
| 1562 |
`--------------------------------------------------------------------*/ |
| 1563 |
yysetstate: |
| 1564 |
YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1565 |
YY_ASSERT (0 <= yystate && yystate < YYNSTATES); |
| 1566 |
YY_IGNORE_USELESS_CAST_BEGIN |
| 1567 |
*yyssp = YY_CAST (yy_state_t, yystate); |
| 1568 |
YY_IGNORE_USELESS_CAST_END |
| 1569 |
YY_STACK_PRINT (yyss, yyssp); |
| 1570 |
|
| 1571 |
if (yyss + yystacksize - 1 <= yyssp) |
| 1572 |
#if !defined yyoverflow && !defined YYSTACK_RELOCATE |
| 1573 |
YYNOMEM; |
| 1574 |
#else |
| 1575 |
{ |
| 1576 |
/* Get the current used size of the three stacks, in elements. */ |
| 1577 |
YYPTRDIFF_T yysize = yyssp - yyss + 1; |
| 1578 |
|
| 1579 |
# if defined yyoverflow |
| 1580 |
{ |
| 1581 |
/* Give user a chance to reallocate the stack. Use copies of |
| 1582 |
these so that the &'s don't force the real ones into |
| 1583 |
memory. */ |
| 1584 |
yy_state_t *yyss1 = yyss; |
| 1585 |
YYSTYPE *yyvs1 = yyvs; |
| 1586 |
|
| 1587 |
/* Each stack pointer address is followed by the size of the |
| 1588 |
data in use in that stack, in bytes. This used to be a |
| 1589 |
conditional around just the two extra args, but that might |
| 1590 |
be undefined if yyoverflow is a macro. */ |
| 1591 |
yyoverflow (YY_("memory exhausted"), |
| 1592 |
&yyss1, yysize * YYSIZEOF (*yyssp), |
| 1593 |
&yyvs1, yysize * YYSIZEOF (*yyvsp), |
| 1594 |
&yystacksize); |
| 1595 |
yyss = yyss1; |
| 1596 |
yyvs = yyvs1; |
| 1597 |
} |
| 1598 |
# else /* defined YYSTACK_RELOCATE */ |
| 1599 |
/* Extend the stack our own way. */ |
| 1600 |
if (YYMAXDEPTH <= yystacksize) |
| 1601 |
YYNOMEM; |
| 1602 |
yystacksize *= 2; |
| 1603 |
if (YYMAXDEPTH < yystacksize) |
| 1604 |
yystacksize = YYMAXDEPTH; |
| 1605 |
|
| 1606 |
{ |
| 1607 |
yy_state_t *yyss1 = yyss; |
| 1608 |
union yyalloc *yyptr = |
| 1609 |
YY_CAST (union yyalloc *, |
| 1610 |
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); |
| 1611 |
if (! yyptr) |
| 1612 |
YYNOMEM; |
| 1613 |
YYSTACK_RELOCATE (yyss_alloc, yyss); |
| 1614 |
YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
| 1615 |
# undef YYSTACK_RELOCATE |
| 1616 |
if (yyss1 != yyssa) |
| 1617 |
YYSTACK_FREE (yyss1); |
| 1618 |
} |
| 1619 |
# endif |
| 1620 |
|
| 1621 |
yyssp = yyss + yysize - 1; |
| 1622 |
yyvsp = yyvs + yysize - 1; |
| 1623 |
|
| 1624 |
YY_IGNORE_USELESS_CAST_BEGIN |
| 1625 |
YYDPRINTF ((stderr, "Stack size increased to %ld\n", |
| 1626 |
YY_CAST (long, yystacksize))); |
| 1627 |
YY_IGNORE_USELESS_CAST_END |
| 1628 |
|
| 1629 |
if (yyss + yystacksize - 1 <= yyssp) |
| 1630 |
YYABORT; |
| 1631 |
} |
| 1632 |
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ |
| 1633 |
|
| 1634 |
|
| 1635 |
if (yystate == YYFINAL) |
| 1636 |
YYACCEPT; |
| 1637 |
|
| 1638 |
goto yybackup; |
| 1639 |
|
| 1640 |
|
| 1641 |
/*-----------. |
| 1642 |
| yybackup. | |
| 1643 |
`-----------*/ |
| 1644 |
yybackup: |
| 1645 |
/* Do appropriate processing given the current state. Read a |
| 1646 |
lookahead token if we need one and don't already have one. */ |
| 1647 |
|
| 1648 |
/* First try to decide what to do without reference to lookahead token. */ |
| 1649 |
yyn = yypact[yystate]; |
| 1650 |
if (yypact_value_is_default (yyn)) |
| 1651 |
goto yydefault; |
| 1652 |
|
| 1653 |
/* Not known => get a lookahead token if don't already have one. */ |
| 1654 |
|
| 1655 |
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ |
| 1656 |
if (yychar == YYEMPTY) |
| 1657 |
{ |
| 1658 |
YYDPRINTF ((stderr, "Reading a token\n")); |
| 1659 |
yychar = yylex (&yylval, parm); |
| 1660 |
} |
| 1661 |
|
| 1662 |
if (yychar <= YYEOF) |
| 1663 |
{ |
| 1664 |
yychar = YYEOF; |
| 1665 |
yytoken = YYSYMBOL_YYEOF; |
| 1666 |
YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1667 |
} |
| 1668 |
else if (yychar == YYerror) |
| 1669 |
{ |
| 1670 |
/* The scanner already issued an error message, process directly |
| 1671 |
to error recovery. But do not keep the error token as |
| 1672 |
lookahead, it is too special and may lead us to an endless |
| 1673 |
loop in error recovery. */ |
| 1674 |
yychar = YYUNDEF; |
| 1675 |
yytoken = YYSYMBOL_YYerror; |
| 1676 |
goto yyerrlab1; |
| 1677 |
} |
| 1678 |
else |
| 1679 |
{ |
| 1680 |
yytoken = YYTRANSLATE (yychar); |
| 1681 |
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
| 1682 |
} |
| 1683 |
|
| 1684 |
/* If the proper action on seeing token YYTOKEN is to reduce or to |
| 1685 |
detect an error, take that action. */ |
| 1686 |
yyn += yytoken; |
| 1687 |
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
| 1688 |
goto yydefault; |
| 1689 |
yyn = yytable[yyn]; |
| 1690 |
if (yyn <= 0) |
| 1691 |
{ |
| 1692 |
if (yytable_value_is_error (yyn)) |
| 1693 |
goto yyerrlab; |
| 1694 |
yyn = -yyn; |
| 1695 |
goto yyreduce; |
| 1696 |
} |
| 1697 |
|
| 1698 |
/* Count tokens shifted since error; after three, turn off error |
| 1699 |
status. */ |
| 1700 |
if (yyerrstatus) |
| 1701 |
yyerrstatus--; |
| 1702 |
|
| 1703 |
/* Shift the lookahead token. */ |
| 1704 |
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 1705 |
yystate = yyn; |
| 1706 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 1707 |
*++yyvsp = yylval; |
| 1708 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 1709 |
|
| 1710 |
/* Discard the shifted token. */ |
| 1711 |
yychar = YYEMPTY; |
| 1712 |
goto yynewstate; |
| 1713 |
|
| 1714 |
|
| 1715 |
/*-----------------------------------------------------------. |
| 1716 |
| yydefault -- do the default action for the current state. | |
| 1717 |
`-----------------------------------------------------------*/ |
| 1718 |
yydefault: |
| 1719 |
yyn = yydefact[yystate]; |
| 1720 |
if (yyn == 0) |
| 1721 |
goto yyerrlab; |
| 1722 |
goto yyreduce; |
| 1723 |
|
| 1724 |
|
| 1725 |
/*-----------------------------. |
| 1726 |
| yyreduce -- do a reduction. | |
| 1727 |
`-----------------------------*/ |
| 1728 |
yyreduce: |
| 1729 |
/* yyn is the number of a rule to reduce with. */ |
| 1730 |
yylen = yyr2[yyn]; |
| 1731 |
|
| 1732 |
/* If YYLEN is nonzero, implement the default value of the action: |
| 1733 |
'$$ = $1'. |
| 1734 |
|
| 1735 |
Otherwise, the following line sets YYVAL to garbage. |
| 1736 |
This behavior is undocumented and Bison |
| 1737 |
users should not rely upon it. Assigning to YYVAL |
| 1738 |
unconditionally makes the parser a bit smaller, and it avoids a |
| 1739 |
GCC warning that YYVAL may be used uninitialized. */ |
| 1740 |
yyval = yyvsp[1-yylen]; |
| 1741 |
|
| 1742 |
|
| 1743 |
YY_REDUCE_PRINT (yyn); |
| 1744 |
switch (yyn) |
| 1745 |
{ |
| 1746 |
case 4: /* pos_num: NUM */ |
| 1747 |
#line 183 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1748 |
{ strcpy((yyval.str),(yyvsp[0].str)); } |
| 1749 |
#line 1750 "asn1-parse.c" |
| 1750 |
break; |
| 1751 |
|
| 1752 |
case 5: /* pos_num: '+' NUM */ |
| 1753 |
#line 184 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1754 |
{ strcpy((yyval.str),(yyvsp[0].str)); } |
| 1755 |
#line 1756 "asn1-parse.c" |
| 1756 |
break; |
| 1757 |
|
| 1758 |
case 6: /* neg_num: '-' NUM */ |
| 1759 |
#line 188 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1760 |
{ |
| 1761 |
strcpy((yyval.str),"-"); |
| 1762 |
strcat((yyval.str),(yyvsp[0].str)); |
| 1763 |
} |
| 1764 |
#line 1765 "asn1-parse.c" |
| 1765 |
break; |
| 1766 |
|
| 1767 |
case 7: /* pos_neg_num: pos_num */ |
| 1768 |
#line 194 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1769 |
{ strcpy((yyval.str),(yyvsp[0].str)); } |
| 1770 |
#line 1771 "asn1-parse.c" |
| 1771 |
break; |
| 1772 |
|
| 1773 |
case 8: /* pos_neg_num: neg_num */ |
| 1774 |
#line 195 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1775 |
{ strcpy((yyval.str),(yyvsp[0].str)); } |
| 1776 |
#line 1777 "asn1-parse.c" |
| 1777 |
break; |
| 1778 |
|
| 1779 |
case 9: /* num_identifier: NUM */ |
| 1780 |
#line 198 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1781 |
{strcpy((yyval.str),(yyvsp[0].str));} |
| 1782 |
#line 1783 "asn1-parse.c" |
| 1783 |
break; |
| 1784 |
|
| 1785 |
case 10: /* num_identifier: IDENTIFIER */ |
| 1786 |
#line 199 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1787 |
{strcpy((yyval.str),(yyvsp[0].str));} |
| 1788 |
#line 1789 "asn1-parse.c" |
| 1789 |
break; |
| 1790 |
|
| 1791 |
case 11: /* pos_neg_identifier: pos_neg_num */ |
| 1792 |
#line 202 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1793 |
{strcpy((yyval.str),(yyvsp[0].str));} |
| 1794 |
#line 1795 "asn1-parse.c" |
| 1795 |
break; |
| 1796 |
|
| 1797 |
case 12: /* pos_neg_identifier: IDENTIFIER */ |
| 1798 |
#line 203 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1799 |
{strcpy((yyval.str),(yyvsp[0].str));} |
| 1800 |
#line 1801 "asn1-parse.c" |
| 1801 |
break; |
| 1802 |
|
| 1803 |
case 13: /* constant: '(' pos_neg_num ')' */ |
| 1804 |
#line 207 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1805 |
{ |
| 1806 |
(yyval.node) = NEW_NODE (TYPE_CONSTANT); |
| 1807 |
set_str_value ((yyval.node), (yyvsp[-1].str)); |
| 1808 |
} |
| 1809 |
#line 1810 "asn1-parse.c" |
| 1810 |
break; |
| 1811 |
|
| 1812 |
case 14: /* constant: IDENTIFIER '(' pos_neg_num ')' */ |
| 1813 |
#line 212 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1814 |
{ |
| 1815 |
(yyval.node) = NEW_NODE (TYPE_CONSTANT); |
| 1816 |
set_name ((yyval.node), (yyvsp[-3].str)); |
| 1817 |
set_str_value ((yyval.node), (yyvsp[-1].str)); |
| 1818 |
} |
| 1819 |
#line 1820 "asn1-parse.c" |
| 1820 |
break; |
| 1821 |
|
| 1822 |
case 15: /* constant_list: constant */ |
| 1823 |
#line 219 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1824 |
{ (yyval.node)=(yyvsp[0].node); } |
| 1825 |
#line 1826 "asn1-parse.c" |
| 1826 |
break; |
| 1827 |
|
| 1828 |
case 16: /* constant_list: constant_list ',' constant */ |
| 1829 |
#line 221 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1830 |
{ |
| 1831 |
(yyval.node) = (yyvsp[-2].node); |
| 1832 |
append_right ((yyvsp[-2].node), (yyvsp[0].node)); |
| 1833 |
} |
| 1834 |
#line 1835 "asn1-parse.c" |
| 1835 |
break; |
| 1836 |
|
| 1837 |
case 17: /* obj_constant: num_identifier */ |
| 1838 |
#line 246 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1839 |
{ |
| 1840 |
(yyval.node) = NEW_NODE (TYPE_CONSTANT); |
| 1841 |
set_str_value ((yyval.node), (yyvsp[0].str)); |
| 1842 |
} |
| 1843 |
#line 1844 "asn1-parse.c" |
| 1844 |
break; |
| 1845 |
|
| 1846 |
case 18: /* obj_constant: IDENTIFIER '(' NUM ')' */ |
| 1847 |
#line 251 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1848 |
{ |
| 1849 |
(yyval.node) = NEW_NODE (TYPE_CONSTANT); |
| 1850 |
set_name ((yyval.node), (yyvsp[-3].str)); |
| 1851 |
set_str_value ((yyval.node), (yyvsp[-1].str)); |
| 1852 |
} |
| 1853 |
#line 1854 "asn1-parse.c" |
| 1854 |
break; |
| 1855 |
|
| 1856 |
case 19: /* obj_constant_list: obj_constant */ |
| 1857 |
#line 259 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1858 |
{ (yyval.node)=(yyvsp[0].node);} |
| 1859 |
#line 1860 "asn1-parse.c" |
| 1860 |
break; |
| 1861 |
|
| 1862 |
case 20: /* obj_constant_list: obj_constant_list obj_constant */ |
| 1863 |
#line 261 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1864 |
{ |
| 1865 |
(yyval.node)=(yyvsp[-1].node); |
| 1866 |
append_right ((yyval.node), (yyvsp[0].node)); |
| 1867 |
} |
| 1868 |
#line 1869 "asn1-parse.c" |
| 1869 |
break; |
| 1870 |
|
| 1871 |
case 21: /* class: "UNIVERSAL" */ |
| 1872 |
#line 267 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1873 |
{ (yyval.constant) = CLASS_UNIVERSAL; } |
| 1874 |
#line 1875 "asn1-parse.c" |
| 1875 |
break; |
| 1876 |
|
| 1877 |
case 22: /* class: "PRIVATE" */ |
| 1878 |
#line 268 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1879 |
{ (yyval.constant) = CLASS_PRIVATE; } |
| 1880 |
#line 1881 "asn1-parse.c" |
| 1881 |
break; |
| 1882 |
|
| 1883 |
case 23: /* class: "APPLICATION" */ |
| 1884 |
#line 269 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1885 |
{ (yyval.constant) = CLASS_APPLICATION; } |
| 1886 |
#line 1887 "asn1-parse.c" |
| 1887 |
break; |
| 1888 |
|
| 1889 |
case 24: /* tag_type: '[' NUM ']' */ |
| 1890 |
#line 273 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1891 |
{ |
| 1892 |
(yyval.node) = NEW_NODE (TYPE_TAG); |
| 1893 |
(yyval.node)->flags.class = CLASS_CONTEXT; |
| 1894 |
set_ulong_value ((yyval.node), (yyvsp[-1].str)); |
| 1895 |
} |
| 1896 |
#line 1897 "asn1-parse.c" |
| 1897 |
break; |
| 1898 |
|
| 1899 |
case 25: /* tag_type: '[' class NUM ']' */ |
| 1900 |
#line 279 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1901 |
{ |
| 1902 |
(yyval.node) = NEW_NODE (TYPE_TAG); |
| 1903 |
(yyval.node)->flags.class = (yyvsp[-2].constant); |
| 1904 |
set_ulong_value ((yyval.node), (yyvsp[-1].str)); |
| 1905 |
} |
| 1906 |
#line 1907 "asn1-parse.c" |
| 1907 |
break; |
| 1908 |
|
| 1909 |
case 26: /* tag: tag_type */ |
| 1910 |
#line 287 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1911 |
{ (yyval.node) = (yyvsp[0].node); } |
| 1912 |
#line 1913 "asn1-parse.c" |
| 1913 |
break; |
| 1914 |
|
| 1915 |
case 27: /* tag: tag_type "EXPLICIT" */ |
| 1916 |
#line 289 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1917 |
{ |
| 1918 |
(yyval.node) = (yyvsp[-1].node); |
| 1919 |
(yyval.node)->flags.explicit = 1; |
| 1920 |
} |
| 1921 |
#line 1922 "asn1-parse.c" |
| 1922 |
break; |
| 1923 |
|
| 1924 |
case 28: /* tag: tag_type "IMPLICIT" */ |
| 1925 |
#line 294 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1926 |
{ |
| 1927 |
(yyval.node) = (yyvsp[-1].node); |
| 1928 |
(yyval.node)->flags.implicit = 1; |
| 1929 |
} |
| 1930 |
#line 1931 "asn1-parse.c" |
| 1931 |
break; |
| 1932 |
|
| 1933 |
case 29: /* default: "DEFAULT" pos_neg_identifier */ |
| 1934 |
#line 301 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1935 |
{ |
| 1936 |
(yyval.node) = NEW_NODE (TYPE_DEFAULT); |
| 1937 |
set_str_value ((yyval.node), (yyvsp[0].str)); |
| 1938 |
} |
| 1939 |
#line 1940 "asn1-parse.c" |
| 1940 |
break; |
| 1941 |
|
| 1942 |
case 30: /* default: "DEFAULT" "TRUE" */ |
| 1943 |
#line 306 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1944 |
{ |
| 1945 |
(yyval.node) = NEW_NODE (TYPE_DEFAULT); |
| 1946 |
(yyval.node)->flags.is_true = 1; |
| 1947 |
} |
| 1948 |
#line 1949 "asn1-parse.c" |
| 1949 |
break; |
| 1950 |
|
| 1951 |
case 31: /* default: "DEFAULT" "FALSE" */ |
| 1952 |
#line 311 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1953 |
{ |
| 1954 |
(yyval.node) = NEW_NODE (TYPE_DEFAULT); |
| 1955 |
(yyval.node)->flags.is_false = 1; |
| 1956 |
} |
| 1957 |
#line 1958 "asn1-parse.c" |
| 1958 |
break; |
| 1959 |
|
| 1960 |
case 32: /* integer_def: "INTEGER" */ |
| 1961 |
#line 318 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1962 |
{ |
| 1963 |
(yyval.node) = NEW_NODE (TYPE_INTEGER); |
| 1964 |
} |
| 1965 |
#line 1966 "asn1-parse.c" |
| 1966 |
break; |
| 1967 |
|
| 1968 |
case 33: /* integer_def: "INTEGER" '{' constant_list '}' */ |
| 1969 |
#line 322 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1970 |
{ |
| 1971 |
(yyval.node) = NEW_NODE (TYPE_INTEGER); |
| 1972 |
(yyval.node)->flags.has_list = 1; |
| 1973 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 1974 |
} |
| 1975 |
#line 1976 "asn1-parse.c" |
| 1976 |
break; |
| 1977 |
|
| 1978 |
case 34: /* integer_def: integer_def '(' num_identifier '.' '.' num_identifier ')' */ |
| 1979 |
#line 328 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1980 |
{ |
| 1981 |
(yyval.node) = NEW_NODE (TYPE_INTEGER); |
| 1982 |
(yyval.node)->flags.has_min_max = 1; |
| 1983 |
/* the following is wrong. Better use a union for the value*/ |
| 1984 |
set_down ((yyval.node), NEW_NODE (TYPE_SIZE) ); |
| 1985 |
set_str_value ((yyval.node)->down, (yyvsp[-1].str)); |
| 1986 |
set_name ((yyval.node)->down, (yyvsp[-4].str)); |
| 1987 |
} |
| 1988 |
#line 1989 "asn1-parse.c" |
| 1989 |
break; |
| 1990 |
|
| 1991 |
case 35: /* boolean_def: "BOOLEAN" */ |
| 1992 |
#line 339 "/home/wk/s/libksba/src/asn1-parse.y" |
| 1993 |
{ |
| 1994 |
(yyval.node) = NEW_NODE (TYPE_BOOLEAN); |
| 1995 |
} |
| 1996 |
#line 1997 "asn1-parse.c" |
| 1997 |
break; |
| 1998 |
|
| 1999 |
case 36: /* Time: "UTCTime" */ |
| 2000 |
#line 345 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2001 |
{ |
| 2002 |
(yyval.node) = NEW_NODE (TYPE_UTC_TIME); |
| 2003 |
} |
| 2004 |
#line 2005 "asn1-parse.c" |
| 2005 |
break; |
| 2006 |
|
| 2007 |
case 37: /* Time: "GeneralizedTime" */ |
| 2008 |
#line 349 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2009 |
{ |
| 2010 |
(yyval.node) = NEW_NODE (TYPE_GENERALIZED_TIME); |
| 2011 |
} |
| 2012 |
#line 2013 "asn1-parse.c" |
| 2013 |
break; |
| 2014 |
|
| 2015 |
case 38: /* size_def2: "SIZE" '(' num_identifier ')' */ |
| 2016 |
#line 355 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2017 |
{ |
| 2018 |
(yyval.node) = NEW_NODE (TYPE_SIZE); |
| 2019 |
(yyval.node)->flags.one_param = 1; |
| 2020 |
set_str_value ((yyval.node), (yyvsp[-1].str)); |
| 2021 |
} |
| 2022 |
#line 2023 "asn1-parse.c" |
| 2023 |
break; |
| 2024 |
|
| 2025 |
case 39: /* size_def2: "SIZE" '(' num_identifier '.' '.' num_identifier ')' */ |
| 2026 |
#line 361 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2027 |
{ |
| 2028 |
(yyval.node) = NEW_NODE (TYPE_SIZE); |
| 2029 |
(yyval.node)->flags.has_min_max = 1; |
| 2030 |
set_str_value ((yyval.node), (yyvsp[-4].str)); |
| 2031 |
set_name ((yyval.node), (yyvsp[-1].str)); |
| 2032 |
} |
| 2033 |
#line 2034 "asn1-parse.c" |
| 2034 |
break; |
| 2035 |
|
| 2036 |
case 40: /* size_def: size_def2 */ |
| 2037 |
#line 370 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2038 |
{ |
| 2039 |
(yyval.node)=(yyvsp[0].node); |
| 2040 |
} |
| 2041 |
#line 2042 "asn1-parse.c" |
| 2042 |
break; |
| 2043 |
|
| 2044 |
case 41: /* size_def: '(' size_def2 ')' */ |
| 2045 |
#line 374 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2046 |
{ |
| 2047 |
(yyval.node)=(yyvsp[-1].node); |
| 2048 |
} |
| 2049 |
#line 2050 "asn1-parse.c" |
| 2050 |
break; |
| 2051 |
|
| 2052 |
case 42: /* octet_string_def: "OCTET" "STRING" */ |
| 2053 |
#line 380 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2054 |
{ |
| 2055 |
(yyval.node) = NEW_NODE (TYPE_OCTET_STRING); |
| 2056 |
} |
| 2057 |
#line 2058 "asn1-parse.c" |
| 2058 |
break; |
| 2059 |
|
| 2060 |
case 43: /* octet_string_def: "OCTET" "STRING" size_def */ |
| 2061 |
#line 384 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2062 |
{ |
| 2063 |
(yyval.node) = NEW_NODE (TYPE_OCTET_STRING); |
| 2064 |
(yyval.node)->flags.has_size = 1; |
| 2065 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2066 |
} |
| 2067 |
#line 2068 "asn1-parse.c" |
| 2068 |
break; |
| 2069 |
|
| 2070 |
case 44: /* utf8_string_def: "UTF8String" */ |
| 2071 |
#line 391 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2072 |
{ (yyval.node) = NEW_NODE (TYPE_UTF8_STRING); } |
| 2073 |
#line 2074 "asn1-parse.c" |
| 2074 |
break; |
| 2075 |
|
| 2076 |
case 45: /* utf8_string_def: "UTF8String" size_def */ |
| 2077 |
#line 393 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2078 |
{ |
| 2079 |
(yyval.node) = NEW_NODE (TYPE_UTF8_STRING); |
| 2080 |
(yyval.node)->flags.has_size = 1; |
| 2081 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2082 |
} |
| 2083 |
#line 2084 "asn1-parse.c" |
| 2084 |
break; |
| 2085 |
|
| 2086 |
case 46: /* numeric_string_def: "NumericString" */ |
| 2087 |
#line 399 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2088 |
{ (yyval.node) = NEW_NODE (TYPE_NUMERIC_STRING); } |
| 2089 |
#line 2090 "asn1-parse.c" |
| 2090 |
break; |
| 2091 |
|
| 2092 |
case 47: /* numeric_string_def: "NumericString" size_def */ |
| 2093 |
#line 401 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2094 |
{ |
| 2095 |
(yyval.node) = NEW_NODE (TYPE_NUMERIC_STRING); |
| 2096 |
(yyval.node)->flags.has_size = 1; |
| 2097 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2098 |
} |
| 2099 |
#line 2100 "asn1-parse.c" |
| 2100 |
break; |
| 2101 |
|
| 2102 |
case 48: /* printable_string_def: "PrintableString" */ |
| 2103 |
#line 408 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2104 |
{ (yyval.node) = NEW_NODE (TYPE_PRINTABLE_STRING); } |
| 2105 |
#line 2106 "asn1-parse.c" |
| 2106 |
break; |
| 2107 |
|
| 2108 |
case 49: /* printable_string_def: "PrintableString" size_def */ |
| 2109 |
#line 410 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2110 |
{ |
| 2111 |
(yyval.node) = NEW_NODE (TYPE_PRINTABLE_STRING); |
| 2112 |
(yyval.node)->flags.has_size = 1; |
| 2113 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2114 |
} |
| 2115 |
#line 2116 "asn1-parse.c" |
| 2116 |
break; |
| 2117 |
|
| 2118 |
case 50: /* teletex_string_def: "TeletexString" */ |
| 2119 |
#line 417 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2120 |
{ (yyval.node) = NEW_NODE (TYPE_TELETEX_STRING); } |
| 2121 |
#line 2122 "asn1-parse.c" |
| 2122 |
break; |
| 2123 |
|
| 2124 |
case 51: /* teletex_string_def: "TeletexString" size_def */ |
| 2125 |
#line 419 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2126 |
{ |
| 2127 |
(yyval.node) = NEW_NODE (TYPE_TELETEX_STRING); |
| 2128 |
(yyval.node)->flags.has_size = 1; |
| 2129 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2130 |
} |
| 2131 |
#line 2132 "asn1-parse.c" |
| 2132 |
break; |
| 2133 |
|
| 2134 |
case 52: /* ia5_string_def: "IA5String" */ |
| 2135 |
#line 425 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2136 |
{ (yyval.node) = NEW_NODE (TYPE_IA5_STRING); } |
| 2137 |
#line 2138 "asn1-parse.c" |
| 2138 |
break; |
| 2139 |
|
| 2140 |
case 53: /* ia5_string_def: "IA5String" size_def */ |
| 2141 |
#line 427 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2142 |
{ |
| 2143 |
(yyval.node) = NEW_NODE (TYPE_IA5_STRING); |
| 2144 |
(yyval.node)->flags.has_size = 1; |
| 2145 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2146 |
} |
| 2147 |
#line 2148 "asn1-parse.c" |
| 2148 |
break; |
| 2149 |
|
| 2150 |
case 54: /* universal_string_def: "UniversalString" */ |
| 2151 |
#line 434 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2152 |
{ (yyval.node) = NEW_NODE (TYPE_UNIVERSAL_STRING); } |
| 2153 |
#line 2154 "asn1-parse.c" |
| 2154 |
break; |
| 2155 |
|
| 2156 |
case 55: /* universal_string_def: "UniversalString" size_def */ |
| 2157 |
#line 436 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2158 |
{ |
| 2159 |
(yyval.node) = NEW_NODE (TYPE_UNIVERSAL_STRING); |
| 2160 |
(yyval.node)->flags.has_size = 1; |
| 2161 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2162 |
} |
| 2163 |
#line 2164 "asn1-parse.c" |
| 2164 |
break; |
| 2165 |
|
| 2166 |
case 56: /* bmp_string_def: "BMPString" */ |
| 2167 |
#line 442 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2168 |
{ (yyval.node) = NEW_NODE (TYPE_BMP_STRING); } |
| 2169 |
#line 2170 "asn1-parse.c" |
| 2170 |
break; |
| 2171 |
|
| 2172 |
case 57: /* bmp_string_def: "BMPString" size_def */ |
| 2173 |
#line 444 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2174 |
{ |
| 2175 |
(yyval.node) = NEW_NODE (TYPE_BMP_STRING); |
| 2176 |
(yyval.node)->flags.has_size = 1; |
| 2177 |
set_down ((yyval.node),(yyvsp[0].node)); |
| 2178 |
} |
| 2179 |
#line 2180 "asn1-parse.c" |
| 2180 |
break; |
| 2181 |
|
| 2182 |
case 65: /* bit_element: IDENTIFIER '(' NUM ')' */ |
| 2183 |
#line 465 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2184 |
{ |
| 2185 |
(yyval.node) = NEW_NODE (TYPE_CONSTANT); |
| 2186 |
set_name ((yyval.node), (yyvsp[-3].str)); |
| 2187 |
set_str_value ((yyval.node), (yyvsp[-1].str)); |
| 2188 |
} |
| 2189 |
#line 2190 "asn1-parse.c" |
| 2190 |
break; |
| 2191 |
|
| 2192 |
case 66: /* bit_element_list: bit_element */ |
| 2193 |
#line 473 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2194 |
{ |
| 2195 |
(yyval.node)=(yyvsp[0].node); |
| 2196 |
} |
| 2197 |
#line 2198 "asn1-parse.c" |
| 2198 |
break; |
| 2199 |
|
| 2200 |
case 67: /* bit_element_list: bit_element_list ',' bit_element */ |
| 2201 |
#line 477 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2202 |
{ |
| 2203 |
(yyval.node)=(yyvsp[-2].node); |
| 2204 |
append_right ((yyval.node), (yyvsp[0].node)); |
| 2205 |
} |
| 2206 |
#line 2207 "asn1-parse.c" |
| 2207 |
break; |
| 2208 |
|
| 2209 |
case 68: /* bit_string_def: "BIT" "STRING" */ |
| 2210 |
#line 484 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2211 |
{ |
| 2212 |
(yyval.node) = NEW_NODE (TYPE_BIT_STRING); |
| 2213 |
} |
| 2214 |
#line 2215 "asn1-parse.c" |
| 2215 |
break; |
| 2216 |
|
| 2217 |
case 69: /* bit_string_def: "BIT" "STRING" '{' bit_element_list '}' */ |
| 2218 |
#line 488 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2219 |
{ |
| 2220 |
(yyval.node) = NEW_NODE (TYPE_BIT_STRING); |
| 2221 |
(yyval.node)->flags.has_list = 1; |
| 2222 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2223 |
} |
| 2224 |
#line 2225 "asn1-parse.c" |
| 2225 |
break; |
| 2226 |
|
| 2227 |
case 70: /* enumerated_def: "ENUMERATED" '{' bit_element_list '}' */ |
| 2228 |
#line 496 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2229 |
{ |
| 2230 |
(yyval.node) = NEW_NODE (TYPE_ENUMERATED); |
| 2231 |
(yyval.node)->flags.has_list = 1; |
| 2232 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2233 |
} |
| 2234 |
#line 2235 "asn1-parse.c" |
| 2235 |
break; |
| 2236 |
|
| 2237 |
case 71: /* object_def: "OBJECT" "IDENTIFIER" */ |
| 2238 |
#line 504 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2239 |
{ |
| 2240 |
(yyval.node) = NEW_NODE (TYPE_OBJECT_ID); |
| 2241 |
} |
| 2242 |
#line 2243 "asn1-parse.c" |
| 2243 |
break; |
| 2244 |
|
| 2245 |
case 72: /* type_assig_right: IDENTIFIER */ |
| 2246 |
#line 510 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2247 |
{ |
| 2248 |
(yyval.node) = NEW_NODE (TYPE_IDENTIFIER); |
| 2249 |
set_str_value ((yyval.node), (yyvsp[0].str)); |
| 2250 |
} |
| 2251 |
#line 2252 "asn1-parse.c" |
| 2252 |
break; |
| 2253 |
|
| 2254 |
case 73: /* type_assig_right: IDENTIFIER size_def */ |
| 2255 |
#line 515 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2256 |
{ |
| 2257 |
(yyval.node) = NEW_NODE (TYPE_IDENTIFIER); |
| 2258 |
(yyval.node)->flags.has_size = 1; |
| 2259 |
set_str_value ((yyval.node), (yyvsp[-1].str)); |
| 2260 |
set_down ((yyval.node), (yyvsp[0].node)); |
| 2261 |
} |
| 2262 |
#line 2263 "asn1-parse.c" |
| 2263 |
break; |
| 2264 |
|
| 2265 |
case 74: /* type_assig_right: integer_def */ |
| 2266 |
#line 521 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2267 |
{(yyval.node)=(yyvsp[0].node);} |
| 2268 |
#line 2269 "asn1-parse.c" |
| 2269 |
break; |
| 2270 |
|
| 2271 |
case 75: /* type_assig_right: enumerated_def */ |
| 2272 |
#line 522 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2273 |
{(yyval.node)=(yyvsp[0].node);} |
| 2274 |
#line 2275 "asn1-parse.c" |
| 2275 |
break; |
| 2276 |
|
| 2277 |
case 76: /* type_assig_right: boolean_def */ |
| 2278 |
#line 523 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2279 |
{(yyval.node)=(yyvsp[0].node);} |
| 2280 |
#line 2281 "asn1-parse.c" |
| 2281 |
break; |
| 2282 |
|
| 2283 |
case 77: /* type_assig_right: string_def */ |
| 2284 |
#line 524 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2285 |
{(yyval.node)=(yyvsp[0].node);} |
| 2286 |
#line 2287 "asn1-parse.c" |
| 2287 |
break; |
| 2288 |
|
| 2289 |
case 79: /* type_assig_right: octet_string_def */ |
| 2290 |
#line 526 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2291 |
{(yyval.node)=(yyvsp[0].node);} |
| 2292 |
#line 2293 "asn1-parse.c" |
| 2293 |
break; |
| 2294 |
|
| 2295 |
case 80: /* type_assig_right: bit_string_def */ |
| 2296 |
#line 527 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2297 |
{(yyval.node)=(yyvsp[0].node);} |
| 2298 |
#line 2299 "asn1-parse.c" |
| 2299 |
break; |
| 2300 |
|
| 2301 |
case 81: /* type_assig_right: sequence_def */ |
| 2302 |
#line 528 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2303 |
{(yyval.node)=(yyvsp[0].node);} |
| 2304 |
#line 2305 "asn1-parse.c" |
| 2305 |
break; |
| 2306 |
|
| 2307 |
case 82: /* type_assig_right: object_def */ |
| 2308 |
#line 529 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2309 |
{(yyval.node)=(yyvsp[0].node);} |
| 2310 |
#line 2311 "asn1-parse.c" |
| 2311 |
break; |
| 2312 |
|
| 2313 |
case 83: /* type_assig_right: choise_def */ |
| 2314 |
#line 530 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2315 |
{(yyval.node)=(yyvsp[0].node);} |
| 2316 |
#line 2317 "asn1-parse.c" |
| 2317 |
break; |
| 2318 |
|
| 2319 |
case 84: /* type_assig_right: any_def */ |
| 2320 |
#line 531 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2321 |
{(yyval.node)=(yyvsp[0].node);} |
| 2322 |
#line 2323 "asn1-parse.c" |
| 2323 |
break; |
| 2324 |
|
| 2325 |
case 85: /* type_assig_right: set_def */ |
| 2326 |
#line 532 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2327 |
{(yyval.node)=(yyvsp[0].node);} |
| 2328 |
#line 2329 "asn1-parse.c" |
| 2329 |
break; |
| 2330 |
|
| 2331 |
case 86: /* type_assig_right: "NULL" */ |
| 2332 |
#line 534 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2333 |
{ |
| 2334 |
(yyval.node) = NEW_NODE(TYPE_NULL); |
| 2335 |
} |
| 2336 |
#line 2337 "asn1-parse.c" |
| 2337 |
break; |
| 2338 |
|
| 2339 |
case 87: /* type_assig_right_tag: type_assig_right */ |
| 2340 |
#line 540 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2341 |
{ |
| 2342 |
(yyval.node) = (yyvsp[0].node); |
| 2343 |
} |
| 2344 |
#line 2345 "asn1-parse.c" |
| 2345 |
break; |
| 2346 |
|
| 2347 |
case 88: /* type_assig_right_tag: tag type_assig_right */ |
| 2348 |
#line 544 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2349 |
{ |
| 2350 |
/* $2->flags.has_tag = 1; */ |
| 2351 |
/* $$ = $2; */ |
| 2352 |
/* set_right ($1, $$->down ); */ |
| 2353 |
/* set_down ($$, $1); */ |
| 2354 |
(yyval.node) = (yyvsp[-1].node); |
| 2355 |
set_down ((yyval.node), (yyvsp[0].node)); |
| 2356 |
} |
| 2357 |
#line 2358 "asn1-parse.c" |
| 2358 |
break; |
| 2359 |
|
| 2360 |
case 89: /* type_assig_right_tag_default: type_assig_right_tag */ |
| 2361 |
#line 555 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2362 |
{ |
| 2363 |
(yyval.node) = (yyvsp[0].node); |
| 2364 |
} |
| 2365 |
#line 2366 "asn1-parse.c" |
| 2366 |
break; |
| 2367 |
|
| 2368 |
case 90: /* type_assig_right_tag_default: type_assig_right_tag default */ |
| 2369 |
#line 559 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2370 |
{ |
| 2371 |
(yyvsp[-1].node)->flags.has_default = 1; |
| 2372 |
(yyval.node) = (yyvsp[-1].node); |
| 2373 |
set_right ((yyvsp[0].node), (yyval.node)->down); |
| 2374 |
set_down ((yyval.node), (yyvsp[0].node)); |
| 2375 |
} |
| 2376 |
#line 2377 "asn1-parse.c" |
| 2377 |
break; |
| 2378 |
|
| 2379 |
case 91: /* type_assig_right_tag_default: type_assig_right_tag "OPTIONAL" */ |
| 2380 |
#line 566 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2381 |
{ |
| 2382 |
(yyvsp[-1].node)->flags.is_optional = 1; |
| 2383 |
(yyval.node) = (yyvsp[-1].node); |
| 2384 |
} |
| 2385 |
#line 2386 "asn1-parse.c" |
| 2386 |
break; |
| 2387 |
|
| 2388 |
case 92: /* type_assig: IDENTIFIER type_assig_right_tag_default */ |
| 2389 |
#line 573 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2390 |
{ |
| 2391 |
set_name ((yyvsp[0].node), (yyvsp[-1].str)); |
| 2392 |
(yyval.node) = (yyvsp[0].node); |
| 2393 |
} |
| 2394 |
#line 2395 "asn1-parse.c" |
| 2395 |
break; |
| 2396 |
|
| 2397 |
case 93: /* type_assig_list: type_assig */ |
| 2398 |
#line 580 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2399 |
{ (yyval.node)=(yyvsp[0].node); } |
| 2400 |
#line 2401 "asn1-parse.c" |
| 2401 |
break; |
| 2402 |
|
| 2403 |
case 94: /* type_assig_list: type_assig_list ',' type_assig */ |
| 2404 |
#line 582 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2405 |
{ |
| 2406 |
(yyval.node)=(yyvsp[-2].node); |
| 2407 |
append_right ((yyval.node), (yyvsp[0].node)); |
| 2408 |
} |
| 2409 |
#line 2410 "asn1-parse.c" |
| 2410 |
break; |
| 2411 |
|
| 2412 |
case 95: /* sequence_def: "SEQUENCE" '{' type_assig_list '}' */ |
| 2413 |
#line 589 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2414 |
{ |
| 2415 |
(yyval.node) = NEW_NODE (TYPE_SEQUENCE); |
| 2416 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2417 |
} |
| 2418 |
#line 2419 "asn1-parse.c" |
| 2419 |
break; |
| 2420 |
|
| 2421 |
case 96: /* sequence_def: "SEQUENCE" "OF" type_assig_right */ |
| 2422 |
#line 594 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2423 |
{ |
| 2424 |
(yyval.node) = NEW_NODE (TYPE_SEQUENCE_OF); |
| 2425 |
set_down ((yyval.node), (yyvsp[0].node)); |
| 2426 |
} |
| 2427 |
#line 2428 "asn1-parse.c" |
| 2428 |
break; |
| 2429 |
|
| 2430 |
case 97: /* sequence_def: "SEQUENCE" size_def "OF" type_assig_right */ |
| 2431 |
#line 599 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2432 |
{ |
| 2433 |
(yyval.node) = NEW_NODE (TYPE_SEQUENCE_OF); |
| 2434 |
(yyval.node)->flags.has_size = 1; |
| 2435 |
set_right ((yyvsp[-2].node),(yyvsp[0].node)); |
| 2436 |
set_down ((yyval.node),(yyvsp[-2].node)); |
| 2437 |
} |
| 2438 |
#line 2439 "asn1-parse.c" |
| 2439 |
break; |
| 2440 |
|
| 2441 |
case 98: /* set_def: "SET" '{' type_assig_list '}' */ |
| 2442 |
#line 608 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2443 |
{ |
| 2444 |
(yyval.node) = NEW_NODE (TYPE_SET); |
| 2445 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2446 |
} |
| 2447 |
#line 2448 "asn1-parse.c" |
| 2448 |
break; |
| 2449 |
|
| 2450 |
case 99: /* set_def: "SET" "OF" type_assig_right */ |
| 2451 |
#line 613 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2452 |
{ |
| 2453 |
(yyval.node) = NEW_NODE (TYPE_SET_OF); |
| 2454 |
set_down ((yyval.node), (yyvsp[0].node)); |
| 2455 |
} |
| 2456 |
#line 2457 "asn1-parse.c" |
| 2457 |
break; |
| 2458 |
|
| 2459 |
case 100: /* set_def: "SET" size_def "OF" type_assig_right */ |
| 2460 |
#line 618 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2461 |
{ |
| 2462 |
(yyval.node) = NEW_NODE (TYPE_SET_OF); |
| 2463 |
(yyval.node)->flags.has_size = 1; |
| 2464 |
set_right ((yyvsp[-2].node), (yyvsp[0].node)); |
| 2465 |
set_down ((yyval.node), (yyvsp[-2].node)); |
| 2466 |
} |
| 2467 |
#line 2468 "asn1-parse.c" |
| 2468 |
break; |
| 2469 |
|
| 2470 |
case 101: /* choise_def: "CHOICE" '{' type_assig_list '}' */ |
| 2471 |
#line 627 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2472 |
{ |
| 2473 |
(yyval.node) = NEW_NODE (TYPE_CHOICE); |
| 2474 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2475 |
} |
| 2476 |
#line 2477 "asn1-parse.c" |
| 2477 |
break; |
| 2478 |
|
| 2479 |
case 102: /* any_def: "ANY" */ |
| 2480 |
#line 634 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2481 |
{ |
| 2482 |
(yyval.node) = NEW_NODE (TYPE_ANY); |
| 2483 |
} |
| 2484 |
#line 2485 "asn1-parse.c" |
| 2485 |
break; |
| 2486 |
|
| 2487 |
case 103: /* any_def: "ANY" "DEFINED" "BY" IDENTIFIER */ |
| 2488 |
#line 638 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2489 |
{ |
| 2490 |
AsnNode node; |
| 2491 |
|
| 2492 |
(yyval.node) = NEW_NODE (TYPE_ANY); |
| 2493 |
(yyval.node)->flags.has_defined_by = 1; |
| 2494 |
node = NEW_NODE (TYPE_CONSTANT); |
| 2495 |
set_name (node, (yyvsp[0].str)); |
| 2496 |
set_down((yyval.node), node); |
| 2497 |
} |
| 2498 |
#line 2499 "asn1-parse.c" |
| 2499 |
break; |
| 2500 |
|
| 2501 |
case 104: /* type_def: IDENTIFIER "::=" type_assig_right_tag */ |
| 2502 |
#line 650 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2503 |
{ |
| 2504 |
set_name ((yyvsp[0].node), (yyvsp[-2].str)); |
| 2505 |
(yyval.node) = (yyvsp[0].node); |
| 2506 |
} |
| 2507 |
#line 2508 "asn1-parse.c" |
| 2508 |
break; |
| 2509 |
|
| 2510 |
case 105: /* constant_def: IDENTIFIER "OBJECT" "IDENTIFIER" "::=" '{' obj_constant_list '}' */ |
| 2511 |
#line 657 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2512 |
{ |
| 2513 |
(yyval.node) = NEW_NODE (TYPE_OBJECT_ID); |
| 2514 |
(yyval.node)->flags.assignment = 1; |
| 2515 |
set_name ((yyval.node), (yyvsp[-6].str)); |
| 2516 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2517 |
} |
| 2518 |
#line 2519 "asn1-parse.c" |
| 2519 |
break; |
| 2520 |
|
| 2521 |
case 106: /* constant_def: IDENTIFIER IDENTIFIER "::=" '{' obj_constant_list '}' */ |
| 2522 |
#line 664 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2523 |
{ |
| 2524 |
(yyval.node) = NEW_NODE (TYPE_OBJECT_ID); |
| 2525 |
(yyval.node)->flags.assignment = 1; |
| 2526 |
(yyval.node)->flags.one_param = 1; |
| 2527 |
set_name ((yyval.node), (yyvsp[-5].str)); |
| 2528 |
set_str_value ((yyval.node), (yyvsp[-4].str)); |
| 2529 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2530 |
} |
| 2531 |
#line 2532 "asn1-parse.c" |
| 2532 |
break; |
| 2533 |
|
| 2534 |
case 107: /* constant_def: IDENTIFIER "INTEGER" "::=" NUM */ |
| 2535 |
#line 673 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2536 |
{ |
| 2537 |
(yyval.node) = NEW_NODE (TYPE_INTEGER); |
| 2538 |
(yyval.node)->flags.assignment = 1; |
| 2539 |
set_name ((yyval.node), (yyvsp[-3].str)); |
| 2540 |
set_str_value ((yyval.node), (yyvsp[0].str)); |
| 2541 |
} |
| 2542 |
#line 2543 "asn1-parse.c" |
| 2543 |
break; |
| 2544 |
|
| 2545 |
case 108: /* type_constant: type_def */ |
| 2546 |
#line 681 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2547 |
{ (yyval.node) = (yyvsp[0].node); } |
| 2548 |
#line 2549 "asn1-parse.c" |
| 2549 |
break; |
| 2550 |
|
| 2551 |
case 109: /* type_constant: constant_def */ |
| 2552 |
#line 682 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2553 |
{ (yyval.node) = (yyvsp[0].node); } |
| 2554 |
#line 2555 "asn1-parse.c" |
| 2555 |
break; |
| 2556 |
|
| 2557 |
case 110: /* type_constant_list: type_constant */ |
| 2558 |
#line 686 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2559 |
{ (yyval.node) = (yyvsp[0].node); } |
| 2560 |
#line 2561 "asn1-parse.c" |
| 2561 |
break; |
| 2562 |
|
| 2563 |
case 111: /* type_constant_list: type_constant_list type_constant */ |
| 2564 |
#line 688 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2565 |
{ |
| 2566 |
(yyval.node) = (yyvsp[-1].node); |
| 2567 |
append_right ((yyval.node), (yyvsp[0].node)); |
| 2568 |
} |
| 2569 |
#line 2570 "asn1-parse.c" |
| 2570 |
break; |
| 2571 |
|
| 2572 |
case 112: /* definitions_id: IDENTIFIER '{' obj_constant_list '}' */ |
| 2573 |
#line 695 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2574 |
{ |
| 2575 |
(yyval.node) = NEW_NODE (TYPE_OBJECT_ID); |
| 2576 |
set_down ((yyval.node), (yyvsp[-1].node)); |
| 2577 |
set_name ((yyval.node), (yyvsp[-3].str)); |
| 2578 |
} |
| 2579 |
#line 2580 "asn1-parse.c" |
| 2580 |
break; |
| 2581 |
|
| 2582 |
case 113: /* imports_def: %empty */ |
| 2583 |
#line 703 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2584 |
{ (yyval.node)=NULL;} |
| 2585 |
#line 2586 "asn1-parse.c" |
| 2586 |
break; |
| 2587 |
|
| 2588 |
case 114: /* explicit_implicit: "EXPLICIT" */ |
| 2589 |
#line 719 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2590 |
{ (yyval.constant) = CONST_EXPLICIT; } |
| 2591 |
#line 2592 "asn1-parse.c" |
| 2592 |
break; |
| 2593 |
|
| 2594 |
case 115: /* explicit_implicit: "IMPLICIT" */ |
| 2595 |
#line 720 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2596 |
{ (yyval.constant) = CONST_IMPLICIT; } |
| 2597 |
#line 2598 "asn1-parse.c" |
| 2598 |
break; |
| 2599 |
|
| 2600 |
case 116: /* definitions: definitions_id "DEFINITIONS" explicit_implicit "TAGS" "::=" "BEGIN" imports_def type_constant_list "END" */ |
| 2601 |
#line 726 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2602 |
{ |
| 2603 |
AsnNode node; |
| 2604 |
|
| 2605 |
(yyval.node) = node = NEW_NODE (TYPE_DEFINITIONS); |
| 2606 |
|
| 2607 |
if ((yyvsp[-6].constant) == CONST_EXPLICIT) |
| 2608 |
node->flags.explicit = 1; |
| 2609 |
else if ((yyvsp[-6].constant) == CONST_IMPLICIT) |
| 2610 |
node->flags.implicit = 1; |
| 2611 |
|
| 2612 |
if ((yyvsp[-2].node)) |
| 2613 |
node->flags.has_imports = 1; |
| 2614 |
|
| 2615 |
set_name ((yyval.node), (yyvsp[-8].node)->name); |
| 2616 |
set_name ((yyvsp[-8].node), ""); |
| 2617 |
|
| 2618 |
if (!node->flags.has_imports) |
| 2619 |
set_right ((yyvsp[-8].node),(yyvsp[-1].node)); |
| 2620 |
else |
| 2621 |
{ |
| 2622 |
set_right ((yyvsp[-2].node),(yyvsp[-1].node)); |
| 2623 |
set_right ((yyvsp[-8].node),(yyvsp[-2].node)); |
| 2624 |
} |
| 2625 |
|
| 2626 |
set_down ((yyval.node), (yyvsp[-8].node)); |
| 2627 |
|
| 2628 |
_ksba_asn_set_default_tag ((yyval.node)); |
| 2629 |
_ksba_asn_type_set_config ((yyval.node)); |
| 2630 |
PARSECTL->result_parse = _ksba_asn_check_identifier((yyval.node)); |
| 2631 |
PARSECTL->parse_tree=(yyval.node); |
| 2632 |
} |
| 2633 |
#line 2634 "asn1-parse.c" |
| 2634 |
break; |
| 2635 |
|
| 2636 |
|
| 2637 |
#line 2638 "asn1-parse.c" |
| 2638 |
|
| 2639 |
default: break; |
| 2640 |
} |
| 2641 |
/* User semantic actions sometimes alter yychar, and that requires |
| 2642 |
that yytoken be updated with the new translation. We take the |
| 2643 |
approach of translating immediately before every use of yytoken. |
| 2644 |
One alternative is translating here after every semantic action, |
| 2645 |
but that translation would be missed if the semantic action invokes |
| 2646 |
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or |
| 2647 |
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an |
| 2648 |
incorrect destructor might then be invoked immediately. In the |
| 2649 |
case of YYERROR or YYBACKUP, subsequent parser actions might lead |
| 2650 |
to an incorrect destructor call or verbose syntax error message |
| 2651 |
before the lookahead is translated. */ |
| 2652 |
YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); |
| 2653 |
|
| 2654 |
YYPOPSTACK (yylen); |
| 2655 |
yylen = 0; |
| 2656 |
|
| 2657 |
*++yyvsp = yyval; |
| 2658 |
|
| 2659 |
/* Now 'shift' the result of the reduction. Determine what state |
| 2660 |
that goes to, based on the state we popped back to and the rule |
| 2661 |
number reduced by. */ |
| 2662 |
{ |
| 2663 |
const int yylhs = yyr1[yyn] - YYNTOKENS; |
| 2664 |
const int yyi = yypgoto[yylhs] + *yyssp; |
| 2665 |
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp |
| 2666 |
? yytable[yyi] |
| 2667 |
: yydefgoto[yylhs]); |
| 2668 |
} |
| 2669 |
|
| 2670 |
goto yynewstate; |
| 2671 |
|
| 2672 |
|
| 2673 |
/*--------------------------------------. |
| 2674 |
| yyerrlab -- here on detecting error. | |
| 2675 |
`--------------------------------------*/ |
| 2676 |
yyerrlab: |
| 2677 |
/* Make sure we have latest lookahead translation. See comments at |
| 2678 |
user semantic actions for why this is necessary. */ |
| 2679 |
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); |
| 2680 |
/* If not already recovering from an error, report this error. */ |
| 2681 |
if (!yyerrstatus) |
| 2682 |
{ |
| 2683 |
++yynerrs; |
| 2684 |
{ |
| 2685 |
yypcontext_t yyctx |
| 2686 |
= {yyssp, yytoken}; |
| 2687 |
char const *yymsgp = YY_("syntax error"); |
| 2688 |
int yysyntax_error_status; |
| 2689 |
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
| 2690 |
if (yysyntax_error_status == 0) |
| 2691 |
yymsgp = yymsg; |
| 2692 |
else if (yysyntax_error_status == -1) |
| 2693 |
{ |
| 2694 |
if (yymsg != yymsgbuf) |
| 2695 |
YYSTACK_FREE (yymsg); |
| 2696 |
yymsg = YY_CAST (char *, |
| 2697 |
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); |
| 2698 |
if (yymsg) |
| 2699 |
{ |
| 2700 |
yysyntax_error_status |
| 2701 |
= yysyntax_error (&yymsg_alloc, &yymsg, &yyctx); |
| 2702 |
yymsgp = yymsg; |
| 2703 |
} |
| 2704 |
else |
| 2705 |
{ |
| 2706 |
yymsg = yymsgbuf; |
| 2707 |
yymsg_alloc = sizeof yymsgbuf; |
| 2708 |
yysyntax_error_status = YYENOMEM; |
| 2709 |
} |
| 2710 |
} |
| 2711 |
yyerror (parm, yymsgp); |
| 2712 |
if (yysyntax_error_status == YYENOMEM) |
| 2713 |
YYNOMEM; |
| 2714 |
} |
| 2715 |
} |
| 2716 |
|
| 2717 |
if (yyerrstatus == 3) |
| 2718 |
{ |
| 2719 |
/* If just tried and failed to reuse lookahead token after an |
| 2720 |
error, discard it. */ |
| 2721 |
|
| 2722 |
if (yychar <= YYEOF) |
| 2723 |
{ |
| 2724 |
/* Return failure if at end of input. */ |
| 2725 |
if (yychar == YYEOF) |
| 2726 |
YYABORT; |
| 2727 |
} |
| 2728 |
else |
| 2729 |
{ |
| 2730 |
yydestruct ("Error: discarding", |
| 2731 |
yytoken, &yylval, parm); |
| 2732 |
yychar = YYEMPTY; |
| 2733 |
} |
| 2734 |
} |
| 2735 |
|
| 2736 |
/* Else will try to reuse lookahead token after shifting the error |
| 2737 |
token. */ |
| 2738 |
goto yyerrlab1; |
| 2739 |
|
| 2740 |
|
| 2741 |
/*---------------------------------------------------. |
| 2742 |
| yyerrorlab -- error raised explicitly by YYERROR. | |
| 2743 |
`---------------------------------------------------*/ |
| 2744 |
yyerrorlab: |
| 2745 |
/* Pacify compilers when the user code never invokes YYERROR and the |
| 2746 |
label yyerrorlab therefore never appears in user code. */ |
| 2747 |
if (0) |
| 2748 |
YYERROR; |
| 2749 |
++yynerrs; |
| 2750 |
|
| 2751 |
/* Do not reclaim the symbols of the rule whose action triggered |
| 2752 |
this YYERROR. */ |
| 2753 |
YYPOPSTACK (yylen); |
| 2754 |
yylen = 0; |
| 2755 |
YY_STACK_PRINT (yyss, yyssp); |
| 2756 |
yystate = *yyssp; |
| 2757 |
goto yyerrlab1; |
| 2758 |
|
| 2759 |
|
| 2760 |
/*-------------------------------------------------------------. |
| 2761 |
| yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 2762 |
`-------------------------------------------------------------*/ |
| 2763 |
yyerrlab1: |
| 2764 |
yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 2765 |
|
| 2766 |
/* Pop stack until we find a state that shifts the error token. */ |
| 2767 |
for (;;) |
| 2768 |
{ |
| 2769 |
yyn = yypact[yystate]; |
| 2770 |
if (!yypact_value_is_default (yyn)) |
| 2771 |
{ |
| 2772 |
yyn += YYSYMBOL_YYerror; |
| 2773 |
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) |
| 2774 |
{ |
| 2775 |
yyn = yytable[yyn]; |
| 2776 |
if (0 < yyn) |
| 2777 |
break; |
| 2778 |
} |
| 2779 |
} |
| 2780 |
|
| 2781 |
/* Pop the current state because it cannot handle the error token. */ |
| 2782 |
if (yyssp == yyss) |
| 2783 |
YYABORT; |
| 2784 |
|
| 2785 |
|
| 2786 |
yydestruct ("Error: popping", |
| 2787 |
YY_ACCESSING_SYMBOL (yystate), yyvsp, parm); |
| 2788 |
YYPOPSTACK (1); |
| 2789 |
yystate = *yyssp; |
| 2790 |
YY_STACK_PRINT (yyss, yyssp); |
| 2791 |
} |
| 2792 |
|
| 2793 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN |
| 2794 |
*++yyvsp = yylval; |
| 2795 |
YY_IGNORE_MAYBE_UNINITIALIZED_END |
| 2796 |
|
| 2797 |
|
| 2798 |
/* Shift the error token. */ |
| 2799 |
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); |
| 2800 |
|
| 2801 |
yystate = yyn; |
| 2802 |
goto yynewstate; |
| 2803 |
|
| 2804 |
|
| 2805 |
/*-------------------------------------. |
| 2806 |
| yyacceptlab -- YYACCEPT comes here. | |
| 2807 |
`-------------------------------------*/ |
| 2808 |
yyacceptlab: |
| 2809 |
yyresult = 0; |
| 2810 |
goto yyreturnlab; |
| 2811 |
|
| 2812 |
|
| 2813 |
/*-----------------------------------. |
| 2814 |
| yyabortlab -- YYABORT comes here. | |
| 2815 |
`-----------------------------------*/ |
| 2816 |
yyabortlab: |
| 2817 |
yyresult = 1; |
| 2818 |
goto yyreturnlab; |
| 2819 |
|
| 2820 |
|
| 2821 |
/*-----------------------------------------------------------. |
| 2822 |
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | |
| 2823 |
`-----------------------------------------------------------*/ |
| 2824 |
yyexhaustedlab: |
| 2825 |
yyerror (parm, YY_("memory exhausted")); |
| 2826 |
yyresult = 2; |
| 2827 |
goto yyreturnlab; |
| 2828 |
|
| 2829 |
|
| 2830 |
/*----------------------------------------------------------. |
| 2831 |
| yyreturnlab -- parsing is finished, clean up and return. | |
| 2832 |
`----------------------------------------------------------*/ |
| 2833 |
yyreturnlab: |
| 2834 |
if (yychar != YYEMPTY) |
| 2835 |
{ |
| 2836 |
/* Make sure we have latest lookahead translation. See comments at |
| 2837 |
user semantic actions for why this is necessary. */ |
| 2838 |
yytoken = YYTRANSLATE (yychar); |
| 2839 |
yydestruct ("Cleanup: discarding lookahead", |
| 2840 |
yytoken, &yylval, parm); |
| 2841 |
} |
| 2842 |
/* Do not reclaim the symbols of the rule whose action triggered |
| 2843 |
this YYABORT or YYACCEPT. */ |
| 2844 |
YYPOPSTACK (yylen); |
| 2845 |
YY_STACK_PRINT (yyss, yyssp); |
| 2846 |
while (yyssp != yyss) |
| 2847 |
{ |
| 2848 |
yydestruct ("Cleanup: popping", |
| 2849 |
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parm); |
| 2850 |
YYPOPSTACK (1); |
| 2851 |
} |
| 2852 |
#ifndef yyoverflow |
| 2853 |
if (yyss != yyssa) |
| 2854 |
YYSTACK_FREE (yyss); |
| 2855 |
#endif |
| 2856 |
if (yymsg != yymsgbuf) |
| 2857 |
YYSTACK_FREE (yymsg); |
| 2858 |
return yyresult; |
| 2859 |
} |
| 2860 |
|
| 2861 |
#line 759 "/home/wk/s/libksba/src/asn1-parse.y" |
| 2862 |
|
| 2863 |
|
| 2864 |
|
| 2865 |
struct token_table_s { |
| 2866 |
const char *word; |
| 2867 |
int token; |
| 2868 |
}; |
| 2869 |
|
| 2870 |
static struct token_table_s token_table[] = { |
| 2871 |
{ "::=", ASSIG }, |
| 2872 |
{ "ANY", ANY }, |
| 2873 |
{ "APPLICATION", APPLICATION }, |
| 2874 |
{ "BEGIN", ksba_BEGIN }, |
| 2875 |
{ "BIT", BIT }, |
| 2876 |
{ "BMPString", BMPSTRING }, |
| 2877 |
{ "BOOLEAN", ksba_BOOLEAN }, |
| 2878 |
{ "BY", BY }, |
| 2879 |
{ "CHOICE", CHOICE }, |
| 2880 |
{ "DEFAULT", DEFAULT }, |
| 2881 |
{ "DEFINED", DEFINED }, |
| 2882 |
{ "DEFINITIONS", DEFINITIONS }, |
| 2883 |
{ "END", ksba_END }, |
| 2884 |
{ "ENUMERATED", ENUMERATED }, |
| 2885 |
{ "EXPLICIT", EXPLICIT }, |
| 2886 |
{ "FALSE", ksba_FALSE }, |
| 2887 |
{ "FROM", FROM }, |
| 2888 |
{ "GeneralizedTime", GeneralizedTime }, |
| 2889 |
{ "IA5String", IA5STRING }, |
| 2890 |
{ "IDENTIFIER", STR_IDENTIFIER }, |
| 2891 |
{ "IMPLICIT", IMPLICIT }, |
| 2892 |
{ "IMPORTS", IMPORTS }, |
| 2893 |
{ "INTEGER", INTEGER }, |
| 2894 |
{ "NULL", TOKEN_NULL }, |
| 2895 |
{ "NumericString", NUMERICSTRING }, |
| 2896 |
{ "OBJECT", OBJECT }, |
| 2897 |
{ "OCTET", OCTET }, |
| 2898 |
{ "OF", OF }, |
| 2899 |
{ "OPTIONAL", OPTIONAL }, |
| 2900 |
{ "PRIVATE", PRIVATE }, |
| 2901 |
{ "PrintableString", PRINTABLESTRING }, |
| 2902 |
{ "SEQUENCE", SEQUENCE }, |
| 2903 |
{ "SET", SET }, |
| 2904 |
{ "SIZE", SIZE }, |
| 2905 |
{ "STRING", STRING }, |
| 2906 |
{ "TAGS", TAGS }, |
| 2907 |
{ "TRUE", ksba_TRUE }, |
| 2908 |
{ "TeletexString", TELETEXSTRING }, |
| 2909 |
{ "UNIVERSAL", UNIVERSAL }, |
| 2910 |
{ "UTCTime", UTCTime }, |
| 2911 |
{ "UTF8String", UTF8STRING }, |
| 2912 |
{ "UniversalString", UNIVERSALSTRING }, |
| 2913 |
}; |
| 2914 |
|
| 2915 |
/*************************************************************/ |
| 2916 |
/* Function: yylex */ |
| 2917 |
/* Description: looks for tokens in file_asn1 pointer file. */ |
| 2918 |
/* Return: int */ |
| 2919 |
/* Token identifier or ASCII code or 0(zero: End Of File) */ |
| 2920 |
/*************************************************************/ |
| 2921 |
static int |
| 2922 |
yylex (YYSTYPE *lvalp, void *parm) |
| 2923 |
{ |
| 2924 |
int c,counter=0,k; |
| 2925 |
char string[MAX_STRING_LENGTH]; |
| 2926 |
FILE *fp = PARSECTL->fp; |
| 2927 |
|
| 2928 |
if (!PARSECTL->lineno) |
| 2929 |
PARSECTL->lineno++; /* start with line one */ |
| 2930 |
|
| 2931 |
while (1) |
| 2932 |
{ |
| 2933 |
while ( (c=fgetc (fp))==' ' || c=='\t') |
| 2934 |
; |
| 2935 |
if (c =='\n') |
| 2936 |
{ |
| 2937 |
PARSECTL->lineno++; |
| 2938 |
continue; |
| 2939 |
} |
| 2940 |
if(c==EOF) |
| 2941 |
return 0; |
| 2942 |
|
| 2943 |
if ( c=='(' || c==')' || c=='[' || c==']' |
| 2944 |
|| c=='{' || c=='}' || c==',' || c=='.' || c=='+') |
| 2945 |
return c; |
| 2946 |
|
| 2947 |
if (c=='-') |
| 2948 |
{ |
| 2949 |
if ( (c=fgetc(fp))!='-') |
| 2950 |
{ |
| 2951 |
ungetc(c,fp); |
| 2952 |
return '-'; |
| 2953 |
} |
| 2954 |
else |
| 2955 |
{ |
| 2956 |
/* A comment finishes at the end of line */ |
| 2957 |
counter=0; |
| 2958 |
while ( (c=fgetc(fp))!=EOF && c != '\n' ) |
| 2959 |
; |
| 2960 |
if (c==EOF) |
| 2961 |
return 0; |
| 2962 |
else |
| 2963 |
continue; /* repeat the search */ |
| 2964 |
} |
| 2965 |
} |
| 2966 |
|
| 2967 |
do |
| 2968 |
{ |
| 2969 |
if (counter >= DIM (string)-1 ) |
| 2970 |
{ |
| 2971 |
fprintf (stderr,"%s:%d: token too long\n", "myfile:", |
| 2972 |
PARSECTL->lineno); |
| 2973 |
return 0; /* EOF */ |
| 2974 |
} |
| 2975 |
string[counter++]=c; |
| 2976 |
} |
| 2977 |
while ( !((c=fgetc(fp))==EOF |
| 2978 |
|| c==' '|| c=='\t' || c=='\n' |
| 2979 |
|| c=='(' || c==')' || c=='[' || c==']' |
| 2980 |
|| c=='{' || c=='}' || c==',' || c=='.')); |
| 2981 |
|
| 2982 |
ungetc (c,fp); |
| 2983 |
string[counter]=0; |
| 2984 |
/*fprintf (stderr, "yylex token `%s'\n", string);*/ |
| 2985 |
|
| 2986 |
/* Is STRING a number? */ |
| 2987 |
for (k=0; k<counter; k++) |
| 2988 |
{ |
| 2989 |
if(!isdigit(string[k])) |
| 2990 |
break; |
| 2991 |
} |
| 2992 |
if (k>=counter) |
| 2993 |
{ |
| 2994 |
strcpy (lvalp->str,string); |
| 2995 |
if (PARSECTL->debug) |
| 2996 |
fprintf (stderr,"%d: yylex found number `%s'\n", |
| 2997 |
PARSECTL->lineno, string); |
| 2998 |
return NUM; |
| 2999 |
} |
| 3000 |
|
| 3001 |
/* Is STRING a keyword? */ |
| 3002 |
for (k = 0; k < DIM (token_table); k++) |
| 3003 |
{ |
| 3004 |
if (!strcmp (token_table[k].word, string)) |
| 3005 |
return token_table[k].token; |
| 3006 |
} |
| 3007 |
|
| 3008 |
/* STRING is an IDENTIFIER */ |
| 3009 |
strcpy(lvalp->str,string); |
| 3010 |
if (PARSECTL->debug) |
| 3011 |
fprintf (stderr,"%d: yylex found identifier `%s'\n", |
| 3012 |
PARSECTL->lineno, string); |
| 3013 |
return IDENTIFIER; |
| 3014 |
} |
| 3015 |
} |
| 3016 |
|
| 3017 |
static void |
| 3018 |
yyerror (void *parm, const char *s) |
| 3019 |
{ |
| 3020 |
(void)parm; |
| 3021 |
/* Sends the error description to stderr */ |
| 3022 |
fprintf (stderr, "%s\n", s); |
| 3023 |
/* Why doesn't bison provide a way to pass the parm to yyerror? |
| 3024 |
Update: Newer bison versions allow for this. We need to see how |
| 3025 |
we can make use of it. */ |
| 3026 |
} |
| 3027 |
|
| 3028 |
|
| 3029 |
|
| 3030 |
static AsnNode |
| 3031 |
new_node (struct parser_control_s *parsectl, node_type_t type) |
| 3032 |
{ |
| 3033 |
AsnNode node; |
| 3034 |
|
| 3035 |
node = xcalloc (1, sizeof *node); |
| 3036 |
node->type = type; |
| 3037 |
node->off = -1; |
| 3038 |
node->link_next = parsectl->all_nodes; |
| 3039 |
parsectl->all_nodes = node; |
| 3040 |
|
| 3041 |
return node; |
| 3042 |
} |
| 3043 |
|
| 3044 |
static void |
| 3045 |
release_all_nodes (AsnNode node) |
| 3046 |
{ |
| 3047 |
AsnNode node2; |
| 3048 |
|
| 3049 |
for (; node; node = node2) |
| 3050 |
{ |
| 3051 |
node2 = node->link_next; |
| 3052 |
xfree (node->name); |
| 3053 |
|
| 3054 |
if (node->valuetype == VALTYPE_CSTR) |
| 3055 |
xfree (node->value.v_cstr); |
| 3056 |
else if (node->valuetype == VALTYPE_MEM) |
| 3057 |
xfree (node->value.v_mem.buf); |
| 3058 |
|
| 3059 |
xfree (node); |
| 3060 |
} |
| 3061 |
} |
| 3062 |
|
| 3063 |
static void |
| 3064 |
set_name (AsnNode node, const char *name) |
| 3065 |
{ |
| 3066 |
_ksba_asn_set_name (node, name); |
| 3067 |
} |
| 3068 |
|
| 3069 |
static void |
| 3070 |
set_str_value (AsnNode node, const char *text) |
| 3071 |
{ |
| 3072 |
if (text && *text) |
| 3073 |
_ksba_asn_set_value (node, VALTYPE_CSTR, text, 0); |
| 3074 |
else |
| 3075 |
_ksba_asn_set_value (node, VALTYPE_NULL, NULL, 0); |
| 3076 |
} |
| 3077 |
|
| 3078 |
static void |
| 3079 |
set_ulong_value (AsnNode node, const char *text) |
| 3080 |
{ |
| 3081 |
unsigned long val; |
| 3082 |
|
| 3083 |
if (text && *text) |
| 3084 |
val = strtoul (text, NULL, 10); |
| 3085 |
else |
| 3086 |
val = 0; |
| 3087 |
_ksba_asn_set_value (node, VALTYPE_ULONG, &val, sizeof(val)); |
| 3088 |
} |
| 3089 |
|
| 3090 |
static void |
| 3091 |
set_right (AsnNode node, AsnNode right) |
| 3092 |
{ |
| 3093 |
return_if_fail (node); |
| 3094 |
|
| 3095 |
node->right = right; |
| 3096 |
if (right) |
| 3097 |
right->left = node; |
| 3098 |
} |
| 3099 |
|
| 3100 |
static void |
| 3101 |
append_right (AsnNode node, AsnNode right) |
| 3102 |
{ |
| 3103 |
return_if_fail (node); |
| 3104 |
|
| 3105 |
while (node->right) |
| 3106 |
node = node->right; |
| 3107 |
|
| 3108 |
node->right = right; |
| 3109 |
if (right) |
| 3110 |
right->left = node; |
| 3111 |
} |
| 3112 |
|
| 3113 |
|
| 3114 |
static void |
| 3115 |
set_down (AsnNode node, AsnNode down) |
| 3116 |
{ |
| 3117 |
return_if_fail (node); |
| 3118 |
|
| 3119 |
node->down = down; |
| 3120 |
if (down) |
| 3121 |
down->left = node; |
| 3122 |
} |
| 3123 |
|
| 3124 |
|
| 3125 |
/** |
| 3126 |
* ksba_asn_parse_file: |
| 3127 |
* @file_name: Filename with the ASN module |
| 3128 |
* @pointer: Returns the syntax tree |
| 3129 |
* @debug: Enable debug output |
| 3130 |
* |
| 3131 |
* Parse an ASN.1 file and return an syntax tree. |
| 3132 |
* |
| 3133 |
* Return value: 0 for okay or an ASN_xx error code |
| 3134 |
**/ |
| 3135 |
int |
| 3136 |
ksba_asn_parse_file (const char *file_name, ksba_asn_tree_t *result, int debug) |
| 3137 |
{ |
| 3138 |
struct parser_control_s parsectl; |
| 3139 |
|
| 3140 |
*result = NULL; |
| 3141 |
|
| 3142 |
parsectl.fp = file_name? fopen (file_name, "r") : NULL; |
| 3143 |
if ( !parsectl.fp ) |
| 3144 |
return gpg_error_from_syserror (); |
| 3145 |
|
| 3146 |
parsectl.lineno = 0; |
| 3147 |
parsectl.debug = debug; |
| 3148 |
parsectl.result_parse = gpg_error (GPG_ERR_SYNTAX); |
| 3149 |
parsectl.parse_tree = NULL; |
| 3150 |
parsectl.all_nodes = NULL; |
| 3151 |
/* yydebug = 1; */ |
| 3152 |
if ( yyparse ((void*)&parsectl) || parsectl.result_parse ) |
| 3153 |
{ /* error */ |
| 3154 |
fprintf (stderr, "%s:%d: parse error\n", |
| 3155 |
file_name?file_name:"-", parsectl.lineno ); |
| 3156 |
release_all_nodes (parsectl.all_nodes); |
| 3157 |
parsectl.all_nodes = NULL; |
| 3158 |
} |
| 3159 |
else |
| 3160 |
{ /* okay */ |
| 3161 |
ksba_asn_tree_t tree; |
| 3162 |
|
| 3163 |
_ksba_asn_change_integer_value (parsectl.parse_tree); |
| 3164 |
_ksba_asn_expand_object_id (parsectl.parse_tree); |
| 3165 |
tree = xmalloc ( sizeof *tree + (file_name? strlen (file_name):1) ); |
| 3166 |
tree->parse_tree = parsectl.parse_tree; |
| 3167 |
tree->node_list = parsectl.all_nodes; |
| 3168 |
strcpy (tree->filename, file_name? file_name:"-"); |
| 3169 |
*result = tree; |
| 3170 |
} |
| 3171 |
|
| 3172 |
if (file_name) |
| 3173 |
fclose (parsectl.fp); |
| 3174 |
return parsectl.result_parse; |
| 3175 |
} |
| 3176 |
|
| 3177 |
void |
| 3178 |
ksba_asn_tree_release (ksba_asn_tree_t tree) |
| 3179 |
{ |
| 3180 |
if (!tree) |
| 3181 |
return; |
| 3182 |
release_all_nodes (tree->node_list); |
| 3183 |
tree->node_list = NULL; |
| 3184 |
xfree (tree); |
| 3185 |
} |
| 3186 |
|
| 3187 |
|
| 3188 |
void |
| 3189 |
_ksba_asn_release_nodes (AsnNode node) |
| 3190 |
{ |
| 3191 |
/* FIXME: it does not work yet because the allocation function in |
| 3192 |
asn1-func.c does not link all nodes together */ |
| 3193 |
release_all_nodes (node); |
| 3194 |
} |