Coverage Report

Created: 2026-12-04 07:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/yara/libyara/hex_grammar.c
Line
Count
Source
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 1
59
60
/* Push parsers.  */
61
#define YYPUSH 0
62
63
/* Pull parsers.  */
64
#define YYPULL 1
65
66
67
/* Substitute the variable and function names.  */
68
#define yyparse         hex_yyparse
69
#define yylex           hex_yylex
70
#define yyerror         hex_yyerror
71
#define yydebug         hex_yydebug
72
#define yynerrs         hex_yynerrs
73
74
/* First part of user prologue.  */
75
#line 30 "hex_grammar.y"
76
77
78
#include <string.h>
79
#include <limits.h>
80
81
#include <yara/integers.h>
82
#include <yara/utils.h>
83
#include <yara/hex_lexer.h>
84
#include <yara/limits.h>
85
#include <yara/mem.h>
86
#include <yara/error.h>
87
88
89
#define STR_EXPAND(tok) #tok
90
#define STR(tok) STR_EXPAND(tok)
91
92
#define YYERROR_VERBOSE
93
94
#define YYMALLOC yr_malloc
95
429
#define YYFREE yr_free
96
97
#define mark_as_not_fast_regexp() \
98
3.80k
    ((RE_AST*) yyget_extra(yyscanner))->flags &= ~RE_FLAGS_FAST_REGEXP
99
100
#define fail_if(x, error) \
101
92.4k
    if (x) \
102
92.4k
    { \
103
0
      lex_env->last_error = error; \
104
0
      YYABORT; \
105
0
    } \
106
107
#define destroy_node_if(x, node) \
108
13.6k
    if (x) \
109
13.6k
    { \
110
0
      yr_re_node_destroy(node); \
111
0
    } \
112
113
#define fail_if_too_many_ast_levels(cleanup_code) \
114
13.0k
    if (((RE_AST*) yyget_extra(yyscanner))->levels++ > RE_MAX_AST_LEVELS) \
115
13.0k
    { \
116
2
      { cleanup_code } \
117
2
      lex_env->last_error = ERROR_REGULAR_EXPRESSION_TOO_COMPLEX; \
118
2
      YYABORT; \
119
2
    }
120
121
122
#line 123 "hex_grammar.c"
123
124
# ifndef YY_CAST
125
#  ifdef __cplusplus
126
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
127
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
128
#  else
129
1.50M
#   define YY_CAST(Type, Val) ((Type) (Val))
130
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
131
#  endif
132
# endif
133
# ifndef YY_NULLPTR
134
#  if defined __cplusplus
135
#   if 201103L <= __cplusplus
136
#    define YY_NULLPTR nullptr
137
#   else
138
#    define YY_NULLPTR 0
139
#   endif
140
#  else
141
#   define YY_NULLPTR ((void*)0)
142
#  endif
143
# endif
144
145
/* Use api.header.include to #include this header
146
   instead of duplicating it here.  */
147
#ifndef YY_HEX_YY_HEX_GRAMMAR_H_INCLUDED
148
# define YY_HEX_YY_HEX_GRAMMAR_H_INCLUDED
149
/* Debug traces.  */
150
#ifndef YYDEBUG
151
# define YYDEBUG 0
152
#endif
153
#if YYDEBUG
154
extern int hex_yydebug;
155
#endif
156
157
/* Token kinds.  */
158
#ifndef YYTOKENTYPE
159
# define YYTOKENTYPE
160
  enum yytokentype
161
  {
162
    YYEMPTY = -2,
163
    YYEOF = 0,                     /* "end of file"  */
164
    YYerror = 256,                 /* error  */
165
    YYUNDEF = 257,                 /* "invalid token"  */
166
    _BYTE_ = 258,                  /* _BYTE_  */
167
    _MASKED_BYTE_ = 259,           /* _MASKED_BYTE_  */
168
    _NOT_BYTE_ = 260,              /* _NOT_BYTE_  */
169
    _MASKED_NOT_BYTE_ = 261,       /* _MASKED_NOT_BYTE_  */
170
    _NUMBER_ = 262                 /* _NUMBER_  */
171
  };
172
  typedef enum yytokentype yytoken_kind_t;
173
#endif
174
/* Token kinds.  */
175
#define YYEMPTY -2
176
#define YYEOF 0
177
#define YYerror 256
178
#define YYUNDEF 257
179
#define _BYTE_ 258
180
#define _MASKED_BYTE_ 259
181
#define _NOT_BYTE_ 260
182
#define _MASKED_NOT_BYTE_ 261
183
#define _NUMBER_ 262
184
185
/* Value type.  */
186
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
187
union YYSTYPE
188
{
189
#line 78 "hex_grammar.y"
190
191
  int64_t integer;
192
  RE_NODE *re_node;
193
194
#line 187 "hex_grammar.c"
195
196
};
197
typedef union YYSTYPE YYSTYPE;
198
# define YYSTYPE_IS_TRIVIAL 1
199
# define YYSTYPE_IS_DECLARED 1
200
#endif
201
202
203
204
205
int hex_yyparse (void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env);
206
207
208
#endif /* !YY_HEX_YY_HEX_GRAMMAR_H_INCLUDED  */
209
/* Symbol kind.  */
210
enum yysymbol_kind_t
211
{
212
  YYSYMBOL_YYEMPTY = -2,
213
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
214
  YYSYMBOL_YYerror = 1,                    /* error  */
215
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
216
  YYSYMBOL__BYTE_ = 3,                     /* _BYTE_  */
217
  YYSYMBOL__MASKED_BYTE_ = 4,              /* _MASKED_BYTE_  */
218
  YYSYMBOL__NOT_BYTE_ = 5,                 /* _NOT_BYTE_  */
219
  YYSYMBOL__MASKED_NOT_BYTE_ = 6,          /* _MASKED_NOT_BYTE_  */
220
  YYSYMBOL__NUMBER_ = 7,                   /* _NUMBER_  */
221
  YYSYMBOL_8_ = 8,                         /* '{'  */
222
  YYSYMBOL_9_ = 9,                         /* '}'  */
223
  YYSYMBOL_10_ = 10,                       /* '('  */
224
  YYSYMBOL_11_ = 11,                       /* ')'  */
225
  YYSYMBOL_12_ = 12,                       /* '['  */
226
  YYSYMBOL_13_ = 13,                       /* ']'  */
227
  YYSYMBOL_14_ = 14,                       /* '-'  */
228
  YYSYMBOL_15_ = 15,                       /* '|'  */
229
  YYSYMBOL_YYACCEPT = 16,                  /* $accept  */
230
  YYSYMBOL_hex_string = 17,                /* hex_string  */
231
  YYSYMBOL_tokens = 18,                    /* tokens  */
232
  YYSYMBOL_token_sequence = 19,            /* token_sequence  */
233
  YYSYMBOL_token_or_range = 20,            /* token_or_range  */
234
  YYSYMBOL_token = 21,                     /* token  */
235
  YYSYMBOL_22_1 = 22,                      /* $@1  */
236
  YYSYMBOL_range = 23,                     /* range  */
237
  YYSYMBOL_alternatives = 24,              /* alternatives  */
238
  YYSYMBOL_byte = 25                       /* byte  */
239
};
240
typedef enum yysymbol_kind_t yysymbol_kind_t;
241
242
243
244
245
#ifdef short
246
# undef short
247
#endif
248
249
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
250
   <limits.h> and (if available) <stdint.h> are included
251
   so that the code can choose integer types of a good width.  */
252
253
#ifndef __PTRDIFF_MAX__
254
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
255
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
256
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
257
#  define YY_STDINT_H
258
# endif
259
#endif
260
261
/* Narrow types that promote to a signed type and that can represent a
262
   signed or unsigned integer of at least N bits.  In tables they can
263
   save space and decrease cache pressure.  Promoting to a signed type
264
   helps avoid bugs in integer arithmetic.  */
