Debian Codegraph @

src/config_file_yacc.c

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