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