1 /* A Bison parser, made by GNU Bison 2.7. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2012 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 "2.7"
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 371 of yacc.c */
66 #line 17 "cfgram.y"
67
68 #include <rush.h>
69 #include <cf.h>
70 static int errors;
71 int re_flags = REG_EXTENDED;
72 static struct rush_rule *current_rule;
73 struct asgn {
74 struct asgn *next;
75 char *name;
76 char *value;
77 };
78 static void add_asgn_list(struct asgn *head, enum envar_type type);
79 static struct transform_node *new_set_node(enum transform_node_type type,
80 char *varname,
81 struct cfloc const *loc);
82
83 /* Line 371 of yacc.c */
84 #line 85 "cfgram.c"
85
86 # ifndef YY_NULL
87 # if defined __cplusplus && 201103L <= __cplusplus
88 # define YY_NULL nullptr
89 # else
90 # define YY_NULL 0
91 # endif
92 # endif
93
94 /* Enabling verbose error messages. */
95 #ifdef YYERROR_VERBOSE
96 # undef YYERROR_VERBOSE
97 # define YYERROR_VERBOSE 1
98 #else
99 # define YYERROR_VERBOSE 1
100 #endif
101
102 /* In a future release of Bison, this section will be replaced
103 by #include "y.tab.h". */
104 #ifndef YY_YY_CFGRAM_H_INCLUDED
105 # define YY_YY_CFGRAM_H_INCLUDED
106 /* Enabling traces. */
107 #ifndef YYDEBUG
108 # define YYDEBUG 1
109 #endif
110 #if YYDEBUG
111 extern int yydebug;
112 #endif
113
114 /* Tokens. */
115 #ifndef YYTOKENTYPE
116 # define YYTOKENTYPE
117 /* Put the tokens into the symbol table, so that GDB and other debuggers
118 know about them. */
119 enum yytokentype {
120 STRING = 258,
121 IDENT = 259,
122 NUMBER = 260,
123 RUSH = 261,
124 T_VERSION = 262,
125 RULE = 263,
126 GLOBAL = 264,
127 EOL = 265,
128 SET = 266,
129 INSERT = 267,
130 REMOPT = 268,
131 MAP = 269,
132 UNSET = 270,
133 MATCH = 271,
134 FALLTHROUGH = 272,
135 INCLUDE = 273,
136 LIMITS = 274,
137 CLRENV = 275,
138 SETENV = 276,
139 UNSETENV = 277,
140 KEEPENV = 278,
141 EVALENV = 279,
142 DELETE = 280,
143 EXIT = 281,
144 ATTRIB = 282,
145 GLATTRIB = 283,
146 BOGUS = 284,
147 OR = 285,
148 AND = 286,
149 NOT = 287,
150 EQ = 288,
151 NE = 289,
152 LT = 290,
153 LE = 291,
154 GT = 292,
155 GE = 293,
156 XF = 294,
157 NM = 295,
158 IN = 296,
159 GROUP = 297
160 };
161 #endif
162 /* Tokens. */
163 #define STRING 258
164 #define IDENT 259
165 #define NUMBER 260
166 #define RUSH 261
167 #define T_VERSION 262
168 #define RULE 263
169 #define GLOBAL 264
170 #define EOL 265
171 #define SET 266
172 #define INSERT 267
173 #define REMOPT 268
174 #define MAP 269
175 #define UNSET 270
176 #define MATCH 271
177 #define FALLTHROUGH 272
178 #define INCLUDE 273
179 #define LIMITS 274
180 #define CLRENV 275
181 #define SETENV 276
182 #define UNSETENV 277
183 #define KEEPENV 278
184 #define EVALENV 279
185 #define DELETE 280
186 #define EXIT 281
187 #define ATTRIB 282
188 #define GLATTRIB 283
189 #define BOGUS 284
190 #define OR 285
191 #define AND 286
192 #define NOT 287
193 #define EQ 288
194 #define NE 289
195 #define LT 290
196 #define LE 291
197 #define GT 292
198 #define GE 293
199 #define XF 294
200 #define NM 295
201 #define IN 296
202 #define GROUP 297
203
204
205
206 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
207 typedef union YYSTYPE
208 {
209 /* Line 387 of yacc.c */
210 #line 37 "cfgram.y"
211
212 char *str;
213 struct cfnumber num;
214 int intval;
215 regex_t regex;
216 struct rush_rule rule;
217 struct test_node *node;
218 struct strlist {
219 char **argv;
220 size_t argc;
221 } strlist;
222 struct {
223 int start;
224 int end;
225 } range;
226 struct asgn *asgn;
227 struct {
228 struct asgn *head;
229 struct asgn *tail;
230 } asgn_list;
231 struct limits_rec *lrec;
232 rule_attrib_setter_t attrib;
233 struct global_attrib *global_attrib;
234 struct argval *arg;
235 struct {
236 int argc;
237 struct argval *head;
238 struct argval *tail;
239 } arglist;
240 struct { unsigned major, minor; } version;
241
242
243 /* Line 387 of yacc.c */
244 #line 245 "cfgram.c"
245 } YYSTYPE;
246 # define YYSTYPE_IS_TRIVIAL 1
247 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
248 # define YYSTYPE_IS_DECLARED 1
249 #endif
250
251 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
252 typedef struct YYLTYPE
253 {
254 int first_line;
255 int first_column;
256 int last_line;
257 int last_column;
258 } YYLTYPE;
259 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
260 # define YYLTYPE_IS_DECLARED 1
261 # define YYLTYPE_IS_TRIVIAL 1
262 #endif
263
264 extern YYSTYPE yylval;
265 extern YYLTYPE yylloc;
266 #ifdef YYPARSE_PARAM
267 #if defined __STDC__ || defined __cplusplus
268 int yyparse (void *YYPARSE_PARAM);
269 #else
270 int yyparse ();
271 #endif
272 #else /* ! YYPARSE_PARAM */
273 #if defined __STDC__ || defined __cplusplus
274 int yyparse (void);
275 #else
276 int yyparse ();
277 #endif
278 #endif /* ! YYPARSE_PARAM */
279
280 #endif /* !YY_YY_CFGRAM_H_INCLUDED */
281
282 /* Copy the second part of user declarations. */
283
284 /* Line 390 of yacc.c */
285 #line 286 "cfgram.c"
286
287 #ifdef short
288 # undef short
289 #endif
290
291 #ifdef YYTYPE_UINT8
292 typedef YYTYPE_UINT8 yytype_uint8;
293 #else
294 typedef unsigned char yytype_uint8;
295 #endif
296
297 #ifdef YYTYPE_INT8
298 typedef YYTYPE_INT8 yytype_int8;
299 #elif (defined __STDC__ || defined __C99__FUNC__ \
300 || defined __cplusplus || defined _MSC_VER)
301 typedef signed char yytype_int8;
302 #else
303 typedef short int yytype_int8;
304 #endif
305
306 #ifdef YYTYPE_UINT16
307 typedef YYTYPE_UINT16 yytype_uint16;
308 #else
309 typedef unsigned short int yytype_uint16;
310 #endif
311
312 #ifdef YYTYPE_INT16
313 typedef YYTYPE_INT16 yytype_int16;
314 #else
315 typedef short int yytype_int16;
316 #endif
317
318 #ifndef YYSIZE_T
319 # ifdef __SIZE_TYPE__
320 # define YYSIZE_T __SIZE_TYPE__
321 # elif defined size_t
322 # define YYSIZE_T size_t
323 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
324 || defined __cplusplus || defined _MSC_VER)
325 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
326 # define YYSIZE_T size_t
327 # else
328 # define YYSIZE_T unsigned int
329 # endif
330 #endif
331
332 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
333
334 #ifndef YY_
335 # if defined YYENABLE_NLS && YYENABLE_NLS
336 # if ENABLE_NLS
337 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
338 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
339 # endif
340 # endif
341 # ifndef YY_
342 # define YY_(Msgid) Msgid
343 # endif
344 #endif
345
346 /* Suppress unused-variable warnings by "using" E. */
347 #if ! defined lint || defined __GNUC__
348 # define YYUSE(E) ((void) (E))
349 #else
350 # define YYUSE(E) /* empty */
351 #endif
352
353 /* Identity function, used to suppress warnings about constant conditions. */
354 #ifndef lint
355 # define YYID(N) (N)
356 #else
357 #if (defined __STDC__ || defined __C99__FUNC__ \
358 || defined __cplusplus || defined _MSC_VER)
359 static int
YYID(int yyi)360 YYID (int yyi)
361 #else
362 static int
363 YYID (yyi)
364 int yyi;
365 #endif
366 {
367 return yyi;
368 }
369 #endif
370
371 #if ! defined yyoverflow || YYERROR_VERBOSE
372
373 /* The parser invokes alloca or malloc; define the necessary symbols. */
374
375 # ifdef YYSTACK_USE_ALLOCA
376 # if YYSTACK_USE_ALLOCA
377 # ifdef __GNUC__
378 # define YYSTACK_ALLOC __builtin_alloca
379 # elif defined __BUILTIN_VA_ARG_INCR
380 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
381 # elif defined _AIX
382 # define YYSTACK_ALLOC __alloca
383 # elif defined _MSC_VER
384 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
385 # define alloca _alloca
386 # else
387 # define YYSTACK_ALLOC alloca
388 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
389 || defined __cplusplus || defined _MSC_VER)
390 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
391 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
392 # ifndef EXIT_SUCCESS
393 # define EXIT_SUCCESS 0
394 # endif
395 # endif
396 # endif
397 # endif
398 # endif
399
400 # ifdef YYSTACK_ALLOC
401 /* Pacify GCC's `empty if-body' warning. */
402 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
403 # ifndef YYSTACK_ALLOC_MAXIMUM
404 /* The OS might guarantee only one guard page at the bottom of the stack,
405 and a page size can be as small as 4096 bytes. So we cannot safely
406 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
407 to allow for a few compiler-allocated temporary stack slots. */
408 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
409 # endif
410 # else
411 # define YYSTACK_ALLOC YYMALLOC
412 # define YYSTACK_FREE YYFREE
413 # ifndef YYSTACK_ALLOC_MAXIMUM
414 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
415 # endif
416 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
417 && ! ((defined YYMALLOC || defined malloc) \
418 && (defined YYFREE || defined free)))
419 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
420 # ifndef EXIT_SUCCESS
421 # define EXIT_SUCCESS 0
422 # endif
423 # endif
424 # ifndef YYMALLOC
425 # define YYMALLOC malloc
426 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
427 || defined __cplusplus || defined _MSC_VER)
428 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
429 # endif
430 # endif
431 # ifndef YYFREE
432 # define YYFREE free
433 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
434 || defined __cplusplus || defined _MSC_VER)
435 void free (void *); /* INFRINGES ON USER NAME SPACE */
436 # endif
437 # endif
438 # endif
439 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
440
441
442 #if (! defined yyoverflow \
443 && (! defined __cplusplus \
444 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
445 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
446
447 /* A type that is properly aligned for any stack member. */
448 union yyalloc
449 {
450 yytype_int16 yyss_alloc;
451 YYSTYPE yyvs_alloc;
452 YYLTYPE yyls_alloc;
453 };
454
455 /* The size of the maximum gap between one aligned stack and the next. */
456 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
457
458 /* The size of an array large to enough to hold all stacks, each with
459 N elements. */
460 # define YYSTACK_BYTES(N) \
461 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
462 + 2 * YYSTACK_GAP_MAXIMUM)
463
464 # define YYCOPY_NEEDED 1
465
466 /* Relocate STACK from its old location to the new one. The
467 local variables YYSIZE and YYSTACKSIZE give the old and new number of
468 elements in the stack, and YYPTR gives the new location of the
469 stack. Advance YYPTR to a properly aligned location for the next
470 stack. */
471 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
472 do \
473 { \
474 YYSIZE_T yynewbytes; \
475 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
476 Stack = &yyptr->Stack_alloc; \
477 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
478 yyptr += yynewbytes / sizeof (*yyptr); \
479 } \
480 while (YYID (0))
481
482 #endif
483
484 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
485 /* Copy COUNT objects from SRC to DST. The source and destination do
486 not overlap. */
487 # ifndef YYCOPY
488 # if defined __GNUC__ && 1 < __GNUC__
489 # define YYCOPY(Dst, Src, Count) \
490 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
491 # else
492 # define YYCOPY(Dst, Src, Count) \
493 do \
494 { \
495 YYSIZE_T yyi; \
496 for (yyi = 0; yyi < (Count); yyi++) \
497 (Dst)[yyi] = (Src)[yyi]; \
498 } \
499 while (YYID (0))
500 # endif
501 # endif
502 #endif /* !YYCOPY_NEEDED */
503
504 /* YYFINAL -- State number of the termination state. */
505 #define YYFINAL 5
506 /* YYLAST -- Last index in YYTABLE. */
507 #define YYLAST 206
508
509 /* YYNTOKENS -- Number of terminals. */
510 #define YYNTOKENS 49
511 /* YYNNTS -- Number of nonterminals. */
512 #define YYNNTS 45
513 /* YYNRULES -- Number of rules. */
514 #define YYNRULES 108
515 /* YYNRULES -- Number of states. */
516 #define YYNSTATES 194
517
518 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
519 #define YYUNDEFTOK 2
520 #define YYMAXUTOK 297
521
522 #define YYTRANSLATE(YYX) \
523 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
524
525 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
526 static const yytype_uint8 yytranslate[] =
527 {
528 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 44, 45, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 46, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 47, 2, 48, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 43, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
554 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
555 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
556 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
557 35, 36, 37, 38, 39, 40, 41, 42
558 };
559
560 #if YYDEBUG
561 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
562 YYRHS. */
563 static const yytype_uint16 yyprhs[] =
564 {
565 0, 0, 3, 6, 10, 12, 16, 17, 19, 21,
566 24, 25, 27, 29, 32, 35, 38, 41, 43, 46,
567 50, 52, 55, 57, 59, 63, 64, 66, 68, 71,
568 74, 77, 80, 83, 86, 89, 92, 95, 98, 101,
569 103, 106, 108, 112, 116, 118, 121, 125, 129, 133,
570 137, 141, 145, 149, 153, 157, 161, 165, 169, 172,
571 175, 177, 179, 181, 183, 185, 187, 192, 197, 202,
572 209, 216, 221, 226, 233, 236, 239, 248, 257, 258,
573 260, 264, 266, 268, 272, 276, 277, 279, 282, 284,
574 287, 291, 294, 296, 299, 303, 304, 306, 308, 313,
575 316, 319, 322, 324, 327, 329, 333, 336, 337
576 };
577
578 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
579 static const yytype_int8 yyrhs[] =
580 {
581 50, 0, -1, 53, 51, -1, 52, 53, 55, -1,
582 29, -1, 6, 7, 10, -1, -1, 54, -1, 10,
583 -1, 54, 10, -1, -1, 56, -1, 57, -1, 56,
584 57, -1, 63, 65, -1, 58, 59, -1, 9, 54,
585 -1, 60, -1, 59, 60, -1, 28, 61, 54, -1,
586 62, -1, 61, 62, -1, 71, -1, 5, -1, 8,
587 64, 54, -1, -1, 72, -1, 66, -1, 65, 66,
588 -1, 67, 54, -1, 74, 54, -1, 75, 54, -1,
589 81, 54, -1, 84, 54, -1, 88, 54, -1, 79,
590 54, -1, 91, 54, -1, 86, 54, -1, 83, 53,
591 -1, 1, -1, 16, 68, -1, 69, -1, 68, 31,
592 69, -1, 68, 30, 69, -1, 70, -1, 32, 69,
593 -1, 44, 68, 45, -1, 72, 43, 73, -1, 72,
594 40, 73, -1, 72, 33, 71, -1, 72, 34, 71,
595 -1, 72, 33, 5, -1, 72, 34, 5, -1, 72,
596 35, 5, -1, 72, 36, 5, -1, 72, 37, 5,
597 -1, 72, 38, 5, -1, 72, 41, 92, -1, 42,
598 72, -1, 42, 92, -1, 4, -1, 3, -1, 4,
599 -1, 3, -1, 5, -1, 72, -1, 11, 77, 46,
600 78, -1, 12, 77, 46, 78, -1, 11, 77, 39,
601 78, -1, 11, 77, 46, 72, 43, 78, -1, 12,
602 77, 46, 72, 43, 78, -1, 11, 4, 46, 78,
603 -1, 11, 4, 39, 78, -1, 11, 4, 46, 72,
604 43, 78, -1, 15, 4, -1, 15, 77, -1, 14,
605 77, 78, 78, 78, 5, 5, 76, -1, 14, 4,
606 78, 78, 78, 5, 5, 76, -1, -1, 72, -1,
607 47, 5, 48, -1, 72, -1, 17, -1, 26, 80,
608 3, -1, 26, 80, 4, -1, -1, 5, -1, 25,
609 82, -1, 5, -1, 5, 5, -1, 18, 72, 10,
610 -1, 19, 85, -1, 4, -1, 85, 4, -1, 13,
611 72, 87, -1, -1, 72, -1, 20, -1, 21, 4,
612 46, 72, -1, 24, 72, -1, 22, 89, -1, 23,
613 89, -1, 90, -1, 89, 90, -1, 71, -1, 4,
614 46, 78, -1, 27, 72, -1, -1, 44, 93, 61,
615 45, -1
616 };
617
618 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
619 static const yytype_uint16 yyrline[] =
620 {
621 0, 130, 130, 133, 138, 145, 156, 157, 160, 161,
622 164, 165, 168, 169, 172, 173, 176, 179, 180, 183,
623 193, 198, 206, 214, 225, 235, 238, 241, 242, 245,
624 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
625 268, 280, 281, 287, 295, 296, 301, 307, 314, 324,
626 331, 338, 345, 352, 359, 366, 373, 380, 387, 394,
627 401, 402, 405, 406, 407, 413, 428, 439, 450, 462,
628 474, 486, 495, 506, 517, 525, 542, 560, 579, 582,
629 585, 592, 598, 602, 607, 620, 623, 633, 650, 655,
630 670, 681, 687, 707, 732, 770, 773, 779, 783, 792,
631 800, 804, 810, 814, 821, 828, 840, 847, 847
632 };
633 #endif
634
635 #if YYDEBUG || YYERROR_VERBOSE || 1
636 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
637 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
638 static const char *const yytname[] =
639 {
640 "$end", "error", "$undefined", "\"string\"", "\"identifier\"",
641 "\"number\"", "\"rush\"", "T_VERSION", "\"rule\"", "\"global\"",
642 "\"end of line\"", "\"set\"", "\"insert\"", "\"remopt\"", "\"map\"",
643 "\"unset\"", "\"match\"", "\"fallthrough\"", "\"include\"", "\"limits\"",
644 "\"clrenv\"", "\"setenv\"", "\"unsetenv\"", "\"keepenv\"", "\"evalenv\"",
645 "\"delete\"", "\"exit\"", "\"rule attribute\"", "\"global attribute\"",
646 "\"erroneous token\"", "\"||\"", "\"&&\"", "\"!\"", "\"==\"", "\"!=\"",
647 "\"<\"", "\"<=\"", "\">\"", "\">=\"", "\"=~\"", "\"!~\"", "\"in\"",
648 "\"group\"", "'~'", "'('", "')'", "'='", "'['", "']'", "$accept",
649 "rcfile", "select", "preface", "skipeol", "eol", "content", "rulelist",
650 "rule", "globhdr", "globbody", "glob_stmt", "arglist", "arg", "rulehdr",
651 "ruleid", "rulebody", "stmt", "match_stmt", "compound_cond",
652 "simple_cond", "expr", "literal", "string", "regex", "set_stmt",
653 "map_stmt", "defval", "index", "value", "flowctl_stmt", "fdescr",
654 "delete_stmt", "range", "include_stmt", "limits_stmt", "resource_limits",
655 "remopt_stmt", "optstring", "environ_stmt", "asgn_list", "asgn",
656 "attrib_stmt", "strlist", "$@1", YY_NULL
657 };
658 #endif
659
660 # ifdef YYPRINT
661 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
662 token YYLEX-NUM. */
663 static const yytype_uint16 yytoknum[] =
664 {
665 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
666 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
667 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
668 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
669 295, 296, 297, 126, 40, 41, 61, 91, 93
670 };
671 # endif
672
673 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
674 static const yytype_uint8 yyr1[] =
675 {
676 0, 49, 50, 51, 51, 52, 53, 53, 54, 54,
677 55, 55, 56, 56, 57, 57, 58, 59, 59, 60,
678 61, 61, 62, 62, 63, 64, 64, 65, 65, 66,
679 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
680 67, 68, 68, 68, 69, 69, 69, 70, 70, 70,
681 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
682 71, 71, 72, 72, 72, 73, 74, 74, 74, 74,
683 74, 74, 74, 74, 74, 74, 75, 75, 76, 76,
684 77, 78, 79, 79, 79, 80, 80, 81, 82, 82,
685 83, 84, 85, 85, 86, 87, 87, 88, 88, 88,
686 88, 88, 89, 89, 90, 90, 91, 93, 92
687 };
688
689 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
690 static const yytype_uint8 yyr2[] =
691 {
692 0, 2, 2, 3, 1, 3, 0, 1, 1, 2,
693 0, 1, 1, 2, 2, 2, 2, 1, 2, 3,
694 1, 2, 1, 1, 3, 0, 1, 1, 2, 2,
695 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
696 2, 1, 3, 3, 1, 2, 3, 3, 3, 3,
697 3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
698 1, 1, 1, 1, 1, 1, 4, 4, 4, 6,
699 6, 4, 4, 6, 2, 2, 8, 8, 0, 1,
700 3, 1, 1, 3, 3, 0, 1, 2, 1, 2,
701 3, 2, 1, 2, 3, 0, 1, 1, 4, 2,
702 2, 2, 1, 2, 1, 3, 2, 0, 4
703 };
704
705 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
706 Performed when YYTABLE doesn't specify something else to do. Zero
707 means the default is an error. */
708 static const yytype_uint8 yydefact[] =
709 {
710 6, 8, 0, 0, 7, 1, 0, 4, 2, 6,
711 9, 0, 10, 5, 25, 0, 3, 11, 12, 0,
712 0, 63, 62, 64, 0, 26, 16, 13, 0, 15,
713 17, 39, 0, 0, 0, 0, 0, 0, 82, 0,
714 0, 97, 0, 0, 0, 0, 0, 85, 0, 0,
715 27, 0, 0, 0, 0, 0, 6, 0, 0, 0,
716 0, 24, 61, 60, 23, 0, 20, 22, 18, 0,
717 0, 0, 0, 95, 0, 0, 74, 75, 0, 0,
718 0, 40, 41, 44, 0, 0, 92, 91, 0, 60,
719 104, 100, 102, 101, 99, 88, 87, 86, 0, 106,
720 28, 29, 30, 31, 35, 32, 38, 33, 37, 34,
721 36, 19, 21, 0, 0, 0, 0, 0, 0, 96,
722 94, 81, 0, 0, 45, 107, 58, 59, 0, 0,
723 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
724 90, 93, 0, 0, 103, 89, 83, 84, 72, 81,
725 71, 80, 68, 81, 66, 81, 67, 0, 0, 0,
726 46, 43, 42, 51, 49, 52, 50, 53, 54, 55,
727 56, 65, 48, 57, 47, 98, 105, 0, 0, 0,
728 0, 0, 0, 73, 69, 70, 0, 0, 108, 78,
729 78, 79, 77, 76
730 };
731
732 /* YYDEFGOTO[NTERM-NUM]. */
733 static const yytype_int16 yydefgoto[] =
734 {
735 -1, 2, 8, 9, 3, 4, 16, 17, 18, 19,
736 29, 30, 65, 66, 20, 24, 49, 50, 51, 81,
737 82, 83, 67, 121, 172, 52, 53, 192, 71, 122,
738 54, 98, 55, 96, 56, 57, 87, 58, 120, 59,
739 91, 92, 60, 127, 159
740 };
741
742 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
743 STATE-NUM. */
744 #define YYPACT_NINF -73
745 static const yytype_int16 yypact[] =
746 {
747 1, -73, 27, 10, 22, -73, 17, -73, -73, 1,
748 -73, 30, 64, -73, 105, 1, -73, 64, -73, 15,
749 166, -73, -73, -73, 1, -73, 22, -73, 108, 15,
750 -73, -73, 6, 21, 105, 8, 9, 25, -73, 105,
751 58, -73, 75, 11, 11, 105, 79, 82, 105, 121,
752 -73, 1, 1, 1, 1, 1, 1, 1, 1, 1,
753 1, 22, -73, -73, -73, 86, -73, -73, -73, -13,
754 89, 24, 53, 105, 105, 105, -73, -73, 25, 14,
755 25, 71, -73, -73, 116, 104, -73, 113, 73, 74,
756 -73, 11, -73, 11, -73, 119, -73, -73, 123, -73,
757 -73, 22, 22, 22, 22, 22, -73, 22, 22, 22,
758 22, 22, -73, 105, 105, 83, 105, 105, 105, -73,
759 -73, -73, 105, 105, -73, -73, -73, -73, -9, 25,
760 25, 157, 160, 150, 153, 161, 163, 105, 125, 105,
761 -73, -73, 105, 105, -73, -73, -73, -73, -73, 127,
762 -73, -73, -73, 128, -73, 129, -73, 105, 105, 108,
763 -73, -73, -73, -73, -73, -73, -73, -73, -73, -73,
764 -73, -73, -73, -73, -73, -73, -73, 105, 105, 105,
765 168, 169, 3, -73, -73, -73, 189, 190, -73, 105,
766 105, -73, -73, -73
767 };
768
769 /* YYPGOTO[NTERM-NUM]. */
770 static const yytype_int16 yypgoto[] =
771 {
772 -73, -73, -73, -73, -7, 23, -73, -73, 179, -73,
773 -73, 170, 38, -64, -73, -73, -73, 149, -73, 120,
774 -69, -73, -39, -14, 63, -73, -73, 13, 62, -72,
775 -73, -73, -73, -73, -73, -73, -73, -73, -73, -73,
776 162, -56, -73, 66, -73
777 };
778
779 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
780 positive, shift that token. If negative, reduce the rule which
781 number is the opposite. If YYTABLE_NINF, syntax error. */
782 #define YYTABLE_NINF -15
783 static const yytype_int16 yytable[] =
784 {
785 25, 112, 12, 123, 90, 90, 62, 63, 64, 124,
786 69, 1, 74, 76, 62, 89, 6, 21, 22, 23,
787 73, 129, 130, 84, 11, 85, 113, 5, 21, 22,
788 23, 94, 10, 114, 99, 144, 160, 144, 26, 7,
789 13, 148, 150, 28, 152, 154, 156, 61, 188, 106,
790 157, 158, 90, 70, 90, 70, 70, 78, 125, 119,
791 161, 162, 86, 116, 84, 126, 84, 79, 70, 80,
792 117, 176, 14, 15, 101, 102, 103, 104, 105, 88,
793 107, 108, 109, 110, 95, 180, 181, 97, 111, 62,
794 63, 64, 164, 166, 115, 72, 1, 75, 77, 118,
795 149, 129, 130, 153, 155, 183, 184, 185, 21, 22,
796 23, 62, 63, 64, 140, 84, 84, 141, 112, 142,
797 143, -14, 31, 171, 145, 171, 146, 147, 175, -14,
798 -14, 151, 32, 33, 34, 35, 36, 37, 38, 39,
799 40, 41, 42, 43, 44, 45, 46, 47, 48, 131,
800 132, 133, 134, 135, 136, 167, 137, 138, 168, 139,
801 62, 63, 163, 62, 63, 165, 169, 31, 170, 125,
802 177, 178, 179, 186, 187, 191, 191, 32, 33, 34,
803 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
804 45, 46, 47, 48, 189, 190, 27, 182, 100, 68,
805 128, 0, 174, 193, 173, 0, 93
806 };
807
808 #define yypact_value_is_default(Yystate) \
809 (!!((Yystate) == (-73)))
810
811 #define yytable_value_is_error(Yytable_value) \
812 YYID (0)
813
814 static const yytype_int16 yycheck[] =
815 {
816 14, 65, 9, 75, 43, 44, 3, 4, 5, 78,
817 4, 10, 4, 4, 3, 4, 6, 3, 4, 5,
818 34, 30, 31, 37, 7, 39, 39, 0, 3, 4,
819 5, 45, 10, 46, 48, 91, 45, 93, 15, 29,
820 10, 113, 114, 28, 116, 117, 118, 24, 45, 56,
821 122, 123, 91, 47, 93, 47, 47, 32, 44, 73,
822 129, 130, 4, 39, 78, 79, 80, 42, 47, 44,
823 46, 143, 8, 9, 51, 52, 53, 54, 55, 4,
824 57, 58, 59, 60, 5, 157, 158, 5, 65, 3,
825 4, 5, 131, 132, 5, 33, 10, 35, 36, 46,
826 114, 30, 31, 117, 118, 177, 178, 179, 3, 4,
827 5, 3, 4, 5, 10, 129, 130, 4, 182, 46,
828 46, 0, 1, 137, 5, 139, 3, 4, 142, 8,
829 9, 48, 11, 12, 13, 14, 15, 16, 17, 18,
830 19, 20, 21, 22, 23, 24, 25, 26, 27, 33,
831 34, 35, 36, 37, 38, 5, 40, 41, 5, 43,
832 3, 4, 5, 3, 4, 5, 5, 1, 5, 44,
833 43, 43, 43, 5, 5, 189, 190, 11, 12, 13,
834 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
835 24, 25, 26, 27, 5, 5, 17, 159, 49, 29,
836 80, -1, 139, 190, 138, -1, 44
837 };
838
839 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
840 symbol of state STATE-NUM. */
841 static const yytype_uint8 yystos[] =
842 {
843 0, 10, 50, 53, 54, 0, 6, 29, 51, 52,
844 10, 7, 53, 10, 8, 9, 55, 56, 57, 58,
845 63, 3, 4, 5, 64, 72, 54, 57, 28, 59,
846 60, 1, 11, 12, 13, 14, 15, 16, 17, 18,
847 19, 20, 21, 22, 23, 24, 25, 26, 27, 65,
848 66, 67, 74, 75, 79, 81, 83, 84, 86, 88,
849 91, 54, 3, 4, 5, 61, 62, 71, 60, 4,
850 47, 77, 77, 72, 4, 77, 4, 77, 32, 42,
851 44, 68, 69, 70, 72, 72, 4, 85, 4, 4,
852 71, 89, 90, 89, 72, 5, 82, 5, 80, 72,
853 66, 54, 54, 54, 54, 54, 53, 54, 54, 54,
854 54, 54, 62, 39, 46, 5, 39, 46, 46, 72,
855 87, 72, 78, 78, 69, 44, 72, 92, 68, 30,
856 31, 33, 34, 35, 36, 37, 38, 40, 41, 43,
857 10, 4, 46, 46, 90, 5, 3, 4, 78, 72,
858 78, 48, 78, 72, 78, 72, 78, 78, 78, 93,
859 45, 69, 69, 5, 71, 5, 71, 5, 5, 5,
860 5, 72, 73, 92, 73, 72, 78, 43, 43, 43,
861 78, 78, 61, 78, 78, 78, 5, 5, 45, 5,
862 5, 72, 76, 76
863 };
864
865 #define yyerrok (yyerrstatus = 0)
866 #define yyclearin (yychar = YYEMPTY)
867 #define YYEMPTY (-2)
868 #define YYEOF 0
869
870 #define YYACCEPT goto yyacceptlab
871 #define YYABORT goto yyabortlab
872 #define YYERROR goto yyerrorlab
873
874
875 /* Like YYERROR except do call yyerror. This remains here temporarily
876 to ease the transition to the new meaning of YYERROR, for GCC.
877 Once GCC version 2 has supplanted version 1, this can go. However,
878 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
879 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
880 discussed. */
881
882 #define YYFAIL goto yyerrlab
883 #if defined YYFAIL
884 /* This is here to suppress warnings from the GCC cpp's
885 -Wunused-macros. Normally we don't worry about that warning, but
886 some users do, and we want to make it easy for users to remove
887 YYFAIL uses, which will produce warnings from Bison 2.5. */
888 #endif
889
890 #define YYRECOVERING() (!!yyerrstatus)
891
892 #define YYBACKUP(Token, Value) \
893 do \
894 if (yychar == YYEMPTY) \
895 { \
896 yychar = (Token); \
897 yylval = (Value); \
898 YYPOPSTACK (yylen); \
899 yystate = *yyssp; \
900 goto yybackup; \
901 } \
902 else \
903 { \
904 yyerror (YY_("syntax error: cannot back up")); \
905 YYERROR; \
906 } \
907 while (YYID (0))
908
909 /* Error token number */
910 #define YYTERROR 1
911 #define YYERRCODE 256
912
913
914 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
915 If N is 0, then set CURRENT to the empty location which ends
916 the previous symbol: RHS[0] (always defined). */
917
918 #ifndef YYLLOC_DEFAULT
919 # define YYLLOC_DEFAULT(Current, Rhs, N) \
920 do \
921 if (YYID (N)) \
922 { \
923 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
924 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
925 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
926 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
927 } \
928 else \
929 { \
930 (Current).first_line = (Current).last_line = \
931 YYRHSLOC (Rhs, 0).last_line; \
932 (Current).first_column = (Current).last_column = \
933 YYRHSLOC (Rhs, 0).last_column; \
934 } \
935 while (YYID (0))
936 #endif
937
938 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
939
940
941 /* YY_LOCATION_PRINT -- Print the location on the stream.
942 This macro was not mandated originally: define only if we know
943 we won't break user code: when these are the locations we know. */
944
945 #ifndef YY_LOCATION_PRINT
946 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
947
948 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
949
950 __attribute__((__unused__))
951 #if (defined __STDC__ || defined __C99__FUNC__ \
952 || defined __cplusplus || defined _MSC_VER)
953 static unsigned
yy_location_print_(FILE * yyo,YYLTYPE const * const yylocp)954 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
955 #else
956 static unsigned
957 yy_location_print_ (yyo, yylocp)
958 FILE *yyo;
959 YYLTYPE const * const yylocp;
960 #endif
961 {
962 unsigned res = 0;
963 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
964 if (0 <= yylocp->first_line)
965 {
966 res += fprintf (yyo, "%d", yylocp->first_line);
967 if (0 <= yylocp->first_column)
968 res += fprintf (yyo, ".%d", yylocp->first_column);
969 }
970 if (0 <= yylocp->last_line)
971 {
972 if (yylocp->first_line < yylocp->last_line)
973 {
974 res += fprintf (yyo, "-%d", yylocp->last_line);
975 if (0 <= end_col)
976 res += fprintf (yyo, ".%d", end_col);
977 }
978 else if (0 <= end_col && yylocp->first_column < end_col)
979 res += fprintf (yyo, "-%d", end_col);
980 }
981 return res;
982 }
983
984 # define YY_LOCATION_PRINT(File, Loc) \
985 yy_location_print_ (File, &(Loc))
986
987 # else
988 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
989 # endif
990 #endif
991
992
993 /* YYLEX -- calling `yylex' with the right arguments. */
994 #ifdef YYLEX_PARAM
995 # define YYLEX yylex (YYLEX_PARAM)
996 #else
997 # define YYLEX yylex ()
998 #endif
999
1000 /* Enable debugging if requested. */
1001 #if YYDEBUG
1002
1003 # ifndef YYFPRINTF
1004 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1005 # define YYFPRINTF fprintf
1006 # endif
1007
1008 # define YYDPRINTF(Args) \
1009 do { \
1010 if (yydebug) \
1011 YYFPRINTF Args; \
1012 } while (YYID (0))
1013
1014 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1015 do { \
1016 if (yydebug) \
1017 { \
1018 YYFPRINTF (stderr, "%s ", Title); \
1019 yy_symbol_print (stderr, \
1020 Type, Value, Location); \
1021 YYFPRINTF (stderr, "\n"); \
1022 } \
1023 } while (YYID (0))
1024
1025
1026 /*--------------------------------.
1027 | Print this symbol on YYOUTPUT. |
1028 `--------------------------------*/
1029
1030 /*ARGSUSED*/
1031 #if (defined __STDC__ || defined __C99__FUNC__ \
1032 || defined __cplusplus || defined _MSC_VER)
1033 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,YYLTYPE const * const yylocationp)1034 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1035 #else
1036 static void
1037 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
1038 FILE *yyoutput;
1039 int yytype;
1040 YYSTYPE const * const yyvaluep;
1041 YYLTYPE const * const yylocationp;
1042 #endif
1043 {
1044 FILE *yyo = yyoutput;
1045 YYUSE (yyo);
1046 if (!yyvaluep)
1047 return;
1048 YYUSE (yylocationp);
1049 # ifdef YYPRINT
1050 if (yytype < YYNTOKENS)
1051 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1052 # else
1053 YYUSE (yyoutput);
1054 # endif
1055 switch (yytype)
1056 {
1057 default:
1058 break;
1059 }
1060 }
1061
1062
1063 /*--------------------------------.
1064 | Print this symbol on YYOUTPUT. |
1065 `--------------------------------*/
1066
1067 #if (defined __STDC__ || defined __C99__FUNC__ \
1068 || defined __cplusplus || defined _MSC_VER)
1069 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,YYLTYPE const * const yylocationp)1070 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1071 #else
1072 static void
1073 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
1074 FILE *yyoutput;
1075 int yytype;
1076 YYSTYPE const * const yyvaluep;
1077 YYLTYPE const * const yylocationp;
1078 #endif
1079 {
1080 if (yytype < YYNTOKENS)
1081 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1082 else
1083 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1084
1085 YY_LOCATION_PRINT (yyoutput, *yylocationp);
1086 YYFPRINTF (yyoutput, ": ");
1087 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
1088 YYFPRINTF (yyoutput, ")");
1089 }
1090
1091 /*------------------------------------------------------------------.
1092 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1093 | TOP (included). |
1094 `------------------------------------------------------------------*/
1095
1096 #if (defined __STDC__ || defined __C99__FUNC__ \
1097 || defined __cplusplus || defined _MSC_VER)
1098 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)1099 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1100 #else
1101 static void
1102 yy_stack_print (yybottom, yytop)
1103 yytype_int16 *yybottom;
1104 yytype_int16 *yytop;
1105 #endif
1106 {
1107 YYFPRINTF (stderr, "Stack now");
1108 for (; yybottom <= yytop; yybottom++)
1109 {
1110 int yybot = *yybottom;
1111 YYFPRINTF (stderr, " %d", yybot);
1112 }
1113 YYFPRINTF (stderr, "\n");
1114 }
1115
1116 # define YY_STACK_PRINT(Bottom, Top) \
1117 do { \
1118 if (yydebug) \
1119 yy_stack_print ((Bottom), (Top)); \
1120 } while (YYID (0))
1121
1122
1123 /*------------------------------------------------.
1124 | Report that the YYRULE is going to be reduced. |
1125 `------------------------------------------------*/
1126
1127 #if (defined __STDC__ || defined __C99__FUNC__ \
1128 || defined __cplusplus || defined _MSC_VER)
1129 static void
yy_reduce_print(YYSTYPE * yyvsp,YYLTYPE * yylsp,int yyrule)1130 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1131 #else
1132 static void
1133 yy_reduce_print (yyvsp, yylsp, yyrule)
1134 YYSTYPE *yyvsp;
1135 YYLTYPE *yylsp;
1136 int yyrule;
1137 #endif
1138 {
1139 int yynrhs = yyr2[yyrule];
1140 int yyi;
1141 unsigned long int yylno = yyrline[yyrule];
1142 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1143 yyrule - 1, yylno);
1144 /* The symbols being reduced. */
1145 for (yyi = 0; yyi < yynrhs; yyi++)
1146 {
1147 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1148 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1149 &(yyvsp[(yyi + 1) - (yynrhs)])
1150 , &(yylsp[(yyi + 1) - (yynrhs)]) );
1151 YYFPRINTF (stderr, "\n");
1152 }
1153 }
1154
1155 # define YY_REDUCE_PRINT(Rule) \
1156 do { \
1157 if (yydebug) \
1158 yy_reduce_print (yyvsp, yylsp, Rule); \
1159 } while (YYID (0))
1160
1161 /* Nonzero means print parse trace. It is left uninitialized so that
1162 multiple parsers can coexist. */
1163 int yydebug;
1164 #else /* !YYDEBUG */
1165 # define YYDPRINTF(Args)
1166 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1167 # define YY_STACK_PRINT(Bottom, Top)
1168 # define YY_REDUCE_PRINT(Rule)
1169 #endif /* !YYDEBUG */
1170
1171
1172 /* YYINITDEPTH -- initial size of the parser's stacks. */
1173 #ifndef YYINITDEPTH
1174 # define YYINITDEPTH 200
1175 #endif
1176
1177 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1178 if the built-in stack extension method is used).
1179
1180 Do not make this value too large; the results are undefined if
1181 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1182 evaluated with infinite-precision integer arithmetic. */
1183
1184 #ifndef YYMAXDEPTH
1185 # define YYMAXDEPTH 10000
1186 #endif
1187
1188
1189 #if YYERROR_VERBOSE
1190
1191 # ifndef yystrlen
1192 # if defined __GLIBC__ && defined _STRING_H
1193 # define yystrlen strlen
1194 # else
1195 /* Return the length of YYSTR. */
1196 #if (defined __STDC__ || defined __C99__FUNC__ \
1197 || defined __cplusplus || defined _MSC_VER)
1198 static YYSIZE_T
yystrlen(const char * yystr)1199 yystrlen (const char *yystr)
1200 #else
1201 static YYSIZE_T
1202 yystrlen (yystr)
1203 const char *yystr;
1204 #endif
1205 {
1206 YYSIZE_T yylen;
1207 for (yylen = 0; yystr[yylen]; yylen++)
1208 continue;
1209 return yylen;
1210 }
1211 # endif
1212 # endif
1213
1214 # ifndef yystpcpy
1215 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1216 # define yystpcpy stpcpy
1217 # else
1218 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1219 YYDEST. */
1220 #if (defined __STDC__ || defined __C99__FUNC__ \
1221 || defined __cplusplus || defined _MSC_VER)
1222 static char *
yystpcpy(char * yydest,const char * yysrc)1223 yystpcpy (char *yydest, const char *yysrc)
1224 #else
1225 static char *
1226 yystpcpy (yydest, yysrc)
1227 char *yydest;
1228 const char *yysrc;
1229 #endif
1230 {
1231 char *yyd = yydest;
1232 const char *yys = yysrc;
1233
1234 while ((*yyd++ = *yys++) != '\0')
1235 continue;
1236
1237 return yyd - 1;
1238 }
1239 # endif
1240 # endif
1241
1242 # ifndef yytnamerr
1243 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1244 quotes and backslashes, so that it's suitable for yyerror. The
1245 heuristic is that double-quoting is unnecessary unless the string
1246 contains an apostrophe, a comma, or backslash (other than
1247 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1248 null, do not copy; instead, return the length of what the result
1249 would have been. */
1250 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1251 yytnamerr (char *yyres, const char *yystr)
1252 {
1253 if (*yystr == '"')
1254 {
1255 YYSIZE_T yyn = 0;
1256 char const *yyp = yystr;
1257
1258 for (;;)
1259 switch (*++yyp)
1260 {
1261 case '\'':
1262 case ',':
1263 goto do_not_strip_quotes;
1264
1265 case '\\':
1266 if (*++yyp != '\\')
1267 goto do_not_strip_quotes;
1268 /* Fall through. */
1269 default:
1270 if (yyres)
1271 yyres[yyn] = *yyp;
1272 yyn++;
1273 break;
1274
1275 case '"':
1276 if (yyres)
1277 yyres[yyn] = '\0';
1278 return yyn;
1279 }
1280 do_not_strip_quotes: ;
1281 }
1282
1283 if (! yyres)
1284 return yystrlen (yystr);
1285
1286 return yystpcpy (yyres, yystr) - yyres;
1287 }
1288 # endif
1289
1290 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1291 about the unexpected token YYTOKEN for the state stack whose top is
1292 YYSSP.
1293
1294 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1295 not large enough to hold the message. In that case, also set
1296 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1297 required number of bytes is too large to store. */
1298 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1299 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1300 yytype_int16 *yyssp, int yytoken)
1301 {
1302 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1303 YYSIZE_T yysize = yysize0;
1304 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1305 /* Internationalized format string. */
1306 const char *yyformat = YY_NULL;
1307 /* Arguments of yyformat. */
1308 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1309 /* Number of reported tokens (one for the "unexpected", one per
1310 "expected"). */
1311 int yycount = 0;
1312
1313 /* There are many possibilities here to consider:
1314 - Assume YYFAIL is not used. It's too flawed to consider. See
1315 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1316 for details. YYERROR is fine as it does not invoke this
1317 function.
1318 - If this state is a consistent state with a default action, then
1319 the only way this function was invoked is if the default action
1320 is an error action. In that case, don't check for expected
1321 tokens because there are none.
1322 - The only way there can be no lookahead present (in yychar) is if
1323 this state is a consistent state with a default action. Thus,
1324 detecting the absence of a lookahead is sufficient to determine
1325 that there is no unexpected or expected token to report. In that
1326 case, just report a simple "syntax error".
1327 - Don't assume there isn't a lookahead just because this state is a
1328 consistent state with a default action. There might have been a
1329 previous inconsistent state, consistent state with a non-default
1330 action, or user semantic action that manipulated yychar.
1331 - Of course, the expected token list depends on states to have
1332 correct lookahead information, and it depends on the parser not
1333 to perform extra reductions after fetching a lookahead from the
1334 scanner and before detecting a syntax error. Thus, state merging
1335 (from LALR or IELR) and default reductions corrupt the expected
1336 token list. However, the list is correct for canonical LR with
1337 one exception: it will still contain any token that will not be
1338 accepted due to an error action in a later state.
1339 */
1340 if (yytoken != YYEMPTY)
1341 {
1342 int yyn = yypact[*yyssp];
1343 yyarg[yycount++] = yytname[yytoken];
1344 if (!yypact_value_is_default (yyn))
1345 {
1346 /* Start YYX at -YYN if negative to avoid negative indexes in
1347 YYCHECK. In other words, skip the first -YYN actions for
1348 this state because they are default actions. */
1349 int yyxbegin = yyn < 0 ? -yyn : 0;
1350 /* Stay within bounds of both yycheck and yytname. */
1351 int yychecklim = YYLAST - yyn + 1;
1352 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1353 int yyx;
1354
1355 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1356 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1357 && !yytable_value_is_error (yytable[yyx + yyn]))
1358 {
1359 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1360 {
1361 yycount = 1;
1362 yysize = yysize0;
1363 break;
1364 }
1365 yyarg[yycount++] = yytname[yyx];
1366 {
1367 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1368 if (! (yysize <= yysize1
1369 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1370 return 2;
1371 yysize = yysize1;
1372 }
1373 }
1374 }
1375 }
1376
1377 switch (yycount)
1378 {
1379 # define YYCASE_(N, S) \
1380 case N: \
1381 yyformat = S; \
1382 break
1383 YYCASE_(0, YY_("syntax error"));
1384 YYCASE_(1, YY_("syntax error, unexpected %s"));
1385 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1386 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1387 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1388 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1389 # undef YYCASE_
1390 }
1391
1392 {
1393 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1394 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1395 return 2;
1396 yysize = yysize1;
1397 }
1398
1399 if (*yymsg_alloc < yysize)
1400 {
1401 *yymsg_alloc = 2 * yysize;
1402 if (! (yysize <= *yymsg_alloc
1403 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1404 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1405 return 1;
1406 }
1407
1408 /* Avoid sprintf, as that infringes on the user's name space.
1409 Don't have undefined behavior even if the translation
1410 produced a string with the wrong number of "%s"s. */
1411 {
1412 char *yyp = *yymsg;
1413 int yyi = 0;
1414 while ((*yyp = *yyformat) != '\0')
1415 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1416 {
1417 yyp += yytnamerr (yyp, yyarg[yyi++]);
1418 yyformat += 2;
1419 }
1420 else
1421 {
1422 yyp++;
1423 yyformat++;
1424 }
1425 }
1426 return 0;
1427 }
1428 #endif /* YYERROR_VERBOSE */
1429
1430 /*-----------------------------------------------.
1431 | Release the memory associated to this symbol. |
1432 `-----------------------------------------------*/
1433
1434 /*ARGSUSED*/
1435 #if (defined __STDC__ || defined __C99__FUNC__ \
1436 || defined __cplusplus || defined _MSC_VER)
1437 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,YYLTYPE * yylocationp)1438 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1439 #else
1440 static void
1441 yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1442 const char *yymsg;
1443 int yytype;
1444 YYSTYPE *yyvaluep;
1445 YYLTYPE *yylocationp;
1446 #endif
1447 {
1448 YYUSE (yyvaluep);
1449 YYUSE (yylocationp);
1450
1451 if (!yymsg)
1452 yymsg = "Deleting";
1453 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1454
1455 switch (yytype)
1456 {
1457
1458 default:
1459 break;
1460 }
1461 }
1462
1463
1464
1465
1466 /* The lookahead symbol. */
1467 int yychar;
1468
1469
1470 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1471 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1472 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1473 #endif
1474 #ifndef YY_INITIAL_VALUE
1475 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1476 #endif
1477
1478 /* The semantic value of the lookahead symbol. */
1479 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1480
1481 /* Location data for the lookahead symbol. */
1482 YYLTYPE yylloc
1483 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1484 = { 1, 1, 1, 1 }
1485 # endif
1486 ;
1487
1488
1489 /* Number of syntax errors so far. */
1490 int yynerrs;
1491
1492
1493 /*----------.
1494 | yyparse. |
1495 `----------*/
1496
1497 #ifdef YYPARSE_PARAM
1498 #if (defined __STDC__ || defined __C99__FUNC__ \
1499 || defined __cplusplus || defined _MSC_VER)
1500 int
yyparse(void * YYPARSE_PARAM)1501 yyparse (void *YYPARSE_PARAM)
1502 #else
1503 int
1504 yyparse (YYPARSE_PARAM)
1505 void *YYPARSE_PARAM;
1506 #endif
1507 #else /* ! YYPARSE_PARAM */
1508 #if (defined __STDC__ || defined __C99__FUNC__ \
1509 || defined __cplusplus || defined _MSC_VER)
1510 int
1511 yyparse (void)
1512 #else
1513 int
1514 yyparse ()
1515
1516 #endif
1517 #endif
1518 {
1519 int yystate;
1520 /* Number of tokens to shift before error messages enabled. */
1521 int yyerrstatus;
1522
1523 /* The stacks and their tools:
1524 `yyss': related to states.
1525 `yyvs': related to semantic values.
1526 `yyls': related to locations.
1527
1528 Refer to the stacks through separate pointers, to allow yyoverflow
1529 to reallocate them elsewhere. */
1530
1531 /* The state stack. */
1532 yytype_int16 yyssa[YYINITDEPTH];
1533 yytype_int16 *yyss;
1534 yytype_int16 *yyssp;
1535
1536 /* The semantic value stack. */
1537 YYSTYPE yyvsa[YYINITDEPTH];
1538 YYSTYPE *yyvs;
1539 YYSTYPE *yyvsp;
1540
1541 /* The location stack. */
1542 YYLTYPE yylsa[YYINITDEPTH];
1543 YYLTYPE *yyls;
1544 YYLTYPE *yylsp;
1545
1546 /* The locations where the error started and ended. */
1547 YYLTYPE yyerror_range[3];
1548
1549 YYSIZE_T yystacksize;
1550
1551 int yyn;
1552 int yyresult;
1553 /* Lookahead token as an internal (translated) token number. */
1554 int yytoken = 0;
1555 /* The variables used to return semantic value and location from the
1556 action routines. */
1557 YYSTYPE yyval;
1558 YYLTYPE yyloc;
1559
1560 #if YYERROR_VERBOSE
1561 /* Buffer for error messages, and its allocated size. */
1562 char yymsgbuf[128];
1563 char *yymsg = yymsgbuf;
1564 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1565 #endif
1566
1567 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1568
1569 /* The number of symbols on the RHS of the reduced rule.
1570 Keep to zero when no symbol should be popped. */
1571 int yylen = 0;
1572
1573 yyssp = yyss = yyssa;
1574 yyvsp = yyvs = yyvsa;
1575 yylsp = yyls = yylsa;
1576 yystacksize = YYINITDEPTH;
1577
1578 YYDPRINTF ((stderr, "Starting parse\n"));
1579
1580 yystate = 0;
1581 yyerrstatus = 0;
1582 yynerrs = 0;
1583 yychar = YYEMPTY; /* Cause a token to be read. */
1584 yylsp[0] = yylloc;
1585 goto yysetstate;
1586
1587 /*------------------------------------------------------------.
1588 | yynewstate -- Push a new state, which is found in yystate. |
1589 `------------------------------------------------------------*/
1590 yynewstate:
1591 /* In all cases, when you get here, the value and location stacks
1592 have just been pushed. So pushing a state here evens the stacks. */
1593 yyssp++;
1594
1595 yysetstate:
1596 *yyssp = yystate;
1597
1598 if (yyss + yystacksize - 1 <= yyssp)
1599 {
1600 /* Get the current used size of the three stacks, in elements. */
1601 YYSIZE_T yysize = yyssp - yyss + 1;
1602
1603 #ifdef yyoverflow
1604 {
1605 /* Give user a chance to reallocate the stack. Use copies of
1606 these so that the &'s don't force the real ones into
1607 memory. */
1608 YYSTYPE *yyvs1 = yyvs;
1609 yytype_int16 *yyss1 = yyss;
1610 YYLTYPE *yyls1 = yyls;
1611
1612 /* Each stack pointer address is followed by the size of the
1613 data in use in that stack, in bytes. This used to be a
1614 conditional around just the two extra args, but that might
1615 be undefined if yyoverflow is a macro. */
1616 yyoverflow (YY_("memory exhausted"),
1617 &yyss1, yysize * sizeof (*yyssp),
1618 &yyvs1, yysize * sizeof (*yyvsp),
1619 &yyls1, yysize * sizeof (*yylsp),
1620 &yystacksize);
1621
1622 yyls = yyls1;
1623 yyss = yyss1;
1624 yyvs = yyvs1;
1625 }
1626 #else /* no yyoverflow */
1627 # ifndef YYSTACK_RELOCATE
1628 goto yyexhaustedlab;
1629 # else
1630 /* Extend the stack our own way. */
1631 if (YYMAXDEPTH <= yystacksize)
1632 goto yyexhaustedlab;
1633 yystacksize *= 2;
1634 if (YYMAXDEPTH < yystacksize)
1635 yystacksize = YYMAXDEPTH;
1636
1637 {
1638 yytype_int16 *yyss1 = yyss;
1639 union yyalloc *yyptr =
1640 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1641 if (! yyptr)
1642 goto yyexhaustedlab;
1643 YYSTACK_RELOCATE (yyss_alloc, yyss);
1644 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1645 YYSTACK_RELOCATE (yyls_alloc, yyls);
1646 # undef YYSTACK_RELOCATE
1647 if (yyss1 != yyssa)
1648 YYSTACK_FREE (yyss1);
1649 }
1650 # endif
1651 #endif /* no yyoverflow */
1652
1653 yyssp = yyss + yysize - 1;
1654 yyvsp = yyvs + yysize - 1;
1655 yylsp = yyls + yysize - 1;
1656
1657 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1658 (unsigned long int) yystacksize));
1659
1660 if (yyss + yystacksize - 1 <= yyssp)
1661 YYABORT;
1662 }
1663
1664 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1665
1666 if (yystate == YYFINAL)
1667 YYACCEPT;
1668
1669 goto yybackup;
1670
1671 /*-----------.
1672 | yybackup. |
1673 `-----------*/
1674 yybackup:
1675
1676 /* Do appropriate processing given the current state. Read a
1677 lookahead token if we need one and don't already have one. */
1678
1679 /* First try to decide what to do without reference to lookahead token. */
1680 yyn = yypact[yystate];
1681 if (yypact_value_is_default (yyn))
1682 goto yydefault;
1683
1684 /* Not known => get a lookahead token if don't already have one. */
1685
1686 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1687 if (yychar == YYEMPTY)
1688 {
1689 YYDPRINTF ((stderr, "Reading a token: "));
1690 yychar = YYLEX;
1691 }
1692
1693 if (yychar <= YYEOF)
1694 {
1695 yychar = yytoken = YYEOF;
1696 YYDPRINTF ((stderr, "Now at end of input.\n"));
1697 }
1698 else
1699 {
1700 yytoken = YYTRANSLATE (yychar);
1701 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1702 }
1703
1704 /* If the proper action on seeing token YYTOKEN is to reduce or to
1705 detect an error, take that action. */
1706 yyn += yytoken;
1707 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1708 goto yydefault;
1709 yyn = yytable[yyn];
1710 if (yyn <= 0)
1711 {
1712 if (yytable_value_is_error (yyn))
1713 goto yyerrlab;
1714 yyn = -yyn;
1715 goto yyreduce;
1716 }
1717
1718 /* Count tokens shifted since error; after three, turn off error
1719 status. */
1720 if (yyerrstatus)
1721 yyerrstatus--;
1722
1723 /* Shift the lookahead token. */
1724 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1725
1726 /* Discard the shifted token. */
1727 yychar = YYEMPTY;
1728
1729 yystate = yyn;
1730 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1731 *++yyvsp = yylval;
1732 YY_IGNORE_MAYBE_UNINITIALIZED_END
1733 *++yylsp = yylloc;
1734 goto yynewstate;
1735
1736
1737 /*-----------------------------------------------------------.
1738 | yydefault -- do the default action for the current state. |
1739 `-----------------------------------------------------------*/
1740 yydefault:
1741 yyn = yydefact[yystate];
1742 if (yyn == 0)
1743 goto yyerrlab;
1744 goto yyreduce;
1745
1746
1747 /*-----------------------------.
1748 | yyreduce -- Do a reduction. |
1749 `-----------------------------*/
1750 yyreduce:
1751 /* yyn is the number of a rule to reduce with. */
1752 yylen = yyr2[yyn];
1753
1754 /* If YYLEN is nonzero, implement the default value of the action:
1755 `$$ = $1'.
1756
1757 Otherwise, the following line sets YYVAL to garbage.
1758 This behavior is undocumented and Bison
1759 users should not rely upon it. Assigning to YYVAL
1760 unconditionally makes the parser a bit smaller, and it avoids a
1761 GCC warning that YYVAL may be used uninitialized. */
1762 yyval = yyvsp[1-yylen];
1763
1764 /* Default location. */
1765 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1766 YY_REDUCE_PRINT (yyn);
1767 switch (yyn)
1768 {
1769 case 3:
1770 /* Line 1792 of yacc.c */
1771 #line 134 "cfgram.y"
1772 {
1773 if (errors)
1774 YYERROR;
1775 }
1776 break;
1777
1778 case 4:
1779 /* Line 1792 of yacc.c */
1780 #line 139 "cfgram.y"
1781 {
1782 if (parse_old_rc())
1783 YYERROR;
1784 }
1785 break;
1786
1787 case 5:
1788 /* Line 1792 of yacc.c */
1789 #line 146 "cfgram.y"
1790 {
1791 if ((yyvsp[(2) - (3)].version).major == 2 && (yyvsp[(2) - (3)].version).minor == 0) {
1792 cflex_normal();
1793 } else {
1794 cferror(&(yylsp[(2) - (3)]), _("unsupported configuration file version"));
1795 YYERROR;
1796 }
1797 }
1798 break;
1799
1800 case 19:
1801 /* Line 1792 of yacc.c */
1802 #line 184 "cfgram.y"
1803 {
1804 struct cfloc loc;
1805 loc.beg = (yylsp[(1) - (3)]).beg;
1806 loc.end = (yylsp[(2) - (3)]).end;
1807 global_attrib_set((yyvsp[(1) - (3)].global_attrib), (yyvsp[(2) - (3)].arglist).argc, (yyvsp[(2) - (3)].arglist).head, &loc);
1808 arglist_free((yyvsp[(2) - (3)].arglist).head);
1809 }
1810 break;
1811
1812 case 20:
1813 /* Line 1792 of yacc.c */
1814 #line 194 "cfgram.y"
1815 {
1816 (yyval.arglist).head = (yyval.arglist).tail = (yyvsp[(1) - (1)].arg);
1817 (yyval.arglist).argc = 1;
1818 }
1819 break;
1820
1821 case 21:
1822 /* Line 1792 of yacc.c */
1823 #line 199 "cfgram.y"
1824 {
1825 LIST_APPEND((yyvsp[(2) - (2)].arg), (yyvsp[(1) - (2)].arglist).head, (yyvsp[(1) - (2)].arglist).tail);
1826 (yyvsp[(1) - (2)].arglist).argc++;
1827 (yyval.arglist) = (yyvsp[(1) - (2)].arglist);
1828 }
1829 break;
1830
1831 case 22:
1832 /* Line 1792 of yacc.c */
1833 #line 207 "cfgram.y"
1834 {
1835 (yyval.arg) = xcalloc(1, sizeof(*(yyval.arg)));
1836 (yyval.arg)->next = NULL;
1837 (yyval.arg)->loc = (yylsp[(1) - (1)]);
1838 (yyval.arg)->isnum = 0;
1839 (yyval.arg)->strval = (yyvsp[(1) - (1)].str);
1840 }
1841 break;
1842
1843 case 23:
1844 /* Line 1792 of yacc.c */
1845 #line 215 "cfgram.y"
1846 {
1847 (yyval.arg) = xcalloc(1, sizeof(*(yyval.arg)));
1848 (yyval.arg)->next = NULL;
1849 (yyval.arg)->loc = (yylsp[(1) - (1)]);
1850 (yyval.arg)->isnum = 1;
1851 (yyval.arg)->strval = (yyvsp[(1) - (1)].num).strval;
1852 (yyval.arg)->intval = (yyvsp[(1) - (1)].num).intval;
1853 }
1854 break;
1855
1856 case 24:
1857 /* Line 1792 of yacc.c */
1858 #line 226 "cfgram.y"
1859 {
1860 current_rule = new_rush_rule((yyvsp[(2) - (3)].str));
1861 current_rule->file = (yylsp[(1) - (3)]).beg.filename;
1862 current_rule->line = (yylsp[(1) - (3)]).beg.line;
1863 free((yyvsp[(2) - (3)].str));
1864 }
1865 break;
1866
1867 case 25:
1868 /* Line 1792 of yacc.c */
1869 #line 235 "cfgram.y"
1870 {
1871 (yyval.str) = NULL;
1872 }
1873 break;
1874
1875 case 39:
1876 /* Line 1792 of yacc.c */
1877 #line 256 "cfgram.y"
1878 {
1879 skiptoeol();
1880 restorenormal();
1881 yyerrok;
1882 yyclearin;
1883 errors = 1;
1884 }
1885 break;
1886
1887 case 40:
1888 /* Line 1792 of yacc.c */
1889 #line 269 "cfgram.y"
1890 {
1891 if (current_rule->test_node) {
1892 struct test_node *np = new_test_node(test_and);
1893 np->v.arg[0] = current_rule->test_node;
1894 np->v.arg[1] = (yyvsp[(2) - (2)].node);
1895 current_rule->test_node = np;
1896 } else
1897 current_rule->test_node = (yyvsp[(2) - (2)].node);
1898 }
1899 break;
1900
1901 case 42:
1902 /* Line 1792 of yacc.c */
1903 #line 282 "cfgram.y"
1904 {
1905 (yyval.node) = new_test_node(test_and);
1906 (yyval.node)->v.arg[0] = (yyvsp[(1) - (3)].node);
1907 (yyval.node)->v.arg[1] = (yyvsp[(3) - (3)].node);
1908 }
1909 break;
1910
1911 case 43:
1912 /* Line 1792 of yacc.c */
1913 #line 288 "cfgram.y"
1914 {
1915 (yyval.node) = new_test_node(test_or);
1916 (yyval.node)->v.arg[0] = (yyvsp[(1) - (3)].node);
1917 (yyval.node)->v.arg[1] = (yyvsp[(3) - (3)].node);
1918 }
1919 break;
1920
1921 case 45:
1922 /* Line 1792 of yacc.c */
1923 #line 297 "cfgram.y"
1924 {
1925 (yyval.node) = new_test_node(test_not);
1926 (yyval.node)->v.arg[0] = (yyvsp[(2) - (2)].node);
1927 }
1928 break;
1929
1930 case 46:
1931 /* Line 1792 of yacc.c */
1932 #line 302 "cfgram.y"
1933 {
1934 (yyval.node) = (yyvsp[(2) - (3)].node);
1935 }
1936 break;
1937
1938 case 47:
1939 /* Line 1792 of yacc.c */
1940 #line 308 "cfgram.y"
1941 {
1942 (yyval.node) = new_test_node(test_cmps);
1943 (yyval.node)->v.cmp.op = cmp_match;
1944 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
1945 (yyval.node)->v.cmp.rarg.rx = (yyvsp[(3) - (3)].regex);
1946 }
1947 break;
1948
1949 case 48:
1950 /* Line 1792 of yacc.c */
1951 #line 315 "cfgram.y"
1952 {
1953 struct test_node *np = new_test_node(test_cmps);
1954 np->v.cmp.op = cmp_match;
1955 np->v.cmp.larg = (yyvsp[(1) - (3)].str);
1956 np->v.cmp.rarg.rx = (yyvsp[(3) - (3)].regex);
1957
1958 (yyval.node) = new_test_node(test_not);
1959 (yyval.node)->v.arg[0] = np;
1960 }
1961 break;
1962
1963 case 49:
1964 /* Line 1792 of yacc.c */
1965 #line 325 "cfgram.y"
1966 {
1967 (yyval.node) = new_test_node(test_cmps);
1968 (yyval.node)->v.cmp.op = cmp_eq;
1969 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
1970 (yyval.node)->v.cmp.rarg.str = (yyvsp[(3) - (3)].str);
1971 }
1972 break;
1973
1974 case 50:
1975 /* Line 1792 of yacc.c */
1976 #line 332 "cfgram.y"
1977 {
1978 (yyval.node) = new_test_node(test_cmps);
1979 (yyval.node)->v.cmp.op = cmp_ne;
1980 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
1981 (yyval.node)->v.cmp.rarg.str = (yyvsp[(3) - (3)].str);
1982 }
1983 break;
1984
1985 case 51:
1986 /* Line 1792 of yacc.c */
1987 #line 339 "cfgram.y"
1988 {
1989 (yyval.node) = new_test_node(test_cmpn);
1990 (yyval.node)->v.cmp.op = cmp_eq;
1991 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
1992 (yyval.node)->v.cmp.rarg.num = (yyvsp[(3) - (3)].num).intval;
1993 }
1994 break;
1995
1996 case 52:
1997 /* Line 1792 of yacc.c */
1998 #line 346 "cfgram.y"
1999 {
2000 (yyval.node) = new_test_node(test_cmpn);
2001 (yyval.node)->v.cmp.op = cmp_ne;
2002 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
2003 (yyval.node)->v.cmp.rarg.num = (yyvsp[(3) - (3)].num).intval;
2004 }
2005 break;
2006
2007 case 53:
2008 /* Line 1792 of yacc.c */
2009 #line 353 "cfgram.y"
2010 {
2011 (yyval.node) = new_test_node(test_cmpn);
2012 (yyval.node)->v.cmp.op = cmp_lt;
2013 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
2014 (yyval.node)->v.cmp.rarg.num = (yyvsp[(3) - (3)].num).intval;
2015 }
2016 break;
2017
2018 case 54:
2019 /* Line 1792 of yacc.c */
2020 #line 360 "cfgram.y"
2021 {
2022 (yyval.node) = new_test_node(test_cmpn);
2023 (yyval.node)->v.cmp.op = cmp_le;
2024 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
2025 (yyval.node)->v.cmp.rarg.num = (yyvsp[(3) - (3)].num).intval;
2026 }
2027 break;
2028
2029 case 55:
2030 /* Line 1792 of yacc.c */
2031 #line 367 "cfgram.y"
2032 {
2033 (yyval.node) = new_test_node(test_cmpn);
2034 (yyval.node)->v.cmp.op = cmp_gt;
2035 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
2036 (yyval.node)->v.cmp.rarg.num = (yyvsp[(3) - (3)].num).intval;
2037 }
2038 break;
2039
2040 case 56:
2041 /* Line 1792 of yacc.c */
2042 #line 374 "cfgram.y"
2043 {
2044 (yyval.node) = new_test_node(test_cmpn);
2045 (yyval.node)->v.cmp.op = cmp_ge;
2046 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
2047 (yyval.node)->v.cmp.rarg.num = (yyvsp[(3) - (3)].num).intval;
2048 }
2049 break;
2050
2051 case 57:
2052 /* Line 1792 of yacc.c */
2053 #line 381 "cfgram.y"
2054 {
2055 (yyval.node) = new_test_node(test_in);
2056 (yyval.node)->v.cmp.op = cmp_in;
2057 (yyval.node)->v.cmp.larg = (yyvsp[(1) - (3)].str);
2058 (yyval.node)->v.cmp.rarg.strv = (yyvsp[(3) - (3)].strlist).argv;
2059 }
2060 break;
2061
2062 case 58:
2063 /* Line 1792 of yacc.c */
2064 #line 388 "cfgram.y"
2065 {
2066 (yyval.node) = new_test_node(test_group);
2067 (yyval.node)->v.groups = xcalloc(2, sizeof((yyval.node)->v.groups[0]));
2068 (yyval.node)->v.groups[0] = (yyvsp[(2) - (2)].str);
2069 (yyval.node)->v.groups[1] = NULL;
2070 }
2071 break;
2072
2073 case 59:
2074 /* Line 1792 of yacc.c */
2075 #line 395 "cfgram.y"
2076 {
2077 (yyval.node) = new_test_node(test_group);
2078 (yyval.node)->v.groups = (yyvsp[(2) - (2)].strlist).argv;
2079 }
2080 break;
2081
2082 case 64:
2083 /* Line 1792 of yacc.c */
2084 #line 408 "cfgram.y"
2085 {
2086 (yyval.str) = (yyvsp[(1) - (1)].num).strval;
2087 }
2088 break;
2089
2090 case 65:
2091 /* Line 1792 of yacc.c */
2092 #line 414 "cfgram.y"
2093 {
2094 int rc = regcomp(&(yyval.regex), (yyvsp[(1) - (1)].str), re_flags);
2095 if (rc) {
2096 char errbuf[512];
2097 regerror(rc, &(yyval.regex), errbuf, sizeof(errbuf));
2098 cferror(&(yylsp[(1) - (1)]), _("invalid regexp: %s"), (yyvsp[(1) - (1)].str));
2099 YYERROR;
2100 }
2101 }
2102 break;
2103
2104 case 66:
2105 /* Line 1792 of yacc.c */
2106 #line 429 "cfgram.y"
2107 {
2108 struct transform_node *node;
2109
2110 node = new_transform_node(current_rule, transform_set);
2111 node->target.type = target_arg;
2112 node->target.v.arg.ins = 0;
2113 node->target.v.arg.idx = (yyvsp[(2) - (4)].intval);
2114 node->v.xf.pattern = (yyvsp[(4) - (4)].str);
2115 node->v.xf.trans = NULL;
2116 }
2117 break;
2118
2119 case 67:
2120 /* Line 1792 of yacc.c */
2121 #line 440 "cfgram.y"
2122 {
2123 struct transform_node *node;
2124
2125 node = new_transform_node(current_rule, transform_set);
2126 node->target.type = target_arg;
2127 node->target.v.arg.ins = 1;
2128 node->target.v.arg.idx = (yyvsp[(2) - (4)].intval);
2129 node->v.xf.pattern = (yyvsp[(4) - (4)].str);
2130 node->v.xf.trans = NULL;
2131 }
2132 break;
2133
2134 case 68:
2135 /* Line 1792 of yacc.c */
2136 #line 451 "cfgram.y"
2137 {
2138 struct transform_node *node;
2139
2140 node = new_transform_node(current_rule, transform_set);
2141 node->target.type = target_arg;
2142 node->target.v.arg.ins = 0;
2143 node->target.v.arg.idx = (yyvsp[(2) - (4)].intval);
2144 node->v.xf.pattern = NULL;
2145 node->v.xf.trans = compile_transform_expr((yyvsp[(4) - (4)].str), re_flags,
2146 &(yylsp[(4) - (4)]));
2147 }
2148 break;
2149
2150 case 69:
2151 /* Line 1792 of yacc.c */
2152 #line 463 "cfgram.y"
2153 {
2154 struct transform_node *node;
2155
2156 node = new_transform_node(current_rule, transform_set);
2157 node->target.type = target_arg;
2158 node->target.v.arg.ins = 0;
2159 node->target.v.arg.idx = (yyvsp[(2) - (6)].intval);
2160 node->v.xf.pattern = (yyvsp[(4) - (6)].str);
2161 node->v.xf.trans = compile_transform_expr((yyvsp[(6) - (6)].str), re_flags,
2162 &(yylsp[(6) - (6)]));
2163 }
2164 break;
2165
2166 case 70:
2167 /* Line 1792 of yacc.c */
2168 #line 475 "cfgram.y"
2169 {
2170 struct transform_node *node;
2171
2172 node = new_transform_node(current_rule, transform_set);
2173 node->target.type = target_arg;
2174 node->target.v.arg.ins = 1;
2175 node->target.v.arg.idx = (yyvsp[(2) - (6)].intval);
2176 node->v.xf.pattern = (yyvsp[(4) - (6)].str);
2177 node->v.xf.trans = compile_transform_expr((yyvsp[(6) - (6)].str), re_flags,
2178 &(yylsp[(6) - (6)]));
2179 }
2180 break;
2181
2182 case 71:
2183 /* Line 1792 of yacc.c */
2184 #line 487 "cfgram.y"
2185 {
2186 struct transform_node *node =
2187 new_set_node(transform_set, (yyvsp[(2) - (4)].str), &(yylsp[(2) - (4)]));
2188 if (node) {
2189 node->v.xf.pattern = (yyvsp[(4) - (4)].str);
2190 node->v.xf.trans = NULL;
2191 }
2192 }
2193 break;
2194
2195 case 72:
2196 /* Line 1792 of yacc.c */
2197 #line 496 "cfgram.y"
2198 {
2199 struct transform_node *node =
2200 new_set_node(transform_set, (yyvsp[(2) - (4)].str), &(yylsp[(2) - (4)]));
2201 if (node) {
2202 node->v.xf.pattern = NULL;
2203 node->v.xf.trans = compile_transform_expr((yyvsp[(4) - (4)].str),
2204 re_flags,
2205 &(yylsp[(4) - (4)]));
2206 }
2207 }
2208 break;
2209
2210 case 73:
2211 /* Line 1792 of yacc.c */
2212 #line 507 "cfgram.y"
2213 {
2214 struct transform_node *node =
2215 new_set_node(transform_set, (yyvsp[(2) - (6)].str), &(yylsp[(2) - (6)]));
2216 if (node) {
2217 node->v.xf.pattern = (yyvsp[(4) - (6)].str);
2218 node->v.xf.trans = compile_transform_expr((yyvsp[(6) - (6)].str),
2219 re_flags,
2220 &(yylsp[(6) - (6)]));
2221 }
2222 }
2223 break;
2224
2225 case 74:
2226 /* Line 1792 of yacc.c */
2227 #line 518 "cfgram.y"
2228 {
2229 struct transform_node *node =
2230 new_set_node(transform_delete, (yyvsp[(2) - (2)].str), &(yylsp[(2) - (2)]));
2231 if (node) {
2232 node->target.v.name = (yyvsp[(2) - (2)].str);
2233 }
2234 }
2235 break;
2236
2237 case 75:
2238 /* Line 1792 of yacc.c */
2239 #line 526 "cfgram.y"
2240 {
2241 if ((yyvsp[(2) - (2)].intval) == 0) {
2242 cferror(&(yylsp[(2) - (2)]), _("$0 cannot be unset"));
2243 errors++;
2244 } else {
2245 struct transform_node *node =
2246 new_transform_node(current_rule,
2247 transform_delete);
2248 node->target.type = target_arg;
2249 node->target.v.arg.ins = 0;
2250 node->target.v.arg.idx = (yyvsp[(2) - (2)].intval);
2251 node->v.arg_end = (yyvsp[(2) - (2)].intval);
2252 }
2253 }
2254 break;
2255
2256 case 76:
2257 /* Line 1792 of yacc.c */
2258 #line 543 "cfgram.y"
2259 {
2260 struct transform_node *node;
2261
2262 node = new_transform_node(current_rule, transform_map);
2263 node->target.type = target_arg;
2264 node->target.v.arg.ins = 0;
2265 node->target.v.arg.idx = (yyvsp[(2) - (8)].intval);
2266 node->v.map.file = (yyvsp[(3) - (8)].str);
2267 node->v.map.delim = (yyvsp[(4) - (8)].str);
2268 node->v.map.key = (yyvsp[(5) - (8)].str);
2269 node->v.map.key_field = (yyvsp[(6) - (8)].num).intval;
2270 node->v.map.val_field = (yyvsp[(7) - (8)].num).intval;
2271 node->v.map.defval = (yyvsp[(8) - (8)].str);
2272
2273 free((yyvsp[(6) - (8)].num).strval);
2274 free((yyvsp[(7) - (8)].num).strval);
2275 }
2276 break;
2277
2278 case 77:
2279 /* Line 1792 of yacc.c */
2280 #line 561 "cfgram.y"
2281 {
2282 struct transform_node *node;
2283
2284 node = new_set_node(transform_map, (yyvsp[(2) - (8)].str), &(yylsp[(2) - (8)]));
2285 node->target.v.name = (yyvsp[(2) - (8)].str);
2286 node->v.map.file = (yyvsp[(3) - (8)].str);
2287 node->v.map.delim = (yyvsp[(4) - (8)].str);
2288 node->v.map.key = (yyvsp[(5) - (8)].str);
2289 node->v.map.key_field = (yyvsp[(6) - (8)].num).intval;
2290 node->v.map.val_field = (yyvsp[(7) - (8)].num).intval;
2291 node->v.map.defval = (yyvsp[(8) - (8)].str);
2292
2293 free((yyvsp[(6) - (8)].num).strval);
2294 free((yyvsp[(7) - (8)].num).strval);
2295 }
2296 break;
2297
2298 case 78:
2299 /* Line 1792 of yacc.c */
2300 #line 579 "cfgram.y"
2301 {
2302 (yyval.str) = NULL;
2303 }
2304 break;
2305
2306 case 80:
2307 /* Line 1792 of yacc.c */
2308 #line 586 "cfgram.y"
2309 {
2310 (yyval.intval) = (yyvsp[(2) - (3)].num).intval;
2311 free((yyvsp[(2) - (3)].num).strval);
2312 }
2313 break;
2314
2315 case 82:
2316 /* Line 1792 of yacc.c */
2317 #line 599 "cfgram.y"
2318 {
2319 current_rule->fall_through = 1;
2320 }
2321 break;
2322
2323 case 83:
2324 /* Line 1792 of yacc.c */
2325 #line 603 "cfgram.y"
2326 {
2327 current_rule->error = new_error((yyvsp[(2) - (3)].intval), (yyvsp[(3) - (3)].str), 0);
2328 free((yyvsp[(3) - (3)].str));
2329 }
2330 break;
2331
2332 case 84:
2333 /* Line 1792 of yacc.c */
2334 #line 608 "cfgram.y"
2335 {
2336 int n = string_to_error_index((yyvsp[(3) - (3)].str));
2337 if (n == -1) {
2338 cferror(&(yylsp[(1) - (3)]), _("Unknown message reference"));
2339 YYERROR;
2340 } else
2341 current_rule->error = new_standard_error((yyvsp[(2) - (3)].intval), n);
2342 free((yyvsp[(3) - (3)].str));
2343 }
2344 break;
2345
2346 case 85:
2347 /* Line 1792 of yacc.c */
2348 #line 620 "cfgram.y"
2349 {
2350 (yyval.intval) = 2;
2351 }
2352 break;
2353
2354 case 86:
2355 /* Line 1792 of yacc.c */
2356 #line 624 "cfgram.y"
2357 {
2358 (yyval.intval) = (yyvsp[(1) - (1)].num).intval;
2359 free((yyvsp[(1) - (1)].num).strval);
2360 }
2361 break;
2362
2363 case 87:
2364 /* Line 1792 of yacc.c */
2365 #line 634 "cfgram.y"
2366 {
2367 if ((yyvsp[(2) - (2)].range).start == 0 || (yyvsp[(2) - (2)].range).end == 0) {
2368 cferror(&(yylsp[(2) - (2)]), _("$0 cannot be deleted"));
2369 errors++;
2370 } else {
2371 struct transform_node *node =
2372 new_transform_node(current_rule,
2373 transform_delete);
2374 node->target.type = target_arg;
2375 node->target.v.arg.ins = 0;
2376 node->target.v.arg.idx = (yyvsp[(2) - (2)].range).start;
2377 node->v.arg_end = (yyvsp[(2) - (2)].range).end;
2378 }
2379 }
2380 break;
2381
2382 case 88:
2383 /* Line 1792 of yacc.c */
2384 #line 651 "cfgram.y"
2385 {
2386 (yyval.range).start = (yyval.range).end = (yyvsp[(1) - (1)].num).intval;
2387 free((yyvsp[(1) - (1)].num).strval);
2388 }
2389 break;
2390
2391 case 89:
2392 /* Line 1792 of yacc.c */
2393 #line 656 "cfgram.y"
2394 {
2395 (yyval.range).start = (yyvsp[(1) - (2)].num).intval;
2396 (yyval.range).end = (yyvsp[(2) - (2)].num).intval;
2397 free((yyvsp[(1) - (2)].num).strval);
2398 free((yyvsp[(2) - (2)].num).strval);
2399 }
2400 break;
2401
2402 case 90:
2403 /* Line 1792 of yacc.c */
2404 #line 671 "cfgram.y"
2405 {
2406 if (cflex_include((yyvsp[(2) - (3)].str), &(yylsp[(2) - (3)])))
2407 YYERROR;
2408 free((yyvsp[(2) - (3)].str));
2409 }
2410 break;
2411
2412 case 91:
2413 /* Line 1792 of yacc.c */
2414 #line 682 "cfgram.y"
2415 {
2416 current_rule->limits = (yyvsp[(2) - (2)].lrec);
2417 }
2418 break;
2419
2420 case 92:
2421 /* Line 1792 of yacc.c */
2422 #line 688 "cfgram.y"
2423 {
2424 char *p;
2425 (yyval.lrec) = limits_record_create();
2426 switch (limits_record_add((yyval.lrec), (yyvsp[(1) - (1)].str), &p)) {
2427 case lrec_ok:
2428 break;
2429 case lrec_error:
2430 cferror(&(yylsp[(1) - (1)]),
2431 _("unrecognized resource limit: %s"),
2432 p);
2433 break;
2434 case lrec_badval:
2435 cferror(&(yylsp[(1) - (1)]),
2436 _("bad value: %s"),
2437 p);
2438 break;
2439 }
2440 free((yyvsp[(1) - (1)].str));
2441 }
2442 break;
2443
2444 case 93:
2445 /* Line 1792 of yacc.c */
2446 #line 708 "cfgram.y"
2447 {
2448 char *p;
2449 switch (limits_record_add((yyvsp[(1) - (2)].lrec), (yyvsp[(2) - (2)].str), &p)) {
2450 case lrec_ok:
2451 break;
2452 case lrec_error:
2453 cferror(&(yylsp[(1) - (2)]),
2454 _("unrecognized resource limit: %s"),
2455 p);
2456 break;
2457 case lrec_badval:
2458 cferror(&(yylsp[(1) - (2)]),
2459 _("bad value: %s"),
2460 p);
2461 break;
2462 }
2463 free((yyvsp[(2) - (2)].str));
2464 (yyval.lrec) = (yyvsp[(1) - (2)].lrec);
2465 }
2466 break;
2467
2468 case 94:
2469 /* Line 1792 of yacc.c */
2470 #line 733 "cfgram.y"
2471 {
2472 struct transform_node *node;
2473 size_t n;
2474
2475 n = strspn((yyvsp[(2) - (3)].str) + 1, ":");
2476 if ((yyvsp[(2) - (3)].str)[n + 1]) {
2477 struct cfloc loc;
2478 loc.beg = (yylsp[(2) - (3)]).beg;
2479 loc.beg.column += n + 1;
2480 loc.end = loc.beg;
2481 cferror(&loc,
2482 _("invalid character in short option designator"));
2483 cferror(&loc,
2484 _("short option letter can be followed only by zero to two colons"));
2485 errors++;
2486 } else {
2487 if (n > 2) {
2488 struct cfloc loc;
2489 loc.beg = (yylsp[(2) - (3)]).beg;
2490 loc.beg.column += n;
2491 loc.end = loc.beg;
2492 cferror(&loc,
2493 _("ignoring extra character in short option designator"));
2494 cferror(&loc,
2495 _("short option letter can be followed only by zero to two colons"));
2496 }
2497
2498 node = new_transform_node(current_rule,
2499 transform_remopt);
2500 node->target.type = target_command;
2501 node->v.remopt.s_opt = (yyvsp[(2) - (3)].str);
2502 node->v.remopt.l_opt = (yyvsp[(3) - (3)].str);
2503 }
2504 }
2505 break;
2506
2507 case 95:
2508 /* Line 1792 of yacc.c */
2509 #line 770 "cfgram.y"
2510 {
2511 (yyval.str) = NULL;
2512 }
2513 break;
2514
2515 case 97:
2516 /* Line 1792 of yacc.c */
2517 #line 780 "cfgram.y"
2518 {
2519 current_rule->clrenv = 1;
2520 }
2521 break;
2522
2523 case 98:
2524 /* Line 1792 of yacc.c */
2525 #line 784 "cfgram.y"
2526 {
2527 new_envar(current_rule,
2528 (yyvsp[(2) - (4)].str), strlen((yyvsp[(2) - (4)].str)),
2529 (yyvsp[(4) - (4)].str), strlen((yyvsp[(4) - (4)].str)),
2530 envar_set);
2531 free((yyvsp[(2) - (4)].str));
2532 free((yyvsp[(4) - (4)].str));
2533 }
2534 break;
2535
2536 case 99:
2537 /* Line 1792 of yacc.c */
2538 #line 793 "cfgram.y"
2539 {
2540 new_envar(current_rule,
2541 "", 0,
2542 (yyvsp[(2) - (2)].str), strlen((yyvsp[(2) - (2)].str)),
2543 envar_eval);
2544 free((yyvsp[(2) - (2)].str));
2545 }
2546 break;
2547
2548 case 100:
2549 /* Line 1792 of yacc.c */
2550 #line 801 "cfgram.y"
2551 {
2552 add_asgn_list((yyvsp[(2) - (2)].asgn_list).head, envar_unset);
2553 }
2554 break;
2555
2556 case 101:
2557 /* Line 1792 of yacc.c */
2558 #line 805 "cfgram.y"
2559 {
2560 add_asgn_list((yyvsp[(2) - (2)].asgn_list).head, envar_keep);
2561 }
2562 break;
2563
2564 case 102:
2565 /* Line 1792 of yacc.c */
2566 #line 811 "cfgram.y"
2567 {
2568 (yyval.asgn_list).head = (yyval.asgn_list).tail = (yyvsp[(1) - (1)].asgn);
2569 }
2570 break;
2571
2572 case 103:
2573 /* Line 1792 of yacc.c */
2574 #line 815 "cfgram.y"
2575 {
2576 LIST_APPEND((yyvsp[(2) - (2)].asgn), (yyvsp[(1) - (2)].asgn_list).head, (yyvsp[(1) - (2)].asgn_list).tail);
2577 (yyval.asgn_list) = (yyvsp[(1) - (2)].asgn_list);
2578 }
2579 break;
2580
2581 case 104:
2582 /* Line 1792 of yacc.c */
2583 #line 822 "cfgram.y"
2584 {
2585 (yyval.asgn) = xmalloc(sizeof(*(yyval.asgn)));
2586 (yyval.asgn)->next = NULL;
2587 (yyval.asgn)->name = (yyvsp[(1) - (1)].str);
2588 (yyval.asgn)->value = NULL;
2589 }
2590 break;
2591
2592 case 105:
2593 /* Line 1792 of yacc.c */
2594 #line 829 "cfgram.y"
2595 {
2596 (yyval.asgn) = xmalloc(sizeof(*(yyval.asgn)));
2597 (yyval.asgn)->next = NULL;
2598 (yyval.asgn)->name = (yyvsp[(1) - (3)].str);
2599 (yyval.asgn)->value = (yyvsp[(3) - (3)].str);
2600 }
2601 break;
2602
2603 case 106:
2604 /* Line 1792 of yacc.c */
2605 #line 841 "cfgram.y"
2606 {
2607 (yyvsp[(1) - (2)].attrib)(current_rule, (yyvsp[(2) - (2)].str), &(yylsp[(2) - (2)]));
2608 free((yyvsp[(2) - (2)].str));
2609 }
2610 break;
2611
2612 case 107:
2613 /* Line 1792 of yacc.c */
2614 #line 847 "cfgram.y"
2615 { cflex_pushargs(); }
2616 break;
2617
2618 case 108:
2619 /* Line 1792 of yacc.c */
2620 #line 848 "cfgram.y"
2621 {
2622 int i;
2623 struct argval *arg;
2624
2625 cflex_popargs();
2626 (yyval.strlist).argc = (yyvsp[(3) - (4)].arglist).argc;
2627 (yyval.strlist).argv = xcalloc((yyvsp[(3) - (4)].arglist).argc + 1, sizeof((yyval.strlist).argv[0]));
2628 for (i = 0, arg = (yyvsp[(3) - (4)].arglist).head; i < (yyvsp[(3) - (4)].arglist).argc; i++, arg = arg->next) {
2629 (yyval.strlist).argv[i] = arg->strval;
2630 arg->strval = NULL;
2631 }
2632 arglist_free((yyvsp[(3) - (4)].arglist).head);
2633 }
2634 break;
2635
2636
2637 /* Line 1792 of yacc.c */
2638 #line 2639 "cfgram.c"
2639 default: break;
2640 }
2641 /* User semantic actions sometimes alter yychar, and that requires
2642 that yytoken be updated with the new translation. We take the
2643 approach of translating immediately before every use of yytoken.
2644 One alternative is translating here after every semantic action,
2645 but that translation would be missed if the semantic action invokes
2646 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2647 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2648 incorrect destructor might then be invoked immediately. In the
2649 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2650 to an incorrect destructor call or verbose syntax error message
2651 before the lookahead is translated. */
2652 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2653
2654 YYPOPSTACK (yylen);
2655 yylen = 0;
2656 YY_STACK_PRINT (yyss, yyssp);
2657
2658 *++yyvsp = yyval;
2659 *++yylsp = yyloc;
2660
2661 /* Now `shift' the result of the reduction. Determine what state
2662 that goes to, based on the state we popped back to and the rule
2663 number reduced by. */
2664
2665 yyn = yyr1[yyn];
2666
2667 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2668 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2669 yystate = yytable[yystate];
2670 else
2671 yystate = yydefgoto[yyn - YYNTOKENS];
2672
2673 goto yynewstate;
2674
2675
2676 /*------------------------------------.
2677 | yyerrlab -- here on detecting error |
2678 `------------------------------------*/
2679 yyerrlab:
2680 /* Make sure we have latest lookahead translation. See comments at
2681 user semantic actions for why this is necessary. */
2682 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2683
2684 /* If not already recovering from an error, report this error. */
2685 if (!yyerrstatus)
2686 {
2687 ++yynerrs;
2688 #if ! YYERROR_VERBOSE
2689 yyerror (YY_("syntax error"));
2690 #else
2691 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2692 yyssp, yytoken)
2693 {
2694 char const *yymsgp = YY_("syntax error");
2695 int yysyntax_error_status;
2696 yysyntax_error_status = YYSYNTAX_ERROR;
2697 if (yysyntax_error_status == 0)
2698 yymsgp = yymsg;
2699 else if (yysyntax_error_status == 1)
2700 {
2701 if (yymsg != yymsgbuf)
2702 YYSTACK_FREE (yymsg);
2703 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2704 if (!yymsg)
2705 {
2706 yymsg = yymsgbuf;
2707 yymsg_alloc = sizeof yymsgbuf;
2708 yysyntax_error_status = 2;
2709 }
2710 else
2711 {
2712 yysyntax_error_status = YYSYNTAX_ERROR;
2713 yymsgp = yymsg;
2714 }
2715 }
2716 yyerror (yymsgp);
2717 if (yysyntax_error_status == 2)
2718 goto yyexhaustedlab;
2719 }
2720 # undef YYSYNTAX_ERROR
2721 #endif
2722 }
2723
2724 yyerror_range[1] = yylloc;
2725
2726 if (yyerrstatus == 3)
2727 {
2728 /* If just tried and failed to reuse lookahead token after an
2729 error, discard it. */
2730
2731 if (yychar <= YYEOF)
2732 {
2733 /* Return failure if at end of input. */
2734 if (yychar == YYEOF)
2735 YYABORT;
2736 }
2737 else
2738 {
2739 yydestruct ("Error: discarding",
2740 yytoken, &yylval, &yylloc);
2741 yychar = YYEMPTY;
2742 }
2743 }
2744
2745 /* Else will try to reuse lookahead token after shifting the error
2746 token. */
2747 goto yyerrlab1;
2748
2749
2750 /*---------------------------------------------------.
2751 | yyerrorlab -- error raised explicitly by YYERROR. |
2752 `---------------------------------------------------*/
2753 yyerrorlab:
2754
2755 /* Pacify compilers like GCC when the user code never invokes
2756 YYERROR and the label yyerrorlab therefore never appears in user
2757 code. */
2758 if (/*CONSTCOND*/ 0)
2759 goto yyerrorlab;
2760
2761 yyerror_range[1] = yylsp[1-yylen];
2762 /* Do not reclaim the symbols of the rule which action triggered
2763 this YYERROR. */
2764 YYPOPSTACK (yylen);
2765 yylen = 0;
2766 YY_STACK_PRINT (yyss, yyssp);
2767 yystate = *yyssp;
2768 goto yyerrlab1;
2769
2770
2771 /*-------------------------------------------------------------.
2772 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2773 `-------------------------------------------------------------*/
2774 yyerrlab1:
2775 yyerrstatus = 3; /* Each real token shifted decrements this. */
2776
2777 for (;;)
2778 {
2779 yyn = yypact[yystate];
2780 if (!yypact_value_is_default (yyn))
2781 {
2782 yyn += YYTERROR;
2783 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2784 {
2785 yyn = yytable[yyn];
2786 if (0 < yyn)
2787 break;
2788 }
2789 }
2790
2791 /* Pop the current state because it cannot handle the error token. */
2792 if (yyssp == yyss)
2793 YYABORT;
2794
2795 yyerror_range[1] = *yylsp;
2796 yydestruct ("Error: popping",
2797 yystos[yystate], yyvsp, yylsp);
2798 YYPOPSTACK (1);
2799 yystate = *yyssp;
2800 YY_STACK_PRINT (yyss, yyssp);
2801 }
2802
2803 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2804 *++yyvsp = yylval;
2805 YY_IGNORE_MAYBE_UNINITIALIZED_END
2806
2807 yyerror_range[2] = yylloc;
2808 /* Using YYLLOC is tempting, but would change the location of
2809 the lookahead. YYLOC is available though. */
2810 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
2811 *++yylsp = yyloc;
2812
2813 /* Shift the error token. */
2814 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2815
2816 yystate = yyn;
2817 goto yynewstate;
2818
2819
2820 /*-------------------------------------.
2821 | yyacceptlab -- YYACCEPT comes here. |
2822 `-------------------------------------*/
2823 yyacceptlab:
2824 yyresult = 0;
2825 goto yyreturn;
2826
2827 /*-----------------------------------.
2828 | yyabortlab -- YYABORT comes here. |
2829 `-----------------------------------*/
2830 yyabortlab:
2831 yyresult = 1;
2832 goto yyreturn;
2833
2834 #if !defined yyoverflow || YYERROR_VERBOSE
2835 /*-------------------------------------------------.
2836 | yyexhaustedlab -- memory exhaustion comes here. |
2837 `-------------------------------------------------*/
2838 yyexhaustedlab:
2839 yyerror (YY_("memory exhausted"));
2840 yyresult = 2;
2841 /* Fall through. */
2842 #endif
2843
2844 yyreturn:
2845 if (yychar != YYEMPTY)
2846 {
2847 /* Make sure we have latest lookahead translation. See comments at
2848 user semantic actions for why this is necessary. */
2849 yytoken = YYTRANSLATE (yychar);
2850 yydestruct ("Cleanup: discarding lookahead",
2851 yytoken, &yylval, &yylloc);
2852 }
2853 /* Do not reclaim the symbols of the rule which action triggered
2854 this YYABORT or YYACCEPT. */
2855 YYPOPSTACK (yylen);
2856 YY_STACK_PRINT (yyss, yyssp);
2857 while (yyssp != yyss)
2858 {
2859 yydestruct ("Cleanup: popping",
2860 yystos[*yyssp], yyvsp, yylsp);
2861 YYPOPSTACK (1);
2862 }
2863 #ifndef yyoverflow
2864 if (yyss != yyssa)
2865 YYSTACK_FREE (yyss);
2866 #endif
2867 #if YYERROR_VERBOSE
2868 if (yymsg != yymsgbuf)
2869 YYSTACK_FREE (yymsg);
2870 #endif
2871 /* Make sure YYID is used. */
2872 return YYID (yyresult);
2873 }
2874
2875
2876 /* Line 2055 of yacc.c */
2877 #line 863 "cfgram.y"
2878
2879 void
yyerror(char const * fmt,...)2880 yyerror(char const *fmt, ...)
2881 {
2882 va_list ap;
2883 va_start(ap, fmt);
2884 vcferror(&curloc, fmt, ap);
2885 va_end(ap);
2886 errors = 1;
2887 }
2888
2889 void
cfgram_debug(int v)2890 cfgram_debug(int v)
2891 {
2892 #ifdef YYDEBUG
2893 yydebug = v;
2894 #endif
2895 }
2896
2897 struct rush_rule *
new_rush_rule(char const * tag)2898 new_rush_rule(char const *tag)
2899 {
2900 struct rush_rule *p = xzalloc(sizeof(*p));
2901 LIST_APPEND(p, rule_head, rule_tail);
2902 static unsigned rule_num = 0;
2903
2904 rule_num++;
2905 if (tag && tag[0])
2906 p->tag = xstrdup(tag);
2907 else {
2908 char buf[INT_BUFSIZE_BOUND(unsigned)];
2909 char *s = uinttostr(rule_num, buf);
2910 p->tag = xmalloc(strlen(s) + 2);
2911 p->tag[0] = '#';
2912 strcpy(p->tag + 1, s);
2913 }
2914
2915 p->mask = NO_UMASK;
2916 p->gid = NO_GID;
2917 p->fork = rush_undefined;
2918 p->acct = rush_undefined;
2919 return p;
2920 }
2921
2922 struct transform_node *
new_transform_node(struct rush_rule * rule,enum transform_node_type type)2923 new_transform_node(struct rush_rule *rule, enum transform_node_type type)
2924 {
2925 struct transform_node *p = xzalloc(sizeof(*p));
2926 LIST_APPEND(p, rule->transform_head, rule->transform_tail);
2927 p->type = type;
2928 return p;
2929 }
2930
2931 struct test_node *
new_test_node(enum test_type type)2932 new_test_node(enum test_type type)
2933 {
2934 struct test_node *p = xzalloc(sizeof(*p));
2935 p->type = type;
2936 return p;
2937 }
2938
2939 struct envar *
new_envar(struct rush_rule * rule,char const * name,size_t nlen,char const * value,size_t vlen,enum envar_type type)2940 new_envar(struct rush_rule *rule,
2941 char const *name, size_t nlen,
2942 char const *value, size_t vlen,
2943 enum envar_type type)
2944 {
2945 struct envar *p = xmalloc(sizeof(*p)
2946 + nlen + 1
2947 + (value ? vlen + 1 : 0));
2948 p->next = NULL;
2949 p->name = (char*)(p + 1);
2950 memcpy(p->name, name, nlen);
2951 p->name[nlen] = 0;
2952 if (value) {
2953 p->value = p->name + nlen + 1;
2954 memcpy(p->value, value, vlen);
2955 p->value[vlen] = 0;
2956 } else {
2957 p->value = NULL;
2958 }
2959
2960 p->type = type;
2961 LIST_APPEND(p, rule->envar_head, rule->envar_tail);
2962 return p;
2963 }
2964
2965 static void
add_asgn_list(struct asgn * head,enum envar_type type)2966 add_asgn_list(struct asgn *head, enum envar_type type)
2967 {
2968 for (; head; head = head->next) {
2969 new_envar(current_rule,
2970 head->name, strlen(head->name),
2971 head->value, head->value ? strlen(head->value) : 0,
2972 type);
2973 free(head->name);
2974 free(head->value);
2975 }
2976 }
2977
2978 static struct transform_node *
new_set_node(enum transform_node_type type,char * varname,struct cfloc const * loc)2979 new_set_node(enum transform_node_type type,
2980 char *varname,
2981 struct cfloc const *loc)
2982 {
2983 struct transform_node *node;
2984 enum transform_target_type tgt;
2985
2986 tgt = rush_variable_target(varname);
2987 if (tgt == target_readonly) {
2988 cferror(loc, _("attempt to modify a read-only variable"));
2989 errors++;
2990 return NULL;
2991 }
2992 node = new_transform_node(current_rule, type);
2993 node->target.type = tgt;
2994 switch (tgt) {
2995 case target_command:
2996 case target_program:
2997 free(varname);
2998 if (type == transform_delete) {
2999 cferror(loc,
3000 _("attempt to unset a read-only variable"));
3001 errors++;
3002 return NULL;
3003 }
3004 break;
3005 case target_var:
3006 node->target.v.name = varname;
3007 break;
3008 default:
3009 die(system_error, NULL,
3010 _("INTERNAL ERROR at %s:%d: invalid target type %d"),
3011 __FILE__, __LINE__,
3012 tgt);
3013 }
3014 return node;
3015 }
3016