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