265
266
#ifdef __INT_LEAST8_MAX__
267
typedef __INT_LEAST8_TYPE__ yytype_int8;
268
#elif defined YY_STDINT_H
269
typedef int_least8_t yytype_int8;
270
#else
271
typedef signed char yytype_int8;
272
#endif
273
274
#ifdef __INT_LEAST16_MAX__
275
typedef __INT_LEAST16_TYPE__ yytype_int16;
276
#elif defined YY_STDINT_H
277
typedef int_least16_t yytype_int16;
278
#else
279
typedef short yytype_int16;
280
#endif
281
282
/* Work around bug in HP-UX 11.23, which defines these macros
283
   incorrectly for preprocessor constants.  This workaround can likely
284
   be removed in 2023, as HPE has promised support for HP-UX 11.23
285
   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
286
   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
287
#ifdef __hpux
288
# undef UINT_LEAST8_MAX
289
# undef UINT_LEAST16_MAX
290
# define UINT_LEAST8_MAX 255
291
# define UINT_LEAST16_MAX 65535
292
#endif
293
294
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
295
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
296
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
297
       && UINT_LEAST8_MAX <= INT_MAX)
298
typedef uint_least8_t yytype_uint8;
299
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
300
typedef unsigned char yytype_uint8;
301
#else
302
typedef short yytype_uint8;
303
#endif
304
305
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
306
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
307
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
308
       && UINT_LEAST16_MAX <= INT_MAX)
309
typedef uint_least16_t yytype_uint16;
310
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
311
typedef unsigned short yytype_uint16;
312
#else
313
typedef int yytype_uint16;
314
#endif
315
316
#ifndef YYPTRDIFF_T
317
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
318
3.65k
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
319
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
320
# elif defined PTRDIFF_MAX
321
#  ifndef ptrdiff_t
322
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
323
#  endif
324
#  define YYPTRDIFF_T ptrdiff_t
325
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
326
# else
327
#  define YYPTRDIFF_T long
328
#  define YYPTRDIFF_MAXIMUM LONG_MAX
329
# endif
330
#endif
331
332
#ifndef YYSIZE_T
333
# ifdef __SIZE_TYPE__
334
#  define YYSIZE_T __SIZE_TYPE__
335
# elif defined size_t
336
#  define YYSIZE_T size_t
337
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
338
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
339
#  define YYSIZE_T size_t
340
# else
341
#  define YYSIZE_T unsigned
342
# endif
343
#endif
344
345
#define YYSIZE_MAXIMUM                                  \
346
  YY_CAST (YYPTRDIFF_T,                                 \
347
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
348
            ? YYPTRDIFF_MAXIMUM                         \
349
            : YY_CAST (YYSIZE_T, -1)))
350
351
2.57k
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
352
353
354
/* Stored state numbers (used for stacks). */
355
typedef yytype_int8 yy_state_t;
356
357
/* State numbers in computations.  */
358
typedef int yy_state_fast_t;
359
360
#ifndef YY_
361
# if defined YYENABLE_NLS && YYENABLE_NLS
362
#  if ENABLE_NLS
363
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
364
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
365
#  endif
366
# endif
367
# ifndef YY_
368
775
#  define YY_(Msgid) Msgid
369
# endif
370
#endif
371
372
373
#ifndef YY_ATTRIBUTE_PURE
374
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
375
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
376
# else
377
#  define YY_ATTRIBUTE_PURE
378
# endif
379
#endif
380
381
#ifndef YY_ATTRIBUTE_UNUSED
382
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
383
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
384
# else
385
#  define YY_ATTRIBUTE_UNUSED
386
# endif
387
#endif
388
389
/* Suppress unused-variable warnings by "using" E.  */
390
#if ! defined lint || defined __GNUC__
391
996k
# define YY_USE(E) ((void) (E))
392
#else
393
# define YY_USE(E) /* empty */
394
#endif
395
396
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
397
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
398
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
399
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
400
    _Pragma ("GCC diagnostic push")                                     \
401
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
402
# else
403
#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
404
    _Pragma ("GCC diagnostic push")                                     \
405
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
406
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
407
# endif
408
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
409
    _Pragma ("GCC diagnostic pop")
410
#else
411
4.72k
# define YY_INITIAL_VALUE(Value) Value
412
#endif
413
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
414
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
415
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
416
#endif
417
#ifndef YY_INITIAL_VALUE
418
# define YY_INITIAL_VALUE(Value) /* Nothing. */
419
#endif
420
421
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
422
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
423
    _Pragma ("GCC diagnostic push")                            \
424
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
425
# define YY_IGNORE_USELESS_CAST_END            \
426
    _Pragma ("GCC diagnostic pop")
427
#endif
428
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
429
# define YY_IGNORE_USELESS_CAST_BEGIN
430
# define YY_IGNORE_USELESS_CAST_END
431
#endif
432
433
434
804k
#define YY_ASSERT(E) ((void) (0 && (E)))
435
436
#if !defined yyoverflow
437
438
/* The parser invokes alloca or malloc; define the necessary symbols.  */
439
440
# ifdef YYSTACK_USE_ALLOCA
441
#  if YYSTACK_USE_ALLOCA
442
#   ifdef __GNUC__
443
#    define YYSTACK_ALLOC __builtin_alloca
444
#   elif defined __BUILTIN_VA_ARG_INCR
445
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
446
#   elif defined _AIX
447
#    define YYSTACK_ALLOC __alloca
448
#   elif defined _MSC_VER
449
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
450
#    define alloca _alloca
451
#   else
452
#    define YYSTACK_ALLOC alloca
453
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
454
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
455
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
456
#     ifndef EXIT_SUCCESS
457
#      define EXIT_SUCCESS 0
458
#     endif
459
#    endif
460
#   endif
461
#  endif
462
# endif
463
464
# ifdef YYSTACK_ALLOC
465
   /* Pacify GCC's 'empty if-body' warning.  */
466
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
467
#  ifndef YYSTACK_ALLOC_MAXIMUM
468
    /* The OS might guarantee only one guard page at the bottom of the stack,
469
       and a page size can be as small as 4096 bytes.  So we cannot safely
470
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
471
       to allow for a few compiler-allocated temporary stack slots.  */
472
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
473
#  endif
474
# else
475
#  define YYSTACK_ALLOC YYMALLOC
476
429
#  define YYSTACK_FREE YYFREE
477
#  ifndef YYSTACK_ALLOC_MAXIMUM
478
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
479
#  endif
480
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
481
       && ! ((defined YYMALLOC || defined malloc) \
482
             && (defined YYFREE || defined free)))
483
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
484
#   ifndef EXIT_SUCCESS
485
#    define EXIT_SUCCESS 0
486
#   endif
487
#  endif
488
#  ifndef YYMALLOC
489
#   define YYMALLOC malloc
490
#   if ! defined malloc && ! defined EXIT_SUCCESS
491
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
492
#   endif
493
#  endif
494
#  ifndef YYFREE
495
#   define YYFREE free
496
#   if ! defined free && ! defined EXIT_SUCCESS
497
void free (void *); /* INFRINGES ON USER NAME SPACE */
498
#   endif
499
#  endif
500
# endif
501
#endif /* !defined yyoverflow */
502
503
#if (! defined yyoverflow \
504
     && (! defined __cplusplus \
505
         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
506
507
/* A type that is properly aligned for any stack member.  */
508
union yyalloc
509
{
510
  yy_state_t yyss_alloc;
511
  YYSTYPE yyvs_alloc;
512
};
513
514
/* The size of the maximum gap between one aligned stack and the next.  */
515
858
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
516
517
/* The size of an array large to enough to hold all stacks, each with
518
   N elements.  */
519
# define YYSTACK_BYTES(N) \
520
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
521
      + YYSTACK_GAP_MAXIMUM)
522
523
# define YYCOPY_NEEDED 1
524
525
/* Relocate STACK from its old location to the new one.  The
526
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
527
   elements in the stack, and YYPTR gives the new location of the
528
   stack.  Advance YYPTR to a properly aligned location for the next
529
   stack.  */
