Debian Codegraph @

src/conf_yacc.c

raw symbols SCIP
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 0
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 confparse
69 #define yylex conflex
70 #define yyerror conferror
71 #define yydebug confdebug
72 #define yynerrs confnerrs
73 #define yylval conflval
74 #define yychar confchar
75
76 /* First part of user prologue. */
77 #line 4 "src/conf_yacc.y"
78
79
80 /*
81 * AIDE (Advanced Intrusion Detection Environment)
82 *
83 * Copyright (C) 1999-2006, 2010-2013, 2015-2016, 2019-2025 Rami Lehti,
84 * Pablo Virolainen, Richard van den Berg, Hannes von Haugwitz
85 *
86 * This program is free software; you can redistribute it and/or
87 * modify it under the terms of the GNU General Public License as
88 * published by the Free Software Foundation; either version 2 of the
89 * License, or (at your option) any later version.
90 *
91 * This program is distributed in the hope that it will be useful, but
92 * WITHOUT ANY WARRANTY; without even the implied warranty of
93 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
94 * General Public License for more details.
95 *
96 * You should have received a copy of the GNU General Public License along
97 * with this program; if not, write to the Free Software Foundation, Inc.,
98 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
99 */
100
101 #include <stdbool.h>
102 #include "attributes.h"
103 #include <stdlib.h>
104 #include <string.h>
105 #include "log.h"
106 #include "rx_rule.h"
107 #include "conf_lex.h"
108
109 DB_ATTR_TYPE retval=0;
110
111 #include "conf_ast.h"
112 extern int conflex(void);
113 void conferror(ast**, const char *);
114
115
116 #line 117 "src/conf_yacc.c"
117
118 # ifndef YY_CAST
119 # ifdef __cplusplus
120 # define YY_CAST(Type, Val) static_cast<Type> (Val)
121 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
122 # else
123 # define YY_CAST(Type, Val) ((Type) (Val))
124 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
125 # endif
126 # endif
127 # ifndef YY_NULLPTR
128 # if defined __cplusplus
129 # if 201103L <= __cplusplus
130 # define YY_NULLPTR nullptr
131 # else
132 # define YY_NULLPTR 0
133 # endif
134 # else
135 # define YY_NULLPTR ((void*)0)
136 # endif
137 # endif
138
139 #include "conf_yacc.h"
140 /* Symbol kind. */
141 enum yysymbol_kind_t
142 {
143 YYSYMBOL_YYEMPTY = -2,
144 YYSYMBOL_YYEOF = 0, /* "end of file" */
145 YYSYMBOL_YYerror = 1, /* error */
146 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
147 YYSYMBOL_TDEFINE = 3, /* "@@define" */
148 YYSYMBOL_TUNDEFINE = 4, /* "@@undef" */
149 YYSYMBOL_TIFDEF = 5, /* "@@ifdef" */
150 YYSYMBOL_TIFNDEF = 6, /* "@@ifndef" */
151 YYSYMBOL_TIFNHOST = 7, /* "@@ifnhost" */
152 YYSYMBOL_TIFHOST = 8, /* "@@ifhost" */
153 YYSYMBOL_TIF = 9, /* "@@if" */
154 YYSYMBOL_TBOOLNOT = 10, /* "not" */
155 YYSYMBOL_TBOOLFUNC = 11, /* "boolean function" */
156 YYSYMBOL_TBOOLOP = 12, /* "boolean operator" */
157 YYSYMBOL_TELSE = 13, /* "@@else" */
158 YYSYMBOL_TENDIF = 14, /* "@@endif" */
159 YYSYMBOL_TINCLUDE = 15, /* "@@include" */
160 YYSYMBOL_TXINCLUDE = 16, /* "@@x_include" */
161 YYSYMBOL_TSETENV = 17, /* "@@x_include_setenv" */
162 YYSYMBOL_TGROUP = 18, /* "group name" */
163 YYSYMBOL_TSTRING = 19, /* "string" */
164 YYSYMBOL_TEXPR = 20, /* "group" */
165 YYSYMBOL_TVARIABLE = 21, /* "variable name" */
166 YYSYMBOL_TSPACE = 22, /* "whitespace" */
167 YYSYMBOL_TNEWLINE = 23, /* "new line" */
168 YYSYMBOL_TSELRXRULE = 24, /* "regular rule" */
169 YYSYMBOL_TEQURXRULE = 25, /* "equals rule" */
170 YYSYMBOL_TRECNEGRXRULE = 26, /* "recursive negative rule" */
171 YYSYMBOL_TNONRECNEGRXRULE = 27, /* "non-recursive negative rule" */
172 YYSYMBOL_CONFIGOPTION = 28, /* "configuration option" */
173 YYSYMBOL_29_ = 29, /* '+' */
174 YYSYMBOL_30_ = 30, /* '-' */
175 YYSYMBOL_31_ = 31, /* ',' */
176 YYSYMBOL_32_ = 32, /* '=' */
177 YYSYMBOL_33_0_ = 33, /* '0' */
178 YYSYMBOL_YYACCEPT = 34, /* $accept */
179 YYSYMBOL_config = 35, /* config */
180 YYSYMBOL_statements = 36, /* statements */
181 YYSYMBOL_statement = 37, /* statement */
182 YYSYMBOL_attribute_expression = 38, /* attribute_expression */
183 YYSYMBOL_ft_restriction_expression = 39, /* ft_restriction_expression */
184 YYSYMBOL_restriction_expression = 40, /* restriction_expression */
185 YYSYMBOL_define_statement = 41, /* define_statement */
186 YYSYMBOL_string_expression = 42, /* string_expression */
187 YYSYMBOL_string_fragment = 43, /* string_fragment */
188 YYSYMBOL_undefine_statement = 44, /* undefine_statement */
189 YYSYMBOL_config_statement = 45, /* config_statement */
190 YYSYMBOL_group_statement = 46, /* group_statement */
191 YYSYMBOL_include_statement = 47, /* include_statement */
192 YYSYMBOL_x_include_setenv_statement = 48, /* x_include_setenv_statement */
193 YYSYMBOL_if_statement = 49, /* if_statement */
194 YYSYMBOL_if_condition = 50, /* if_condition */
195 YYSYMBOL_bool_expression = 51, /* bool_expression */
196 YYSYMBOL_rule_statement = 52 /* rule_statement */
197 };
198 typedef enum yysymbol_kind_t yysymbol_kind_t;
199
200
201
202
203 #ifdef short
204 # undef short
205 #endif
206
207 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
208 <limits.h> and (if available) <stdint.h> are included
209 so that the code can choose integer types of a good width. */
210
211 #ifndef __PTRDIFF_MAX__
212 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
213 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
214 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
215 # define YY_STDINT_H
216 # endif
217 #endif
218
219 /* Narrow types that promote to a signed type and that can represent a
220 signed or unsigned integer of at least N bits. In tables they can
221 save space and decrease cache pressure. Promoting to a signed type
222 helps avoid bugs in integer arithmetic. */
223
224 #ifdef __INT_LEAST8_MAX__
225 typedef __INT_LEAST8_TYPE__ yytype_int8;
226 #elif defined YY_STDINT_H
227 typedef int_least8_t yytype_int8;
228 #else
229 typedef signed char yytype_int8;
230 #endif
231
232 #ifdef __INT_LEAST16_MAX__
233 typedef __INT_LEAST16_TYPE__ yytype_int16;
234 #elif defined YY_STDINT_H
235 typedef int_least16_t yytype_int16;
236 #else
237 typedef short yytype_int16;
238 #endif
239
240 /* Work around bug in HP-UX 11.23, which defines these macros
241 incorrectly for preprocessor constants. This workaround can likely
242 be removed in 2023, as HPE has promised support for HP-UX 11.23
243 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
244 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
245 #ifdef __hpux
246 # undef UINT_LEAST8_MAX
247 # undef UINT_LEAST16_MAX
248 # define UINT_LEAST8_MAX 255
249 # define UINT_LEAST16_MAX 65535
250 #endif
251
252 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
253 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
254 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
255 && UINT_LEAST8_MAX <= INT_MAX)
256 typedef uint_least8_t yytype_uint8;
257 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
258 typedef unsigned char yytype_uint8;
259 #else
260 typedef short yytype_uint8;
261 #endif
262
263 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
264 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
265 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
266 && UINT_LEAST16_MAX <= INT_MAX)
267 typedef uint_least16_t yytype_uint16;
268 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
269 typedef unsigned short yytype_uint16;
270 #else
271 typedef int yytype_uint16;
272 #endif
273
274 #ifndef YYPTRDIFF_T
275 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
276 # define YYPTRDIFF_T __PTRDIFF_TYPE__
277 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
278 # elif defined PTRDIFF_MAX
279 # ifndef ptrdiff_t
280 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
281 # endif
282 # define YYPTRDIFF_T ptrdiff_t
283 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
284 # else
285 # define YYPTRDIFF_T long
286 # define YYPTRDIFF_MAXIMUM LONG_MAX
287 # endif
288 #endif
289
290 #ifndef YYSIZE_T
291 # ifdef __SIZE_TYPE__
292 # define YYSIZE_T __SIZE_TYPE__
293 # elif defined size_t
294 # define YYSIZE_T size_t
295 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
296 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
297 # define YYSIZE_T size_t
298 # else
299 # define YYSIZE_T unsigned
300 # endif
301 #endif
302
303 #define YYSIZE_MAXIMUM \
304 YY_CAST (YYPTRDIFF_T, \
305 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
306 ? YYPTRDIFF_MAXIMUM \
307 : YY_CAST (YYSIZE_T, -1)))
308
309 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
310
311
312 /* Stored state numbers (used for stacks). */
313 typedef yytype_int8 yy_state_t;
314
315 /* State numbers in computations. */
316 typedef int yy_state_fast_t;
317
318 #ifndef YY_
319 # if defined YYENABLE_NLS && YYENABLE_NLS
320 # if ENABLE_NLS
321 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
322 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
323 # endif
324 # endif
325 # ifndef YY_
326 # define YY_(Msgid) Msgid
327 # endif
328 #endif
329
330
331 #ifndef YY_ATTRIBUTE_PURE
332 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
333 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
334 # else
335 # define YY_ATTRIBUTE_PURE
336 # endif
337 #endif
338
339 #ifndef YY_ATTRIBUTE_UNUSED
340 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
341 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
342 # else
343 # define YY_ATTRIBUTE_UNUSED
344 # endif
345 #endif
346
347 /* Suppress unused-variable warnings by "using" E. */
348 #if ! defined lint || defined __GNUC__
349 # define YY_USE(E) ((void) (E))
350 #else
351 # define YY_USE(E) /* empty */
352 #endif
353
354 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
355 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
356 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
357 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
358 _Pragma ("GCC diagnostic push") \
359 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
360 # else
361 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
362 _Pragma ("GCC diagnostic push") \
363 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
364 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
365 # endif
366 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
367 _Pragma ("GCC diagnostic pop")
368 #else
369 # define YY_INITIAL_VALUE(Value) Value
370 #endif
371 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
372 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
373 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
374 #endif
375 #ifndef YY_INITIAL_VALUE
376 # define YY_INITIAL_VALUE(Value) /* Nothing. */
377 #endif
378
379 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
380 # define YY_IGNORE_USELESS_CAST_BEGIN \
381 _Pragma ("GCC diagnostic push") \
382 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
383 # define YY_IGNORE_USELESS_CAST_END \
384 _Pragma ("GCC diagnostic pop")
385 #endif
386 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
387 # define YY_IGNORE_USELESS_CAST_BEGIN
388 # define YY_IGNORE_USELESS_CAST_END
389 #endif
390
391
392 #define YY_ASSERT(E) ((void) (0 && (E)))
393
394 #if 1
395
396 /* The parser invokes alloca or malloc; define the necessary symbols. */
397
398 # ifdef YYSTACK_USE_ALLOCA
399 # if YYSTACK_USE_ALLOCA
400 # ifdef __GNUC__
401 # define YYSTACK_ALLOC __builtin_alloca
402 # elif defined __BUILTIN_VA_ARG_INCR
403 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
404 # elif defined _AIX
405 # define YYSTACK_ALLOC __alloca
406 # elif defined _MSC_VER
407 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
408 # define alloca _alloca
409 # else
410 # define YYSTACK_ALLOC alloca
411 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
412 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
413 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
414 # ifndef EXIT_SUCCESS
415 # define EXIT_SUCCESS 0
416 # endif
417 # endif
418 # endif
419 # endif
420 # endif
421
422 # ifdef YYSTACK_ALLOC
423 /* Pacify GCC's 'empty if-body' warning. */
424 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
425 # ifndef YYSTACK_ALLOC_MAXIMUM
426 /* The OS might guarantee only one guard page at the bottom of the stack,
427 and a page size can be as small as 4096 bytes. So we cannot safely
428 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
429 to allow for a few compiler-allocated temporary stack slots. */
430 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
431 # endif
432 # else
433 # define YYSTACK_ALLOC YYMALLOC
434 # define YYSTACK_FREE YYFREE
435 # ifndef YYSTACK_ALLOC_MAXIMUM
436 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
437 # endif
438 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
439 && ! ((defined YYMALLOC || defined malloc) \
440 && (defined YYFREE || defined free)))
441 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
442 # ifndef EXIT_SUCCESS
443 # define EXIT_SUCCESS 0
444 # endif
445 # endif
446 # ifndef YYMALLOC
447 # define YYMALLOC malloc
448 # if ! defined malloc && ! defined EXIT_SUCCESS
449 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
450 # endif
451 # endif
452 # ifndef YYFREE
453 # define YYFREE free
454 # if ! defined free && ! defined EXIT_SUCCESS
455 void free (void *); /* INFRINGES ON USER NAME SPACE */
456 # endif
457 # endif
458 # endif
459 #endif /* 1 */
460
461 #if (! defined yyoverflow \
462 && (! defined __cplusplus \
463 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
464
465 /* A type that is properly aligned for any stack member. */
466 union yyalloc
467 {
468 yy_state_t yyss_alloc;
469 YYSTYPE yyvs_alloc;
470 };
471
472 /* The size of the maximum gap between one aligned stack and the next. */
473 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
474
475 /* The size of an array large to enough to hold all stacks, each with
476 N elements. */
477 # define YYSTACK_BYTES(N) \
478 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
479 + YYSTACK_GAP_MAXIMUM)
480
481 # define YYCOPY_NEEDED 1
482
483 /* Relocate STACK from its old location to the new one. The
484 local variables YYSIZE and YYSTACKSIZE give the old and new number of
485 elements in the stack, and YYPTR gives the new location of the
486 stack. Advance YYPTR to a properly aligned location for the next
487 stack. */
488 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
489 do \
490 { \
491 YYPTRDIFF_T yynewbytes; \
492 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
493 Stack = &yyptr->Stack_alloc; \
494 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
495 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
496 } \
497 while (0)
498
499 #endif
500
501 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
502 /* Copy COUNT objects from SRC to DST. The source and destination do
503 not overlap. */
504 # ifndef YYCOPY
505 # if defined __GNUC__ && 1 < __GNUC__
506 # define YYCOPY(Dst, Src, Count) \
507 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
508 # else
509 # define YYCOPY(Dst, Src, Count) \
510 do \
511 { \
512 YYPTRDIFF_T yyi; \
513 for (yyi = 0; yyi < (Count); yyi++) \
514 (Dst)[yyi] = (Src)[yyi]; \
515 } \
516 while (0)
517 # endif
518 # endif
519 #endif /* !YYCOPY_NEEDED */
520
521 /* YYFINAL -- State number of the termination state. */
522 #define YYFINAL 51
523 /* YYLAST -- Last index in YYTABLE. */
524 #define YYLAST 98
525
526 /* YYNTOKENS -- Number of terminals. */
527 #define YYNTOKENS 34
528 /* YYNNTS -- Number of nonterminals. */
529 #define YYNNTS 19
530 /* YYNRULES -- Number of rules. */
531 #define YYNRULES 60
532 /* YYNSTATES -- Number of states. */
533 #define YYNSTATES 106
534
535 /* YYMAXUTOK -- Last valid token kind. */
536 #define YYMAXUTOK 283
537
538
539 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
540 as returned by yylex, with out-of-bounds checking. */
541 #define YYTRANSLATE(YYX) \
542 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
543 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
544 : YYSYMBOL_YYUNDEF)
545
546 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
547 as returned by yylex. */
548 static const yytype_int8 yytranslate[] =
549 {
550 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 29, 31, 30, 2, 2, 33, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 32, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
576 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
577 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
578 25, 26, 27, 28
579 };
580
581 #if YYDEBUG
582 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
583 static const yytype_uint8 yyrline[] =
584 {
585 0, 107, 107, 108, 110, 114, 115, 117, 118, 119,
586 120, 121, 121, 122, 123, 125, 126, 127, 129, 130,
587 132, 133, 134, 135, 137, 138, 140, 141, 142, 143,
588 145, 147, 148, 150, 152, 153, 154, 155, 156, 157,
589 159, 161, 162, 164, 165, 166, 167, 168, 170, 171,
590 172, 174, 175, 176, 177, 178, 179, 180, 181, 182,
591 186
592 };
593 #endif
594
595 /** Accessing symbol of state STATE. */
596 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
597
598 #if 1
599 /* The user-facing name of the symbol whose (internal) number is
600 YYSYMBOL. No bounds checking. */
601 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
602
603 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
604 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
605 static const char *const yytname[] =
606 {
607 "\"end of file\"", "error", "\"invalid token\"", "\"@@define\"",
608 "\"@@undef\"", "\"@@ifdef\"", "\"@@ifndef\"", "\"@@ifnhost\"",
609 "\"@@ifhost\"", "\"@@if\"", "\"not\"", "\"boolean function\"",
610 "\"boolean operator\"", "\"@@else\"", "\"@@endif\"", "\"@@include\"",
611 "\"@@x_include\"", "\"@@x_include_setenv\"", "\"group name\"",
612 "\"string\"", "\"group\"", "\"variable name\"", "\"whitespace\"",
613 "\"new line\"", "\"regular rule\"", "\"equals rule\"",
614 "\"recursive negative rule\"", "\"non-recursive negative rule\"",
615 "\"configuration option\"", "'+'", "'-'", "','", "'='", "'0'", "$accept",
616 "config", "statements", "statement", "attribute_expression",
617 "ft_restriction_expression", "restriction_expression",
618 "define_statement", "string_expression", "string_fragment",
619 "undefine_statement", "config_statement", "group_statement",
620 "include_statement", "x_include_setenv_statement", "if_statement",
621 "if_condition", "bool_expression", "rule_statement", YY_NULLPTR
622 };
623
624 static const char *
625 yysymbol_name (yysymbol_kind_t yysymbol)
626 {
627 return yytname[yysymbol];
628 }
629 #endif
630
631 #define YYPACT_NINF (-49)
632
633 #define yypact_value_is_default(Yyn) \
634 ((Yyn) == YYPACT_NINF)
635
636 #define YYTABLE_NINF (-20)
637
638 #define yytable_value_is_error(Yyn) \
639 0
640
641 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
642 STATE-NUM. */
643 static const yytype_int8 yypact[] =
644 {
645 55, -4, -1, 11, 11, 11, 11, 46, -6, 2,
646 8, 1, 11, 11, 11, 11, 10, 43, -49, 22,
647 -49, -49, -49, -49, -49, -49, -49, 45, -49, 11,
648 -49, -49, -49, -49, 11, -49, -49, -49, 46, 11,
649 38, -49, 11, 11, 11, 49, -14, -14, -5, -5,
650 33, -49, 55, 55, -49, -49, -49, -49, 11, 44,
651 62, -49, -49, -22, 3, 65, -49, -22, -18, 49,
652 -22, 49, -49, 49, 49, -22, -49, -49, 24, -49,
653 11, 11, 66, 67, -49, 68, 69, -22, -22, -22,
654 -22, 70, -49, 72, 73, -49, -49, -49, -49, 55,
655 11, 11, 76, -49, -49, -49
656 };
657
658 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
659 Performed when YYTABLE does not specify something else to do. Zero
660 means the default is an error. */
661 static const yytype_int8 yydefact[] =
662 {
663 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
664 0, 0, 0, 0, 0, 0, 0, 0, 3, 6,
665 11, 12, 7, 13, 8, 9, 10, 0, 14, 24,
666 30, 28, 29, 43, 27, 44, 46, 45, 0, 0,
667 0, 47, 0, 0, 0, 0, 0, 0, 53, 54,
668 0, 1, 5, 0, 25, 26, 48, 49, 0, 34,
669 37, 40, 17, 33, 17, 0, 23, 51, 22, 0,
670 52, 0, 19, 57, 58, 32, 31, 4, 0, 50,
671 0, 0, 0, 0, 21, 0, 0, 55, 56, 59,
672 60, 0, 41, 35, 38, 15, 16, 18, 20, 0,
673 0, 0, 0, 36, 39, 42
674 };
675
676 /* YYPGOTO[NTERM-NUM]. */
677 static const yytype_int8 yypgoto[] =
678 {
679 -49, -49, -48, -49, -25, -49, 27, -49, -3, -49,
680 -49, -49, -49, -49, -49, -49, -49, 53, -49
681 };
682
683 /* YYDEFGOTO[NTERM-NUM]. */
684 static const yytype_int8 yydefgoto[] =
685 {
686 0, 17, 18, 19, 63, 68, 69, 20, 40, 34,
687 21, 22, 23, 24, 25, 26, 27, 41, 28
688 };
689
690 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
691 positive, shift that token. If negative, reduce the rule whose
692 number is the opposite. If YYTABLE_NINF, syntax error. */
693 static const yytype_int8 yytable[] =
694 {
695 33, 35, 36, 37, 77, 78, 64, 82, 83, 46,
696 47, 48, 49, 85, 86, 72, 42, 29, 65, 66,
697 30, 67, 70, -19, 43, 75, 54, 65, 66, 44,
698 31, 55, 32, 45, -19, -19, 57, 91, 92, 59,
699 60, 61, 50, 51, 87, 52, 88, 76, 89, 90,
700 58, 102, 31, 62, 32, 79, 38, 39, 1, 2,
701 3, 4, 5, 6, 7, 31, 80, 32, 53, 62,
702 8, 9, 10, 11, 71, 73, 74, 93, 94, 12,
703 13, 14, 15, 16, 81, 84, 95, 96, 97, 98,
704 105, 56, 0, 99, 100, 101, 0, 103, 104
705 };
706
707 static const yytype_int8 yycheck[] =
708 {
709 3, 4, 5, 6, 52, 53, 20, 29, 30, 12,
710 13, 14, 15, 31, 32, 20, 22, 21, 32, 33,
711 21, 46, 47, 20, 22, 50, 29, 32, 33, 21,
712 19, 34, 21, 32, 31, 32, 39, 13, 14, 42,
713 43, 44, 32, 0, 69, 23, 71, 50, 73, 74,
714 12, 99, 19, 20, 21, 58, 10, 11, 3, 4,
715 5, 6, 7, 8, 9, 19, 22, 21, 23, 20,
716 15, 16, 17, 18, 47, 48, 49, 80, 81, 24,
717 25, 26, 27, 28, 22, 20, 20, 20, 20, 20,
718 14, 38, -1, 23, 22, 22, -1, 100, 101
719 };
720
721 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
722 state STATE-NUM. */
723 static const yytype_int8 yystos[] =
724 {
725 0, 3, 4, 5, 6, 7, 8, 9, 15, 16,
726 17, 18, 24, 25, 26, 27, 28, 35, 36, 37,
727 41, 44, 45, 46, 47, 48, 49, 50, 52, 21,
728 21, 19, 21, 42, 43, 42, 42, 42, 10, 11,
729 42, 51, 22, 22, 21, 32, 42, 42, 42, 42,
730 32, 0, 23, 23, 42, 42, 51, 42, 12, 42,
731 42, 42, 20, 38, 20, 32, 33, 38, 39, 40,
732 38, 40, 20, 40, 40, 38, 42, 36, 36, 42,
733 22, 22, 29, 30, 20, 31, 32, 38, 38, 38,
734 38, 13, 14, 42, 42, 20, 20, 20, 20, 23,
735 22, 22, 36, 42, 42, 14
736 };
737
738 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
739 static const yytype_int8 yyr1[] =
740 {
741 0, 34, 35, 35, 36, 36, 36, 37, 37, 37,
742 37, 37, 37, 37, 37, 38, 38, 38, 39, 39,
743 40, 40, 40, 40, 41, 41, 42, 42, 43, 43,
744 44, 45, 45, 46, 47, 47, 47, 47, 47, 47,
745 48, 49, 49, 50, 50, 50, 50, 50, 51, 51,
746 51, 52, 52, 52, 52, 52, 52, 52, 52, 52,
747 52
748 };
749
750 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
751 static const yytype_int8 yyr2[] =
752 {
753 0, 2, 0, 1, 3, 2, 1, 1, 1, 1,
754 1, 1, 1, 1, 1, 3, 3, 1, 3, 1,
755 3, 2, 1, 1, 2, 3, 2, 1, 1, 1,
756 2, 3, 3, 3, 3, 5, 7, 3, 5, 7,
757 3, 4, 7, 2, 2, 2, 2, 2, 2, 2,
758 3, 3, 3, 2, 2, 4, 4, 3, 3, 4,
759 4
760 };
761
762
763 enum { YYENOMEM = -2 };
764
765 #define yyerrok (yyerrstatus = 0)
766 #define yyclearin (yychar = YYEMPTY)
767
768 #define YYACCEPT goto yyacceptlab
769 #define YYABORT goto yyabortlab
770 #define YYERROR goto yyerrorlab
771 #define YYNOMEM goto yyexhaustedlab
772
773
774 #define YYRECOVERING() (!!yyerrstatus)
775
776 #define YYBACKUP(Token, Value) \
777 do \
778 if (yychar == YYEMPTY) \
779 { \
780 yychar = (Token); \
781 yylval = (Value); \
782 YYPOPSTACK (yylen); \
783 yystate = *yyssp; \
784 goto yybackup; \
785 } \
786 else \
787 { \
788 yyerror (config_ast, YY_("syntax error: cannot back up")); \
789 YYERROR; \
790 } \
791 while (0)
792
793 /* Backward compatibility with an undocumented macro.
794 Use YYerror or YYUNDEF. */
795 #define YYERRCODE YYUNDEF
796
797
798 /* Enable debugging if requested. */
799 #if YYDEBUG
800
801 # ifndef YYFPRINTF
802 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
803 # define YYFPRINTF fprintf
804 # endif
805
806 # define YYDPRINTF(Args) \
807 do { \
808 if (yydebug) \
809 YYFPRINTF Args; \
810 } while (0)
811
812
813
814
815 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
816 do { \
817 if (yydebug) \
818 { \
819 YYFPRINTF (stderr, "%s ", Title); \
820 yy_symbol_print (stderr, \
821 Kind, Value, config_ast); \
822 YYFPRINTF (stderr, "\n"); \
823 } \
824 } while (0)
825
826
827 /*-----------------------------------.
828 | Print this symbol's value on YYO. |
829 `-----------------------------------*/
830
831 static void
832 yy_symbol_value_print (FILE *yyo,
833 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, ast** config_ast)
834 {
835 FILE *yyoutput = yyo;
836 YY_USE (yyoutput);
837 YY_USE (config_ast);
838 if (!yyvaluep)
839 return;
840 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
841 YY_USE (yykind);
842 YY_IGNORE_MAYBE_UNINITIALIZED_END
843 }
844
845
846 /*---------------------------.
847 | Print this symbol on YYO. |
848 `---------------------------*/
849
850 static void
851 yy_symbol_print (FILE *yyo,
852 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, ast** config_ast)
853 {
854 YYFPRINTF (yyo, "%s %s (",
855 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
856
857 yy_symbol_value_print (yyo, yykind, yyvaluep, config_ast);
858 YYFPRINTF (yyo, ")");
859 }
860
861 /*------------------------------------------------------------------.
862 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
863 | TOP (included). |
864 `------------------------------------------------------------------*/
865
866 static void
867 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
868 {
869 YYFPRINTF (stderr, "Stack now");
870 for (; yybottom <= yytop; yybottom++)
871 {
872 int yybot = *yybottom;
873 YYFPRINTF (stderr, " %d", yybot);
874 }
875 YYFPRINTF (stderr, "\n");
876 }
877
878 # define YY_STACK_PRINT(Bottom, Top) \
879 do { \
880 if (yydebug) \
881 yy_stack_print ((Bottom), (Top)); \
882 } while (0)
883
884
885 /*------------------------------------------------.
886 | Report that the YYRULE is going to be reduced. |
887 `------------------------------------------------*/
888
889 static void
890 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
891 int yyrule, ast** config_ast)
892 {
893 int yylno = yyrline[yyrule];
894 int yynrhs = yyr2[yyrule];
895 int yyi;
896 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
897 yyrule - 1, yylno);
898 /* The symbols being reduced. */
899 for (yyi = 0; yyi < yynrhs; yyi++)
900 {
901 YYFPRINTF (stderr, " $%d = ", yyi + 1);
902 yy_symbol_print (stderr,
903 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
904 &yyvsp[(yyi + 1) - (yynrhs)], config_ast);
905 YYFPRINTF (stderr, "\n");
906 }
907 }
908
909 # define YY_REDUCE_PRINT(Rule) \
910 do { \
911 if (yydebug) \
912 yy_reduce_print (yyssp, yyvsp, Rule, config_ast); \
913 } while (0)
914
915 /* Nonzero means print parse trace. It is left uninitialized so that
916 multiple parsers can coexist. */
917 int yydebug;
918 #else /* !YYDEBUG */
919 # define YYDPRINTF(Args) ((void) 0)
920 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
921 # define YY_STACK_PRINT(Bottom, Top)
922 # define YY_REDUCE_PRINT(Rule)
923 #endif /* !YYDEBUG */
924
925
926 /* YYINITDEPTH -- initial size of the parser's stacks. */
927 #ifndef YYINITDEPTH
928 # define YYINITDEPTH 200
929 #endif
930
931 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
932 if the built-in stack extension method is used).
933
934 Do not make this value too large; the results are undefined if
935 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
936 evaluated with infinite-precision integer arithmetic. */
937
938 #ifndef YYMAXDEPTH
939 # define YYMAXDEPTH 10000
940 #endif
941
942
943 /* Context of a parse error. */
944 typedef struct
945 {
946 yy_state_t *yyssp;
947 yysymbol_kind_t yytoken;
948 } yypcontext_t;
949
950 /* Put in YYARG at most YYARGN of the expected tokens given the
951 current YYCTX, and return the number of tokens stored in YYARG. If
952 YYARG is null, return the number of expected tokens (guaranteed to
953 be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
954 Return 0 if there are more than YYARGN expected tokens, yet fill
955 YYARG up to YYARGN. */
956 static int
957 yypcontext_expected_tokens (const yypcontext_t *yyctx,
958 yysymbol_kind_t yyarg[], int yyargn)
959 {
960 /* Actual size of YYARG. */
961 int yycount = 0;
962 int yyn = yypact[+*yyctx->yyssp];
963 if (!yypact_value_is_default (yyn))
964 {
965 /* Start YYX at -YYN if negative to avoid negative indexes in
966 YYCHECK. In other words, skip the first -YYN actions for
967 this state because they are default actions. */
968 int yyxbegin = yyn < 0 ? -yyn : 0;
969 /* Stay within bounds of both yycheck and yytname. */
970 int yychecklim = YYLAST - yyn + 1;
971 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
972 int yyx;
973 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
974 if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
975 && !yytable_value_is_error (yytable[yyx + yyn]))
976 {
977 if (!yyarg)
978 ++yycount;
979 else if (yycount == yyargn)
980 return 0;
981 else
982 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
983 }
984 }
985 if (yyarg && yycount == 0 && 0 < yyargn)
986 yyarg[0] = YYSYMBOL_YYEMPTY;
987 return yycount;
988 }
989
990
991
992
993 #ifndef yystrlen
994 # if defined __GLIBC__ && defined _STRING_H
995 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
996 # else
997 /* Return the length of YYSTR. */
998 static YYPTRDIFF_T
999 yystrlen (const char *yystr)
1000 {
1001 YYPTRDIFF_T yylen;
1002 for (yylen = 0; yystr[yylen]; yylen++)
1003 continue;
1004 return yylen;
1005 }
1006 # endif
1007 #endif
1008
1009 #ifndef yystpcpy
1010 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1011 # define yystpcpy stpcpy
1012 # else
1013 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1014 YYDEST. */
1015 static char *
1016 yystpcpy (char *yydest, const char *yysrc)
1017 {
1018 char *yyd = yydest;
1019 const char *yys = yysrc;
1020
1021 while ((*yyd++ = *yys++) != '\0')
1022 continue;
1023
1024 return yyd - 1;
1025 }
1026 # endif
1027 #endif
1028
1029 #ifndef yytnamerr
1030 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1031 quotes and backslashes, so that it's suitable for yyerror. The
1032 heuristic is that double-quoting is unnecessary unless the string
1033 contains an apostrophe, a comma, or backslash (other than
1034 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1035 null, do not copy; instead, return the length of what the result
1036 would have been. */
1037 static YYPTRDIFF_T
1038 yytnamerr (char *yyres, const char *yystr)
1039 {
1040 if (*yystr == '"')
1041 {
1042 YYPTRDIFF_T yyn = 0;
1043 char const *yyp = yystr;
1044 for (;;)
1045 switch (*++yyp)
1046 {
1047 case '\'':
1048 case ',':
1049 goto do_not_strip_quotes;
1050
1051 case '\\':
1052 if (*++yyp != '\\')
1053 goto do_not_strip_quotes;
1054 else
1055 goto append;
1056
1057 append:
1058 default:
1059 if (yyres)
1060 yyres[yyn] = *yyp;
1061 yyn++;
1062 break;
1063
1064 case '"':
1065 if (yyres)
1066 yyres[yyn] = '\0';
1067 return yyn;
1068 }
1069 do_not_strip_quotes: ;
1070 }
1071
1072 if (yyres)
1073 return yystpcpy (yyres, yystr) - yyres;
1074 else
1075 return yystrlen (yystr);
1076 }
1077 #endif
1078
1079
1080 static int
1081 yy_syntax_error_arguments (const yypcontext_t *yyctx,
1082 yysymbol_kind_t yyarg[], int yyargn)
1083 {
1084 /* Actual size of YYARG. */
1085 int yycount = 0;
1086 /* There are many possibilities here to consider:
1087 - If this state is a consistent state with a default action, then
1088 the only way this function was invoked is if the default action
1089 is an error action. In that case, don't check for expected
1090 tokens because there are none.
1091 - The only way there can be no lookahead present (in yychar) is if
1092 this state is a consistent state with a default action. Thus,
1093 detecting the absence of a lookahead is sufficient to determine
1094 that there is no unexpected or expected token to report. In that
1095 case, just report a simple "syntax error".
1096 - Don't assume there isn't a lookahead just because this state is a
1097 consistent state with a default action. There might have been a
1098 previous inconsistent state, consistent state with a non-default
1099 action, or user semantic action that manipulated yychar.
1100 - Of course, the expected token list depends on states to have
1101 correct lookahead information, and it depends on the parser not
1102 to perform extra reductions after fetching a lookahead from the
1103 scanner and before detecting a syntax error. Thus, state merging
1104 (from LALR or IELR) and default reductions corrupt the expected
1105 token list. However, the list is correct for canonical LR with
1106 one exception: it will still contain any token that will not be
1107 accepted due to an error action in a later state.
1108 */
1109 if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1110 {
1111 int yyn;
1112 if (yyarg)
1113 yyarg[yycount] = yyctx->yytoken;
1114 ++yycount;
1115 yyn = yypcontext_expected_tokens (yyctx,
1116 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1117 if (yyn == YYENOMEM)
1118 return YYENOMEM;
1119 else
1120 yycount += yyn;
1121 }
1122 return yycount;
1123 }
1124
1125 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1126 about the unexpected token YYTOKEN for the state stack whose top is
1127 YYSSP.
1128
1129 Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1130 not large enough to hold the message. In that case, also set
1131 *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1132 required number of bytes is too large to store. */
1133 static int
1134 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1135 const yypcontext_t *yyctx)
1136 {
1137 enum { YYARGS_MAX = 5 };
1138 /* Internationalized format string. */
1139 const char *yyformat = YY_NULLPTR;
1140 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1141 one per "expected"). */
1142 yysymbol_kind_t yyarg[YYARGS_MAX];
1143 /* Cumulated lengths of YYARG. */
1144 YYPTRDIFF_T yysize = 0;
1145
1146 /* Actual size of YYARG. */
1147 int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1148 if (yycount == YYENOMEM)
1149 return YYENOMEM;
1150
1151 switch (yycount)
1152 {
1153 #define YYCASE_(N, S) \
1154 case N: \
1155 yyformat = S; \
1156 break
1157 default: /* Avoid compiler warnings. */
1158 YYCASE_(0, YY_("syntax error"));
1159 YYCASE_(1, YY_("syntax error, unexpected %s"));
1160 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1161 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1162 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1163 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1164 #undef YYCASE_
1165 }
1166
1167 /* Compute error message size. Don't count the "%s"s, but reserve
1168 room for the terminator. */
1169 yysize = yystrlen (yyformat) - 2 * yycount + 1;
1170 {
1171 int yyi;
1172 for (yyi = 0; yyi < yycount; ++yyi)
1173 {
1174 YYPTRDIFF_T yysize1
1175 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1176 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1177 yysize = yysize1;
1178 else
1179 return YYENOMEM;
1180 }
1181 }
1182
1183 if (*yymsg_alloc < yysize)
1184 {
1185 *yymsg_alloc = 2 * yysize;
1186 if (! (yysize <= *yymsg_alloc
1187 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1188 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1189 return -1;
1190 }
1191
1192 /* Avoid sprintf, as that infringes on the user's name space.
1193 Don't have undefined behavior even if the translation
1194 produced a string with the wrong number of "%s"s. */
1195 {
1196 char *yyp = *yymsg;
1197 int yyi = 0;
1198 while ((*yyp = *yyformat) != '\0')
1199 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1200 {
1201 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1202 yyformat += 2;
1203 }
1204 else
1205 {
1206 ++yyp;
1207 ++yyformat;
1208 }
1209 }
1210 return 0;
1211 }
1212
1213
1214 /*-----------------------------------------------.
1215 | Release the memory associated to this symbol. |
1216 `-----------------------------------------------*/
1217
1218 static void
1219 yydestruct (const char *yymsg,
1220 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, ast** config_ast)
1221 {
1222 YY_USE (yyvaluep);
1223 YY_USE (config_ast);
1224 if (!yymsg)
1225 yymsg = "Deleting";
1226 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1227
1228 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1229 YY_USE (yykind);
1230 YY_IGNORE_MAYBE_UNINITIALIZED_END
1231 }
1232
1233
1234 /* Lookahead token kind. */
1235 int yychar;
1236
1237 /* The semantic value of the lookahead symbol. */
1238 YYSTYPE yylval;
1239 /* Number of syntax errors so far. */
1240 int yynerrs;
1241
1242
1243
1244
1245 /*----------.
1246 | yyparse. |
1247 `----------*/
1248
1249 int
1250 yyparse (ast** config_ast)
1251 {
1252 yy_state_fast_t yystate = 0;
1253 /* Number of tokens to shift before error messages enabled. */
1254 int yyerrstatus = 0;
1255
1256 /* Refer to the stacks through separate pointers, to allow yyoverflow
1257 to reallocate them elsewhere. */
1258
1259 /* Their size. */
1260 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1261
1262 /* The state stack: array, bottom, top. */
1263 yy_state_t yyssa[YYINITDEPTH];
1264 yy_state_t *yyss = yyssa;
1265 yy_state_t *yyssp = yyss;
1266
1267 /* The semantic value stack: array, bottom, top. */
1268 YYSTYPE yyvsa[YYINITDEPTH];
1269 YYSTYPE *yyvs = yyvsa;
1270 YYSTYPE *yyvsp = yyvs;
1271
1272 int yyn;
1273 /* The return value of yyparse. */
1274 int yyresult;
1275 /* Lookahead symbol kind. */
1276 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1277 /* The variables used to return semantic value and location from the
1278 action routines. */
1279 YYSTYPE yyval;
1280
1281 /* Buffer for error messages, and its allocated size. */
1282 char yymsgbuf[128];
1283 char *yymsg = yymsgbuf;
1284 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1285
1286 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1287
1288 /* The number of symbols on the RHS of the reduced rule.
1289 Keep to zero when no symbol should be popped. */
1290 int yylen = 0;
1291
1292 YYDPRINTF ((stderr, "Starting parse\n"));
1293
1294 yychar = YYEMPTY; /* Cause a token to be read. */
1295
1296 goto yysetstate;
1297
1298
1299 /*------------------------------------------------------------.
1300 | yynewstate -- push a new state, which is found in yystate. |
1301 `------------------------------------------------------------*/
1302 yynewstate:
1303 /* In all cases, when you get here, the value and location stacks
1304 have just been pushed. So pushing a state here evens the stacks. */
1305 yyssp++;
1306
1307
1308 /*--------------------------------------------------------------------.
1309 | yysetstate -- set current state (the top of the stack) to yystate. |
1310 `--------------------------------------------------------------------*/
1311 yysetstate:
1312 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1313 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1314 YY_IGNORE_USELESS_CAST_BEGIN
1315 *yyssp = YY_CAST (yy_state_t, yystate);
1316 YY_IGNORE_USELESS_CAST_END
1317 YY_STACK_PRINT (yyss, yyssp);
1318
1319 if (yyss + yystacksize - 1 <= yyssp)
1320 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1321 YYNOMEM;
1322 #else
1323 {
1324 /* Get the current used size of the three stacks, in elements. */
1325 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1326
1327 # if defined yyoverflow
1328 {
1329 /* Give user a chance to reallocate the stack. Use copies of
1330 these so that the &'s don't force the real ones into
1331 memory. */
1332 yy_state_t *yyss1 = yyss;
1333 YYSTYPE *yyvs1 = yyvs;
1334
1335 /* Each stack pointer address is followed by the size of the
1336 data in use in that stack, in bytes. This used to be a
1337 conditional around just the two extra args, but that might
1338 be undefined if yyoverflow is a macro. */
1339 yyoverflow (YY_("memory exhausted"),
1340 &yyss1, yysize * YYSIZEOF (*yyssp),
1341 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1342 &yystacksize);
1343 yyss = yyss1;
1344 yyvs = yyvs1;
1345 }
1346 # else /* defined YYSTACK_RELOCATE */
1347 /* Extend the stack our own way. */
1348 if (YYMAXDEPTH <= yystacksize)
1349 YYNOMEM;
1350 yystacksize *= 2;
1351 if (YYMAXDEPTH < yystacksize)
1352 yystacksize = YYMAXDEPTH;
1353
1354 {
1355 yy_state_t *yyss1 = yyss;
1356 union yyalloc *yyptr =
1357 YY_CAST (union yyalloc *,
1358 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1359 if (! yyptr)
1360 YYNOMEM;
1361 YYSTACK_RELOCATE (yyss_alloc, yyss);
1362 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1363 # undef YYSTACK_RELOCATE
1364 if (yyss1 != yyssa)
1365 YYSTACK_FREE (yyss1);
1366 }
1367 # endif
1368
1369 yyssp = yyss + yysize - 1;
1370 yyvsp = yyvs + yysize - 1;
1371
1372 YY_IGNORE_USELESS_CAST_BEGIN
1373 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1374 YY_CAST (long, yystacksize)));
1375 YY_IGNORE_USELESS_CAST_END
1376
1377 if (yyss + yystacksize - 1 <= yyssp)
1378 YYABORT;
1379 }
1380 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1381
1382
1383 if (yystate == YYFINAL)
1384 YYACCEPT;
1385
1386 goto yybackup;
1387
1388
1389 /*-----------.
1390 | yybackup. |
1391 `-----------*/
1392 yybackup:
1393 /* Do appropriate processing given the current state. Read a
1394 lookahead token if we need one and don't already have one. */
1395
1396 /* First try to decide what to do without reference to lookahead token. */
1397 yyn = yypact[yystate];
1398 if (yypact_value_is_default (yyn))
1399 goto yydefault;
1400
1401 /* Not known => get a lookahead token if don't already have one. */
1402
1403 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1404 if (yychar == YYEMPTY)
1405 {
1406 YYDPRINTF ((stderr, "Reading a token\n"));
1407 yychar = yylex ();
1408 }
1409
1410 if (yychar <= YYEOF)
1411 {
1412 yychar = YYEOF;
1413 yytoken = YYSYMBOL_YYEOF;
1414 YYDPRINTF ((stderr, "Now at end of input.\n"));
1415 }
1416 else if (yychar == YYerror)
1417 {
1418 /* The scanner already issued an error message, process directly
1419 to error recovery. But do not keep the error token as
1420 lookahead, it is too special and may lead us to an endless
1421 loop in error recovery. */
1422 yychar = YYUNDEF;
1423 yytoken = YYSYMBOL_YYerror;
1424 goto yyerrlab1;
1425 }
1426 else
1427 {
1428 yytoken = YYTRANSLATE (yychar);
1429 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1430 }
1431
1432 /* If the proper action on seeing token YYTOKEN is to reduce or to
1433 detect an error, take that action. */
1434 yyn += yytoken;
1435 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1436 goto yydefault;
1437 yyn = yytable[yyn];
1438 if (yyn <= 0)
1439 {
1440 if (yytable_value_is_error (yyn))
1441 goto yyerrlab;
1442 yyn = -yyn;
1443 goto yyreduce;
1444 }
1445
1446 /* Count tokens shifted since error; after three, turn off error
1447 status. */
1448 if (yyerrstatus)
1449 yyerrstatus--;
1450
1451 /* Shift the lookahead token. */
1452 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1453 yystate = yyn;
1454 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1455 *++yyvsp = yylval;
1456 YY_IGNORE_MAYBE_UNINITIALIZED_END
1457
1458 /* Discard the shifted token. */
1459 yychar = YYEMPTY;
1460 goto yynewstate;
1461
1462
1463 /*-----------------------------------------------------------.
1464 | yydefault -- do the default action for the current state. |
1465 `-----------------------------------------------------------*/
1466 yydefault:
1467 yyn = yydefact[yystate];
1468 if (yyn == 0)
1469 goto yyerrlab;
1470 goto yyreduce;
1471
1472
1473 /*-----------------------------.
1474 | yyreduce -- do a reduction. |
1475 `-----------------------------*/
1476 yyreduce:
1477 /* yyn is the number of a rule to reduce with. */
1478 yylen = yyr2[yyn];
1479
1480 /* If YYLEN is nonzero, implement the default value of the action:
1481 '$$ = $1'.
1482
1483 Otherwise, the following line sets YYVAL to garbage.
1484 This behavior is undocumented and Bison
1485 users should not rely upon it. Assigning to YYVAL
1486 unconditionally makes the parser a bit smaller, and it avoids a
1487 GCC warning that YYVAL may be used uninitialized. */
1488 yyval = yyvsp[1-yylen];
1489
1490
1491 YY_REDUCE_PRINT (yyn);
1492 switch (yyn)
1493 {
1494 case 3: /* config: statements */
1495 #line 108 "src/conf_yacc.y"
1496 { *config_ast = (yyvsp[0].ast); }
1497 #line 1498 "src/conf_yacc.c"
1498 break;
1499
1500 case 4: /* statements: statement "new line" statements */
1501 #line 110 "src/conf_yacc.y"
1502 {
1503 ast *temp = (yyvsp[-2].ast);
1504 temp->next = (yyvsp[0].ast);
1505 (yyval.ast) = (yyvsp[-2].ast); }
1506 #line 1507 "src/conf_yacc.c"
1507 break;
1508
1509 case 5: /* statements: statement "new line" */
1510 #line 114 "src/conf_yacc.y"
1511 { (yyval.ast) = (yyvsp[-1].ast); }
1512 #line 1513 "src/conf_yacc.c"
1513 break;
1514
1515 case 6: /* statements: statement */
1516 #line 115 "src/conf_yacc.y"
1517 { (yyval.ast) = (yyvsp[0].ast); }
1518 #line 1519 "src/conf_yacc.c"
1519 break;
1520
1521 case 15: /* attribute_expression: attribute_expression '+' "group" */
1522 #line 125 "src/conf_yacc.y"
1523 { (yyval.attr_expr) = new_attribute_expression(ATTR_OP_PLUS, (yyvsp[-2].attr_expr), (yyvsp[0].s)); }
1524 #line 1525 "src/conf_yacc.c"
1525 break;
1526
1527 case 16: /* attribute_expression: attribute_expression '-' "group" */
1528 #line 126 "src/conf_yacc.y"
1529 { (yyval.attr_expr) = new_attribute_expression(ATTR_OP_MINUS, (yyvsp[-2].attr_expr), (yyvsp[0].s)); }
1530 #line 1531 "src/conf_yacc.c"
1531 break;
1532
1533 case 17: /* attribute_expression: "group" */
1534 #line 127 "src/conf_yacc.y"
1535 { (yyval.attr_expr) = new_attribute_expression(ATTR_OP_GROUP, NULL, (yyvsp[0].s)); }
1536 #line 1537 "src/conf_yacc.c"
1537 break;
1538
1539 case 18: /* ft_restriction_expression: ft_restriction_expression ',' "group" */
1540 #line 129 "src/conf_yacc.y"
1541 { (yyval.ft_rs_expr) = new_ft_restriction_expression((yyvsp[-2].ft_rs_expr), (yyvsp[0].s)); }
1542 #line 1543 "src/conf_yacc.c"
1543 break;
1544
1545 case 19: /* ft_restriction_expression: "group" */
1546 #line 130 "src/conf_yacc.y"
1547 { (yyval.ft_rs_expr) = new_ft_restriction_expression(NULL, (yyvsp[0].s)); }
1548 #line 1549 "src/conf_yacc.c"
1549 break;
1550
1551 case 20: /* restriction_expression: ft_restriction_expression '=' "group" */
1552 #line 132 "src/conf_yacc.y"
1553 { (yyval.rs_expr) = new_restriction_expression((yyvsp[-2].ft_rs_expr), (yyvsp[0].s)); }
1554 #line 1555 "src/conf_yacc.c"
1555 break;
1556
1557 case 21: /* restriction_expression: '=' "group" */
1558 #line 133 "src/conf_yacc.y"
1559 { (yyval.rs_expr) = new_restriction_expression(NULL, (yyvsp[0].s)); }
1560 #line 1561 "src/conf_yacc.c"
1561 break;
1562
1563 case 22: /* restriction_expression: ft_restriction_expression */
1564 #line 134 "src/conf_yacc.y"
1565 { (yyval.rs_expr) = new_restriction_expression((yyvsp[0].ft_rs_expr), NULL); }
1566 #line 1567 "src/conf_yacc.c"
1567 break;
1568
1569 case 23: /* restriction_expression: '0' */
1570 #line 135 "src/conf_yacc.y"
1571 { (yyval.rs_expr) = new_restriction_expression(NULL, NULL); }
1572 #line 1573 "src/conf_yacc.c"
1573 break;
1574
1575 case 24: /* define_statement: "@@define" "variable name" */
1576 #line 137 "src/conf_yacc.y"
1577 { (yyval.ast) = new_define_statement((yyvsp[0].s), NULL); }
1578 #line 1579 "src/conf_yacc.c"
1579 break;
1580
1581 case 25: /* define_statement: "@@define" "variable name" string_expression */
1582 #line 138 "src/conf_yacc.y"
1583 { (yyval.ast) = new_define_statement((yyvsp[-1].s), (yyvsp[0].string_expr)); }
1584 #line 1585 "src/conf_yacc.c"
1585 break;
1586
1587 case 26: /* string_expression: string_fragment string_expression */
1588 #line 140 "src/conf_yacc.y"
1589 { (yyval.string_expr) = new_string_concat((yyvsp[-1].string_expr), (yyvsp[0].string_expr)); }
1590 #line 1591 "src/conf_yacc.c"
1591 break;
1592
1593 case 27: /* string_expression: string_fragment */
1594 #line 141 "src/conf_yacc.y"
1595 { (yyval.string_expr) = (yyvsp[0].string_expr); }
1596 #line 1597 "src/conf_yacc.c"
1597 break;
1598
1599 case 28: /* string_fragment: "string" */
1600 #line 142 "src/conf_yacc.y"
1601 { (yyval.string_expr) = new_string((yyvsp[0].s)); }
1602 #line 1603 "src/conf_yacc.c"
1603 break;
1604
1605 case 29: /* string_fragment: "variable name" */
1606 #line 143 "src/conf_yacc.y"
1607 { (yyval.string_expr) = new_variable((yyvsp[0].s)); }
1608 #line 1609 "src/conf_yacc.c"
1609 break;
1610
1611 case 30: /* undefine_statement: "@@undef" "variable name" */
1612 #line 145 "src/conf_yacc.y"
1613 { (yyval.ast) = new_undefine_statement((yyvsp[0].s)); }
1614 #line 1615 "src/conf_yacc.c"
1615 break;
1616
1617 case 31: /* config_statement: "configuration option" '=' string_expression */
1618 #line 147 "src/conf_yacc.y"
1619 { (yyval.ast) = new_string_option_statement((yyvsp[-2].option), (yyvsp[0].string_expr)); }
1620 #line 1621 "src/conf_yacc.c"
1621 break;
1622
1623 case 32: /* config_statement: "configuration option" '=' attribute_expression */
1624 #line 148 "src/conf_yacc.y"
1625 { (yyval.ast) = new_attribute_option_statement((yyvsp[-2].option), (yyvsp[0].attr_expr)); }
1626 #line 1627 "src/conf_yacc.c"
1627 break;
1628
1629 case 33: /* group_statement: "group name" '=' attribute_expression */
1630 #line 150 "src/conf_yacc.y"
1631 { (yyval.ast) = new_group_statement((yyvsp[-2].s), (yyvsp[0].attr_expr)); }
1632 #line 1633 "src/conf_yacc.c"
1633 break;
1634
1635 case 34: /* include_statement: "@@include" "whitespace" string_expression */
1636 #line 152 "src/conf_yacc.y"
1637 { (yyval.ast) = new_include_statement((yyvsp[0].string_expr), NULL, false, NULL); }
1638 #line 1639 "src/conf_yacc.c"
1639 break;
1640
1641 case 35: /* include_statement: "@@include" "whitespace" string_expression "whitespace" string_expression */
1642 #line 153 "src/conf_yacc.y"
1643 { (yyval.ast) = new_include_statement((yyvsp[-2].string_expr), (yyvsp[0].string_expr), false, NULL); }
1644 #line 1645 "src/conf_yacc.c"
1645 break;
1646
1647 case 36: /* include_statement: "@@include" "whitespace" string_expression "whitespace" string_expression "whitespace" string_expression */
1648 #line 154 "src/conf_yacc.y"
1649 { (yyval.ast) = new_include_statement((yyvsp[-4].string_expr), (yyvsp[-2].string_expr), false, (yyvsp[0].string_expr)); }
1650 #line 1651 "src/conf_yacc.c"
1651 break;
1652
1653 case 37: /* include_statement: "@@x_include" "whitespace" string_expression */
1654 #line 155 "src/conf_yacc.y"
1655 { (yyval.ast) = new_include_statement((yyvsp[0].string_expr), NULL, true, NULL); }
1656 #line 1657 "src/conf_yacc.c"
1657 break;
1658
1659 case 38: /* include_statement: "@@x_include" "whitespace" string_expression "whitespace" string_expression */
1660 #line 156 "src/conf_yacc.y"
1661 { (yyval.ast) = new_include_statement((yyvsp[-2].string_expr), (yyvsp[0].string_expr), true, NULL); }
1662 #line 1663 "src/conf_yacc.c"
1663 break;
1664
1665 case 39: /* include_statement: "@@x_include" "whitespace" string_expression "whitespace" string_expression "whitespace" string_expression */
1666 #line 157 "src/conf_yacc.y"
1667 { (yyval.ast) = new_include_statement((yyvsp[-4].string_expr), (yyvsp[-2].string_expr), true, (yyvsp[0].string_expr)); }
1668 #line 1669 "src/conf_yacc.c"
1669 break;
1670
1671 case 40: /* x_include_setenv_statement: "@@x_include_setenv" "variable name" string_expression */
1672 #line 159 "src/conf_yacc.y"
1673 { (yyval.ast) = new_x_include_setenv_statement((yyvsp[-1].s), (yyvsp[0].string_expr)); }
1674 #line 1675 "src/conf_yacc.c"
1675 break;
1676
1677 case 41: /* if_statement: if_condition "new line" statements "@@endif" */
1678 #line 161 "src/conf_yacc.y"
1679 { (yyval.ast) = new_if_statement((yyvsp[-3].if_cond), (yyvsp[-1].ast), NULL); }
1680 #line 1681 "src/conf_yacc.c"
1681 break;
1682
1683 case 42: /* if_statement: if_condition "new line" statements "@@else" "new line" statements "@@endif" */
1684 #line 162 "src/conf_yacc.y"
1685 { (yyval.ast) = new_if_statement((yyvsp[-6].if_cond), (yyvsp[-4].ast), (yyvsp[-1].ast)); }
1686 #line 1687 "src/conf_yacc.c"
1687 break;
1688
1689 case 43: /* if_condition: "@@ifdef" string_expression */
1690 #line 164 "src/conf_yacc.y"
1691 { (yyval.if_cond)=new_if_condition(new_string_bool_expression(BOOL_OP_DEFINED, (yyvsp[0].string_expr), NULL)); }
1692 #line 1693 "src/conf_yacc.c"
1693 break;
1694
1695 case 44: /* if_condition: "@@ifndef" string_expression */
1696 #line 165 "src/conf_yacc.y"
1697 { (yyval.if_cond)=new_if_condition(new_bool_expression(BOOL_OP_NOT, new_string_bool_expression(BOOL_OP_DEFINED, (yyvsp[0].string_expr), NULL), NULL)); }
1698 #line 1699 "src/conf_yacc.c"
1699 break;
1700
1701 case 45: /* if_condition: "@@ifhost" string_expression */
1702 #line 166 "src/conf_yacc.y"
1703 { (yyval.if_cond)=new_if_condition(new_string_bool_expression(BOOL_OP_HOSTNAME, (yyvsp[0].string_expr), NULL)); }
1704 #line 1705 "src/conf_yacc.c"
1705 break;
1706
1707 case 46: /* if_condition: "@@ifnhost" string_expression */
1708 #line 167 "src/conf_yacc.y"
1709 { (yyval.if_cond)=new_if_condition(new_bool_expression(BOOL_OP_NOT, new_string_bool_expression(BOOL_OP_HOSTNAME, (yyvsp[0].string_expr), NULL), NULL)); }
1710 #line 1711 "src/conf_yacc.c"
1711 break;
1712
1713 case 47: /* if_condition: "@@if" bool_expression */
1714 #line 168 "src/conf_yacc.y"
1715 { (yyval.if_cond)=new_if_condition((yyvsp[0].bool_expr)); }
1716 #line 1717 "src/conf_yacc.c"
1717 break;
1718
1719 case 48: /* bool_expression: "not" bool_expression */
1720 #line 170 "src/conf_yacc.y"
1721 { (yyval.bool_expr) = new_bool_expression(BOOL_OP_NOT, (yyvsp[0].bool_expr), NULL); }
1722 #line 1723 "src/conf_yacc.c"
1723 break;
1724
1725 case 49: /* bool_expression: "boolean function" string_expression */
1726 #line 171 "src/conf_yacc.y"
1727 { (yyval.bool_expr) = new_string_bool_expression((yyvsp[-1].operator), (yyvsp[0].string_expr), NULL); }
1728 #line 1729 "src/conf_yacc.c"
1729 break;
1730
1731 case 50: /* bool_expression: string_expression "boolean operator" string_expression */
1732 #line 172 "src/conf_yacc.y"
1733 { (yyval.bool_expr) = new_string_bool_expression((yyvsp[-1].operator), (yyvsp[-2].string_expr), (yyvsp[0].string_expr)); }
1734 #line 1735 "src/conf_yacc.c"
1735 break;
1736
1737 case 51: /* rule_statement: "regular rule" string_expression attribute_expression */
1738 #line 174 "src/conf_yacc.y"
1739 { (yyval.ast) = new_rule_statement(AIDE_SELECTIVE_RULE, (yyvsp[-1].string_expr), NULL, (yyvsp[0].attr_expr)); }
1740 #line 1741 "src/conf_yacc.c"
1741 break;
1742
1743 case 52: /* rule_statement: "equals rule" string_expression attribute_expression */
1744 #line 175 "src/conf_yacc.y"
1745 { (yyval.ast) = new_rule_statement(AIDE_EQUAL_RULE, (yyvsp[-1].string_expr), NULL, (yyvsp[0].attr_expr)); }
1746 #line 1747 "src/conf_yacc.c"
1747 break;
1748
1749 case 53: /* rule_statement: "recursive negative rule" string_expression */
1750 #line 176 "src/conf_yacc.y"
1751 { (yyval.ast) = new_rule_statement(AIDE_RECURSIVE_NEGATIVE_RULE, (yyvsp[0].string_expr), NULL, NULL); }
1752 #line 1753 "src/conf_yacc.c"
1753 break;
1754
1755 case 54: /* rule_statement: "non-recursive negative rule" string_expression */
1756 #line 177 "src/conf_yacc.y"
1757 { (yyval.ast) = new_rule_statement(AIDE_NON_RECURSIVE_NEGATIVE_RULE, (yyvsp[0].string_expr), NULL, NULL); }
1758 #line 1759 "src/conf_yacc.c"
1759 break;
1760
1761 case 55: /* rule_statement: "regular rule" string_expression restriction_expression attribute_expression */
1762 #line 178 "src/conf_yacc.y"
1763 { (yyval.ast) = new_rule_statement(AIDE_SELECTIVE_RULE, (yyvsp[-2].string_expr), (yyvsp[-1].rs_expr), (yyvsp[0].attr_expr)); }
1764 #line 1765 "src/conf_yacc.c"
1765 break;
1766
1767 case 56: /* rule_statement: "equals rule" string_expression restriction_expression attribute_expression */
1768 #line 179 "src/conf_yacc.y"
1769 { (yyval.ast) = new_rule_statement(AIDE_EQUAL_RULE, (yyvsp[-2].string_expr), (yyvsp[-1].rs_expr), (yyvsp[0].attr_expr)); }
1770 #line 1771 "src/conf_yacc.c"
1771 break;
1772
1773 case 57: /* rule_statement: "recursive negative rule" string_expression restriction_expression */
1774 #line 180 "src/conf_yacc.y"
1775 { (yyval.ast) = new_rule_statement(AIDE_RECURSIVE_NEGATIVE_RULE, (yyvsp[-1].string_expr), (yyvsp[0].rs_expr), NULL); }
1776 #line 1777 "src/conf_yacc.c"
1777 break;
1778
1779 case 58: /* rule_statement: "non-recursive negative rule" string_expression restriction_expression */
1780 #line 181 "src/conf_yacc.y"
1781 { (yyval.ast) = new_rule_statement(AIDE_NON_RECURSIVE_NEGATIVE_RULE, (yyvsp[-1].string_expr), (yyvsp[0].rs_expr), NULL); }
1782 #line 1783 "src/conf_yacc.c"
1783 break;
1784
1785 case 59: /* rule_statement: "recursive negative rule" string_expression restriction_expression attribute_expression */
1786 #line 182 "src/conf_yacc.y"
1787 {
1788 log_msg(LOG_LEVEL_ERROR, "%s:%d: recursive negative rule must not have an attribute expression (line: '%s')", conf_filename, conf_linenumber, conf_linebuf);
1789 YYABORT;
1790 }
1791 #line 1792 "src/conf_yacc.c"
1792 break;
1793
1794 case 60: /* rule_statement: "non-recursive negative rule" string_expression restriction_expression attribute_expression */
1795 #line 186 "src/conf_yacc.y"
1796 {
1797 log_msg(LOG_LEVEL_ERROR, "%s:%d: non-recursive negative rule must not have an attribute expression (line: '%s')", conf_filename, conf_linenumber, conf_linebuf);
1798 YYABORT;
1799 }
1800 #line 1801 "src/conf_yacc.c"
1801 break;
1802
1803
1804 #line 1805 "src/conf_yacc.c"
1805
1806 default: break;
1807 }
1808 /* User semantic actions sometimes alter yychar, and that requires
1809 that yytoken be updated with the new translation. We take the
1810 approach of translating immediately before every use of yytoken.
1811 One alternative is translating here after every semantic action,
1812 but that translation would be missed if the semantic action invokes
1813 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1814 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1815 incorrect destructor might then be invoked immediately. In the
1816 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1817 to an incorrect destructor call or verbose syntax error message
1818 before the lookahead is translated. */
1819 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1820
1821 YYPOPSTACK (yylen);
1822 yylen = 0;
1823
1824 *++yyvsp = yyval;
1825
1826 /* Now 'shift' the result of the reduction. Determine what state
1827 that goes to, based on the state we popped back to and the rule
1828 number reduced by. */
1829 {
1830 const int yylhs = yyr1[yyn] - YYNTOKENS;
1831 const int yyi = yypgoto[yylhs] + *yyssp;
1832 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1833 ? yytable[yyi]
1834 : yydefgoto[yylhs]);
1835 }
1836
1837 goto yynewstate;
1838
1839
1840 /*--------------------------------------.
1841 | yyerrlab -- here on detecting error. |
1842 `--------------------------------------*/
1843 yyerrlab:
1844 /* Make sure we have latest lookahead translation. See comments at
1845 user semantic actions for why this is necessary. */
1846 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1847 /* If not already recovering from an error, report this error. */
1848 if (!yyerrstatus)
1849 {
1850 ++yynerrs;
1851 {
1852 yypcontext_t yyctx
1853 = {yyssp, yytoken};
1854 char const *yymsgp = YY_("syntax error");
1855 int yysyntax_error_status;
1856 yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1857 if (yysyntax_error_status == 0)
1858 yymsgp = yymsg;
1859 else if (yysyntax_error_status == -1)
1860 {
1861 if (yymsg != yymsgbuf)
1862 YYSTACK_FREE (yymsg);
1863 yymsg = YY_CAST (char *,
1864 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1865 if (yymsg)
1866 {
1867 yysyntax_error_status
1868 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1869 yymsgp = yymsg;
1870 }
1871 else
1872 {
1873 yymsg = yymsgbuf;
1874 yymsg_alloc = sizeof yymsgbuf;
1875 yysyntax_error_status = YYENOMEM;
1876 }
1877 }
1878 yyerror (config_ast, yymsgp);
1879 if (yysyntax_error_status == YYENOMEM)
1880 YYNOMEM;
1881 }
1882 }
1883
1884 if (yyerrstatus == 3)
1885 {
1886 /* If just tried and failed to reuse lookahead token after an
1887 error, discard it. */
1888
1889 if (yychar <= YYEOF)
1890 {
1891 /* Return failure if at end of input. */
1892 if (yychar == YYEOF)
1893 YYABORT;
1894 }
1895 else
1896 {
1897 yydestruct ("Error: discarding",
1898 yytoken, &yylval, config_ast);
1899 yychar = YYEMPTY;
1900 }
1901 }
1902
1903 /* Else will try to reuse lookahead token after shifting the error
1904 token. */
1905 goto yyerrlab1;
1906
1907
1908 /*---------------------------------------------------.
1909 | yyerrorlab -- error raised explicitly by YYERROR. |
1910 `---------------------------------------------------*/
1911 yyerrorlab:
1912 /* Pacify compilers when the user code never invokes YYERROR and the
1913 label yyerrorlab therefore never appears in user code. */
1914 if (0)
1915 YYERROR;
1916 ++yynerrs;
1917
1918 /* Do not reclaim the symbols of the rule whose action triggered
1919 this YYERROR. */
1920 YYPOPSTACK (yylen);
1921 yylen = 0;
1922 YY_STACK_PRINT (yyss, yyssp);
1923 yystate = *yyssp;
1924 goto yyerrlab1;
1925
1926
1927 /*-------------------------------------------------------------.
1928 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1929 `-------------------------------------------------------------*/
1930 yyerrlab1:
1931 yyerrstatus = 3; /* Each real token shifted decrements this. */
1932
1933 /* Pop stack until we find a state that shifts the error token. */
1934 for (;;)
1935 {
1936 yyn = yypact[yystate];
1937 if (!yypact_value_is_default (yyn))
1938 {
1939 yyn += YYSYMBOL_YYerror;
1940 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1941 {
1942 yyn = yytable[yyn];
1943 if (0 < yyn)
1944 break;
1945 }
1946 }
1947
1948 /* Pop the current state because it cannot handle the error token. */
1949 if (yyssp == yyss)
1950 YYABORT;
1951
1952
1953 yydestruct ("Error: popping",
1954 YY_ACCESSING_SYMBOL (yystate), yyvsp, config_ast);
1955 YYPOPSTACK (1);
1956 yystate = *yyssp;
1957 YY_STACK_PRINT (yyss, yyssp);
1958 }
1959
1960 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1961 *++yyvsp = yylval;
1962 YY_IGNORE_MAYBE_UNINITIALIZED_END
1963
1964
1965 /* Shift the error token. */
1966 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1967
1968 yystate = yyn;
1969 goto yynewstate;
1970
1971
1972 /*-------------------------------------.
1973 | yyacceptlab -- YYACCEPT comes here. |
1974 `-------------------------------------*/
1975 yyacceptlab:
1976 yyresult = 0;
1977 goto yyreturnlab;
1978
1979
1980 /*-----------------------------------.
1981 | yyabortlab -- YYABORT comes here. |
1982 `-----------------------------------*/
1983 yyabortlab:
1984 yyresult = 1;
1985 goto yyreturnlab;
1986
1987
1988 /*-----------------------------------------------------------.
1989 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1990 `-----------------------------------------------------------*/
1991 yyexhaustedlab:
1992 yyerror (config_ast, YY_("memory exhausted"));
1993 yyresult = 2;
1994 goto yyreturnlab;
1995
1996
1997 /*----------------------------------------------------------.
1998 | yyreturnlab -- parsing is finished, clean up and return. |
1999 `----------------------------------------------------------*/
2000 yyreturnlab:
2001 if (yychar != YYEMPTY)
2002 {
2003 /* Make sure we have latest lookahead translation. See comments at
2004 user semantic actions for why this is necessary. */
2005 yytoken = YYTRANSLATE (yychar);
2006 yydestruct ("Cleanup: discarding lookahead",
2007 yytoken, &yylval, config_ast);
2008 }
2009 /* Do not reclaim the symbols of the rule whose action triggered
2010 this YYABORT or YYACCEPT. */
2011 YYPOPSTACK (yylen);
2012 YY_STACK_PRINT (yyss, yyssp);
2013 while (yyssp != yyss)
2014 {
2015 yydestruct ("Cleanup: popping",
2016 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, config_ast);
2017 YYPOPSTACK (1);
2018 }
2019 #ifndef yyoverflow
2020 if (yyss != yyssa)
2021 YYSTACK_FREE (yyss);
2022 #endif
2023 if (yymsg != yymsgbuf)
2024 YYSTACK_FREE (yymsg);
2025 return yyresult;
2026 }
2027
2028 #line 191 "src/conf_yacc.y"
2029
2030
2031 void conferror(
2032 ast** config_ast __attribute__((unused)),
2033 const char *msg){
2034 log_msg(LOG_LEVEL_ERROR, "%s:%d: %s (line: '%s')", conf_filename, conf_linenumber, msg, conf_linebuf);
2035 }