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