530
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
531
858
    do                                                                  \
532
858
      {                                                                 \
533
858
        YYPTRDIFF_T yynewbytes;                                         \
534
858
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
535
858
        Stack = &yyptr->Stack_alloc;                                    \
536
858
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
537
858
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
538
858
      }                                                                 \
539
858
    while (0)
540
541
#endif
542
543
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
544
/* Copy COUNT objects from SRC to DST.  The source and destination do
545
   not overlap.  */
546
# ifndef YYCOPY
547
#  if defined __GNUC__ && 1 < __GNUC__
548
#   define YYCOPY(Dst, Src, Count) \
549
858
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
550
#  else
551
#   define YYCOPY(Dst, Src, Count)              \
552
      do                                        \
553
        {                                       \
554
          YYPTRDIFF_T yyi;                      \
555
          for (yyi = 0; yyi < (Count); yyi++)   \
556
            (Dst)[yyi] = (Src)[yyi];            \
557
        }                                       \
558
      while (0)
559
#  endif
560
# endif
561
#endif /* !YYCOPY_NEEDED */
562
563
/* YYFINAL -- State number of the termination state.  */
564
804k
#define YYFINAL  11
565
/* YYLAST -- Last index in YYTABLE.  */
566
1.31M
#define YYLAST   35
567
568
/* YYNTOKENS -- Number of terminals.  */
569
519k
#define YYNTOKENS  16
570
/* YYNNTS -- Number of nonterminals.  */
571
#define YYNNTS  10
572
/* YYNRULES -- Number of rules.  */
573
#define YYNRULES  22
574
/* YYNSTATES -- Number of states.  */
575
#define YYNSTATES  34
576
577
/* YYMAXUTOK -- Last valid token kind.  */
578
366k
#define YYMAXUTOK   262
579
580
581
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
582
   as returned by yylex, with out-of-bounds checking.  */
583
#define YYTRANSLATE(YYX)                                \
584
367k
  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
585
367k
   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
586
367k
   : YYSYMBOL_YYUNDEF)
587
588
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
589
   as returned by yylex.  */
590
static const yytype_int8 yytranslate[] =
591
{
592
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
593
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
594
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
595
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
596
      10,    11,     2,     2,     2,    14,     2,     2,     2,     2,
597
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
598
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
599
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
600
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
601
       2,    12,     2,    13,     2,     2,     2,     2,     2,     2,
602
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
603
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
604
       2,     2,     2,     8,    15,     9,     2,     2,     2,     2,
605
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
606
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
607
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
608
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
609
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
610
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
611
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
612
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
613
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
614
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
615
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
616
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
617
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
618
       5,     6,     7
619
};
620
621
#if YYDEBUG
622
/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
623
static const yytype_int16 yyrline[] =
624
{
625
       0,   107,   107,   116,   120,   132,   143,   152,   161,   165,
626
     174,   179,   178,   191,   227,   259,   281,   301,   305,   322,
627
     331,   340,   363
628
};
629
#endif
630
631
/** Accessing symbol of state STATE.  */
632
331k
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
633
634
#if YYDEBUG || 0
635
/* The user-facing name of the symbol whose (internal) number is
636
   YYSYMBOL.  No bounds checking.  */
637
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
638
639
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
640
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
641
static const char *const yytname[] =
642
{
643
  "\"end of file\"", "error", "\"invalid token\"", "_BYTE_",
644
  "_MASKED_BYTE_", "_NOT_BYTE_", "_MASKED_NOT_BYTE_", "_NUMBER_", "'{'",
645
  "'}'", "'('", "')'", "'['", "']'", "'-'", "'|'", "$accept", "hex_string",
646
  "tokens", "token_sequence", "token_or_range", "token", "$@1", "range",
647
  "alternatives", "byte", YY_NULLPTR
648
};
649
650
static const char *
651
yysymbol_name (yysymbol_kind_t yysymbol)
652
{
653
  return yytname[yysymbol];
654
}
655
#endif
656
657
975k
#define YYPACT_NINF (-13)
658
659
#define yypact_value_is_default(Yyn) \
660
975k
  ((Yyn) == YYPACT_NINF)
661
662
#define YYTABLE_NINF (-6)
663
664
#define yytable_value_is_error(Yyn) \
665
4.17k
  0
666
667
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
668
   STATE-NUM.  */
669
static const yytype_int8 yypact[] =
670
{
671
       1,    12,    24,   -13,   -13,   -13,   -13,   -13,     3,    -2,
672
     -13,   -13,    12,   -13,    -1,    -2,   -13,    -4,   -13,   -13,
673
      16,    19,    15,   -13,    10,   -13,    12,   -13,    13,   -13,
674
     -13,    17,   -13,   -13
675
};
676
677
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
678
   Performed when YYTABLE does not specify something else to do.  Zero
679
   means the default is an error.  */
680
static const yytype_int8 yydefact[] =
681
{
682
       0,     0,     0,    19,    21,    20,    22,    11,     0,     3,
683
      10,     1,     0,     2,     0,     0,     6,     8,     9,    17,
684
       0,     0,     0,     7,     8,    12,     0,    13,     0,    16,
685
      18,     0,    15,    14
686
};
687
688
/* YYPGOTO[NTERM-NUM].  */
689
static const yytype_int8 yypgoto[] =
690
{
691
     -13,   -13,   -12,   -13,    20,    14,   -13,   -13,   -13,   -13
692
};
693
694
/* YYDEFGOTO[NTERM-NUM].  */
695
static const yytype_int8 yydefgoto[] =
696
{
697
       0,     2,     8,    15,    16,     9,    12,    18,    20,    10
698
};
699
700
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
701
   positive, shift that token.  If negative, reduce the rule whose
702
   number is the opposite.  If YYTABLE_NINF, syntax error.  */
703
static const yytype_int8 yytable[] =
704
{
705
      19,     3,     4,     5,     6,    -4,    21,    -4,     7,     1,
706
      14,    -4,    13,    22,    30,     3,     4,     5,     6,    -5,
707
      31,    -5,     7,    17,    11,    -5,    32,    25,    29,    24,
708
      33,    26,    27,    28,     0,    23
709
};
710
711
static const yytype_int8 yycheck[] =
712
{
713
      12,     3,     4,     5,     6,     9,     7,    11,    10,     8,
714
      12,    15,     9,    14,    26,     3,     4,     5,     6,     9,
715
       7,    11,    10,     9,     0,    15,    13,    11,    13,    15,
716
      13,    15,    13,    14,    -1,    15
717
};
718
719
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
720
   state STATE-NUM.  */
721
static const yytype_int8 yystos[] =
722
{
723
       0,     8,    17,     3,     4,     5,     6,    10,    18,    21,
724
      25,     0,    22,     9,    12,    19,    20,    21,    23,    18,
725
      24,     7,    14,    20,    21,    11,    15,    13,    14,    13,
726
      18,     7,    13,    13
727
};
728
729
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
730
static const yytype_int8 yyr1[] =
731
{
732
       0,    16,    17,    18,    18,    18,    19,    19,    20,    20,
733
      21,    22,    21,    23,    23,    23,    23,    24,    24,    25,
734
      25,    25,    25
735
};
736
737
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
738
static const yytype_int8 yyr2[] =
739
{
740
       0,     2,     3,     1,     2,     3,     1,     2,     1,     1,
741
       1,     0,     4,     3,     5,     4,     3,     1,     3,     1,
742
       1,     1,     1
743
};
744
745
746
enum { YYENOMEM = -2 };
747
748
#define yyerrok         (yyerrstatus = 0)
749
#define yyclearin       (yychar = YYEMPTY)
750
751
1.33k
#define YYACCEPT        goto yyacceptlab
752
1.01k
#define YYABORT         goto yyabortlab
753
0
#define YYERROR         goto yyerrorlab
754
10
#define YYNOMEM         goto yyexhaustedlab
755
756
757
#define YYRECOVERING()  (!!yyerrstatus)
758
759
#define YYBACKUP(Token, Value)                                    \
760
  do                                                              \
