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