1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
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. */
43 /* Identify Bison output. */
44 #define YYBISON 1
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.2"
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
52 /* Pure parsers. */
53 #define YYPURE 0
55 /* Push parsers. */
56 #define YYPUSH 0
58 /* Pull parsers. */
59 #define YYPULL 1
64 /* Copy the first part of user declarations. */
65 #line 27 "parser.y" /* yacc.c:339 */
67 #include <stdlib.h>
68 #include <string.h>
69 #include "oconfig.h"
70 #include "aux_types.h"
72 static char *unquote (const char *orig);
73 static int yyerror (const char *s);
75 /* Lexer variables */
76 extern int yylineno;
77 extern char *yytext;
79 extern oconfig_item_t *ci_root;
80 extern char *c_file;
82 #line 83 "parser.c" /* yacc.c:339 */
84 # ifndef YY_NULLPTR
85 # if defined __cplusplus && 201103L <= __cplusplus
86 # define YY_NULLPTR nullptr
87 # else
88 # define YY_NULLPTR 0
89 # endif
90 # endif
92 /* Enabling verbose error messages. */
93 #ifdef YYERROR_VERBOSE
94 # undef YYERROR_VERBOSE
95 # define YYERROR_VERBOSE 1
96 #else
97 # define YYERROR_VERBOSE 1
98 #endif
100 /* In a future release of Bison, this section will be replaced
101 by #include "y.tab.h". */
102 #ifndef YY_YY_Y_TAB_H_INCLUDED
103 # define YY_YY_Y_TAB_H_INCLUDED
104 /* Debug traces. */
105 #ifndef YYDEBUG
106 # define YYDEBUG 0
107 #endif
108 #if YYDEBUG
109 extern int yydebug;
110 #endif
112 /* Token type. */
113 #ifndef YYTOKENTYPE
114 # define YYTOKENTYPE
115 enum yytokentype
116 {
117 NUMBER = 258,
118 BTRUE = 259,
119 BFALSE = 260,
120 QUOTED_STRING = 261,
121 UNQUOTED_STRING = 262,
122 SLASH = 263,
123 OPENBRAC = 264,
124 CLOSEBRAC = 265,
125 EOL = 266
126 };
127 #endif
128 /* Tokens. */
129 #define NUMBER 258
130 #define BTRUE 259
131 #define BFALSE 260
132 #define QUOTED_STRING 261
133 #define UNQUOTED_STRING 262
134 #define SLASH 263
135 #define OPENBRAC 264
136 #define CLOSEBRAC 265
137 #define EOL 266
139 /* Value type. */
140 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
141 typedef union YYSTYPE YYSTYPE;
142 union YYSTYPE
143 {
144 #line 46 "parser.y" /* yacc.c:355 */
146 double number;
147 int boolean;
148 char *string;
149 oconfig_value_t cv;
150 oconfig_item_t ci;
151 argument_list_t al;
152 statement_list_t sl;
154 #line 155 "parser.c" /* yacc.c:355 */
155 };
156 # define YYSTYPE_IS_TRIVIAL 1
157 # define YYSTYPE_IS_DECLARED 1
158 #endif
161 extern YYSTYPE yylval;
163 int yyparse (void);
165 #endif /* !YY_YY_Y_TAB_H_INCLUDED */
167 /* Copy the second part of user declarations. */
169 #line 170 "parser.c" /* yacc.c:358 */
171 #ifdef short
172 # undef short
173 #endif
175 #ifdef YYTYPE_UINT8
176 typedef YYTYPE_UINT8 yytype_uint8;
177 #else
178 typedef unsigned char yytype_uint8;
179 #endif
181 #ifdef YYTYPE_INT8
182 typedef YYTYPE_INT8 yytype_int8;
183 #else
184 typedef signed char yytype_int8;
185 #endif
187 #ifdef YYTYPE_UINT16
188 typedef YYTYPE_UINT16 yytype_uint16;
189 #else
190 typedef unsigned short int yytype_uint16;
191 #endif
193 #ifdef YYTYPE_INT16
194 typedef YYTYPE_INT16 yytype_int16;
195 #else
196 typedef short int yytype_int16;
197 #endif
199 #ifndef YYSIZE_T
200 # ifdef __SIZE_TYPE__
201 # define YYSIZE_T __SIZE_TYPE__
202 # elif defined size_t
203 # define YYSIZE_T size_t
204 # elif ! defined YYSIZE_T
205 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
206 # define YYSIZE_T size_t
207 # else
208 # define YYSIZE_T unsigned int
209 # endif
210 #endif
212 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
214 #ifndef YY_
215 # if defined YYENABLE_NLS && YYENABLE_NLS
216 # if ENABLE_NLS
217 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
218 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
219 # endif
220 # endif
221 # ifndef YY_
222 # define YY_(Msgid) Msgid
223 # endif
224 #endif
226 #ifndef YY_ATTRIBUTE
227 # if (defined __GNUC__ \
228 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
229 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
230 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
231 # else
232 # define YY_ATTRIBUTE(Spec) /* empty */
233 # endif
234 #endif
236 #ifndef YY_ATTRIBUTE_PURE
237 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
238 #endif
240 #ifndef YY_ATTRIBUTE_UNUSED
241 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
242 #endif
244 #if !defined _Noreturn \
245 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
246 # if defined _MSC_VER && 1200 <= _MSC_VER
247 # define _Noreturn __declspec (noreturn)
248 # else
249 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
250 # endif
251 #endif
253 /* Suppress unused-variable warnings by "using" E. */
254 #if ! defined lint || defined __GNUC__
255 # define YYUSE(E) ((void) (E))
256 #else
257 # define YYUSE(E) /* empty */
258 #endif
260 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
261 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
262 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
263 _Pragma ("GCC diagnostic push") \
264 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
265 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
266 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
267 _Pragma ("GCC diagnostic pop")
268 #else
269 # define YY_INITIAL_VALUE(Value) Value
270 #endif
271 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
272 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
273 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
274 #endif
275 #ifndef YY_INITIAL_VALUE
276 # define YY_INITIAL_VALUE(Value) /* Nothing. */
277 #endif
280 #if ! defined yyoverflow || YYERROR_VERBOSE
282 /* The parser invokes alloca or malloc; define the necessary symbols. */
284 # ifdef YYSTACK_USE_ALLOCA
285 # if YYSTACK_USE_ALLOCA
286 # ifdef __GNUC__
287 # define YYSTACK_ALLOC __builtin_alloca
288 # elif defined __BUILTIN_VA_ARG_INCR
289 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
290 # elif defined _AIX
291 # define YYSTACK_ALLOC __alloca
292 # elif defined _MSC_VER
293 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
294 # define alloca _alloca
295 # else
296 # define YYSTACK_ALLOC alloca
297 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
298 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
299 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
300 # ifndef EXIT_SUCCESS
301 # define EXIT_SUCCESS 0
302 # endif
303 # endif
304 # endif
305 # endif
306 # endif
308 # ifdef YYSTACK_ALLOC
309 /* Pacify GCC's 'empty if-body' warning. */
310 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
311 # ifndef YYSTACK_ALLOC_MAXIMUM
312 /* The OS might guarantee only one guard page at the bottom of the stack,
313 and a page size can be as small as 4096 bytes. So we cannot safely
314 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
315 to allow for a few compiler-allocated temporary stack slots. */
316 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
317 # endif
318 # else
319 # define YYSTACK_ALLOC YYMALLOC
320 # define YYSTACK_FREE YYFREE
321 # ifndef YYSTACK_ALLOC_MAXIMUM
322 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
323 # endif
324 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
325 && ! ((defined YYMALLOC || defined malloc) \
326 && (defined YYFREE || defined free)))
327 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
328 # ifndef EXIT_SUCCESS
329 # define EXIT_SUCCESS 0
330 # endif
331 # endif
332 # ifndef YYMALLOC
333 # define YYMALLOC malloc
334 # if ! defined malloc && ! defined EXIT_SUCCESS
335 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
336 # endif
337 # endif
338 # ifndef YYFREE
339 # define YYFREE free
340 # if ! defined free && ! defined EXIT_SUCCESS
341 void free (void *); /* INFRINGES ON USER NAME SPACE */
342 # endif
343 # endif
344 # endif
345 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
348 #if (! defined yyoverflow \
349 && (! defined __cplusplus \
350 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
352 /* A type that is properly aligned for any stack member. */
353 union yyalloc
354 {
355 yytype_int16 yyss_alloc;
356 YYSTYPE yyvs_alloc;
357 };
359 /* The size of the maximum gap between one aligned stack and the next. */
360 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
362 /* The size of an array large to enough to hold all stacks, each with
363 N elements. */
364 # define YYSTACK_BYTES(N) \
365 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
366 + YYSTACK_GAP_MAXIMUM)
368 # define YYCOPY_NEEDED 1
370 /* Relocate STACK from its old location to the new one. The
371 local variables YYSIZE and YYSTACKSIZE give the old and new number of
372 elements in the stack, and YYPTR gives the new location of the
373 stack. Advance YYPTR to a properly aligned location for the next
374 stack. */
375 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
376 do \
377 { \
378 YYSIZE_T yynewbytes; \
379 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
380 Stack = &yyptr->Stack_alloc; \
381 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
382 yyptr += yynewbytes / sizeof (*yyptr); \
383 } \
384 while (0)
386 #endif
388 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
389 /* Copy COUNT objects from SRC to DST. The source and destination do
390 not overlap. */
391 # ifndef YYCOPY
392 # if defined __GNUC__ && 1 < __GNUC__
393 # define YYCOPY(Dst, Src, Count) \
394 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
395 # else
396 # define YYCOPY(Dst, Src, Count) \
397 do \
398 { \
399 YYSIZE_T yyi; \
400 for (yyi = 0; yyi < (Count); yyi++) \
401 (Dst)[yyi] = (Src)[yyi]; \
402 } \
403 while (0)
404 # endif
405 # endif
406 #endif /* !YYCOPY_NEEDED */
408 /* YYFINAL -- State number of the termination state. */
409 #define YYFINAL 24
410 /* YYLAST -- Last index in YYTABLE. */
411 #define YYLAST 46
413 /* YYNTOKENS -- Number of terminals. */
414 #define YYNTOKENS 12
415 /* YYNNTS -- Number of nonterminals. */
416 #define YYNNTS 12
417 /* YYNRULES -- Number of rules. */
418 #define YYNRULES 23
419 /* YYNSTATES -- Number of states. */
420 #define YYNSTATES 37
422 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
423 by yylex, with out-of-bounds checking. */
424 #define YYUNDEFTOK 2
425 #define YYMAXUTOK 266
427 #define YYTRANSLATE(YYX) \
428 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
430 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
431 as returned by yylex, without out-of-bounds checking. */
432 static const yytype_uint8 yytranslate[] =
433 {
434 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
460 5, 6, 7, 8, 9, 10, 11
461 };
463 #if YYDEBUG
464 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
465 static const yytype_uint8 yyrline[] =
466 {
467 0, 81, 81, 82, 86, 87, 88, 89, 93, 100,
468 109, 113, 123, 129, 139, 146, 159, 175, 176, 177,
469 181, 191, 208, 216
470 };
471 #endif
473 #if YYDEBUG || YYERROR_VERBOSE || 1
474 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
475 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
476 static const char *const yytname[] =
477 {
478 "$end", "error", "$undefined", "NUMBER", "BTRUE", "BFALSE",
479 "QUOTED_STRING", "UNQUOTED_STRING", "SLASH", "OPENBRAC", "CLOSEBRAC",
480 "EOL", "$accept", "string", "argument", "argument_list", "identifier",
481 "option", "block_begin", "block_end", "block", "statement",
482 "statement_list", "entire_file", YY_NULLPTR
483 };
484 #endif
486 # ifdef YYPRINT
487 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
488 (internal) symbol number NUM (which must be that of a token). */
489 static const yytype_uint16 yytoknum[] =
490 {
491 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
492 265, 266
493 };
494 # endif
496 #define YYPACT_NINF -12
498 #define yypact_value_is_default(Yystate) \
499 (!!((Yystate) == (-12)))
501 #define YYTABLE_NINF -1
503 #define yytable_value_is_error(Yytable_value) \
504 0
506 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
507 STATE-NUM. */
508 static const yytype_int8 yypact[] =
509 {
510 0, -12, 9, -12, 33, -12, 34, -12, -12, 0,
511 17, 16, -12, -12, -12, -12, -12, -12, -12, -1,
512 5, -12, 34, -12, -12, 13, 25, -12, -12, 9,
513 -12, -12, 14, 23, -12, 31, -12
514 };
516 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
517 Performed when YYTABLE does not specify something else to do. Zero
518 means the default is an error. */
519 static const yytype_uint8 yydefact[] =
520 {
521 23, 10, 0, 19, 0, 17, 0, 18, 21, 22,
522 0, 0, 4, 5, 6, 2, 3, 7, 9, 0,
523 0, 16, 0, 20, 1, 0, 0, 11, 8, 0,
524 15, 12, 0, 0, 13, 0, 14
525 };
527 /* YYPGOTO[NTERM-NUM]. */
528 static const yytype_int8 yypgoto[] =
529 {
530 -12, -12, -11, 35, -2, -12, -12, 12, -12, -8,
531 38, -12
532 };
534 /* YYDEFGOTO[NTERM-NUM]. */
535 static const yytype_int8 yydefgoto[] =
536 {
537 -1, 17, 18, 19, 4, 5, 6, 21, 7, 8,
538 9, 10
539 };
541 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
542 positive, shift that token. If negative, reduce the rule whose
543 number is the opposite. If YYTABLE_NINF, syntax error. */
544 static const yytype_uint8 yytable[] =
545 {
546 11, 23, 12, 13, 14, 15, 16, 1, 28, 2,
547 27, 3, 1, 29, 23, 28, 1, 24, 11, 12,
548 13, 14, 15, 16, 31, 34, 25, 33, 12, 13,
549 14, 15, 16, 35, 30, 32, 12, 13, 14, 15,
550 16, 1, 36, 20, 22, 3, 26
551 };
553 static const yytype_uint8 yycheck[] =
554 {
555 2, 9, 3, 4, 5, 6, 7, 7, 19, 9,
556 11, 11, 7, 8, 22, 26, 7, 0, 20, 3,
557 4, 5, 6, 7, 11, 11, 10, 29, 3, 4,
558 5, 6, 7, 10, 22, 10, 3, 4, 5, 6,
559 7, 7, 11, 9, 6, 11, 11
560 };
562 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
563 symbol of state STATE-NUM. */
564 static const yytype_uint8 yystos[] =
565 {
566 0, 7, 9, 11, 16, 17, 18, 20, 21, 22,
567 23, 16, 3, 4, 5, 6, 7, 13, 14, 15,
568 9, 19, 22, 21, 0, 10, 15, 11, 14, 8,
569 19, 11, 10, 16, 11, 10, 11
570 };
572 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
573 static const yytype_uint8 yyr1[] =
574 {
575 0, 12, 13, 13, 14, 14, 14, 14, 15, 15,
576 16, 17, 18, 18, 19, 20, 20, 21, 21, 21,
577 22, 22, 23, 23
578 };
580 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
581 static const yytype_uint8 yyr2[] =
582 {
583 0, 2, 1, 1, 1, 1, 1, 1, 2, 1,
584 1, 3, 4, 5, 5, 3, 2, 1, 1, 1,
585 2, 1, 1, 0
586 };
589 #define yyerrok (yyerrstatus = 0)
590 #define yyclearin (yychar = YYEMPTY)
591 #define YYEMPTY (-2)
592 #define YYEOF 0
594 #define YYACCEPT goto yyacceptlab
595 #define YYABORT goto yyabortlab
596 #define YYERROR goto yyerrorlab
599 #define YYRECOVERING() (!!yyerrstatus)
601 #define YYBACKUP(Token, Value) \
602 do \
603 if (yychar == YYEMPTY) \
604 { \
605 yychar = (Token); \
606 yylval = (Value); \
607 YYPOPSTACK (yylen); \
608 yystate = *yyssp; \
609 goto yybackup; \
610 } \
611 else \
612 { \
613 yyerror (YY_("syntax error: cannot back up")); \
614 YYERROR; \
615 } \
616 while (0)
618 /* Error token number */
619 #define YYTERROR 1
620 #define YYERRCODE 256
624 /* Enable debugging if requested. */
625 #if YYDEBUG
627 # ifndef YYFPRINTF
628 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
629 # define YYFPRINTF fprintf
630 # endif
632 # define YYDPRINTF(Args) \
633 do { \
634 if (yydebug) \
635 YYFPRINTF Args; \
636 } while (0)
638 /* This macro is provided for backward compatibility. */
639 #ifndef YY_LOCATION_PRINT
640 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
641 #endif
644 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
645 do { \
646 if (yydebug) \
647 { \
648 YYFPRINTF (stderr, "%s ", Title); \
649 yy_symbol_print (stderr, \
650 Type, Value); \
651 YYFPRINTF (stderr, "\n"); \
652 } \
653 } while (0)
656 /*----------------------------------------.
657 | Print this symbol's value on YYOUTPUT. |
658 `----------------------------------------*/
660 static void
661 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
662 {
663 FILE *yyo = yyoutput;
664 YYUSE (yyo);
665 if (!yyvaluep)
666 return;
667 # ifdef YYPRINT
668 if (yytype < YYNTOKENS)
669 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
670 # endif
671 YYUSE (yytype);
672 }
675 /*--------------------------------.
676 | Print this symbol on YYOUTPUT. |
677 `--------------------------------*/
679 static void
680 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
681 {
682 YYFPRINTF (yyoutput, "%s %s (",
683 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
685 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
686 YYFPRINTF (yyoutput, ")");
687 }
689 /*------------------------------------------------------------------.
690 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
691 | TOP (included). |
692 `------------------------------------------------------------------*/
694 static void
695 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
696 {
697 YYFPRINTF (stderr, "Stack now");
698 for (; yybottom <= yytop; yybottom++)
699 {
700 int yybot = *yybottom;
701 YYFPRINTF (stderr, " %d", yybot);
702 }
703 YYFPRINTF (stderr, "\n");
704 }
706 # define YY_STACK_PRINT(Bottom, Top) \
707 do { \
708 if (yydebug) \
709 yy_stack_print ((Bottom), (Top)); \
710 } while (0)
713 /*------------------------------------------------.
714 | Report that the YYRULE is going to be reduced. |
715 `------------------------------------------------*/
717 static void
718 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
719 {
720 unsigned long int yylno = yyrline[yyrule];
721 int yynrhs = yyr2[yyrule];
722 int yyi;
723 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
724 yyrule - 1, yylno);
725 /* The symbols being reduced. */
726 for (yyi = 0; yyi < yynrhs; yyi++)
727 {
728 YYFPRINTF (stderr, " $%d = ", yyi + 1);
729 yy_symbol_print (stderr,
730 yystos[yyssp[yyi + 1 - yynrhs]],
731 &(yyvsp[(yyi + 1) - (yynrhs)])
732 );
733 YYFPRINTF (stderr, "\n");
734 }
735 }
737 # define YY_REDUCE_PRINT(Rule) \
738 do { \
739 if (yydebug) \
740 yy_reduce_print (yyssp, yyvsp, Rule); \
741 } while (0)
743 /* Nonzero means print parse trace. It is left uninitialized so that
744 multiple parsers can coexist. */
745 int yydebug;
746 #else /* !YYDEBUG */
747 # define YYDPRINTF(Args)
748 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
749 # define YY_STACK_PRINT(Bottom, Top)
750 # define YY_REDUCE_PRINT(Rule)
751 #endif /* !YYDEBUG */
754 /* YYINITDEPTH -- initial size of the parser's stacks. */
755 #ifndef YYINITDEPTH
756 # define YYINITDEPTH 200
757 #endif
759 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
760 if the built-in stack extension method is used).
762 Do not make this value too large; the results are undefined if
763 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
764 evaluated with infinite-precision integer arithmetic. */
766 #ifndef YYMAXDEPTH
767 # define YYMAXDEPTH 10000
768 #endif
771 #if YYERROR_VERBOSE
773 # ifndef yystrlen
774 # if defined __GLIBC__ && defined _STRING_H
775 # define yystrlen strlen
776 # else
777 /* Return the length of YYSTR. */
778 static YYSIZE_T
779 yystrlen (const char *yystr)
780 {
781 YYSIZE_T yylen;
782 for (yylen = 0; yystr[yylen]; yylen++)
783 continue;
784 return yylen;
785 }
786 # endif
787 # endif
789 # ifndef yystpcpy
790 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
791 # define yystpcpy stpcpy
792 # else
793 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
794 YYDEST. */
795 static char *
796 yystpcpy (char *yydest, const char *yysrc)
797 {
798 char *yyd = yydest;
799 const char *yys = yysrc;
801 while ((*yyd++ = *yys++) != '\0')
802 continue;
804 return yyd - 1;
805 }
806 # endif
807 # endif
809 # ifndef yytnamerr
810 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
811 quotes and backslashes, so that it's suitable for yyerror. The
812 heuristic is that double-quoting is unnecessary unless the string
813 contains an apostrophe, a comma, or backslash (other than
814 backslash-backslash). YYSTR is taken from yytname. If YYRES is
815 null, do not copy; instead, return the length of what the result
816 would have been. */
817 static YYSIZE_T
818 yytnamerr (char *yyres, const char *yystr)
819 {
820 if (*yystr == '"')
821 {
822 YYSIZE_T yyn = 0;
823 char const *yyp = yystr;
825 for (;;)
826 switch (*++yyp)
827 {
828 case '\'':
829 case ',':
830 goto do_not_strip_quotes;
832 case '\\':
833 if (*++yyp != '\\')
834 goto do_not_strip_quotes;
835 /* Fall through. */
836 default:
837 if (yyres)
838 yyres[yyn] = *yyp;
839 yyn++;
840 break;
842 case '"':
843 if (yyres)
844 yyres[yyn] = '\0';
845 return yyn;
846 }
847 do_not_strip_quotes: ;
848 }
850 if (! yyres)
851 return yystrlen (yystr);
853 return yystpcpy (yyres, yystr) - yyres;
854 }
855 # endif
857 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
858 about the unexpected token YYTOKEN for the state stack whose top is
859 YYSSP.
861 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
862 not large enough to hold the message. In that case, also set
863 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
864 required number of bytes is too large to store. */
865 static int
866 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
867 yytype_int16 *yyssp, int yytoken)
868 {
869 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
870 YYSIZE_T yysize = yysize0;
871 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
872 /* Internationalized format string. */
873 const char *yyformat = YY_NULLPTR;
874 /* Arguments of yyformat. */
875 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
876 /* Number of reported tokens (one for the "unexpected", one per
877 "expected"). */
878 int yycount = 0;
880 /* There are many possibilities here to consider:
881 - If this state is a consistent state with a default action, then
882 the only way this function was invoked is if the default action
883 is an error action. In that case, don't check for expected
884 tokens because there are none.
885 - The only way there can be no lookahead present (in yychar) is if
886 this state is a consistent state with a default action. Thus,
887 detecting the absence of a lookahead is sufficient to determine
888 that there is no unexpected or expected token to report. In that
889 case, just report a simple "syntax error".
890 - Don't assume there isn't a lookahead just because this state is a
891 consistent state with a default action. There might have been a
892 previous inconsistent state, consistent state with a non-default
893 action, or user semantic action that manipulated yychar.
894 - Of course, the expected token list depends on states to have
895 correct lookahead information, and it depends on the parser not
896 to perform extra reductions after fetching a lookahead from the
897 scanner and before detecting a syntax error. Thus, state merging
898 (from LALR or IELR) and default reductions corrupt the expected
899 token list. However, the list is correct for canonical LR with
900 one exception: it will still contain any token that will not be
901 accepted due to an error action in a later state.
902 */
903 if (yytoken != YYEMPTY)
904 {
905 int yyn = yypact[*yyssp];
906 yyarg[yycount++] = yytname[yytoken];
907 if (!yypact_value_is_default (yyn))
908 {
909 /* Start YYX at -YYN if negative to avoid negative indexes in
910 YYCHECK. In other words, skip the first -YYN actions for
911 this state because they are default actions. */
912 int yyxbegin = yyn < 0 ? -yyn : 0;
913 /* Stay within bounds of both yycheck and yytname. */
914 int yychecklim = YYLAST - yyn + 1;
915 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
916 int yyx;
918 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
919 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
920 && !yytable_value_is_error (yytable[yyx + yyn]))
921 {
922 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
923 {
924 yycount = 1;
925 yysize = yysize0;
926 break;
927 }
928 yyarg[yycount++] = yytname[yyx];
929 {
930 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
931 if (! (yysize <= yysize1
932 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
933 return 2;
934 yysize = yysize1;
935 }
936 }
937 }
938 }
940 switch (yycount)
941 {
942 # define YYCASE_(N, S) \
943 case N: \
944 yyformat = S; \
945 break
946 YYCASE_(0, YY_("syntax error"));
947 YYCASE_(1, YY_("syntax error, unexpected %s"));
948 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
949 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
950 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
951 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
952 # undef YYCASE_
953 }
955 {
956 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
957 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
958 return 2;
959 yysize = yysize1;
960 }
962 if (*yymsg_alloc < yysize)
963 {
964 *yymsg_alloc = 2 * yysize;
965 if (! (yysize <= *yymsg_alloc
966 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
967 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
968 return 1;
969 }
971 /* Avoid sprintf, as that infringes on the user's name space.
972 Don't have undefined behavior even if the translation
973 produced a string with the wrong number of "%s"s. */
974 {
975 char *yyp = *yymsg;
976 int yyi = 0;
977 while ((*yyp = *yyformat) != '\0')
978 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
979 {
980 yyp += yytnamerr (yyp, yyarg[yyi++]);
981 yyformat += 2;
982 }
983 else
984 {
985 yyp++;
986 yyformat++;
987 }
988 }
989 return 0;
990 }
991 #endif /* YYERROR_VERBOSE */
993 /*-----------------------------------------------.
994 | Release the memory associated to this symbol. |
995 `-----------------------------------------------*/
997 static void
998 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
999 {
1000 YYUSE (yyvaluep);
1001 if (!yymsg)
1002 yymsg = "Deleting";
1003 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1005 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1006 YYUSE (yytype);
1007 YY_IGNORE_MAYBE_UNINITIALIZED_END
1008 }
1013 /* The lookahead symbol. */
1014 int yychar;
1016 /* The semantic value of the lookahead symbol. */
1017 YYSTYPE yylval;
1018 /* Number of syntax errors so far. */
1019 int yynerrs;
1022 /*----------.
1023 | yyparse. |
1024 `----------*/
1026 int
1027 yyparse (void)
1028 {
1029 int yystate;
1030 /* Number of tokens to shift before error messages enabled. */
1031 int yyerrstatus;
1033 /* The stacks and their tools:
1034 'yyss': related to states.
1035 'yyvs': related to semantic values.
1037 Refer to the stacks through separate pointers, to allow yyoverflow
1038 to reallocate them elsewhere. */
1040 /* The state stack. */
1041 yytype_int16 yyssa[YYINITDEPTH];
1042 yytype_int16 *yyss;
1043 yytype_int16 *yyssp;
1045 /* The semantic value stack. */
1046 YYSTYPE yyvsa[YYINITDEPTH];
1047 YYSTYPE *yyvs;
1048 YYSTYPE *yyvsp;
1050 YYSIZE_T yystacksize;
1052 int yyn;
1053 int yyresult;
1054 /* Lookahead token as an internal (translated) token number. */
1055 int yytoken = 0;
1056 /* The variables used to return semantic value and location from the
1057 action routines. */
1058 YYSTYPE yyval;
1060 #if YYERROR_VERBOSE
1061 /* Buffer for error messages, and its allocated size. */
1062 char yymsgbuf[128];
1063 char *yymsg = yymsgbuf;
1064 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1065 #endif
1067 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1069 /* The number of symbols on the RHS of the reduced rule.
1070 Keep to zero when no symbol should be popped. */
1071 int yylen = 0;
1073 yyssp = yyss = yyssa;
1074 yyvsp = yyvs = yyvsa;
1075 yystacksize = YYINITDEPTH;
1077 YYDPRINTF ((stderr, "Starting parse\n"));
1079 yystate = 0;
1080 yyerrstatus = 0;
1081 yynerrs = 0;
1082 yychar = YYEMPTY; /* Cause a token to be read. */
1083 goto yysetstate;
1085 /*------------------------------------------------------------.
1086 | yynewstate -- Push a new state, which is found in yystate. |
1087 `------------------------------------------------------------*/
1088 yynewstate:
1089 /* In all cases, when you get here, the value and location stacks
1090 have just been pushed. So pushing a state here evens the stacks. */
1091 yyssp++;
1093 yysetstate:
1094 *yyssp = yystate;
1096 if (yyss + yystacksize - 1 <= yyssp)
1097 {
1098 /* Get the current used size of the three stacks, in elements. */
1099 YYSIZE_T yysize = yyssp - yyss + 1;
1101 #ifdef yyoverflow
1102 {
1103 /* Give user a chance to reallocate the stack. Use copies of
1104 these so that the &'s don't force the real ones into
1105 memory. */
1106 YYSTYPE *yyvs1 = yyvs;
1107 yytype_int16 *yyss1 = yyss;
1109 /* Each stack pointer address is followed by the size of the
1110 data in use in that stack, in bytes. This used to be a
1111 conditional around just the two extra args, but that might
1112 be undefined if yyoverflow is a macro. */
1113 yyoverflow (YY_("memory exhausted"),
1114 &yyss1, yysize * sizeof (*yyssp),
1115 &yyvs1, yysize * sizeof (*yyvsp),
1116 &yystacksize);
1118 yyss = yyss1;
1119 yyvs = yyvs1;
1120 }
1121 #else /* no yyoverflow */
1122 # ifndef YYSTACK_RELOCATE
1123 goto yyexhaustedlab;
1124 # else
1125 /* Extend the stack our own way. */
1126 if (YYMAXDEPTH <= yystacksize)
1127 goto yyexhaustedlab;
1128 yystacksize *= 2;
1129 if (YYMAXDEPTH < yystacksize)
1130 yystacksize = YYMAXDEPTH;
1132 {
1133 yytype_int16 *yyss1 = yyss;
1134 union yyalloc *yyptr =
1135 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1136 if (! yyptr)
1137 goto yyexhaustedlab;
1138 YYSTACK_RELOCATE (yyss_alloc, yyss);
1139 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1140 # undef YYSTACK_RELOCATE
1141 if (yyss1 != yyssa)
1142 YYSTACK_FREE (yyss1);
1143 }
1144 # endif
1145 #endif /* no yyoverflow */
1147 yyssp = yyss + yysize - 1;
1148 yyvsp = yyvs + yysize - 1;
1150 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1151 (unsigned long int) yystacksize));
1153 if (yyss + yystacksize - 1 <= yyssp)
1154 YYABORT;
1155 }
1157 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1159 if (yystate == YYFINAL)
1160 YYACCEPT;
1162 goto yybackup;
1164 /*-----------.
1165 | yybackup. |
1166 `-----------*/
1167 yybackup:
1169 /* Do appropriate processing given the current state. Read a
1170 lookahead token if we need one and don't already have one. */
1172 /* First try to decide what to do without reference to lookahead token. */
1173 yyn = yypact[yystate];
1174 if (yypact_value_is_default (yyn))
1175 goto yydefault;
1177 /* Not known => get a lookahead token if don't already have one. */
1179 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1180 if (yychar == YYEMPTY)
1181 {
1182 YYDPRINTF ((stderr, "Reading a token: "));
1183 yychar = yylex ();
1184 }
1186 if (yychar <= YYEOF)
1187 {
1188 yychar = yytoken = YYEOF;
1189 YYDPRINTF ((stderr, "Now at end of input.\n"));
1190 }
1191 else
1192 {
1193 yytoken = YYTRANSLATE (yychar);
1194 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1195 }
1197 /* If the proper action on seeing token YYTOKEN is to reduce or to
1198 detect an error, take that action. */
1199 yyn += yytoken;
1200 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1201 goto yydefault;
1202 yyn = yytable[yyn];
1203 if (yyn <= 0)
1204 {
1205 if (yytable_value_is_error (yyn))
1206 goto yyerrlab;
1207 yyn = -yyn;
1208 goto yyreduce;
1209 }
1211 /* Count tokens shifted since error; after three, turn off error
1212 status. */
1213 if (yyerrstatus)
1214 yyerrstatus--;
1216 /* Shift the lookahead token. */
1217 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1219 /* Discard the shifted token. */
1220 yychar = YYEMPTY;
1222 yystate = yyn;
1223 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1224 *++yyvsp = yylval;
1225 YY_IGNORE_MAYBE_UNINITIALIZED_END
1227 goto yynewstate;
1230 /*-----------------------------------------------------------.
1231 | yydefault -- do the default action for the current state. |
1232 `-----------------------------------------------------------*/
1233 yydefault:
1234 yyn = yydefact[yystate];
1235 if (yyn == 0)
1236 goto yyerrlab;
1237 goto yyreduce;
1240 /*-----------------------------.
1241 | yyreduce -- Do a reduction. |
1242 `-----------------------------*/
1243 yyreduce:
1244 /* yyn is the number of a rule to reduce with. */
1245 yylen = yyr2[yyn];
1247 /* If YYLEN is nonzero, implement the default value of the action:
1248 '$$ = $1'.
1250 Otherwise, the following line sets YYVAL to garbage.
1251 This behavior is undocumented and Bison
1252 users should not rely upon it. Assigning to YYVAL
1253 unconditionally makes the parser a bit smaller, and it avoids a
1254 GCC warning that YYVAL may be used uninitialized. */
1255 yyval = yyvsp[1-yylen];
1258 YY_REDUCE_PRINT (yyn);
1259 switch (yyn)
1260 {
1261 case 2:
1262 #line 81 "parser.y" /* yacc.c:1646 */
1263 {(yyval.string) = unquote ((yyvsp[0].string));}
1264 #line 1265 "parser.c" /* yacc.c:1646 */
1265 break;
1267 case 3:
1268 #line 82 "parser.y" /* yacc.c:1646 */
1269 {(yyval.string) = strdup ((yyvsp[0].string));}
1270 #line 1271 "parser.c" /* yacc.c:1646 */
1271 break;
1273 case 4:
1274 #line 86 "parser.y" /* yacc.c:1646 */
1275 {(yyval.cv).value.number = (yyvsp[0].number); (yyval.cv).type = OCONFIG_TYPE_NUMBER;}
1276 #line 1277 "parser.c" /* yacc.c:1646 */
1277 break;
1279 case 5:
1280 #line 87 "parser.y" /* yacc.c:1646 */
1281 {(yyval.cv).value.boolean = 1; (yyval.cv).type = OCONFIG_TYPE_BOOLEAN;}
1282 #line 1283 "parser.c" /* yacc.c:1646 */
1283 break;
1285 case 6:
1286 #line 88 "parser.y" /* yacc.c:1646 */
1287 {(yyval.cv).value.boolean = 0; (yyval.cv).type = OCONFIG_TYPE_BOOLEAN;}
1288 #line 1289 "parser.c" /* yacc.c:1646 */
1289 break;
1291 case 7:
1292 #line 89 "parser.y" /* yacc.c:1646 */
1293 {(yyval.cv).value.string = (yyvsp[0].string); (yyval.cv).type = OCONFIG_TYPE_STRING;}
1294 #line 1295 "parser.c" /* yacc.c:1646 */
1295 break;
1297 case 8:
1298 #line 94 "parser.y" /* yacc.c:1646 */
1299 {
1300 (yyval.al) = (yyvsp[-1].al);
1301 (yyval.al).argument_num++;
1302 (yyval.al).argument = realloc ((yyval.al).argument, (yyval.al).argument_num * sizeof (oconfig_value_t));
1303 (yyval.al).argument[(yyval.al).argument_num-1] = (yyvsp[0].cv);
1304 }
1305 #line 1306 "parser.c" /* yacc.c:1646 */
1306 break;
1308 case 9:
1309 #line 101 "parser.y" /* yacc.c:1646 */
1310 {
1311 (yyval.al).argument = malloc (sizeof (oconfig_value_t));
1312 (yyval.al).argument[0] = (yyvsp[0].cv);
1313 (yyval.al).argument_num = 1;
1314 }
1315 #line 1316 "parser.c" /* yacc.c:1646 */
1316 break;
1318 case 10:
1319 #line 109 "parser.y" /* yacc.c:1646 */
1320 {(yyval.string) = strdup ((yyvsp[0].string));}
1321 #line 1322 "parser.c" /* yacc.c:1646 */
1322 break;
1324 case 11:
1325 #line 114 "parser.y" /* yacc.c:1646 */
1326 {
1327 memset (&(yyval.ci), '\0', sizeof ((yyval.ci)));
1328 (yyval.ci).key = (yyvsp[-2].string);
1329 (yyval.ci).values = (yyvsp[-1].al).argument;
1330 (yyval.ci).values_num = (yyvsp[-1].al).argument_num;
1331 }
1332 #line 1333 "parser.c" /* yacc.c:1646 */
1333 break;
1335 case 12:
1336 #line 124 "parser.y" /* yacc.c:1646 */
1337 {
1338 memset (&(yyval.ci), '\0', sizeof ((yyval.ci)));
1339 (yyval.ci).key = (yyvsp[-2].string);
1340 }
1341 #line 1342 "parser.c" /* yacc.c:1646 */
1342 break;
1344 case 13:
1345 #line 130 "parser.y" /* yacc.c:1646 */
1346 {
1347 memset (&(yyval.ci), '\0', sizeof ((yyval.ci)));
1348 (yyval.ci).key = (yyvsp[-3].string);
1349 (yyval.ci).values = (yyvsp[-2].al).argument;
1350 (yyval.ci).values_num = (yyvsp[-2].al).argument_num;
1351 }
1352 #line 1353 "parser.c" /* yacc.c:1646 */
1353 break;
1355 case 14:
1356 #line 140 "parser.y" /* yacc.c:1646 */
1357 {
1358 (yyval.string) = (yyvsp[-2].string);
1359 }
1360 #line 1361 "parser.c" /* yacc.c:1646 */
1361 break;
1363 case 15:
1364 #line 147 "parser.y" /* yacc.c:1646 */
1365 {
1366 if (strcmp ((yyvsp[-2].ci).key, (yyvsp[0].string)) != 0)
1367 {
1368 printf ("block_begin = %s; block_end = %s;\n", (yyvsp[-2].ci).key, (yyvsp[0].string));
1369 yyerror ("Block not closed..\n");
1370 exit (1);
1371 }
1372 free ((yyvsp[0].string)); (yyvsp[0].string) = NULL;
1373 (yyval.ci) = (yyvsp[-2].ci);
1374 (yyval.ci).children = (yyvsp[-1].sl).statement;
1375 (yyval.ci).children_num = (yyvsp[-1].sl).statement_num;
1376 }
1377 #line 1378 "parser.c" /* yacc.c:1646 */
1378 break;
1380 case 16:
1381 #line 160 "parser.y" /* yacc.c:1646 */
1382 {
1383 if (strcmp ((yyvsp[-1].ci).key, (yyvsp[0].string)) != 0)
1384 {
1385 printf ("block_begin = %s; block_end = %s;\n", (yyvsp[-1].ci).key, (yyvsp[0].string));
1386 yyerror ("Block not closed..\n");
1387 exit (1);
1388 }
1389 free ((yyvsp[0].string)); (yyvsp[0].string) = NULL;
1390 (yyval.ci) = (yyvsp[-1].ci);
1391 (yyval.ci).children = NULL;
1392 (yyval.ci).children_num = 0;
1393 }
1394 #line 1395 "parser.c" /* yacc.c:1646 */
1395 break;
1397 case 17:
1398 #line 175 "parser.y" /* yacc.c:1646 */
1399 {(yyval.ci) = (yyvsp[0].ci);}
1400 #line 1401 "parser.c" /* yacc.c:1646 */
1401 break;
1403 case 18:
1404 #line 176 "parser.y" /* yacc.c:1646 */
1405 {(yyval.ci) = (yyvsp[0].ci);}
1406 #line 1407 "parser.c" /* yacc.c:1646 */
1407 break;
1409 case 19:
1410 #line 177 "parser.y" /* yacc.c:1646 */
1411 {(yyval.ci).values_num = 0;}
1412 #line 1413 "parser.c" /* yacc.c:1646 */
1413 break;
1415 case 20:
1416 #line 182 "parser.y" /* yacc.c:1646 */
1417 {
1418 (yyval.sl) = (yyvsp[-1].sl);
1419 if (((yyvsp[0].ci).values_num > 0) || ((yyvsp[0].ci).children_num > 0))
1420 {
1421 (yyval.sl).statement_num++;
1422 (yyval.sl).statement = realloc ((yyval.sl).statement, (yyval.sl).statement_num * sizeof (oconfig_item_t));
1423 (yyval.sl).statement[(yyval.sl).statement_num-1] = (yyvsp[0].ci);
1424 }
1425 }
1426 #line 1427 "parser.c" /* yacc.c:1646 */
1427 break;
1429 case 21:
1430 #line 192 "parser.y" /* yacc.c:1646 */
1431 {
1432 if (((yyvsp[0].ci).values_num > 0) || ((yyvsp[0].ci).children_num > 0))
1433 {
1434 (yyval.sl).statement = malloc (sizeof (oconfig_item_t));
1435 (yyval.sl).statement[0] = (yyvsp[0].ci);
1436 (yyval.sl).statement_num = 1;
1437 }
1438 else
1439 {
1440 (yyval.sl).statement = NULL;
1441 (yyval.sl).statement_num = 0;
1442 }
1443 }
1444 #line 1445 "parser.c" /* yacc.c:1646 */
1445 break;
1447 case 22:
1448 #line 209 "parser.y" /* yacc.c:1646 */
1449 {
1450 ci_root = malloc (sizeof (oconfig_item_t));
1451 memset (ci_root, '\0', sizeof (oconfig_item_t));
1452 ci_root->children = (yyvsp[0].sl).statement;
1453 ci_root->children_num = (yyvsp[0].sl).statement_num;
1454 }
1455 #line 1456 "parser.c" /* yacc.c:1646 */
1456 break;
1458 case 23:
1459 #line 216 "parser.y" /* yacc.c:1646 */
1460 {
1461 ci_root = malloc (sizeof (oconfig_item_t));
1462 memset (ci_root, '\0', sizeof (oconfig_item_t));
1463 ci_root->children = NULL;
1464 ci_root->children_num = 0;
1465 }
1466 #line 1467 "parser.c" /* yacc.c:1646 */
1467 break;
1470 #line 1471 "parser.c" /* yacc.c:1646 */
1471 default: break;
1472 }
1473 /* User semantic actions sometimes alter yychar, and that requires
1474 that yytoken be updated with the new translation. We take the
1475 approach of translating immediately before every use of yytoken.
1476 One alternative is translating here after every semantic action,
1477 but that translation would be missed if the semantic action invokes
1478 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1479 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1480 incorrect destructor might then be invoked immediately. In the
1481 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1482 to an incorrect destructor call or verbose syntax error message
1483 before the lookahead is translated. */
1484 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1486 YYPOPSTACK (yylen);
1487 yylen = 0;
1488 YY_STACK_PRINT (yyss, yyssp);
1490 *++yyvsp = yyval;
1492 /* Now 'shift' the result of the reduction. Determine what state
1493 that goes to, based on the state we popped back to and the rule
1494 number reduced by. */
1496 yyn = yyr1[yyn];
1498 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1499 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1500 yystate = yytable[yystate];
1501 else
1502 yystate = yydefgoto[yyn - YYNTOKENS];
1504 goto yynewstate;
1507 /*--------------------------------------.
1508 | yyerrlab -- here on detecting error. |
1509 `--------------------------------------*/
1510 yyerrlab:
1511 /* Make sure we have latest lookahead translation. See comments at
1512 user semantic actions for why this is necessary. */
1513 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1515 /* If not already recovering from an error, report this error. */
1516 if (!yyerrstatus)
1517 {
1518 ++yynerrs;
1519 #if ! YYERROR_VERBOSE
1520 yyerror (YY_("syntax error"));
1521 #else
1522 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1523 yyssp, yytoken)
1524 {
1525 char const *yymsgp = YY_("syntax error");
1526 int yysyntax_error_status;
1527 yysyntax_error_status = YYSYNTAX_ERROR;
1528 if (yysyntax_error_status == 0)
1529 yymsgp = yymsg;
1530 else if (yysyntax_error_status == 1)
1531 {
1532 if (yymsg != yymsgbuf)
1533 YYSTACK_FREE (yymsg);
1534 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1535 if (!yymsg)
1536 {
1537 yymsg = yymsgbuf;
1538 yymsg_alloc = sizeof yymsgbuf;
1539 yysyntax_error_status = 2;
1540 }
1541 else
1542 {
1543 yysyntax_error_status = YYSYNTAX_ERROR;
1544 yymsgp = yymsg;
1545 }
1546 }
1547 yyerror (yymsgp);
1548 if (yysyntax_error_status == 2)
1549 goto yyexhaustedlab;
1550 }
1551 # undef YYSYNTAX_ERROR
1552 #endif
1553 }
1557 if (yyerrstatus == 3)
1558 {
1559 /* If just tried and failed to reuse lookahead token after an
1560 error, discard it. */
1562 if (yychar <= YYEOF)
1563 {
1564 /* Return failure if at end of input. */
1565 if (yychar == YYEOF)
1566 YYABORT;
1567 }
1568 else
1569 {
1570 yydestruct ("Error: discarding",
1571 yytoken, &yylval);
1572 yychar = YYEMPTY;
1573 }
1574 }
1576 /* Else will try to reuse lookahead token after shifting the error
1577 token. */
1578 goto yyerrlab1;
1581 /*---------------------------------------------------.
1582 | yyerrorlab -- error raised explicitly by YYERROR. |
1583 `---------------------------------------------------*/
1584 yyerrorlab:
1586 /* Pacify compilers like GCC when the user code never invokes
1587 YYERROR and the label yyerrorlab therefore never appears in user
1588 code. */
1589 if (/*CONSTCOND*/ 0)
1590 goto yyerrorlab;
1592 /* Do not reclaim the symbols of the rule whose action triggered
1593 this YYERROR. */
1594 YYPOPSTACK (yylen);
1595 yylen = 0;
1596 YY_STACK_PRINT (yyss, yyssp);
1597 yystate = *yyssp;
1598 goto yyerrlab1;
1601 /*-------------------------------------------------------------.
1602 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1603 `-------------------------------------------------------------*/
1604 yyerrlab1:
1605 yyerrstatus = 3; /* Each real token shifted decrements this. */
1607 for (;;)
1608 {
1609 yyn = yypact[yystate];
1610 if (!yypact_value_is_default (yyn))
1611 {
1612 yyn += YYTERROR;
1613 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1614 {
1615 yyn = yytable[yyn];
1616 if (0 < yyn)
1617 break;
1618 }
1619 }
1621 /* Pop the current state because it cannot handle the error token. */
1622 if (yyssp == yyss)
1623 YYABORT;
1626 yydestruct ("Error: popping",
1627 yystos[yystate], yyvsp);
1628 YYPOPSTACK (1);
1629 yystate = *yyssp;
1630 YY_STACK_PRINT (yyss, yyssp);
1631 }
1633 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1634 *++yyvsp = yylval;
1635 YY_IGNORE_MAYBE_UNINITIALIZED_END
1638 /* Shift the error token. */
1639 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1641 yystate = yyn;
1642 goto yynewstate;
1645 /*-------------------------------------.
1646 | yyacceptlab -- YYACCEPT comes here. |
1647 `-------------------------------------*/
1648 yyacceptlab:
1649 yyresult = 0;
1650 goto yyreturn;
1652 /*-----------------------------------.
1653 | yyabortlab -- YYABORT comes here. |
1654 `-----------------------------------*/
1655 yyabortlab:
1656 yyresult = 1;
1657 goto yyreturn;
1659 #if !defined yyoverflow || YYERROR_VERBOSE
1660 /*-------------------------------------------------.
1661 | yyexhaustedlab -- memory exhaustion comes here. |
1662 `-------------------------------------------------*/
1663 yyexhaustedlab:
1664 yyerror (YY_("memory exhausted"));
1665 yyresult = 2;
1666 /* Fall through. */
1667 #endif
1669 yyreturn:
1670 if (yychar != YYEMPTY)
1671 {
1672 /* Make sure we have latest lookahead translation. See comments at
1673 user semantic actions for why this is necessary. */
1674 yytoken = YYTRANSLATE (yychar);
1675 yydestruct ("Cleanup: discarding lookahead",
1676 yytoken, &yylval);
1677 }
1678 /* Do not reclaim the symbols of the rule whose action triggered
1679 this YYABORT or YYACCEPT. */
1680 YYPOPSTACK (yylen);
1681 YY_STACK_PRINT (yyss, yyssp);
1682 while (yyssp != yyss)
1683 {
1684 yydestruct ("Cleanup: popping",
1685 yystos[*yyssp], yyvsp);
1686 YYPOPSTACK (1);
1687 }
1688 #ifndef yyoverflow
1689 if (yyss != yyssa)
1690 YYSTACK_FREE (yyss);
1691 #endif
1692 #if YYERROR_VERBOSE
1693 if (yymsg != yymsgbuf)
1694 YYSTACK_FREE (yymsg);
1695 #endif
1696 return yyresult;
1697 }
1698 #line 224 "parser.y" /* yacc.c:1906 */
1700 static int yyerror (const char *s)
1701 {
1702 char *text;
1704 if (*yytext == '\n')
1705 text = "<newline>";
1706 else
1707 text = yytext;
1709 fprintf (stderr, "Parse error in file `%s', line %i near `%s': %s\n",
1710 c_file, yylineno, text, s);
1711 return (-1);
1712 } /* int yyerror */
1714 static char *unquote (const char *orig)
1715 {
1716 char *ret = strdup (orig);
1717 int len;
1718 int i;
1720 if (ret == NULL)
1721 return (NULL);
1723 len = strlen (ret);
1725 if ((len < 2) || (ret[0] != '"') || (ret[len - 1] != '"'))
1726 return (ret);
1728 len -= 2;
1729 memmove (ret, ret + 1, len);
1730 ret[len] = '\0';
1732 for (i = 0; i < len; i++)
1733 {
1734 if (ret[i] == '\\')
1735 {
1736 memmove (ret + i, ret + (i + 1), len - i);
1737 len--;
1738 }
1739 }
1741 return (ret);
1742 } /* char *unquote */