761
    if (yychar == YYEMPTY)                                        \
762
      {                                                           \
763
        yychar = (Token);                                         \
764
        yylval = (Value);                                         \
765
        YYPOPSTACK (yylen);                                       \
766
        yystate = *yyssp;                                         \
767
        goto yybackup;                                            \
768
      }                                                           \
769
    else                                                          \
770
      {                                                           \
771
        yyerror (yyscanner, lex_env, YY_("syntax error: cannot back up")); \
772
        YYERROR;                                                  \
773
      }                                                           \
774
  while (0)
775
776
/* Backward compatibility with an undocumented macro.
777
   Use YYerror or YYUNDEF. */
778
#define YYERRCODE YYUNDEF
779
780
781
/* Enable debugging if requested.  */
782
#if YYDEBUG
783
784
# ifndef YYFPRINTF
785
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
786
#  define YYFPRINTF fprintf
787
# endif
788
789
# define YYDPRINTF(Args)                        \
790
do {                                            \
791
  if (yydebug)                                  \
792
    YYFPRINTF Args;                             \
793
} while (0)
794
795
796
797
798
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
799
do {                                                                      \
800
  if (yydebug)                                                            \
801
    {                                                                     \
802
      YYFPRINTF (stderr, "%s ", Title);                                   \
803
      yy_symbol_print (stderr,                                            \
804
                  Kind, Value, yyscanner, lex_env); \
805
      YYFPRINTF (stderr, "\n");                                           \
806
    }                                                                     \
807
} while (0)
808
809
810
/*-----------------------------------.
811
| Print this symbol's value on YYO.  |
812
`-----------------------------------*/
813
814
static void
815
yy_symbol_value_print (FILE *yyo,
816
                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env)
817
{
818
  FILE *yyoutput = yyo;
819
  YY_USE (yyoutput);
820
  YY_USE (yyscanner);
821
  YY_USE (lex_env);
822
  if (!yyvaluep)
823
    return;
824
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
825
  YY_USE (yykind);
826
  YY_IGNORE_MAYBE_UNINITIALIZED_END
827
}
828
829
830
/*---------------------------.
831
| Print this symbol on YYO.  |
832
`---------------------------*/
833
834
static void
835
yy_symbol_print (FILE *yyo,
836
                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env)
837
{
838
  YYFPRINTF (yyo, "%s %s (",
839
             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
840
841
  yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner, lex_env);
842
  YYFPRINTF (yyo, ")");
843
}
844
845
/*------------------------------------------------------------------.
846
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
847
| TOP (included).                                                   |
848
`------------------------------------------------------------------*/
849
850
static void
851
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
852
{
853
  YYFPRINTF (stderr, "Stack now");
854
  for (; yybottom <= yytop; yybottom++)
855
    {
856
      int yybot = *yybottom;
857
      YYFPRINTF (stderr, " %d", yybot);
858
    }
859
  YYFPRINTF (stderr, "\n");
860
}
861
862
# define YY_STACK_PRINT(Bottom, Top)                            \
863
do {                                                            \
864
  if (yydebug)                                                  \
865
    yy_stack_print ((Bottom), (Top));                           \
866
} while (0)
867
868
869
/*------------------------------------------------.
870
| Report that the YYRULE is going to be reduced.  |
871
`------------------------------------------------*/
872
873
static void
874
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
875
                 int yyrule, void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env)
876
{
877
  int yylno = yyrline[yyrule];
878
  int yynrhs = yyr2[yyrule];
879
  int yyi;
880
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
881
             yyrule - 1, yylno);
882
  /* The symbols being reduced.  */
883
  for (yyi = 0; yyi < yynrhs; yyi++)
884
    {
885
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
886
      yy_symbol_print (stderr,
887
                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
888
                       &yyvsp[(yyi + 1) - (yynrhs)], yyscanner, lex_env);
889
      YYFPRINTF (stderr, "\n");
890
    }
891
}
892
893
# define YY_REDUCE_PRINT(Rule)          \
894
do {                                    \
895
  if (yydebug)                          \
896
    yy_reduce_print (yyssp, yyvsp, Rule, yyscanner, lex_env); \
897
} while (0)
898
899
/* Nonzero means print parse trace.  It is left uninitialized so that
900
   multiple parsers can coexist.  */
901
int yydebug;
902
#else /* !YYDEBUG */
903
1.09M
# define YYDPRINTF(Args) ((void) 0)
904
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
905
# define YY_STACK_PRINT(Bottom, Top)
906
# define YY_REDUCE_PRINT(Rule)
907
#endif /* !YYDEBUG */
908
909
910
/* YYINITDEPTH -- initial size of the parser's stacks.  */
911
#ifndef YYINITDEPTH
912
2.36k
# define YYINITDEPTH 200
913
#endif
914
915
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
916
   if the built-in stack extension method is used).
917
918
   Do not make this value too large; the results are undefined if
919
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
920
   evaluated with infinite-precision integer arithmetic.  */
921
922
#ifndef YYMAXDEPTH
923
891
# define YYMAXDEPTH 10000
924
#endif
925
926
927
928
929
930
931
/*-----------------------------------------------.
932
| Release the memory associated to this symbol.  |
933
`-----------------------------------------------*/
934
935
static void
936
yydestruct (const char *yymsg,
937
            yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env)
