xref: /aosp_15_r20/external/libconfig/lib/grammar.c (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1 /* A Bison parser, made by GNU Bison 3.0.4.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6 
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19 
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29 
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
42 
43 /* Identify Bison output.  */
44 #define YYBISON 1
45 
46 /* Bison version.  */
47 #define YYBISON_VERSION "3.0.4"
48 
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers.  */
53 #define YYPURE 1
54 
55 /* Push parsers.  */
56 #define YYPUSH 0
57 
58 /* Pull parsers.  */
59 #define YYPULL 1
60 
61 
62 /* Substitute the variable and function names.  */
63 #define yyparse         libconfig_yyparse
64 #define yylex           libconfig_yylex
65 #define yyerror         libconfig_yyerror
66 #define yydebug         libconfig_yydebug
67 #define yynerrs         libconfig_yynerrs
68 
69 
70 /* Copy the first part of user declarations.  */
71 #line 32 "grammar.y" /* yacc.c:339  */
72 
73 #include <string.h>
74 #include <stdlib.h>
75 
76 #include "libconfig.h"
77 #include "parsectx.h"
78 #include "scanctx.h"
79 #include "util.h"
80 #include "wincompat.h"
81 
82 /* These declarations are provided to suppress compiler warnings. */
83 extern int libconfig_yylex();
84 extern int libconfig_yyget_lineno();
85 
86 static const char *err_array_elem_type = "mismatched element type in array";
87 static const char *err_duplicate_setting = "duplicate setting name";
88 
89 #define IN_ARRAY() \
90   (ctx->parent && (ctx->parent->type == CONFIG_TYPE_ARRAY))
91 
92 #define IN_LIST() \
93   (ctx->parent && (ctx->parent->type == CONFIG_TYPE_LIST))
94 
capture_parse_pos(void * scanner,struct scan_context * scan_ctx,config_setting_t * setting)95 static void capture_parse_pos(void *scanner, struct scan_context *scan_ctx,
96                               config_setting_t *setting)
97 {
98   setting->line = (unsigned int)libconfig_yyget_lineno(scanner);
99   setting->file = libconfig_scanctx_current_filename(scan_ctx);
100 }
101 
102 #define CAPTURE_PARSE_POS(S) \
103   capture_parse_pos(scanner, scan_ctx, (S))
104 
libconfig_yyerror(void * scanner,struct parse_context * ctx,struct scan_context * scan_ctx,char const * s)105 void libconfig_yyerror(void *scanner, struct parse_context *ctx,
106                        struct scan_context *scan_ctx, char const *s)
107 {
108   if(ctx->config->error_text) return;
109   ctx->config->error_line = libconfig_yyget_lineno(scanner);
110   ctx->config->error_text = s;
111 }
112 
113 
114 #line 115 "grammar.c" /* yacc.c:339  */
115 
116 # ifndef YY_NULLPTR
117 #  if defined __cplusplus && 201103L <= __cplusplus
118 #   define YY_NULLPTR nullptr
119 #  else
120 #   define YY_NULLPTR 0
121 #  endif
122 # endif
123 
124 /* Enabling verbose error messages.  */
125 #ifdef YYERROR_VERBOSE
126 # undef YYERROR_VERBOSE
127 # define YYERROR_VERBOSE 1
128 #else
129 # define YYERROR_VERBOSE 0
130 #endif
131 
132 /* In a future release of Bison, this section will be replaced
133    by #include "y.tab.h".  */
134 #ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED
135 # define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED
136 /* Debug traces.  */
137 #ifndef YYDEBUG
138 # define YYDEBUG 0
139 #endif
140 #if YYDEBUG
141 extern int libconfig_yydebug;
142 #endif
143 
144 /* Token type.  */
145 #ifndef YYTOKENTYPE
146 # define YYTOKENTYPE
147   enum yytokentype
148   {
149     TOK_BOOLEAN = 258,
150     TOK_INTEGER = 259,
151     TOK_HEX = 260,
152     TOK_INTEGER64 = 261,
153     TOK_HEX64 = 262,
154     TOK_FLOAT = 263,
155     TOK_STRING = 264,
156     TOK_NAME = 265,
157     TOK_EQUALS = 266,
158     TOK_NEWLINE = 267,
159     TOK_ARRAY_START = 268,
160     TOK_ARRAY_END = 269,
161     TOK_LIST_START = 270,
162     TOK_LIST_END = 271,
163     TOK_COMMA = 272,
164     TOK_GROUP_START = 273,
165     TOK_GROUP_END = 274,
166     TOK_SEMICOLON = 275,
167     TOK_GARBAGE = 276,
168     TOK_ERROR = 277
169   };
170 #endif
171 /* Tokens.  */
172 #define TOK_BOOLEAN 258
173 #define TOK_INTEGER 259
174 #define TOK_HEX 260
175 #define TOK_INTEGER64 261
176 #define TOK_HEX64 262
177 #define TOK_FLOAT 263
178 #define TOK_STRING 264
179 #define TOK_NAME 265
180 #define TOK_EQUALS 266
181 #define TOK_NEWLINE 267
182 #define TOK_ARRAY_START 268
183 #define TOK_ARRAY_END 269
184 #define TOK_LIST_START 270
185 #define TOK_LIST_END 271
186 #define TOK_COMMA 272
187 #define TOK_GROUP_START 273
188 #define TOK_GROUP_END 274
189 #define TOK_SEMICOLON 275
190 #define TOK_GARBAGE 276
191 #define TOK_ERROR 277
192 
193 /* Value type.  */
194 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
195 
196 union YYSTYPE
197 {
198 #line 76 "grammar.y" /* yacc.c:355  */
199 
200   int ival;
201   long long llval;
202   double fval;
203   char *sval;
204 
205 #line 206 "grammar.c" /* yacc.c:355  */
206 };
207 
208 typedef union YYSTYPE YYSTYPE;
209 # define YYSTYPE_IS_TRIVIAL 1
210 # define YYSTYPE_IS_DECLARED 1
211 #endif
212 
213 
214 
215 int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx);
216 
217 #endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED  */
218 
219 /* Copy the second part of user declarations.  */
220 
221 #line 222 "grammar.c" /* yacc.c:358  */
222 
223 #ifdef short
224 # undef short
225 #endif
226 
227 #ifdef YYTYPE_UINT8
228 typedef YYTYPE_UINT8 yytype_uint8;
229 #else
230 typedef unsigned char yytype_uint8;
231 #endif
232 
233 #ifdef YYTYPE_INT8
234 typedef YYTYPE_INT8 yytype_int8;
235 #else
236 typedef signed char yytype_int8;
237 #endif
238 
239 #ifdef YYTYPE_UINT16
240 typedef YYTYPE_UINT16 yytype_uint16;
241 #else
242 typedef unsigned short int yytype_uint16;
243 #endif
244 
245 #ifdef YYTYPE_INT16
246 typedef YYTYPE_INT16 yytype_int16;
247 #else
248 typedef short int yytype_int16;
249 #endif
250 
251 #ifndef YYSIZE_T
252 # ifdef __SIZE_TYPE__
253 #  define YYSIZE_T __SIZE_TYPE__
254 # elif defined size_t
255 #  define YYSIZE_T size_t
256 # elif ! defined YYSIZE_T
257 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
258 #  define YYSIZE_T size_t
259 # else
260 #  define YYSIZE_T unsigned int
261 # endif
262 #endif
263 
264 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
265 
266 #ifndef YY_
267 # if defined YYENABLE_NLS && YYENABLE_NLS
268 #  if ENABLE_NLS
269 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
270 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
271 #  endif
272 # endif
273 # ifndef YY_
274 #  define YY_(Msgid) Msgid
275 # endif
276 #endif
277 
278 #ifndef YY_ATTRIBUTE
279 # if (defined __GNUC__                                               \
280       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
281      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
282 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
283 # else
284 #  define YY_ATTRIBUTE(Spec) /* empty */
285 # endif
286 #endif
287 
288 #ifndef YY_ATTRIBUTE_PURE
289 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
290 #endif
291 
292 #ifndef YY_ATTRIBUTE_UNUSED
293 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
294 #endif
295 
296 #if !defined _Noreturn \
297      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
298 # if defined _MSC_VER && 1200 <= _MSC_VER
299 #  define _Noreturn __declspec (noreturn)
300 # else
301 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
302 # endif
303 #endif
304 
305 /* Suppress unused-variable warnings by "using" E.  */
306 #if ! defined lint || defined __GNUC__
307 # define YYUSE(E) ((void) (E))
308 #else
309 # define YYUSE(E) /* empty */
310 #endif
311 
312 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
313 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
314 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
315     _Pragma ("GCC diagnostic push") \
316     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
317     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
318 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
319     _Pragma ("GCC diagnostic pop")
320 #else
321 # define YY_INITIAL_VALUE(Value) Value
322 #endif
323 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
324 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
325 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
326 #endif
327 #ifndef YY_INITIAL_VALUE
328 # define YY_INITIAL_VALUE(Value) /* Nothing. */
329 #endif
330 
331 
332 #if ! defined yyoverflow || YYERROR_VERBOSE
333 
334 /* The parser invokes alloca or malloc; define the necessary symbols.  */
335 
336 # ifdef YYSTACK_USE_ALLOCA
337 #  if YYSTACK_USE_ALLOCA
338 #   ifdef __GNUC__
339 #    define YYSTACK_ALLOC __builtin_alloca
340 #   elif defined __BUILTIN_VA_ARG_INCR
341 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
342 #   elif defined _AIX
343 #    define YYSTACK_ALLOC __alloca
344 #   elif defined _MSC_VER
345 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
346 #    define alloca _alloca
347 #   else
348 #    define YYSTACK_ALLOC alloca
349 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
350 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
351       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
352 #     ifndef EXIT_SUCCESS
353 #      define EXIT_SUCCESS 0
354 #     endif
355 #    endif
356 #   endif
357 #  endif
358 # endif
359 
360 # ifdef YYSTACK_ALLOC
361    /* Pacify GCC's 'empty if-body' warning.  */
362 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
363 #  ifndef YYSTACK_ALLOC_MAXIMUM
364     /* The OS might guarantee only one guard page at the bottom of the stack,
365        and a page size can be as small as 4096 bytes.  So we cannot safely
366        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
367        to allow for a few compiler-allocated temporary stack slots.  */
368 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
369 #  endif
370 # else
371 #  define YYSTACK_ALLOC YYMALLOC
372 #  define YYSTACK_FREE YYFREE
373 #  ifndef YYSTACK_ALLOC_MAXIMUM
374 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
375 #  endif
376 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
377        && ! ((defined YYMALLOC || defined malloc) \
378              && (defined YYFREE || defined free)))
379 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
380 #   ifndef EXIT_SUCCESS
381 #    define EXIT_SUCCESS 0
382 #   endif
383 #  endif
384 #  ifndef YYMALLOC
385 #   define YYMALLOC malloc
386 #   if ! defined malloc && ! defined EXIT_SUCCESS
387 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
388 #   endif
389 #  endif
390 #  ifndef YYFREE
391 #   define YYFREE free
392 #   if ! defined free && ! defined EXIT_SUCCESS
393 void free (void *); /* INFRINGES ON USER NAME SPACE */
394 #   endif
395 #  endif
396 # endif
397 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
398 
399 
400 #if (! defined yyoverflow \
401      && (! defined __cplusplus \
402          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
403 
404 /* A type that is properly aligned for any stack member.  */
405 union yyalloc
406 {
407   yytype_int16 yyss_alloc;
408   YYSTYPE yyvs_alloc;
409 };
410 
411 /* The size of the maximum gap between one aligned stack and the next.  */
412 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
413 
414 /* The size of an array large to enough to hold all stacks, each with
415    N elements.  */
416 # define YYSTACK_BYTES(N) \
417      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
418       + YYSTACK_GAP_MAXIMUM)
419 
420 # define YYCOPY_NEEDED 1
421 
422 /* Relocate STACK from its old location to the new one.  The
423    local variables YYSIZE and YYSTACKSIZE give the old and new number of
424    elements in the stack, and YYPTR gives the new location of the
425    stack.  Advance YYPTR to a properly aligned location for the next
426    stack.  */
427 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
428     do                                                                  \
429       {                                                                 \
430         YYSIZE_T yynewbytes;                                            \
431         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
432         Stack = &yyptr->Stack_alloc;                                    \
433         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
434         yyptr += yynewbytes / sizeof (*yyptr);                          \
435       }                                                                 \
436     while (0)
437 
438 #endif
439 
440 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
441 /* Copy COUNT objects from SRC to DST.  The source and destination do
442    not overlap.  */
443 # ifndef YYCOPY
444 #  if defined __GNUC__ && 1 < __GNUC__
445 #   define YYCOPY(Dst, Src, Count) \
446       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
447 #  else
448 #   define YYCOPY(Dst, Src, Count)              \
449       do                                        \
450         {                                       \
451           YYSIZE_T yyi;                         \
452           for (yyi = 0; yyi < (Count); yyi++)   \
453             (Dst)[yyi] = (Src)[yyi];            \
454         }                                       \
455       while (0)
456 #  endif
457 # endif
458 #endif /* !YYCOPY_NEEDED */
459 
460 /* YYFINAL -- State number of the termination state.  */
461 #define YYFINAL  6
462 /* YYLAST -- Last index in YYTABLE.  */
463 #define YYLAST   35
464 
465 /* YYNTOKENS -- Number of terminals.  */
466 #define YYNTOKENS  23
467 /* YYNNTS -- Number of nonterminals.  */
468 #define YYNNTS  20
469 /* YYNRULES -- Number of rules.  */
470 #define YYNRULES  41
471 /* YYNSTATES -- Number of states.  */
472 #define YYNSTATES  47
473 
474 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
475    by yylex, with out-of-bounds checking.  */
476 #define YYUNDEFTOK  2
477 #define YYMAXUTOK   277
478 
479 #define YYTRANSLATE(YYX)                                                \
480   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
481 
482 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
483    as returned by yylex, without out-of-bounds checking.  */
484 static const yytype_uint8 yytranslate[] =
485 {
486        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
487        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
488        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
489        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
490        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
491        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
492        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
493        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
494        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
495        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
496        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
497        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
498        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
499        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
500        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
501        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
502        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
503        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
504        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
505        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
506        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
507        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
508        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
509        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
510        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
511        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
512        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
513       15,    16,    17,    18,    19,    20,    21,    22
514 };
515 
516 #if YYDEBUG
517   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
518 static const yytype_uint16 yyrline[] =
519 {
520        0,    92,    92,    94,    98,    99,   102,   104,   107,   109,
521      110,   115,   114,   134,   133,   157,   156,   179,   180,   181,
522      182,   186,   187,   191,   211,   233,   255,   277,   299,   317,
523      345,   346,   347,   350,   352,   356,   357,   358,   361,   363,
524      368,   367
525 };
526 #endif
527 
528 #if YYDEBUG || YYERROR_VERBOSE || 0
529 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
530    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
531 static const char *const yytname[] =
532 {
533   "$end", "error", "$undefined", "TOK_BOOLEAN", "TOK_INTEGER", "TOK_HEX",
534   "TOK_INTEGER64", "TOK_HEX64", "TOK_FLOAT", "TOK_STRING", "TOK_NAME",
535   "TOK_EQUALS", "TOK_NEWLINE", "TOK_ARRAY_START", "TOK_ARRAY_END",
536   "TOK_LIST_START", "TOK_LIST_END", "TOK_COMMA", "TOK_GROUP_START",
537   "TOK_GROUP_END", "TOK_SEMICOLON", "TOK_GARBAGE", "TOK_ERROR", "$accept",
538   "configuration", "setting_list", "setting_list_optional",
539   "setting_terminator", "setting", "$@1", "array", "$@2", "list", "$@3",
540   "value", "string", "simple_value", "value_list", "value_list_optional",
541   "simple_value_list", "simple_value_list_optional", "group", "$@4", YY_NULLPTR
542 };
543 #endif
544 
545 # ifdef YYPRINT
546 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
547    (internal) symbol number NUM (which must be that of a token).  */
548 static const yytype_uint16 yytoknum[] =
549 {
550        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
551      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
552      275,   276,   277
553 };
554 # endif
555 
556 #define YYPACT_NINF -26
557 
558 #define yypact_value_is_default(Yystate) \
559   (!!((Yystate) == (-26)))
560 
561 #define YYTABLE_NINF -1
562 
563 #define yytable_value_is_error(Yytable_value) \
564   0
565 
566   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
567      STATE-NUM.  */
568 static const yytype_int8 yypact[] =
569 {
570       -8,   -26,    12,    -8,   -26,     5,   -26,   -26,     0,   -26,
571      -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,   -26,
572      -26,    -6,    10,   -26,   -26,    23,     0,    -8,   -26,   -26,
573      -26,   -26,   -26,     3,     7,   -26,     6,     8,    -8,    14,
574       23,   -26,     0,   -26,   -26,   -26,   -26
575 };
576 
577   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
578      Performed when YYTABLE does not specify something else to do.  Zero
579      means the default is an error.  */
580 static const yytype_uint8 yydefact[] =
581 {
582        2,    11,     0,     3,     4,     0,     1,     5,     0,    23,
583       24,    26,    25,    27,    28,    21,    13,    15,    40,    18,
584       19,     8,    29,    17,    20,    38,    33,     6,    10,     9,
585       12,    22,    35,    39,     0,    30,    34,     0,     7,     0,
586       37,    14,    32,    16,    41,    36,    31
587 };
588 
589   /* YYPGOTO[NTERM-NUM].  */
590 static const yytype_int8 yypgoto[] =
591 {
592      -26,   -26,    -5,   -26,   -26,    -3,   -26,   -26,   -26,   -26,
593      -26,   -25,   -26,   -15,   -26,   -26,   -26,   -26,   -26,   -26
594 };
595 
596   /* YYDEFGOTO[NTERM-NUM].  */
597 static const yytype_int8 yydefgoto[] =
598 {
599       -1,     2,     3,    39,    30,     4,     5,    19,    25,    20,
600       26,    21,    22,    23,    36,    37,    33,    34,    24,    27
601 };
602 
603   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
604      positive, shift that token.  If negative, reduce the rule whose
605      number is the opposite.  If YYTABLE_NINF, syntax error.  */
606 static const yytype_uint8 yytable[] =
607 {
608        7,    35,     1,     9,    10,    11,    12,    13,    14,    15,
609       32,    28,     6,    16,    29,    17,     8,    46,    18,    31,
610       40,    41,    38,    42,    43,    45,     9,    10,    11,    12,
611       13,    14,    15,    44,     0,     7
612 };
613 
614 static const yytype_int8 yycheck[] =
615 {
616        3,    26,    10,     3,     4,     5,     6,     7,     8,     9,
617       25,    17,     0,    13,    20,    15,    11,    42,    18,     9,
618       17,    14,    27,    17,    16,    40,     3,     4,     5,     6,
619        7,     8,     9,    19,    -1,    38
620 };
621 
622   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
623      symbol of state STATE-NUM.  */
624 static const yytype_uint8 yystos[] =
625 {
626        0,    10,    24,    25,    28,    29,     0,    28,    11,     3,
627        4,     5,     6,     7,     8,     9,    13,    15,    18,    30,
628       32,    34,    35,    36,    41,    31,    33,    42,    17,    20,
629       27,     9,    36,    39,    40,    34,    37,    38,    25,    26,
630       17,    14,    17,    16,    19,    36,    34
631 };
632 
633   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
634 static const yytype_uint8 yyr1[] =
635 {
636        0,    23,    24,    24,    25,    25,    26,    26,    27,    27,
637       27,    29,    28,    31,    30,    33,    32,    34,    34,    34,
638       34,    35,    35,    36,    36,    36,    36,    36,    36,    36,
639       37,    37,    37,    38,    38,    39,    39,    39,    40,    40,
640       42,    41
641 };
642 
643   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
644 static const yytype_uint8 yyr2[] =
645 {
646        0,     2,     0,     1,     1,     2,     0,     1,     0,     1,
647        1,     0,     5,     0,     4,     0,     4,     1,     1,     1,
648        1,     1,     2,     1,     1,     1,     1,     1,     1,     1,
649        1,     3,     2,     0,     1,     1,     3,     2,     0,     1,
650        0,     4
651 };
652 
653 
654 #define yyerrok         (yyerrstatus = 0)
655 #define yyclearin       (yychar = YYEMPTY)
656 #define YYEMPTY         (-2)
657 #define YYEOF           0
658 
659 #define YYACCEPT        goto yyacceptlab
660 #define YYABORT         goto yyabortlab
661 #define YYERROR         goto yyerrorlab
662 
663 
664 #define YYRECOVERING()  (!!yyerrstatus)
665 
666 #define YYBACKUP(Token, Value)                                  \
667 do                                                              \
668   if (yychar == YYEMPTY)                                        \
669     {                                                           \
670       yychar = (Token);                                         \
671       yylval = (Value);                                         \
672       YYPOPSTACK (yylen);                                       \
673       yystate = *yyssp;                                         \
674       goto yybackup;                                            \
675     }                                                           \
676   else                                                          \
677     {                                                           \
678       yyerror (scanner, ctx, scan_ctx, YY_("syntax error: cannot back up")); \
679       YYERROR;                                                  \
680     }                                                           \
681 while (0)
682 
683 /* Error token number */
684 #define YYTERROR        1
685 #define YYERRCODE       256
686 
687 
688 
689 /* Enable debugging if requested.  */
690 #if YYDEBUG
691 
692 # ifndef YYFPRINTF
693 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
694 #  define YYFPRINTF fprintf
695 # endif
696 
697 # define YYDPRINTF(Args)                        \
698 do {                                            \
699   if (yydebug)                                  \
700     YYFPRINTF Args;                             \
701 } while (0)
702 
703 /* This macro is provided for backward compatibility. */
704 #ifndef YY_LOCATION_PRINT
705 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
706 #endif
707 
708 
709 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
710 do {                                                                      \
711   if (yydebug)                                                            \
712     {                                                                     \
713       YYFPRINTF (stderr, "%s ", Title);                                   \
714       yy_symbol_print (stderr,                                            \
715                   Type, Value, scanner, ctx, scan_ctx); \
716       YYFPRINTF (stderr, "\n");                                           \
717     }                                                                     \
718 } while (0)
719 
720 
721 /*----------------------------------------.
722 | Print this symbol's value on YYOUTPUT.  |
723 `----------------------------------------*/
724 
725 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,void * scanner,struct parse_context * ctx,struct scan_context * scan_ctx)726 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
727 {
728   FILE *yyo = yyoutput;
729   YYUSE (yyo);
730   YYUSE (scanner);
731   YYUSE (ctx);
732   YYUSE (scan_ctx);
733   if (!yyvaluep)
734     return;
735 # ifdef YYPRINT
736   if (yytype < YYNTOKENS)
737     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
738 # endif
739   YYUSE (yytype);
740 }
741 
742 
743 /*--------------------------------.
744 | Print this symbol on YYOUTPUT.  |
745 `--------------------------------*/
746 
747 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,void * scanner,struct parse_context * ctx,struct scan_context * scan_ctx)748 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
749 {
750   YYFPRINTF (yyoutput, "%s %s (",
751              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
752 
753   yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx);
754   YYFPRINTF (yyoutput, ")");
755 }
756 
757 /*------------------------------------------------------------------.
758 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
759 | TOP (included).                                                   |
760 `------------------------------------------------------------------*/
761 
762 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)763 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
764 {
765   YYFPRINTF (stderr, "Stack now");
766   for (; yybottom <= yytop; yybottom++)
767     {
768       int yybot = *yybottom;
769       YYFPRINTF (stderr, " %d", yybot);
770     }
771   YYFPRINTF (stderr, "\n");
772 }
773 
774 # define YY_STACK_PRINT(Bottom, Top)                            \
775 do {                                                            \
776   if (yydebug)                                                  \
777     yy_stack_print ((Bottom), (Top));                           \
778 } while (0)
779 
780 
781 /*------------------------------------------------.
782 | Report that the YYRULE is going to be reduced.  |
783 `------------------------------------------------*/
784 
785 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule,void * scanner,struct parse_context * ctx,struct scan_context * scan_ctx)786 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
787 {
788   unsigned long int yylno = yyrline[yyrule];
789   int yynrhs = yyr2[yyrule];
790   int yyi;
791   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
792              yyrule - 1, yylno);
793   /* The symbols being reduced.  */
794   for (yyi = 0; yyi < yynrhs; yyi++)
795     {
796       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
797       yy_symbol_print (stderr,
798                        yystos[yyssp[yyi + 1 - yynrhs]],
799                        &(yyvsp[(yyi + 1) - (yynrhs)])
800                                               , scanner, ctx, scan_ctx);
801       YYFPRINTF (stderr, "\n");
802     }
803 }
804 
805 # define YY_REDUCE_PRINT(Rule)          \
806 do {                                    \
807   if (yydebug)                          \
808     yy_reduce_print (yyssp, yyvsp, Rule, scanner, ctx, scan_ctx); \
809 } while (0)
810 
811 /* Nonzero means print parse trace.  It is left uninitialized so that
812    multiple parsers can coexist.  */
813 int yydebug;
814 #else /* !YYDEBUG */
815 # define YYDPRINTF(Args)
816 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
817 # define YY_STACK_PRINT(Bottom, Top)
818 # define YY_REDUCE_PRINT(Rule)
819 #endif /* !YYDEBUG */
820 
821 
822 /* YYINITDEPTH -- initial size of the parser's stacks.  */
823 #ifndef YYINITDEPTH
824 # define YYINITDEPTH 200
825 #endif
826 
827 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
828    if the built-in stack extension method is used).
829 
830    Do not make this value too large; the results are undefined if
831    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
832    evaluated with infinite-precision integer arithmetic.  */
833 
834 #ifndef YYMAXDEPTH
835 # define YYMAXDEPTH 10000
836 #endif
837 
838 
839 #if YYERROR_VERBOSE
840 
841 # ifndef yystrlen
842 #  if defined __GLIBC__ && defined _STRING_H
843 #   define yystrlen strlen
844 #  else
845 /* Return the length of YYSTR.  */
846 static YYSIZE_T
yystrlen(const char * yystr)847 yystrlen (const char *yystr)
848 {
849   YYSIZE_T yylen;
850   for (yylen = 0; yystr[yylen]; yylen++)
851     continue;
852   return yylen;
853 }
854 #  endif
855 # endif
856 
857 # ifndef yystpcpy
858 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
859 #   define yystpcpy stpcpy
860 #  else
861 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
862    YYDEST.  */
863 static char *
yystpcpy(char * yydest,const char * yysrc)864 yystpcpy (char *yydest, const char *yysrc)
865 {
866   char *yyd = yydest;
867   const char *yys = yysrc;
868 
869   while ((*yyd++ = *yys++) != '\0')
870     continue;
871 
872   return yyd - 1;
873 }
874 #  endif
875 # endif
876 
877 # ifndef yytnamerr
878 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
879    quotes and backslashes, so that it's suitable for yyerror.  The
880    heuristic is that double-quoting is unnecessary unless the string
881    contains an apostrophe, a comma, or backslash (other than
882    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
883    null, do not copy; instead, return the length of what the result
884    would have been.  */
885 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)886 yytnamerr (char *yyres, const char *yystr)
887 {
888   if (*yystr == '"')
889     {
890       YYSIZE_T yyn = 0;
891       char const *yyp = yystr;
892 
893       for (;;)
894         switch (*++yyp)
895           {
896           case '\'':
897           case ',':
898             goto do_not_strip_quotes;
899 
900           case '\\':
901             if (*++yyp != '\\')
902               goto do_not_strip_quotes;
903             /* Fall through.  */
904           default:
905             if (yyres)
906               yyres[yyn] = *yyp;
907             yyn++;
908             break;
909 
910           case '"':
911             if (yyres)
912               yyres[yyn] = '\0';
913             return yyn;
914           }
915     do_not_strip_quotes: ;
916     }
917 
918   if (! yyres)
919     return yystrlen (yystr);
920 
921   return yystpcpy (yyres, yystr) - yyres;
922 }
923 # endif
924 
925 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
926    about the unexpected token YYTOKEN for the state stack whose top is
927    YYSSP.
928 
929    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
930    not large enough to hold the message.  In that case, also set
931    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
932    required number of bytes is too large to store.  */
933 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)934 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
935                 yytype_int16 *yyssp, int yytoken)
936 {
937   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
938   YYSIZE_T yysize = yysize0;
939   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
940   /* Internationalized format string. */
941   const char *yyformat = YY_NULLPTR;
942   /* Arguments of yyformat. */
943   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
944   /* Number of reported tokens (one for the "unexpected", one per
945      "expected"). */
946   int yycount = 0;
947 
948   /* There are many possibilities here to consider:
949      - If this state is a consistent state with a default action, then
950        the only way this function was invoked is if the default action
951        is an error action.  In that case, don't check for expected
952        tokens because there are none.
953      - The only way there can be no lookahead present (in yychar) is if
954        this state is a consistent state with a default action.  Thus,
955        detecting the absence of a lookahead is sufficient to determine
956        that there is no unexpected or expected token to report.  In that
957        case, just report a simple "syntax error".
958      - Don't assume there isn't a lookahead just because this state is a
959        consistent state with a default action.  There might have been a
960        previous inconsistent state, consistent state with a non-default
961        action, or user semantic action that manipulated yychar.
962      - Of course, the expected token list depends on states to have
963        correct lookahead information, and it depends on the parser not
964        to perform extra reductions after fetching a lookahead from the
965        scanner and before detecting a syntax error.  Thus, state merging
966        (from LALR or IELR) and default reductions corrupt the expected
967        token list.  However, the list is correct for canonical LR with
968        one exception: it will still contain any token that will not be
969        accepted due to an error action in a later state.
970   */
971   if (yytoken != YYEMPTY)
972     {
973       int yyn = yypact[*yyssp];
974       yyarg[yycount++] = yytname[yytoken];
975       if (!yypact_value_is_default (yyn))
976         {
977           /* Start YYX at -YYN if negative to avoid negative indexes in
978              YYCHECK.  In other words, skip the first -YYN actions for
979              this state because they are default actions.  */
980           int yyxbegin = yyn < 0 ? -yyn : 0;
981           /* Stay within bounds of both yycheck and yytname.  */
982           int yychecklim = YYLAST - yyn + 1;
983           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
984           int yyx;
985 
986           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
987             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
988                 && !yytable_value_is_error (yytable[yyx + yyn]))
989               {
990                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
991                   {
992                     yycount = 1;
993                     yysize = yysize0;
994                     break;
995                   }
996                 yyarg[yycount++] = yytname[yyx];
997                 {
998                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
999                   if (! (yysize <= yysize1
1000                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1001                     return 2;
1002                   yysize = yysize1;
1003                 }
1004               }
1005         }
1006     }
1007 
1008   switch (yycount)
1009     {
1010 # define YYCASE_(N, S)                      \
1011       case N:                               \
1012         yyformat = S;                       \
1013       break
1014       YYCASE_(0, YY_("syntax error"));
1015       YYCASE_(1, YY_("syntax error, unexpected %s"));
1016       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1017       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1018       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1019       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1020 # undef YYCASE_
1021     }
1022 
1023   {
1024     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1025     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1026       return 2;
1027     yysize = yysize1;
1028   }
1029 
1030   if (*yymsg_alloc < yysize)
1031     {
1032       *yymsg_alloc = 2 * yysize;
1033       if (! (yysize <= *yymsg_alloc
1034              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1035         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1036       return 1;
1037     }
1038 
1039   /* Avoid sprintf, as that infringes on the user's name space.
1040      Don't have undefined behavior even if the translation
1041      produced a string with the wrong number of "%s"s.  */
1042   {
1043     char *yyp = *yymsg;
1044     int yyi = 0;
1045     while ((*yyp = *yyformat) != '\0')
1046       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1047         {
1048           yyp += yytnamerr (yyp, yyarg[yyi++]);
1049           yyformat += 2;
1050         }
1051       else
1052         {
1053           yyp++;
1054           yyformat++;
1055         }
1056   }
1057   return 0;
1058 }
1059 #endif /* YYERROR_VERBOSE */
1060 
1061 /*-----------------------------------------------.
1062 | Release the memory associated to this symbol.  |
1063 `-----------------------------------------------*/
1064 
1065 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,void * scanner,struct parse_context * ctx,struct scan_context * scan_ctx)1066 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
1067 {
1068   YYUSE (yyvaluep);
1069   YYUSE (scanner);
1070   YYUSE (ctx);
1071   YYUSE (scan_ctx);
1072   if (!yymsg)
1073     yymsg = "Deleting";
1074   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1075 
1076   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1077   switch (yytype)
1078     {
1079           case 9: /* TOK_STRING  */
1080 #line 88 "grammar.y" /* yacc.c:1257  */
1081       { free(((*yyvaluep).sval)); }
1082 #line 1083 "grammar.c" /* yacc.c:1257  */
1083         break;
1084 
1085 
1086       default:
1087         break;
1088     }
1089   YY_IGNORE_MAYBE_UNINITIALIZED_END
1090 }
1091 
1092 
1093 
1094 
1095 /*----------.
1096 | yyparse.  |
1097 `----------*/
1098 
1099 int
yyparse(void * scanner,struct parse_context * ctx,struct scan_context * scan_ctx)1100 yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
1101 {
1102 /* The lookahead symbol.  */
1103 int yychar;
1104 
1105 
1106 /* The semantic value of the lookahead symbol.  */
1107 /* Default value used for initialization, for pacifying older GCCs
1108    or non-GCC compilers.  */
1109 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1110 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1111 
1112     /* Number of syntax errors so far.  */
1113     int yynerrs;
1114 
1115     int yystate;
1116     /* Number of tokens to shift before error messages enabled.  */
1117     int yyerrstatus;
1118 
1119     /* The stacks and their tools:
1120        'yyss': related to states.
1121        'yyvs': related to semantic values.
1122 
1123        Refer to the stacks through separate pointers, to allow yyoverflow
1124        to reallocate them elsewhere.  */
1125 
1126     /* The state stack.  */
1127     yytype_int16 yyssa[YYINITDEPTH];
1128     yytype_int16 *yyss;
1129     yytype_int16 *yyssp;
1130 
1131     /* The semantic value stack.  */
1132     YYSTYPE yyvsa[YYINITDEPTH];
1133     YYSTYPE *yyvs;
1134     YYSTYPE *yyvsp;
1135 
1136     YYSIZE_T yystacksize;
1137 
1138   int yyn;
1139   int yyresult;
1140   /* Lookahead token as an internal (translated) token number.  */
1141   int yytoken = 0;
1142   /* The variables used to return semantic value and location from the
1143      action routines.  */
1144   YYSTYPE yyval;
1145 
1146 #if YYERROR_VERBOSE
1147   /* Buffer for error messages, and its allocated size.  */
1148   char yymsgbuf[128];
1149   char *yymsg = yymsgbuf;
1150   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1151 #endif
1152 
1153 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1154 
1155   /* The number of symbols on the RHS of the reduced rule.
1156      Keep to zero when no symbol should be popped.  */
1157   int yylen = 0;
1158 
1159   yyssp = yyss = yyssa;
1160   yyvsp = yyvs = yyvsa;
1161   yystacksize = YYINITDEPTH;
1162 
1163   YYDPRINTF ((stderr, "Starting parse\n"));
1164 
1165   yystate = 0;
1166   yyerrstatus = 0;
1167   yynerrs = 0;
1168   yychar = YYEMPTY; /* Cause a token to be read.  */
1169   goto yysetstate;
1170 
1171 /*------------------------------------------------------------.
1172 | yynewstate -- Push a new state, which is found in yystate.  |
1173 `------------------------------------------------------------*/
1174  yynewstate:
1175   /* In all cases, when you get here, the value and location stacks
1176      have just been pushed.  So pushing a state here evens the stacks.  */
1177   yyssp++;
1178 
1179  yysetstate:
1180   *yyssp = yystate;
1181 
1182   if (yyss + yystacksize - 1 <= yyssp)
1183     {
1184       /* Get the current used size of the three stacks, in elements.  */
1185       YYSIZE_T yysize = yyssp - yyss + 1;
1186 
1187 #ifdef yyoverflow
1188       {
1189         /* Give user a chance to reallocate the stack.  Use copies of
1190            these so that the &'s don't force the real ones into
1191            memory.  */
1192         YYSTYPE *yyvs1 = yyvs;
1193         yytype_int16 *yyss1 = yyss;
1194 
1195         /* Each stack pointer address is followed by the size of the
1196            data in use in that stack, in bytes.  This used to be a
1197            conditional around just the two extra args, but that might
1198            be undefined if yyoverflow is a macro.  */
1199         yyoverflow (YY_("memory exhausted"),
1200                     &yyss1, yysize * sizeof (*yyssp),
1201                     &yyvs1, yysize * sizeof (*yyvsp),
1202                     &yystacksize);
1203 
1204         yyss = yyss1;
1205         yyvs = yyvs1;
1206       }
1207 #else /* no yyoverflow */
1208 # ifndef YYSTACK_RELOCATE
1209       goto yyexhaustedlab;
1210 # else
1211       /* Extend the stack our own way.  */
1212       if (YYMAXDEPTH <= yystacksize)
1213         goto yyexhaustedlab;
1214       yystacksize *= 2;
1215       if (YYMAXDEPTH < yystacksize)
1216         yystacksize = YYMAXDEPTH;
1217 
1218       {
1219         yytype_int16 *yyss1 = yyss;
1220         union yyalloc *yyptr =
1221           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1222         if (! yyptr)
1223           goto yyexhaustedlab;
1224         YYSTACK_RELOCATE (yyss_alloc, yyss);
1225         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1226 #  undef YYSTACK_RELOCATE
1227         if (yyss1 != yyssa)
1228           YYSTACK_FREE (yyss1);
1229       }
1230 # endif
1231 #endif /* no yyoverflow */
1232 
1233       yyssp = yyss + yysize - 1;
1234       yyvsp = yyvs + yysize - 1;
1235 
1236       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1237                   (unsigned long int) yystacksize));
1238 
1239       if (yyss + yystacksize - 1 <= yyssp)
1240         YYABORT;
1241     }
1242 
1243   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1244 
1245   if (yystate == YYFINAL)
1246     YYACCEPT;
1247 
1248   goto yybackup;
1249 
1250 /*-----------.
1251 | yybackup.  |
1252 `-----------*/
1253 yybackup:
1254 
1255   /* Do appropriate processing given the current state.  Read a
1256      lookahead token if we need one and don't already have one.  */
1257 
1258   /* First try to decide what to do without reference to lookahead token.  */
1259   yyn = yypact[yystate];
1260   if (yypact_value_is_default (yyn))
1261     goto yydefault;
1262 
1263   /* Not known => get a lookahead token if don't already have one.  */
1264 
1265   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1266   if (yychar == YYEMPTY)
1267     {
1268       YYDPRINTF ((stderr, "Reading a token: "));
1269       yychar = yylex (&yylval, scanner);
1270     }
1271 
1272   if (yychar <= YYEOF)
1273     {
1274       yychar = yytoken = YYEOF;
1275       YYDPRINTF ((stderr, "Now at end of input.\n"));
1276     }
1277   else
1278     {
1279       yytoken = YYTRANSLATE (yychar);
1280       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1281     }
1282 
1283   /* If the proper action on seeing token YYTOKEN is to reduce or to
1284      detect an error, take that action.  */
1285   yyn += yytoken;
1286   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1287     goto yydefault;
1288   yyn = yytable[yyn];
1289   if (yyn <= 0)
1290     {
1291       if (yytable_value_is_error (yyn))
1292         goto yyerrlab;
1293       yyn = -yyn;
1294       goto yyreduce;
1295     }
1296 
1297   /* Count tokens shifted since error; after three, turn off error
1298      status.  */
1299   if (yyerrstatus)
1300     yyerrstatus--;
1301 
1302   /* Shift the lookahead token.  */
1303   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1304 
1305   /* Discard the shifted token.  */
1306   yychar = YYEMPTY;
1307 
1308   yystate = yyn;
1309   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1310   *++yyvsp = yylval;
1311   YY_IGNORE_MAYBE_UNINITIALIZED_END
1312 
1313   goto yynewstate;
1314 
1315 
1316 /*-----------------------------------------------------------.
1317 | yydefault -- do the default action for the current state.  |
1318 `-----------------------------------------------------------*/
1319 yydefault:
1320   yyn = yydefact[yystate];
1321   if (yyn == 0)
1322     goto yyerrlab;
1323   goto yyreduce;
1324 
1325 
1326 /*-----------------------------.
1327 | yyreduce -- Do a reduction.  |
1328 `-----------------------------*/
1329 yyreduce:
1330   /* yyn is the number of a rule to reduce with.  */
1331   yylen = yyr2[yyn];
1332 
1333   /* If YYLEN is nonzero, implement the default value of the action:
1334      '$$ = $1'.
1335 
1336      Otherwise, the following line sets YYVAL to garbage.
1337      This behavior is undocumented and Bison
1338      users should not rely upon it.  Assigning to YYVAL
1339      unconditionally makes the parser a bit smaller, and it avoids a
1340      GCC warning that YYVAL may be used uninitialized.  */
1341   yyval = yyvsp[1-yylen];
1342 
1343 
1344   YY_REDUCE_PRINT (yyn);
1345   switch (yyn)
1346     {
1347         case 11:
1348 #line 115 "grammar.y" /* yacc.c:1646  */
1349     {
1350     ctx->setting = config_setting_add(ctx->parent, (yyvsp[0].sval), CONFIG_TYPE_NONE);
1351 
1352     if(ctx->setting == NULL)
1353     {
1354       libconfig_yyerror(scanner, ctx, scan_ctx, err_duplicate_setting);
1355       YYABORT;
1356     }
1357     else
1358     {
1359       CAPTURE_PARSE_POS(ctx->setting);
1360     }
1361   }
1362 #line 1363 "grammar.c" /* yacc.c:1646  */
1363     break;
1364 
1365   case 13:
1366 #line 134 "grammar.y" /* yacc.c:1646  */
1367     {
1368     if(IN_LIST())
1369     {
1370       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_ARRAY);
1371       CAPTURE_PARSE_POS(ctx->parent);
1372     }
1373     else
1374     {
1375       ctx->setting->type = CONFIG_TYPE_ARRAY;
1376       ctx->parent = ctx->setting;
1377       ctx->setting = NULL;
1378     }
1379   }
1380 #line 1381 "grammar.c" /* yacc.c:1646  */
1381     break;
1382 
1383   case 14:
1384 #line 149 "grammar.y" /* yacc.c:1646  */
1385     {
1386     if(ctx->parent)
1387       ctx->parent = ctx->parent->parent;
1388   }
1389 #line 1390 "grammar.c" /* yacc.c:1646  */
1390     break;
1391 
1392   case 15:
1393 #line 157 "grammar.y" /* yacc.c:1646  */
1394     {
1395     if(IN_LIST())
1396     {
1397       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_LIST);
1398       CAPTURE_PARSE_POS(ctx->parent);
1399     }
1400     else
1401     {
1402       ctx->setting->type = CONFIG_TYPE_LIST;
1403       ctx->parent = ctx->setting;
1404       ctx->setting = NULL;
1405     }
1406   }
1407 #line 1408 "grammar.c" /* yacc.c:1646  */
1408     break;
1409 
1410   case 16:
1411 #line 172 "grammar.y" /* yacc.c:1646  */
1412     {
1413     if(ctx->parent)
1414       ctx->parent = ctx->parent->parent;
1415   }
1416 #line 1417 "grammar.c" /* yacc.c:1646  */
1417     break;
1418 
1419   case 21:
1420 #line 186 "grammar.y" /* yacc.c:1646  */
1421     { libconfig_parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); }
1422 #line 1423 "grammar.c" /* yacc.c:1646  */
1423     break;
1424 
1425   case 22:
1426 #line 187 "grammar.y" /* yacc.c:1646  */
1427     { libconfig_parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); }
1428 #line 1429 "grammar.c" /* yacc.c:1646  */
1429     break;
1430 
1431   case 23:
1432 #line 192 "grammar.y" /* yacc.c:1646  */
1433     {
1434     if(IN_ARRAY() || IN_LIST())
1435     {
1436       config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1,
1437                                                          (int)(yyvsp[0].ival));
1438 
1439       if(! e)
1440       {
1441         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1442         YYABORT;
1443       }
1444       else
1445       {
1446         CAPTURE_PARSE_POS(e);
1447       }
1448     }
1449     else
1450       config_setting_set_bool(ctx->setting, (int)(yyvsp[0].ival));
1451   }
1452 #line 1453 "grammar.c" /* yacc.c:1646  */
1453     break;
1454 
1455   case 24:
1456 #line 212 "grammar.y" /* yacc.c:1646  */
1457     {
1458     if(IN_ARRAY() || IN_LIST())
1459     {
1460       config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival));
1461       if(! e)
1462       {
1463         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1464         YYABORT;
1465       }
1466       else
1467       {
1468         config_setting_set_format(e, CONFIG_FORMAT_DEFAULT);
1469         CAPTURE_PARSE_POS(e);
1470       }
1471     }
1472     else
1473     {
1474       config_setting_set_int(ctx->setting, (yyvsp[0].ival));
1475       config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT);
1476     }
1477   }
1478 #line 1479 "grammar.c" /* yacc.c:1646  */
1479     break;
1480 
1481   case 25:
1482 #line 234 "grammar.y" /* yacc.c:1646  */
1483     {
1484     if(IN_ARRAY() || IN_LIST())
1485     {
1486       config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval));
1487       if(! e)
1488       {
1489         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1490         YYABORT;
1491       }
1492       else
1493       {
1494         config_setting_set_format(e, CONFIG_FORMAT_DEFAULT);
1495         CAPTURE_PARSE_POS(e);
1496       }
1497     }
1498     else
1499     {
1500       config_setting_set_int64(ctx->setting, (yyvsp[0].llval));
1501       config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT);
1502     }
1503   }
1504 #line 1505 "grammar.c" /* yacc.c:1646  */
1505     break;
1506 
1507   case 26:
1508 #line 256 "grammar.y" /* yacc.c:1646  */
1509     {
1510     if(IN_ARRAY() || IN_LIST())
1511     {
1512       config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival));
1513       if(! e)
1514       {
1515         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1516         YYABORT;
1517       }
1518       else
1519       {
1520         config_setting_set_format(e, CONFIG_FORMAT_HEX);
1521         CAPTURE_PARSE_POS(e);
1522       }
1523     }
1524     else
1525     {
1526       config_setting_set_int(ctx->setting, (yyvsp[0].ival));
1527       config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX);
1528     }
1529   }
1530 #line 1531 "grammar.c" /* yacc.c:1646  */
1531     break;
1532 
1533   case 27:
1534 #line 278 "grammar.y" /* yacc.c:1646  */
1535     {
1536     if(IN_ARRAY() || IN_LIST())
1537     {
1538       config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval));
1539       if(! e)
1540       {
1541         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1542         YYABORT;
1543       }
1544       else
1545       {
1546         config_setting_set_format(e, CONFIG_FORMAT_HEX);
1547         CAPTURE_PARSE_POS(e);
1548       }
1549     }
1550     else
1551     {
1552       config_setting_set_int64(ctx->setting, (yyvsp[0].llval));
1553       config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX);
1554     }
1555   }
1556 #line 1557 "grammar.c" /* yacc.c:1646  */
1557     break;
1558 
1559   case 28:
1560 #line 300 "grammar.y" /* yacc.c:1646  */
1561     {
1562     if(IN_ARRAY() || IN_LIST())
1563     {
1564       config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[0].fval));
1565       if(! e)
1566       {
1567         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1568         YYABORT;
1569       }
1570       else
1571       {
1572         CAPTURE_PARSE_POS(e);
1573       }
1574     }
1575     else
1576       config_setting_set_float(ctx->setting, (yyvsp[0].fval));
1577   }
1578 #line 1579 "grammar.c" /* yacc.c:1646  */
1579     break;
1580 
1581   case 29:
1582 #line 318 "grammar.y" /* yacc.c:1646  */
1583     {
1584     if(IN_ARRAY() || IN_LIST())
1585     {
1586       const char *s = libconfig_parsectx_take_string(ctx);
1587       config_setting_t *e = config_setting_set_string_elem(ctx->parent, -1, s);
1588       __delete(s);
1589 
1590       if(! e)
1591       {
1592         libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type);
1593         YYABORT;
1594       }
1595       else
1596       {
1597         CAPTURE_PARSE_POS(e);
1598       }
1599     }
1600     else
1601     {
1602       const char *s = libconfig_parsectx_take_string(ctx);
1603       config_setting_set_string(ctx->setting, s);
1604       __delete(s);
1605     }
1606   }
1607 #line 1608 "grammar.c" /* yacc.c:1646  */
1608     break;
1609 
1610   case 40:
1611 #line 368 "grammar.y" /* yacc.c:1646  */
1612     {
1613     if(IN_LIST())
1614     {
1615       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_GROUP);
1616       CAPTURE_PARSE_POS(ctx->parent);
1617     }
1618     else
1619     {
1620       ctx->setting->type = CONFIG_TYPE_GROUP;
1621       ctx->parent = ctx->setting;
1622       ctx->setting = NULL;
1623     }
1624   }
1625 #line 1626 "grammar.c" /* yacc.c:1646  */
1626     break;
1627 
1628   case 41:
1629 #line 383 "grammar.y" /* yacc.c:1646  */
1630     {
1631     if(ctx->parent)
1632       ctx->parent = ctx->parent->parent;
1633   }
1634 #line 1635 "grammar.c" /* yacc.c:1646  */
1635     break;
1636 
1637 
1638 #line 1639 "grammar.c" /* yacc.c:1646  */
1639       default: break;
1640     }
1641   /* User semantic actions sometimes alter yychar, and that requires
1642      that yytoken be updated with the new translation.  We take the
1643      approach of translating immediately before every use of yytoken.
1644      One alternative is translating here after every semantic action,
1645      but that translation would be missed if the semantic action invokes
1646      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1647      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1648      incorrect destructor might then be invoked immediately.  In the
1649      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1650      to an incorrect destructor call or verbose syntax error message
1651      before the lookahead is translated.  */
1652   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1653 
1654   YYPOPSTACK (yylen);
1655   yylen = 0;
1656   YY_STACK_PRINT (yyss, yyssp);
1657 
1658   *++yyvsp = yyval;
1659 
1660   /* Now 'shift' the result of the reduction.  Determine what state
1661      that goes to, based on the state we popped back to and the rule
1662      number reduced by.  */
1663 
1664   yyn = yyr1[yyn];
1665 
1666   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1667   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1668     yystate = yytable[yystate];
1669   else
1670     yystate = yydefgoto[yyn - YYNTOKENS];
1671 
1672   goto yynewstate;
1673 
1674 
1675 /*--------------------------------------.
1676 | yyerrlab -- here on detecting error.  |
1677 `--------------------------------------*/
1678 yyerrlab:
1679   /* Make sure we have latest lookahead translation.  See comments at
1680      user semantic actions for why this is necessary.  */
1681   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1682 
1683   /* If not already recovering from an error, report this error.  */
1684   if (!yyerrstatus)
1685     {
1686       ++yynerrs;
1687 #if ! YYERROR_VERBOSE
1688       yyerror (scanner, ctx, scan_ctx, YY_("syntax error"));
1689 #else
1690 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1691                                         yyssp, yytoken)
1692       {
1693         char const *yymsgp = YY_("syntax error");
1694         int yysyntax_error_status;
1695         yysyntax_error_status = YYSYNTAX_ERROR;
1696         if (yysyntax_error_status == 0)
1697           yymsgp = yymsg;
1698         else if (yysyntax_error_status == 1)
1699           {
1700             if (yymsg != yymsgbuf)
1701               YYSTACK_FREE (yymsg);
1702             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1703             if (!yymsg)
1704               {
1705                 yymsg = yymsgbuf;
1706                 yymsg_alloc = sizeof yymsgbuf;
1707                 yysyntax_error_status = 2;
1708               }
1709             else
1710               {
1711                 yysyntax_error_status = YYSYNTAX_ERROR;
1712                 yymsgp = yymsg;
1713               }
1714           }
1715         yyerror (scanner, ctx, scan_ctx, yymsgp);
1716         if (yysyntax_error_status == 2)
1717           goto yyexhaustedlab;
1718       }
1719 # undef YYSYNTAX_ERROR
1720 #endif
1721     }
1722 
1723 
1724 
1725   if (yyerrstatus == 3)
1726     {
1727       /* If just tried and failed to reuse lookahead token after an
1728          error, discard it.  */
1729 
1730       if (yychar <= YYEOF)
1731         {
1732           /* Return failure if at end of input.  */
1733           if (yychar == YYEOF)
1734             YYABORT;
1735         }
1736       else
1737         {
1738           yydestruct ("Error: discarding",
1739                       yytoken, &yylval, scanner, ctx, scan_ctx);
1740           yychar = YYEMPTY;
1741         }
1742     }
1743 
1744   /* Else will try to reuse lookahead token after shifting the error
1745      token.  */
1746   goto yyerrlab1;
1747 
1748 
1749 /*---------------------------------------------------.
1750 | yyerrorlab -- error raised explicitly by YYERROR.  |
1751 `---------------------------------------------------*/
1752 yyerrorlab:
1753 
1754   /* Pacify compilers like GCC when the user code never invokes
1755      YYERROR and the label yyerrorlab therefore never appears in user
1756      code.  */
1757   if (/*CONSTCOND*/ 0)
1758      goto yyerrorlab;
1759 
1760   /* Do not reclaim the symbols of the rule whose action triggered
1761      this YYERROR.  */
1762   YYPOPSTACK (yylen);
1763   yylen = 0;
1764   YY_STACK_PRINT (yyss, yyssp);
1765   yystate = *yyssp;
1766   goto yyerrlab1;
1767 
1768 
1769 /*-------------------------------------------------------------.
1770 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1771 `-------------------------------------------------------------*/
1772 yyerrlab1:
1773   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1774 
1775   for (;;)
1776     {
1777       yyn = yypact[yystate];
1778       if (!yypact_value_is_default (yyn))
1779         {
1780           yyn += YYTERROR;
1781           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1782             {
1783               yyn = yytable[yyn];
1784               if (0 < yyn)
1785                 break;
1786             }
1787         }
1788 
1789       /* Pop the current state because it cannot handle the error token.  */
1790       if (yyssp == yyss)
1791         YYABORT;
1792 
1793 
1794       yydestruct ("Error: popping",
1795                   yystos[yystate], yyvsp, scanner, ctx, scan_ctx);
1796       YYPOPSTACK (1);
1797       yystate = *yyssp;
1798       YY_STACK_PRINT (yyss, yyssp);
1799     }
1800 
1801   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1802   *++yyvsp = yylval;
1803   YY_IGNORE_MAYBE_UNINITIALIZED_END
1804 
1805 
1806   /* Shift the error token.  */
1807   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1808 
1809   yystate = yyn;
1810   goto yynewstate;
1811 
1812 
1813 /*-------------------------------------.
1814 | yyacceptlab -- YYACCEPT comes here.  |
1815 `-------------------------------------*/
1816 yyacceptlab:
1817   yyresult = 0;
1818   goto yyreturn;
1819 
1820 /*-----------------------------------.
1821 | yyabortlab -- YYABORT comes here.  |
1822 `-----------------------------------*/
1823 yyabortlab:
1824   yyresult = 1;
1825   goto yyreturn;
1826 
1827 #if !defined yyoverflow || YYERROR_VERBOSE
1828 /*-------------------------------------------------.
1829 | yyexhaustedlab -- memory exhaustion comes here.  |
1830 `-------------------------------------------------*/
1831 yyexhaustedlab:
1832   yyerror (scanner, ctx, scan_ctx, YY_("memory exhausted"));
1833   yyresult = 2;
1834   /* Fall through.  */
1835 #endif
1836 
1837 yyreturn:
1838   if (yychar != YYEMPTY)
1839     {
1840       /* Make sure we have latest lookahead translation.  See comments at
1841          user semantic actions for why this is necessary.  */
1842       yytoken = YYTRANSLATE (yychar);
1843       yydestruct ("Cleanup: discarding lookahead",
1844                   yytoken, &yylval, scanner, ctx, scan_ctx);
1845     }
1846   /* Do not reclaim the symbols of the rule whose action triggered
1847      this YYABORT or YYACCEPT.  */
1848   YYPOPSTACK (yylen);
1849   YY_STACK_PRINT (yyss, yyssp);
1850   while (yyssp != yyss)
1851     {
1852       yydestruct ("Cleanup: popping",
1853                   yystos[*yyssp], yyvsp, scanner, ctx, scan_ctx);
1854       YYPOPSTACK (1);
1855     }
1856 #ifndef yyoverflow
1857   if (yyss != yyssa)
1858     YYSTACK_FREE (yyss);
1859 #endif
1860 #if YYERROR_VERBOSE
1861   if (yymsg != yymsgbuf)
1862     YYSTACK_FREE (yymsg);
1863 #endif
1864   return yyresult;
1865 }
1866 #line 389 "grammar.y" /* yacc.c:1906  */
1867 
1868