938
332k
{
939
332k
  YY_USE (yyvaluep);
940
332k
  YY_USE (yyscanner);
941
332k
  YY_USE (lex_env);
942
332k
  if (!yymsg)
943
0
    yymsg = "Deleting";
944
332k
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
945
946
332k
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
947
332k
  switch (yykind)
948
332k
    {
949
113
    case YYSYMBOL_tokens: /* tokens  */
950
113
#line 96 "hex_grammar.y"
951
113
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
952
113
#line 945 "hex_grammar.c"
953
113
        break;
954
955
808
    case YYSYMBOL_token_sequence: /* token_sequence  */
956
808
#line 97 "hex_grammar.y"
957
808
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
958
808
#line 951 "hex_grammar.c"
959
808
        break;
960
961
0
    case YYSYMBOL_token_or_range: /* token_or_range  */
962
0
#line 98 "hex_grammar.y"
963
0
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
964
0
#line 957 "hex_grammar.c"
965
0
        break;
966
967
1.40k
    case YYSYMBOL_token: /* token  */
968
1.40k
#line 99 "hex_grammar.y"
969
1.40k
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
970
1.40k
#line 963 "hex_grammar.c"
971
1.40k
        break;
972
973
0
    case YYSYMBOL_range: /* range  */
974
0
#line 102 "hex_grammar.y"
975
0
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
976
0
#line 969 "hex_grammar.c"
977
0
        break;
978
979
329
    case YYSYMBOL_alternatives: /* alternatives  */
980
329
#line 101 "hex_grammar.y"
981
329
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
982
329
#line 975 "hex_grammar.c"
983
329
        break;
984
985
0
    case YYSYMBOL_byte: /* byte  */
986
0
#line 100 "hex_grammar.y"
987
0
            { yr_re_node_destroy(((*yyvaluep).re_node)); ((*yyvaluep).re_node) = NULL; }
988
0
#line 981 "hex_grammar.c"
989
0
        break;
990
991
329k
      default:
992
329k
        break;
993
332k
    }
994
332k
  YY_IGNORE_MAYBE_UNINITIALIZED_END
995
332k
}
996
997
998
999
1000
1001
1002
/*----------.
1003
| yyparse.  |
1004
`----------*/
1005
1006
int
1007
yyparse (void *yyscanner, HEX_LEX_ENVIRONMENT *lex_env)
1008
2.36k
{
1009
/* Lookahead token kind.  */
1010
2.36k
int yychar;
1011
1012
1013
/* The semantic value of the lookahead symbol.  */
1014
/* Default value used for initialization, for pacifying older GCCs
1015
   or non-GCC compilers.  */
1016
2.36k
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1017
2.36k
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1018
1019
    /* Number of syntax errors so far.  */
1020
2.36k
    int yynerrs = 0;
1021
1022
2.36k
    yy_state_fast_t yystate = 0;
1023
    /* Number of tokens to shift before error messages enabled.  */
1024
2.36k
    int yyerrstatus = 0;
1025
1026
    /* Refer to the stacks through separate pointers, to allow yyoverflow
1027
       to reallocate them elsewhere.  */
1028
1029
    /* Their size.  */
1030
2.36k
    YYPTRDIFF_T yystacksize = YYINITDEPTH;
1031
1032
    /* The state stack: array, bottom, top.  */
1033
2.36k
    yy_state_t yyssa[YYINITDEPTH];
1034
2.36k
    yy_state_t *yyss = yyssa;
1035
2.36k
    yy_state_t *yyssp = yyss;
1036
1037
    /* The semantic value stack: array, bottom, top.  */
1038
2.36k
    YYSTYPE yyvsa[YYINITDEPTH];
1039
2.36k
    YYSTYPE *yyvs = yyvsa;
1040
2.36k
    YYSTYPE *yyvsp = yyvs;
1041
1042
2.36k
  int yyn;
1043
  /* The return value of yyparse.  */
1044
2.36k
  int yyresult;
1045
  /* Lookahead symbol kind.  */
1046
2.36k
  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1047
  /* The variables used to return semantic value and location from the
1048
     action routines.  */
1049
2.36k
  YYSTYPE yyval;
1050
1051
1052
1053
853k
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1054
1055
  /* The number of symbols on the RHS of the reduced rule.
1056
     Keep to zero when no symbol should be popped.  */
1057
2.36k
  int yylen = 0;
1058
1059
2.36k
  YYDPRINTF ((stderr, "Starting parse\n"));
1060
1061
2.36k
  yychar = YYEMPTY; /* Cause a token to be read.  */
1062
1063
2.36k
  goto yysetstate;
1064
1065
1066
/*------------------------------------------------------------.
1067
| yynewstate -- push a new state, which is found in yystate.  |
1068
`------------------------------------------------------------*/
1069
801k
yynewstate:
1070
  /* In all cases, when you get here, the value and location stacks
1071
     have just been pushed.  So pushing a state here evens the stacks.  */
1072
801k
  yyssp++;
1073
1074
1075
/*--------------------------------------------------------------------.
1076
| yysetstate -- set current state (the top of the stack) to yystate.  |
1077
`--------------------------------------------------------------------*/
1078
804k
yysetstate:
1079
804k
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1080
804k
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1081
804k
  YY_IGNORE_USELESS_CAST_BEGIN
1082
804k
  *yyssp = YY_CAST (yy_state_t, yystate);
1083
804k
  YY_IGNORE_USELESS_CAST_END
1084
804k
  YY_STACK_PRINT (yyss, yyssp);
1085
1086
804k
  if (yyss + yystacksize - 1 <= yyssp)
1087
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1088
    YYNOMEM;
1089
#else
1090
439
    {
1091
      /* Get the current used size of the three stacks, in elements.  */
1092
439
      YYPTRDIFF_T yysize = yyssp - yyss + 1;
1093
1094
# if defined yyoverflow
1095
      {
1096
        /* Give user a chance to reallocate the stack.  Use copies of
1097
           these so that the &'s don't force the real ones into
1098
           memory.  */
1099
        yy_state_t *yyss1 = yyss;
1100
        YYSTYPE *yyvs1 = yyvs;
1101
1102
        /* Each stack pointer address is followed by the size of the
1103
           data in use in that stack, in bytes.  This used to be a
1104
           conditional around just the two extra args, but that might
1105
           be undefined if yyoverflow is a macro.  */
1106
        yyoverflow (YY_("memory exhausted"),
1107
                    &yyss1, yysize * YYSIZEOF (*yyssp),
1108
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
1109
                    &yystacksize);
1110
        yyss = yyss1;
1111
        yyvs = yyvs1;
1112
      }
1113
# else /* defined YYSTACK_RELOCATE */
1114
      /* Extend the stack our own way.  */
1115
439
      if (YYMAXDEPTH <= yystacksize)
1116
10
        YYNOMEM;
1117
429
      yystacksize *= 2;
1118
429
      if (YYMAXDEPTH < yystacksize)
1119
23
        yystacksize = YYMAXDEPTH;
1120
1121
429
      {
1122
429
        yy_state_t *yyss1 = yyss;
1123
429
        union yyalloc *yyptr =
1124
429
          YY_CAST (union yyalloc *,
1125
429
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1126
429
        if (! yyptr)
1127
0
          YYNOMEM;
1128
429
        YYSTACK_RELOCATE (yyss_alloc, yyss);
1129
429
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1130
429
#  undef YYSTACK_RELOCATE
1131
429
        if (yyss1 != yyssa)
1132
301
          YYSTACK_FREE (yyss1);
1133
429
      }
1134
0
# endif
1135
1136
0
      yyssp = yyss + yysize - 1;
1137
429
      yyvsp = yyvs + yysize - 1;
1138
1139
429
      YY_IGNORE_USELESS_CAST_BEGIN
1140
429
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1141
429
                  YY_CAST (long, yystacksize)));
1142
429
      YY_IGNORE_USELESS_CAST_END
1143
1144
429
      if (yyss + yystacksize - 1 <= yyssp)
1145
0
        YYABORT;
1146
429
    }
1147
804k
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1148
1149
1150
804k
  if (yystate == YYFINAL)
1151
1.33k
    YYACCEPT;
1152
1153
802k
  goto yybackup;
1154
1155
1156
/*-----------.
1157
| yybackup.  |
1158
`-----------*/
1159
802k
yybackup:
1160
  /* Do appropriate processing given the current state.  Read a
1161
     lookahead token if we need one and don't already have one.  */
1162
1163
  /* First try to decide what to do without reference to lookahead token.  */
1164
802k
  yyn = yypact[yystate];
1165
802k
  if (yypact_value_is_default (yyn))
1166
435k
    goto yydefault;
1167
1168
  /* Not known => get a lookahead token if don't already have one.  */
1169
1170
  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1171
367k
  if (yychar == YYEMPTY)
1172
282k
    {
1173
282k
      YYDPRINTF ((stderr, "Reading a token\n"));
1174
282k
      yychar = yylex (&yylval, yyscanner, lex_env);
1175
282k
    }
1176
1177
367k
  if (yychar <= YYEOF)
1178
1.93k
    {
1179
1.93k
      yychar = YYEOF;
1180
1.93k
      yytoken = YYSYMBOL_YYEOF;
1181
1.93k
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1182
1.93k
    }
1183
365k
  else if (yychar == YYerror)
1184
0
    {
1185
      /* The scanner already issued an error message, process directly
1186
         to error recovery.  But do not keep the error token as
1187
         lookahead, it is too special and may lead us to an endless
1188
         loop in error recovery. */
1189
0
      yychar = YYUNDEF;
1190
0
      yytoken = YYSYMBOL_YYerror;
1191
0
      goto yyerrlab1;
1192
0
    }
1193
365k
  else
1194
365k
    {
1195
365k
      yytoken = YYTRANSLATE (yychar);
1196
365k
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1197
365k
    }
1198
1199
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1200
     detect an error, take that action.  */
1201
367k
  yyn += yytoken;
1202
367k
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1203
81.2k
    goto yydefault;
1204
285k
  yyn = yytable[yyn];
1205
285k
  if (yyn <= 0)
1206
4.17k
    {
1207
4.17k
      if (yytable_value_is_error (yyn))
1208
0
        goto yyerrlab;
1209
4.17k
      yyn = -yyn;
1210
4.17k
      goto yyreduce;
1211
4.17k
    }
1212
1213
  /* Count tokens shifted since error; after three, turn off error
1214
     status.  */
1215
281k
  if (yyerrstatus)
1216
0
    yyerrstatus--;
1217
1218
  /* Shift the lookahead token.  */
1219
281k
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1220
281k
  yystate = yyn;
1221
281k
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1222
281k
  *++yyvsp = yylval;
1223
281k
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1224
1225
  /* Discard the shifted token.  */
1226
281k
  yychar = YYEMPTY;
1227
281k
  goto yynewstate;
1228
1229
1230
/*-----------------------------------------------------------.
1231
| yydefault -- do the default action for the current state.  |
1232
`-----------------------------------------------------------*/
1233
516k
yydefault:
1234
516k
  yyn = yydefact[yystate];
1235
516k
  if (yyn == 0)
1236
765
    goto yyerrlab;
1237
516k
  goto yyreduce;
1238
1239
1240
/*-----------------------------.
1241
| yyreduce -- do a reduction.  |
1242
`-----------------------------*/
1243
520k
yyreduce:
1244
  /* yyn is the number of a rule to reduce with.  */
1245
520k
  yylen = yyr2[yyn];
1246
1247
  /* If YYLEN is nonzero, implement the default value of the action:
1248
     '$$ = $1'.
1249
1250
     Otherwise, the following line sets YYVAL to garbage.
1251
     This behavior is undocumented and Bison
1252
     users should not rely upon it.  Assigning to YYVAL
1253
     unconditionally makes the parser a bit smaller, and it avoids a
1254
     GCC warning that YYVAL may be used uninitialized.  */
1255
520k
  yyval = yyvsp[1-yylen];
1256
1257
1258
520k
  YY_REDUCE_PRINT (yyn);
1259
520k
  switch (yyn)
1260
520k
    {
1261
1.33k
  case 2: /* hex_string: '{' tokens '}'  */
1262
1.33k
#line 108 "hex_grammar.y"
1263
1.33k
      {
1264
1.33k
        RE_AST* re_ast = yyget_extra(yyscanner);
1265
1.33k
        re_ast->root_node = (yyvsp[-1].re_node);
1266
1.33k
      }
1267
1.33k
#line 1260 "hex_grammar.c"
1268
1.33k
    break;
1269
1270
10.6k
  case 3: /* tokens: token  */
1271
10.6k
#line 117 "hex_grammar.y"
1272
10.6k
      {
1273
10.6k
        (yyval.re_node) = (yyvsp[0].re_node);
1274
10.6k
      }
1275
10.6k
#line 1268 "hex_grammar.c"
1276
10.6k
    break;
1277
1278
1.08k
  case 4: /* tokens: token token  */
1279
1.08k
#line 121 "hex_grammar.y"
1280
1.08k
      {
1281
1.08k
        (yyval.re_node) = yr_re_node_create(RE_NODE_CONCAT);
1282
1283
1.08k
        destroy_node_if((yyval.re_node) == NULL, (yyvsp[-1].re_node));
1284
1.08k
        destroy_node_if((yyval.re_node) == NULL, (yyvsp[0].re_node));
1285
1286
1.08k
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1287
1288
1.08k
        yr_re_node_append_child((yyval.re_node), (yyvsp[-1].re_node));
1289
1.08k
        yr_re_node_append_child((yyval.re_node), (yyvsp[0].re_node));
1290
1.08k
      }
1291
0
#line 1284 "hex_grammar.c"
1292
0
    break;
1293
1294
3.09k
  case 5: /* tokens: token token_sequence token  */
1295
3.09k
#line 133 "hex_grammar.y"
1296
3.09k
      {
1297
3.09k
        yr_re_node_append_child((yyvsp[-1].re_node), (yyvsp[0].re_node));
1298
3.09k
        yr_re_node_prepend_child((yyvsp[-1].re_node), (yyvsp[-2].re_node));
1299
1300
3.09k
        (yyval.re_node) = (yyvsp[-1].re_node);
1301
3.09k
      }
1302
3.09k
#line 1295 "hex_grammar.c"
1303
3.09k
    break;
1304
1305
3.89k
  case 6: /* token_sequence: token_or_range  */
1306
3.89k
#line 144 "hex_grammar.y"
1307
3.89k
      {
1308
3.89k
        (yyval.re_node) = yr_re_node_create(RE_NODE_CONCAT);
1309
1310
3.89k
        destroy_node_if((yyval.re_node) == NULL, (yyvsp[0].re_node));
1311
3.89k
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1312
1313
3.89k
        yr_re_node_append_child((yyval.re_node), (yyvsp[0].re_node));
1314
3.89k
      }
1315
0
#line 1308 "hex_grammar.c"
1316
0
    break;
1317
1318
68.6k
  case 7: /* token_sequence: token_sequence token_or_range  */
1319
68.6k
#line 153 "hex_grammar.y"
1320
68.6k
      {
1321
68.6k
        yr_re_node_append_child((yyvsp[-1].re_node), (yyvsp[0].re_node));
1322
68.6k
        (yyval.re_node) = (yyvsp[-1].re_node);
1323
68.6k
      }
1324
68.6k
#line 1317 "hex_grammar.c"
1325
68.6k
    break;
1326
1327
69.8k
  case 8: /* token_or_range: token  */
1328
69.8k
#line 162 "hex_grammar.y"
1329
69.8k
      {
1330
69.8k
        (yyval.re_node) = (yyvsp[0].re_node);
1331
69.8k
      }
1332
69.8k
#line 1325 "hex_grammar.c"
1333
69.8k
    break;
1334
1335
2.68k
  case 9: /* token_or_range: range  */
1336
2.68k
#line 166 "hex_grammar.y"
1337
2.68k
      {
1338
2.68k
        (yyval.re_node) = (yyvsp[0].re_node);
1339
2.68k
        (yyval.re_node)->greedy = false;
1340
2.68k
      }
1341
2.68k
#line 1334 "hex_grammar.c"
1342
2.68k
    break;
1343
1344
81.0k
  case 10: /* token: byte  */
1345
81.0k
#line 175 "hex_grammar.y"
1346
81.0k
      {
1347
81.0k
        (yyval.re_node) = (yyvsp[0].re_node);
1348
81.0k
      }
1349
81.0k
#line 1342 "hex_grammar.c"
1350
81.0k
    break;
1351
1352
171k
  case 11: /* $@1: %empty  */
1353
171k
#line 179 "hex_grammar.y"
1354
171k
      {
1355
171k
        lex_env->inside_or++;
1356
171k
      }
1357
171k
#line 1350 "hex_grammar.c"
1358
171k
    break;
1359
1360
9.21k
  case 12: /* token: '(' $@1 alternatives ')'  */
1361
9.21k
#line 191 "hex_grammar.y"
1362
9.21k
      {
1363
9.21k
        fail_if_too_many_ast_levels({
1364
9.21k
          yr_re_node_destroy((yyvsp[-1].re_node));
1365
9.21k
        });
1366
1367
9.21k
        (yyval.re_node) = (yyvsp[-1].re_node);
1368
9.21k
        lex_env->inside_or--;
1369
9.21k
      }
1370
0
#line 1371 "hex_grammar.c"
1371
0
    break;
1372
1373
1.31k
  case 13: /* range: '[' _NUMBER_ ']'  */
1374
1.31k
#line 192 "hex_grammar.y"
1375
1.31k
      {
1376
1.31k
        if ((yyvsp[-1].integer) <= 0)
1377
14
        {
1378
14
          yyerror(yyscanner, lex_env, "invalid jump length");
1379
14
          YYABORT;
1380
14
        }
1381
1382
1.30k
        if (lex_env->inside_or && (yyvsp[-1].integer) > YR_STRING_CHAINING_THRESHOLD)
1383
15
        {
1384
15
          yyerror(yyscanner, lex_env, "jumps over "
1385
15
              STR(YR_STRING_CHAINING_THRESHOLD)
1386
15
              " not allowed inside alternation (|)");
1387
15
          YYABORT;
1388
15
        }
1389
1390
        // A jump of one is equivalent to ??
1391
1.28k
        if ((yyvsp[-1].integer) == 1)
1392
394
        {
1393
394
          (yyval.re_node) = yr_re_node_create(RE_NODE_MASKED_LITERAL);
1394
1395
394
          fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1396
1397
394
          (yyval.re_node)->value = 0x00;
1398
394
          (yyval.re_node)->mask = 0x00;
1399
394
        }
1400
893
        else
1401
893
        {
1402
893
          (yyval.re_node) = yr_re_node_create(RE_NODE_RANGE_ANY);
1403
1404
893
          fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1405
1406
893
          (yyval.re_node)->start = (int) (yyvsp[-1].integer);
1407
893
          (yyval.re_node)->end = (int) (yyvsp[-1].integer);
1408
893
        }
1409
1.28k
      }
1410
1.28k
#line 1399 "hex_grammar.c"
1411
1.28k
    break;
1412
1413
1.28k
  case 14: /* range: '[' _NUMBER_ '-' _NUMBER_ ']'  */
1414
755
#line 228 "hex_grammar.y"
1415
755
      {
1416
755
        if (lex_env->inside_or &&
1417
406
            ((yyvsp[-3].integer) > YR_STRING_CHAINING_THRESHOLD ||
1418
336
             (yyvsp[-1].integer) > YR_STRING_CHAINING_THRESHOLD) )
1419
129
        {
1420
129
          yyerror(yyscanner, lex_env, "jumps over "
1421
129
              STR(YR_STRING_CHAINING_THRESHOLD)
1422
129
              " not allowed inside alternation (|)");
1423
1424
129
          YYABORT;
1425
129
        }
1426
1427
626
        if ((yyvsp[-3].integer) < 0 || (yyvsp[-1].integer) < 0)
1428
0
        {
1429
0
          yyerror(yyscanner, lex_env, "invalid negative jump length");
1430
0
          YYABORT;
1431
0
        }
1432
1433
626
        if ((yyvsp[-3].integer) > (yyvsp[-1].integer))
1434
47
        {
1435
47
          yyerror(yyscanner, lex_env, "invalid jump range");
1436
47
          YYABORT;
1437
47
        }
1438
1439
579
        (yyval.re_node) = yr_re_node_create(RE_NODE_RANGE_ANY);
1440
1441
579
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1442
1443
579
        (yyval.re_node)->start = (int) (yyvsp[-3].integer);
1444
579
        (yyval.re_node)->end = (int) (yyvsp[-1].integer);
1445
579
      }
1446
0
#line 1435 "hex_grammar.c"
1447
0
    break;
1448
1449
343
  case 15: /* range: '[' _NUMBER_ '-' ']'  */
1450
343
#line 260 "hex_grammar.y"
1451
343
      {
1452
343
        if (lex_env->inside_or)
1453
21
        {
1454
21
          yyerror(yyscanner, lex_env,
1455
21
              "unbounded jumps not allowed inside alternation (|)");
1456
21
          YYABORT;
1457
21
        }
1458
1459
322
        if ((yyvsp[-2].integer) < 0)
1460
0
        {
1461
0
          yyerror(yyscanner, lex_env, "invalid negative jump length");
1462
0
          YYABORT;
1463
0
        }
1464
1465
322
        (yyval.re_node) = yr_re_node_create(RE_NODE_RANGE_ANY);
1466
1467
322
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1468
1469
322
        (yyval.re_node)->start = (int) (yyvsp[-2].integer);
1470
322
        (yyval.re_node)->end = INT_MAX;
1471
322
      }
1472
0
#line 1461 "hex_grammar.c"
1473
0
    break;
1474
1475
519
  case 16: /* range: '[' '-' ']'  */
1476
519
#line 282 "hex_grammar.y"
1477
519
      {
1478
519
        if (lex_env->inside_or)
1479
22
        {
1480
22
          yyerror(yyscanner, lex_env,
1481
22
              "unbounded jumps not allowed inside alternation (|)");
1482
22
          YYABORT;
1483
22
        }
1484
1485
497
        (yyval.re_node) = yr_re_node_create(RE_NODE_RANGE_ANY);
1486
1487
497
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1488
1489
497
        (yyval.re_node)->start = 0;
1490
497
        (yyval.re_node)->end = INT_MAX;
1491
497
      }
1492
0
#line 1481 "hex_grammar.c"
1493
0
    break;
1494
1495
9.54k
  case 17: /* alternatives: tokens  */
1496
9.54k
#line 302 "hex_grammar.y"
1497
9.54k
      {
1498
9.54k
          (yyval.re_node) = (yyvsp[0].re_node);
1499
9.54k
      }
1500
9.54k
#line 1489 "hex_grammar.c"
1501
9.54k
    break;
1502
1503
3.80k
  case 18: /* alternatives: alternatives '|' tokens  */
1504
3.80k
#line 318 "hex_grammar.y"
1505
3.80k
      {
1506
3.80k
        mark_as_not_fast_regexp();
1507
1508
3.80k
        fail_if_too_many_ast_levels({
1509
3.80k
          yr_re_node_destroy((yyvsp[-2].re_node));
1510
3.80k
          yr_re_node_destroy((yyvsp[0].re_node));
1511
3.80k
        });
1512
1513
3.80k
        (yyval.re_node) = yr_re_node_create(RE_NODE_ALT);
1514
1515
3.80k
        destroy_node_if((yyval.re_node) == NULL, (yyvsp[-2].re_node));
1516
3.80k
        destroy_node_if((yyval.re_node) == NULL, (yyvsp[0].re_node));
1517
1518
3.80k
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1519
1520
3.80k
        yr_re_node_append_child((yyval.re_node), (yyvsp[-2].re_node));
1521
3.80k
        yr_re_node_append_child((yyval.re_node), (yyvsp[0].re_node));
1522
3.80k
      }
1523
0
#line 1524 "hex_grammar.c"
1524
0
    break;
1525
1526
69.4k
  case 19: /* byte: _BYTE_  */
1527
69.4k
#line 323 "hex_grammar.y"
1528
69.4k
      {
1529
69.4k
        (yyval.re_node) = yr_re_node_create(RE_NODE_LITERAL);
1530
1531
69.4k
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1532
1533
69.4k
        (yyval.re_node)->value = (int) (yyvsp[0].integer);
1534
69.4k
        (yyval.re_node)->mask = 0xFF;
1535
69.4k
      }
1536
0
#line 1520 "hex_grammar.c"
1537
0
    break;
1538
1539
368
  case 20: /* byte: _NOT_BYTE_  */
1540
368
#line 332 "hex_grammar.y"
1541
368
      {
1542
368
        (yyval.re_node) = yr_re_node_create(RE_NODE_NOT_LITERAL);
1543
1544
368
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1545
1546
368
        (yyval.re_node)->value = (int) (yyvsp[0].integer);
1547
368
        (yyval.re_node)->mask = 0xFF;
1548
368
      }
1549
0
#line 1533 "hex_grammar.c"
1550
0
    break;
1551
1552
10.5k
  case 21: /* byte: _MASKED_BYTE_  */
1553
10.5k
#line 341 "hex_grammar.y"
1554
10.5k
      {
1555
10.5k
        uint8_t mask = (uint8_t) ((yyvsp[0].integer) >> 8);
1556
1557
10.5k
        if (mask == 0x00)
1558
1.14k
        {
1559
1.14k
          (yyval.re_node) = yr_re_node_create(RE_NODE_ANY);
1560
1561
1.14k
          fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1562
1563
1.14k
          (yyval.re_node)->value = 0x00;
1564
1.14k
          (yyval.re_node)->mask = 0x00;
1565
1.14k
        }
1566
9.44k
        else
1567
9.44k
        {
1568
9.44k
          (yyval.re_node) = yr_re_node_create(RE_NODE_MASKED_LITERAL);
1569
1570
9.44k
          fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1571
1572
9.44k
          (yyval.re_node)->value = (yyvsp[0].integer) & 0xFF;
1573
9.44k
          (yyval.re_node)->mask = mask;
1574
9.44k
        }
1575
10.5k
      }
1576
10.5k
#line 1560 "hex_grammar.c"
1577
10.5k
    break;
1578
1579
10.5k
  case 22: /* byte: _MASKED_NOT_BYTE_  */
1580
578
#line 364 "hex_grammar.y"
1581
578
      {
1582
578
        uint8_t mask = (uint8_t) ((yyvsp[0].integer) >> 8);
1583
1584
578
        (yyval.re_node) = yr_re_node_create(RE_NODE_MASKED_NOT_LITERAL);
1585
1586
578
        fail_if((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
1587
1588
578
        (yyval.re_node)->value = (yyvsp[0].integer) & 0xFF;
1589
578
        (yyval.re_node)->mask = mask;
1590
578
      }
1591
0
#line 1575 "hex_grammar.c"
1592
0
    break;
1593
1594
1595
0
#line 1579 "hex_grammar.c"
1596
1597
0
      default: break;
1598
520k
    }
1599
  /* User semantic actions sometimes alter yychar, and that requires
1600
     that yytoken be updated with the new translation.  We take the
1601
     approach of translating immediately before every use of yytoken.
1602
     One alternative is translating here after every semantic action,
1603
     but that translation would be missed if the semantic action invokes
1604
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1605
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1606
     incorrect destructor might then be invoked immediately.  In the
1607
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
1608
     to an incorrect destructor call or verbose syntax error message
1609
     before the lookahead is translated.  */
1610
519k
  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1611
1612
519k
  YYPOPSTACK (yylen);
1613
519k
  yylen = 0;
1614
1615
519k
  *++yyvsp = yyval;
1616
1617
  /* Now 'shift' the result of the reduction.  Determine what state
1618
     that goes to, based on the state we popped back to and the rule
1619
     number reduced by.  */
1620
519k
  {
1621
519k
    const int yylhs = yyr1[yyn] - YYNTOKENS;
1622
519k
    const int yyi = yypgoto[yylhs] + *yyssp;
1623
519k
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1624
519k
               ? yytable[yyi]
1625
519k
               : yydefgoto[yylhs]);
1626
519k
  }
1627
1628
519k
  goto yynewstate;
1629
1630
1631
/*--------------------------------------.
1632
| yyerrlab -- here on detecting error.  |
1633
`--------------------------------------*/
1634
765
yyerrlab:
1635
  /* Make sure we have latest lookahead translation.  See comments at
1636
     user semantic actions for why this is necessary.  */
1637
765
  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1638
  /* If not already recovering from an error, report this error.  */
1639
765
  if (!yyerrstatus)
1640
765
    {
1641
765
      ++yynerrs;
1642
765
      yyerror (yyscanner, lex_env, YY_("syntax error"));
1643
765
    }
1644
1645
765
  if (yyerrstatus == 3)
1646
0
    {
1647
      /* If just tried and failed to reuse lookahead token after an
1648
         error, discard it.  */
1649
1650
0
      if (yychar <= YYEOF)
1651
0
        {
1652
          /* Return failure if at end of input.  */
1653
0
          if (yychar == YYEOF)
1654
0
            YYABORT;
1655
0
        }
1656
0
      else
1657
0
        {
1658
0
          yydestruct ("Error: discarding",
1659
0
                      yytoken, &yylval, yyscanner, lex_env);
1660
0
          yychar = YYEMPTY;
1661
0
        }
1662
0
    }
1663
1664
  /* Else will try to reuse lookahead token after shifting the error
1665
     token.  */
1666
765
  goto yyerrlab1;
1667
1668
1669
/*---------------------------------------------------.
1670
| yyerrorlab -- error raised explicitly by YYERROR.  |
1671
`---------------------------------------------------*/
1672
765
yyerrorlab:
1673
  /* Pacify compilers when the user code never invokes YYERROR and the
1674
     label yyerrorlab therefore never appears in user code.  */
1675
0
  if (0)
1676
0
    YYERROR;
1677
0
  ++yynerrs;
1678
1679
  /* Do not reclaim the symbols of the rule whose action triggered
1680
     this YYERROR.  */
1681
0
  YYPOPSTACK (yylen);
1682
0
  yylen = 0;
1683
0
  YY_STACK_PRINT (yyss, yyssp);
1684
0
  yystate = *yyssp;
1685
0
  goto yyerrlab1;
1686
1687
1688
/*-------------------------------------------------------------.
1689
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1690
`-------------------------------------------------------------*/
1691
765
yyerrlab1:
1692
765
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1693
1694
  /* Pop stack until we find a state that shifts the error token.  */
1695
765
  for (;;)
1696
172k
    {
1697
172k
      yyn = yypact[yystate];
1698
172k
      if (!yypact_value_is_default (yyn))
1699
88.7k
        {
1700
88.7k
          yyn += YYSYMBOL_YYerror;
1701
88.7k
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1702
0
            {
1703
0
              yyn = yytable[yyn];
1704
0
              if (0 < yyn)
1705
0
                break;
1706
0
            }
1707
88.7k
        }
1708
1709
      /* Pop the current state because it cannot handle the error token.  */
1710
172k
      if (yyssp == yyss)
1711
765
        YYABORT;
1712
1713
1714
172k
      yydestruct ("Error: popping",
1715
172k
                  YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner, lex_env);
1716
172k
      YYPOPSTACK (1);
1717
172k
      yystate = *yyssp;
1718
172k
      YY_STACK_PRINT (yyss, yyssp);
1719
172k
    }
1720
1721
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1722
0
  *++yyvsp = yylval;
1723
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1724
1725
1726
  /* Shift the error token.  */
1727
0
  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1728
1729
0
  yystate = yyn;
1730
0
  goto yynewstate;
1731
1732
1733
/*-------------------------------------.
1734
| yyacceptlab -- YYACCEPT comes here.  |
1735
`-------------------------------------*/
1736
1.33k
yyacceptlab:
1737
1.33k
  yyresult = 0;
1738
1.33k
  goto yyreturnlab;
1739
1740
1741
/*-----------------------------------.
1742
| yyabortlab -- YYABORT comes here.  |
1743
`-----------------------------------*/
1744
1.01k
yyabortlab:
1745
1.01k
  yyresult = 1;
1746
1.01k
  goto yyreturnlab;
1747
1748
1749
/*-----------------------------------------------------------.
1750
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
1751
`-----------------------------------------------------------*/
1752
10
yyexhaustedlab:
1753
10
  yyerror (yyscanner, lex_env, YY_("memory exhausted"));
1754
10
  yyresult = 2;
1755
10
  goto yyreturnlab;
1756
1757
1758
/*----------------------------------------------------------.
1759
| yyreturnlab -- parsing is finished, clean up and return.  |
1760
`----------------------------------------------------------*/
1761
2.36k
yyreturnlab:
1762
2.36k
  if (yychar != YYEMPTY)
1763
766
    {
1764
      /* Make sure we have latest lookahead translation.  See comments at
1765
         user semantic actions for why this is necessary.  */
1766
766
      yytoken = YYTRANSLATE (yychar);
1767
766
      yydestruct ("Cleanup: discarding lookahead",
1768
766
                  yytoken, &yylval, yyscanner, lex_env);
1769
766
    }
1770
  /* Do not reclaim the symbols of the rule whose action triggered
1771
     this YYABORT or YYACCEPT.  */
1772
2.36k
  YYPOPSTACK (yylen);
1773
2.36k
  YY_STACK_PRINT (yyss, yyssp);
1774
161k
  while (yyssp != yyss)
1775
159k
    {
1776
159k
      yydestruct ("Cleanup: popping",
1777
159k
                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner, lex_env);
1778
159k
      YYPOPSTACK (1);
1779
159k
    }
1780
2.36k
#ifndef yyoverflow
1781
2.36k
  if (yyss != yyssa)
1782
128
    YYSTACK_FREE (yyss);
1783
2.36k
#endif
1784
1785
2.36k
  return yyresult;
1786
765
}
1787
1788
#line 376 "hex_grammar.y"
1789