build: scripts/config - update to kconfig-v5.6
[oweals/openwrt.git] / scripts / config / parser.tab.c
1 /* A Bison parser, made by GNU Bison 3.1.  */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
42
43 /* Identify Bison output.  */
44 #define YYBISON 1
45
46 /* Bison version.  */
47 #define YYBISON_VERSION "3.1"
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
66
67
68 #include <ctype.h>
69 #include <stdarg.h>
70 #include <stdio.h>
71 #include <stdlib.h>
72 #include <string.h>
73 #include <stdbool.h>
74
75 #include "lkc.h"
76
77 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
78
79 #define PRINTD          0x0001
80 #define DEBUG_PARSE     0x0002
81
82 int cdebug = PRINTD;
83
84 static void yyerror(const char *err);
85 static void zconfprint(const char *err, ...);
86 static void zconf_error(const char *err, ...);
87 static bool zconf_endtoken(const char *tokenname,
88                            const char *expected_tokenname);
89
90 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
91
92 static struct menu *current_menu, *current_entry;
93
94
95
96
97 # ifndef YY_NULLPTR
98 #  if defined __cplusplus && 201103L <= __cplusplus
99 #   define YY_NULLPTR nullptr
100 #  else
101 #   define YY_NULLPTR 0
102 #  endif
103 # endif
104
105 /* Enabling verbose error messages.  */
106 #ifdef YYERROR_VERBOSE
107 # undef YYERROR_VERBOSE
108 # define YYERROR_VERBOSE 1
109 #else
110 # define YYERROR_VERBOSE 0
111 #endif
112
113 /* In a future release of Bison, this section will be replaced
114    by #include "parser.tab.h".  */
115 #ifndef YY_YY_PARSER_TAB_H_INCLUDED
116 # define YY_YY_PARSER_TAB_H_INCLUDED
117 /* Debug traces.  */
118 #ifndef YYDEBUG
119 # define YYDEBUG 0
120 #endif
121 #if YYDEBUG
122 extern int yydebug;
123 #endif
124
125 /* Token type.  */
126 #ifndef YYTOKENTYPE
127 # define YYTOKENTYPE
128   enum yytokentype
129   {
130     T_HELPTEXT = 258,
131     T_WORD = 259,
132     T_WORD_QUOTE = 260,
133     T_ALLNOCONFIG_Y = 261,
134     T_BOOL = 262,
135     T_CHOICE = 263,
136     T_CLOSE_PAREN = 264,
137     T_COLON_EQUAL = 265,
138     T_COMMENT = 266,
139     T_CONFIG = 267,
140     T_DEFAULT = 268,
141     T_DEFCONFIG_LIST = 269,
142     T_DEF_BOOL = 270,
143     T_DEF_TRISTATE = 271,
144     T_DEPENDS = 272,
145     T_ENDCHOICE = 273,
146     T_ENDIF = 274,
147     T_ENDMENU = 275,
148     T_HELP = 276,
149     T_HEX = 277,
150     T_IF = 278,
151     T_IMPLY = 279,
152     T_INT = 280,
153     T_MAINMENU = 281,
154     T_MENU = 282,
155     T_MENUCONFIG = 283,
156     T_MODULES = 284,
157     T_ON = 285,
158     T_OPEN_PAREN = 286,
159     T_OPTION = 287,
160     T_OPTIONAL = 288,
161     T_PLUS_EQUAL = 289,
162     T_PROMPT = 290,
163     T_RANGE = 291,
164     T_RESET = 292,
165     T_SELECT = 293,
166     T_SOURCE = 294,
167     T_STRING = 295,
168     T_TRISTATE = 296,
169     T_VISIBLE = 297,
170     T_EOL = 298,
171     T_ASSIGN_VAL = 299,
172     T_OR = 300,
173     T_AND = 301,
174     T_EQUAL = 302,
175     T_UNEQUAL = 303,
176     T_LESS = 304,
177     T_LESS_EQUAL = 305,
178     T_GREATER = 306,
179     T_GREATER_EQUAL = 307,
180     T_NOT = 308
181   };
182 #endif
183
184 /* Value type.  */
185 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
186
187 union YYSTYPE
188 {
189
190
191         char *string;
192         struct symbol *symbol;
193         struct expr *expr;
194         struct menu *menu;
195         enum symbol_type type;
196         enum variable_flavor flavor;
197
198
199 };
200
201 typedef union YYSTYPE YYSTYPE;
202 # define YYSTYPE_IS_TRIVIAL 1
203 # define YYSTYPE_IS_DECLARED 1
204 #endif
205
206
207 extern YYSTYPE yylval;
208
209 int yyparse (void);
210
211 #endif /* !YY_YY_PARSER_TAB_H_INCLUDED  */
212
213 /* Copy the second part of user declarations.  */
214
215
216
217 #ifdef short
218 # undef short
219 #endif
220
221 #ifdef YYTYPE_UINT8
222 typedef YYTYPE_UINT8 yytype_uint8;
223 #else
224 typedef unsigned char yytype_uint8;
225 #endif
226
227 #ifdef YYTYPE_INT8
228 typedef YYTYPE_INT8 yytype_int8;
229 #else
230 typedef signed char yytype_int8;
231 #endif
232
233 #ifdef YYTYPE_UINT16
234 typedef YYTYPE_UINT16 yytype_uint16;
235 #else
236 typedef unsigned short yytype_uint16;
237 #endif
238
239 #ifdef YYTYPE_INT16
240 typedef YYTYPE_INT16 yytype_int16;
241 #else
242 typedef short yytype_int16;
243 #endif
244
245 #ifndef YYSIZE_T
246 # ifdef __SIZE_TYPE__
247 #  define YYSIZE_T __SIZE_TYPE__
248 # elif defined size_t
249 #  define YYSIZE_T size_t
250 # elif ! defined YYSIZE_T
251 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
252 #  define YYSIZE_T size_t
253 # else
254 #  define YYSIZE_T unsigned
255 # endif
256 #endif
257
258 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
259
260 #ifndef YY_
261 # if defined YYENABLE_NLS && YYENABLE_NLS
262 #  if ENABLE_NLS
263 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
264 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
265 #  endif
266 # endif
267 # ifndef YY_
268 #  define YY_(Msgid) Msgid
269 # endif
270 #endif
271
272 #ifndef YY_ATTRIBUTE
273 # if (defined __GNUC__                                               \
274       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
275      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
276 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
277 # else
278 #  define YY_ATTRIBUTE(Spec) /* empty */
279 # endif
280 #endif
281
282 #ifndef YY_ATTRIBUTE_PURE
283 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
284 #endif
285
286 #ifndef YY_ATTRIBUTE_UNUSED
287 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
288 #endif
289
290 #if !defined _Noreturn \
291      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
292 # if defined _MSC_VER && 1200 <= _MSC_VER
293 #  define _Noreturn __declspec (noreturn)
294 # else
295 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
296 # endif
297 #endif
298
299 /* Suppress unused-variable warnings by "using" E.  */
300 #if ! defined lint || defined __GNUC__
301 # define YYUSE(E) ((void) (E))
302 #else
303 # define YYUSE(E) /* empty */
304 #endif
305
306 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
307 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
308 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
309     _Pragma ("GCC diagnostic push") \
310     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
311     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
312 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
313     _Pragma ("GCC diagnostic pop")
314 #else
315 # define YY_INITIAL_VALUE(Value) Value
316 #endif
317 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
318 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
319 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
320 #endif
321 #ifndef YY_INITIAL_VALUE
322 # define YY_INITIAL_VALUE(Value) /* Nothing. */
323 #endif
324
325
326 #if ! defined yyoverflow || YYERROR_VERBOSE
327
328 /* The parser invokes alloca or malloc; define the necessary symbols.  */
329
330 # ifdef YYSTACK_USE_ALLOCA
331 #  if YYSTACK_USE_ALLOCA
332 #   ifdef __GNUC__
333 #    define YYSTACK_ALLOC __builtin_alloca
334 #   elif defined __BUILTIN_VA_ARG_INCR
335 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
336 #   elif defined _AIX
337 #    define YYSTACK_ALLOC __alloca
338 #   elif defined _MSC_VER
339 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
340 #    define alloca _alloca
341 #   else
342 #    define YYSTACK_ALLOC alloca
343 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
344 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
345       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
346 #     ifndef EXIT_SUCCESS
347 #      define EXIT_SUCCESS 0
348 #     endif
349 #    endif
350 #   endif
351 #  endif
352 # endif
353
354 # ifdef YYSTACK_ALLOC
355    /* Pacify GCC's 'empty if-body' warning.  */
356 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
357 #  ifndef YYSTACK_ALLOC_MAXIMUM
358     /* The OS might guarantee only one guard page at the bottom of the stack,
359        and a page size can be as small as 4096 bytes.  So we cannot safely
360        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
361        to allow for a few compiler-allocated temporary stack slots.  */
362 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
363 #  endif
364 # else
365 #  define YYSTACK_ALLOC YYMALLOC
366 #  define YYSTACK_FREE YYFREE
367 #  ifndef YYSTACK_ALLOC_MAXIMUM
368 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
369 #  endif
370 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
371        && ! ((defined YYMALLOC || defined malloc) \
372              && (defined YYFREE || defined free)))
373 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
374 #   ifndef EXIT_SUCCESS
375 #    define EXIT_SUCCESS 0
376 #   endif
377 #  endif
378 #  ifndef YYMALLOC
379 #   define YYMALLOC malloc
380 #   if ! defined malloc && ! defined EXIT_SUCCESS
381 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
382 #   endif
383 #  endif
384 #  ifndef YYFREE
385 #   define YYFREE free
386 #   if ! defined free && ! defined EXIT_SUCCESS
387 void free (void *); /* INFRINGES ON USER NAME SPACE */
388 #   endif
389 #  endif
390 # endif
391 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
392
393
394 #if (! defined yyoverflow \
395      && (! defined __cplusplus \
396          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
397
398 /* A type that is properly aligned for any stack member.  */
399 union yyalloc
400 {
401   yytype_int16 yyss_alloc;
402   YYSTYPE yyvs_alloc;
403 };
404
405 /* The size of the maximum gap between one aligned stack and the next.  */
406 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
407
408 /* The size of an array large to enough to hold all stacks, each with
409    N elements.  */
410 # define YYSTACK_BYTES(N) \
411      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
412       + YYSTACK_GAP_MAXIMUM)
413
414 # define YYCOPY_NEEDED 1
415
416 /* Relocate STACK from its old location to the new one.  The
417    local variables YYSIZE and YYSTACKSIZE give the old and new number of
418    elements in the stack, and YYPTR gives the new location of the
419    stack.  Advance YYPTR to a properly aligned location for the next
420    stack.  */
421 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
422     do                                                                  \
423       {                                                                 \
424         YYSIZE_T yynewbytes;                                            \
425         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
426         Stack = &yyptr->Stack_alloc;                                    \
427         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
428         yyptr += yynewbytes / sizeof (*yyptr);                          \
429       }                                                                 \
430     while (0)
431
432 #endif
433
434 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
435 /* Copy COUNT objects from SRC to DST.  The source and destination do
436    not overlap.  */
437 # ifndef YYCOPY
438 #  if defined __GNUC__ && 1 < __GNUC__
439 #   define YYCOPY(Dst, Src, Count) \
440       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
441 #  else
442 #   define YYCOPY(Dst, Src, Count)              \
443       do                                        \
444         {                                       \
445           YYSIZE_T yyi;                         \
446           for (yyi = 0; yyi < (Count); yyi++)   \
447             (Dst)[yyi] = (Src)[yyi];            \
448         }                                       \
449       while (0)
450 #  endif
451 # endif
452 #endif /* !YYCOPY_NEEDED */
453
454 /* YYFINAL -- State number of the termination state.  */
455 #define YYFINAL  6
456 /* YYLAST -- Last index in YYTABLE.  */
457 #define YYLAST   194
458
459 /* YYNTOKENS -- Number of terminals.  */
460 #define YYNTOKENS  54
461 /* YYNNTS -- Number of nonterminals.  */
462 #define YYNNTS  47
463 /* YYNRULES -- Number of rules.  */
464 #define YYNRULES  105
465 /* YYNSTATES -- Number of states.  */
466 #define YYNSTATES  187
467
468 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
469    by yylex, with out-of-bounds checking.  */
470 #define YYUNDEFTOK  2
471 #define YYMAXUTOK   308
472
473 #define YYTRANSLATE(YYX)                                                \
474   ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
475
476 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
477    as returned by yylex, without out-of-bounds checking.  */
478 static const yytype_uint8 yytranslate[] =
479 {
480        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
481        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
482        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
483        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
484        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
485        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
486        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
487        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
488        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
489        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
490        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
491        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
492        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
493        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
494        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
495        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
496        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
497        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
498        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
499        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
500        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
501        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
502        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
503        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
504        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
505        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
506        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
507       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
508       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
509       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
510       45,    46,    47,    48,    49,    50,    51,    52,    53
511 };
512
513 #if YYDEBUG
514   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
515 static const yytype_uint16 yyrline[] =
516 {
517        0,   112,   112,   112,   116,   121,   123,   124,   125,   126,
518      127,   131,   132,   133,   134,   135,   136,   141,   148,   153,
519      160,   169,   171,   172,   173,   176,   184,   190,   200,   206,
520      212,   218,   223,   228,   235,   245,   250,   258,   261,   263,
521      264,   265,   268,   274,   281,   287,   292,   300,   301,   302,
522      303,   306,   307,   310,   311,   312,   314,   316,   321,   329,
523      337,   342,   349,   354,   362,   365,   367,   368,   371,   380,
524      387,   390,   392,   397,   403,   415,   422,   429,   431,   436,
525      437,   438,   441,   442,   445,   446,   447,   448,   449,   450,
526      451,   452,   453,   454,   455,   459,   461,   462,   465,   466,
527      470,   473,   474,   475,   479,   480
528 };
529 #endif
530
531 #if YYDEBUG || YYERROR_VERBOSE || 0
532 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
533    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
534 static const char *const yytname[] =
535 {
536   "$end", "error", "$undefined", "T_HELPTEXT", "T_WORD", "T_WORD_QUOTE",
537   "T_ALLNOCONFIG_Y", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN",
538   "T_COLON_EQUAL", "T_COMMENT", "T_CONFIG", "T_DEFAULT",
539   "T_DEFCONFIG_LIST", "T_DEF_BOOL", "T_DEF_TRISTATE", "T_DEPENDS",
540   "T_ENDCHOICE", "T_ENDIF", "T_ENDMENU", "T_HELP", "T_HEX", "T_IF",
541   "T_IMPLY", "T_INT", "T_MAINMENU", "T_MENU", "T_MENUCONFIG", "T_MODULES",
542   "T_ON", "T_OPEN_PAREN", "T_OPTION", "T_OPTIONAL", "T_PLUS_EQUAL",
543   "T_PROMPT", "T_RANGE", "T_RESET", "T_SELECT", "T_SOURCE", "T_STRING",
544   "T_TRISTATE", "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND",
545   "T_EQUAL", "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER",
546   "T_GREATER_EQUAL", "T_NOT", "$accept", "input", "mainmenu_stmt",
547   "stmt_list", "common_stmt", "config_entry_start", "config_stmt",
548   "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
549   "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
550   "choice_option_list", "choice_option", "type", "logic_type", "default",
551   "choice_block", "if_entry", "if_end", "if_stmt", "menu", "menu_entry",
552   "menu_end", "menu_stmt", "menu_option_list", "source_stmt", "comment",
553   "comment_stmt", "comment_option_list", "help_start", "help", "depends",
554   "visible", "prompt_stmt_opt", "end", "if_expr", "expr",
555   "nonconst_symbol", "symbol", "word_opt", "assignment_stmt", "assign_op",
556   "assign_val", YY_NULLPTR
557 };
558 #endif
559
560 # ifdef YYPRINT
561 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
562    (internal) symbol number NUM (which must be that of a token).  */
563 static const yytype_uint16 yytoknum[] =
564 {
565        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
566      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
567      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
568      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
569      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
570      305,   306,   307,   308
571 };
572 # endif
573
574 #define YYPACT_NINF -107
575
576 #define yypact_value_is_default(Yystate) \
577   (!!((Yystate) == (-107)))
578
579 #define YYTABLE_NINF -4
580
581 #define yytable_value_is_error(Yytable_value) \
582   0
583
584   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
585      STATE-NUM.  */
586 static const yytype_int16 yypact[] =
587 {
588       -6,    24,    33,  -107,    65,    -7,  -107,    71,    -4,    12,
589       49,    53,    63,    -1,    69,    63,    76,  -107,  -107,  -107,
590     -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
591     -107,  -107,  -107,  -107,  -107,  -107,    25,  -107,  -107,  -107,
592       26,  -107,    46,    47,  -107,    54,  -107,    -1,    -1,   -22,
593     -107,   142,    58,    60,    68,   134,   134,   147,   114,   101,
594        2,   101,    67,  -107,  -107,    72,  -107,  -107,  -107,     5,
595     -107,  -107,    -1,    -1,    44,    44,    44,    44,    44,    44,
596     -107,  -107,  -107,  -107,  -107,  -107,  -107,    66,    73,  -107,
597       63,  -107,    94,   109,    44,    63,  -107,  -107,  -107,   112,
598     -107,    -1,   103,  -107,  -107,    63,    79,   122,   107,  -107,
599      112,  -107,  -107,     8,    88,    92,    93,  -107,  -107,  -107,
600     -107,  -107,   107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
601       97,  -107,  -107,  -107,  -107,  -107,  -107,  -107,    -1,  -107,
602      107,    95,    96,   102,   107,    44,   107,   107,   105,    41,
603     -107,   107,  -107,   107,    -1,   118,   119,  -107,  -107,  -107,
604      120,    17,   124,  -107,  -107,  -107,   128,   107,   130,  -107,
605     -107,   133,   135,   136,    11,  -107,  -107,  -107,  -107,  -107,
606     -107,   138,  -107,  -107,  -107,  -107,  -107
607 };
608
609   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
610      Performed when YYTABLE does not specify something else to do.  Zero
611      means the default is an error.  */
612 static const yytype_uint8 yydefact[] =
613 {
614        5,     0,     0,     5,     0,     0,     1,     0,     0,     0,
615       98,     0,     0,     0,     0,     0,     0,     6,    21,    13,
616       21,    14,    38,    56,     7,     5,    11,    65,     5,     8,
617       15,    71,    12,    16,     4,    10,     0,   102,   103,   101,
618      104,    99,     0,     0,    95,     0,    97,     0,     0,     0,
619       96,    84,     0,     0,     0,    18,    20,    35,     0,     0,
620       62,     0,    70,     9,   105,     0,    34,    69,    17,     0,
621       92,    58,     0,     0,     0,     0,     0,     0,     0,     0,
622       61,    19,    68,    51,    53,    54,    55,     0,     0,    49,
623        0,    48,     0,     0,     0,     0,    50,    52,    22,    77,
624       47,     0,     0,    24,    23,     0,     0,     0,    82,    39,
625       77,    41,    40,     0,     0,     0,     0,    57,    37,    36,
626       60,    59,    82,    67,    66,    64,    63,    72,   100,    91,
627       93,    94,    89,    90,    85,    86,    87,    88,     0,    73,
628       82,     0,     0,     0,    82,     0,    82,    82,     0,    82,
629       74,    82,    44,    82,     0,     0,     0,    80,    81,    79,
630        0,     0,     0,    33,    32,    31,     0,    82,     0,    78,
631       25,     0,     0,     0,    83,    45,    43,    76,    75,    29,
632       26,     0,    28,    27,    46,    42,    30
633 };
634
635   /* YYPGOTO[NTERM-NUM].  */
636 static const yytype_int8 yypgoto[] =
637 {
638     -107,  -107,  -107,     3,    86,  -107,  -107,  -107,  -107,   126,
639     -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,   100,  -107,
640     -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
641     -107,  -107,  -107,  -107,   108,   -25,  -107,    42,   -44,  -106,
642      -47,   -10,   -67,  -107,  -107,  -107,  -107
643 };
644
645   /* YYDEFGOTO[NTERM-NUM].  */
646 static const yytype_int16 yydefgoto[] =
647 {
648       -1,     2,     3,     4,    17,    18,    19,    20,    21,    55,
649       98,    22,    23,   118,    24,    57,   109,    99,   100,   101,
650       58,    25,   120,    26,    27,    28,   125,    29,    60,    30,
651       31,    32,    62,   102,   103,   104,   124,   148,   119,   155,
652       49,    50,    51,    42,    33,    40,    65
653 };
654
655   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
656      positive, shift that token.  If negative, reduce the rule whose
657      number is the opposite.  If YYTABLE_NINF, syntax error.  */
658 static const yytype_int16 yytable[] =
659 {
660       69,    70,    45,    44,    46,    53,     7,   132,   133,   134,
661      135,   136,   137,    36,   129,   121,   160,   126,    37,    87,
662        1,    71,    37,    72,    73,   130,   131,   145,    59,     5,
663       47,    61,   112,     6,   162,   123,    34,   127,   166,    35,
664      168,   169,    38,   171,   122,   172,    38,   173,    44,    46,
665       72,    73,    48,    41,   149,    39,    72,    73,    43,    39,
666      178,   181,    72,    73,   154,    -3,     8,    44,    63,     9,
667       64,    -2,     8,    10,    52,     9,    11,    12,   167,    10,
668      140,    54,    11,    12,    87,   146,    72,    73,    13,    66,
669       67,   161,    14,    15,    13,   151,   138,    68,    14,    15,
670      141,    80,     8,    81,    16,     9,   150,   174,   142,    10,
671       16,    82,    11,    12,   144,   128,   139,   147,   113,   114,
672      115,   116,   152,   143,    13,    11,    12,   153,    14,    15,
673      154,   157,   114,   115,   116,   158,   159,    13,   163,   164,
674       16,    83,    15,    73,   117,   165,    56,    84,   170,    85,
675       86,    87,   156,    16,    83,    88,    89,   110,    90,    91,
676      105,   175,   176,   177,    87,   111,    92,   179,    88,    93,
677       94,   180,    95,   182,    96,    97,   183,     0,   184,   185,
678      106,   186,   107,     0,   108,     0,     0,     0,    97,    74,
679       75,    76,    77,    78,    79
680 };
681
682 static const yytype_int16 yycheck[] =
683 {
684       47,    48,    12,     4,     5,    15,     3,    74,    75,    76,
685       77,    78,    79,     1,     9,    59,   122,    61,    10,    17,
686       26,    43,    10,    45,    46,    72,    73,    94,    25,     5,
687       31,    28,    57,     0,   140,    60,    43,    62,   144,    43,
688      146,   147,    34,   149,    42,   151,    34,   153,     4,     5,
689       45,    46,    53,     4,   101,    47,    45,    46,     5,    47,
690       43,   167,    45,    46,    23,     0,     1,     4,    43,     4,
691       44,     0,     1,     8,     5,     4,    11,    12,   145,     8,
692       90,     5,    11,    12,    17,    95,    45,    46,    23,    43,
693       43,   138,    27,    28,    23,   105,    30,    43,    27,    28,
694        6,    43,     1,    43,    39,     4,     3,   154,    14,     8,
695       39,    43,    11,    12,     5,    43,    43,     5,     4,    18,
696       19,    20,    43,    29,    23,    11,    12,     5,    27,    28,
697       23,    43,    18,    19,    20,    43,    43,    23,    43,    43,
698       39,     7,    28,    46,    58,    43,    20,    13,    43,    15,
699       16,    17,   110,    39,     7,    21,    22,    57,    24,    25,
700       13,    43,    43,    43,    17,    57,    32,    43,    21,    35,
701       36,    43,    38,    43,    40,    41,    43,    -1,    43,    43,
702       33,    43,    35,    -1,    37,    -1,    -1,    -1,    41,    47,
703       48,    49,    50,    51,    52
704 };
705
706   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
707      symbol of state STATE-NUM.  */
708 static const yytype_uint8 yystos[] =
709 {
710        0,    26,    55,    56,    57,     5,     0,    57,     1,     4,
711        8,    11,    12,    23,    27,    28,    39,    58,    59,    60,
712       61,    62,    65,    66,    68,    75,    77,    78,    79,    81,
713       83,    84,    85,    98,    43,    43,     1,    10,    34,    47,
714       99,     4,    97,     5,     4,    95,     5,    31,    53,    94,
715       95,    96,     5,    95,     5,    63,    63,    69,    74,    57,
716       82,    57,    86,    43,    44,   100,    43,    43,    43,    94,
717       94,    43,    45,    46,    47,    48,    49,    50,    51,    52,
718       43,    43,    43,     7,    13,    15,    16,    17,    21,    22,
719       24,    25,    32,    35,    36,    38,    40,    41,    64,    71,
720       72,    73,    87,    88,    89,    13,    33,    35,    37,    70,
721       72,    88,    89,     4,    18,    19,    20,    58,    67,    92,
722       76,    92,    42,    89,    90,    80,    92,    89,    43,     9,
723       94,    94,    96,    96,    96,    96,    96,    96,    30,    43,
724       95,     6,    14,    29,     5,    96,    95,     5,    91,    94,
725        3,    95,    43,     5,    23,    93,    91,    43,    43,    43,
726       93,    94,    93,    43,    43,    43,    93,    96,    93,    93,
727       43,    93,    93,    93,    94,    43,    43,    43,    43,    43,
728       43,    93,    43,    43,    43,    43,    43
729 };
730
731   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
732 static const yytype_uint8 yyr1[] =
733 {
734        0,    54,    55,    55,    56,    57,    57,    57,    57,    57,
735       57,    58,    58,    58,    58,    58,    58,    59,    60,    61,
736       62,    63,    63,    63,    63,    64,    64,    64,    64,    64,
737       64,    64,    64,    64,    65,    66,    67,    68,    69,    69,
738       69,    69,    70,    70,    70,    70,    70,    71,    71,    71,
739       71,    72,    72,    73,    73,    73,    74,    74,    75,    76,
740       77,    78,    79,    80,    81,    82,    82,    82,    83,    84,
741       85,    86,    86,    87,    88,    89,    90,    91,    91,    92,
742       92,    92,    93,    93,    94,    94,    94,    94,    94,    94,
743       94,    94,    94,    94,    94,    95,    96,    96,    97,    97,
744       98,    99,    99,    99,   100,   100
745 };
746
747   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
748 static const yytype_uint8 yyr2[] =
749 {
750        0,     2,     2,     1,     3,     0,     2,     2,     2,     4,
751        3,     1,     1,     1,     1,     1,     1,     3,     2,     3,
752        2,     0,     2,     2,     2,     3,     4,     4,     4,     4,
753        5,     3,     3,     3,     3,     2,     1,     3,     0,     2,
754        2,     2,     4,     3,     2,     3,     4,     1,     1,     1,
755        1,     1,     1,     1,     1,     1,     0,     2,     3,     1,
756        3,     3,     2,     1,     3,     0,     2,     2,     3,     3,
757        2,     0,     2,     2,     2,     4,     3,     0,     2,     2,
758        2,     2,     0,     2,     1,     3,     3,     3,     3,     3,
759        3,     3,     2,     3,     3,     1,     1,     1,     0,     1,
760        4,     1,     1,     1,     0,     1
761 };
762
763
764 #define yyerrok         (yyerrstatus = 0)
765 #define yyclearin       (yychar = YYEMPTY)
766 #define YYEMPTY         (-2)
767 #define YYEOF           0
768
769 #define YYACCEPT        goto yyacceptlab
770 #define YYABORT         goto yyabortlab
771 #define YYERROR         goto yyerrorlab
772
773
774 #define YYRECOVERING()  (!!yyerrstatus)
775
776 #define YYBACKUP(Token, Value)                                  \
777 do                                                              \
778   if (yychar == YYEMPTY)                                        \
779     {                                                           \
780       yychar = (Token);                                         \
781       yylval = (Value);                                         \
782       YYPOPSTACK (yylen);                                       \
783       yystate = *yyssp;                                         \
784       goto yybackup;                                            \
785     }                                                           \
786   else                                                          \
787     {                                                           \
788       yyerror (YY_("syntax error: cannot back up")); \
789       YYERROR;                                                  \
790     }                                                           \
791 while (0)
792
793 /* Error token number */
794 #define YYTERROR        1
795 #define YYERRCODE       256
796
797
798
799 /* Enable debugging if requested.  */
800 #if YYDEBUG
801
802 # ifndef YYFPRINTF
803 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
804 #  define YYFPRINTF fprintf
805 # endif
806
807 # define YYDPRINTF(Args)                        \
808 do {                                            \
809   if (yydebug)                                  \
810     YYFPRINTF Args;                             \
811 } while (0)
812
813 /* This macro is provided for backward compatibility. */
814 #ifndef YY_LOCATION_PRINT
815 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
816 #endif
817
818
819 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
820 do {                                                                      \
821   if (yydebug)                                                            \
822     {                                                                     \
823       YYFPRINTF (stderr, "%s ", Title);                                   \
824       yy_symbol_print (stderr,                                            \
825                   Type, Value); \
826       YYFPRINTF (stderr, "\n");                                           \
827     }                                                                     \
828 } while (0)
829
830
831 /*----------------------------------------.
832 | Print this symbol's value on YYOUTPUT.  |
833 `----------------------------------------*/
834
835 static void
836 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
837 {
838   FILE *yyo = yyoutput;
839   YYUSE (yyo);
840   if (!yyvaluep)
841     return;
842 # ifdef YYPRINT
843   if (yytype < YYNTOKENS)
844     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
845 # endif
846   YYUSE (yytype);
847 }
848
849
850 /*--------------------------------.
851 | Print this symbol on YYOUTPUT.  |
852 `--------------------------------*/
853
854 static void
855 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
856 {
857   YYFPRINTF (yyoutput, "%s %s (",
858              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
859
860   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
861   YYFPRINTF (yyoutput, ")");
862 }
863
864 /*------------------------------------------------------------------.
865 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
866 | TOP (included).                                                   |
867 `------------------------------------------------------------------*/
868
869 static void
870 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
871 {
872   YYFPRINTF (stderr, "Stack now");
873   for (; yybottom <= yytop; yybottom++)
874     {
875       int yybot = *yybottom;
876       YYFPRINTF (stderr, " %d", yybot);
877     }
878   YYFPRINTF (stderr, "\n");
879 }
880
881 # define YY_STACK_PRINT(Bottom, Top)                            \
882 do {                                                            \
883   if (yydebug)                                                  \
884     yy_stack_print ((Bottom), (Top));                           \
885 } while (0)
886
887
888 /*------------------------------------------------.
889 | Report that the YYRULE is going to be reduced.  |
890 `------------------------------------------------*/
891
892 static void
893 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
894 {
895   unsigned long yylno = yyrline[yyrule];
896   int yynrhs = yyr2[yyrule];
897   int yyi;
898   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
899              yyrule - 1, yylno);
900   /* The symbols being reduced.  */
901   for (yyi = 0; yyi < yynrhs; yyi++)
902     {
903       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
904       yy_symbol_print (stderr,
905                        yystos[yyssp[yyi + 1 - yynrhs]],
906                        &(yyvsp[(yyi + 1) - (yynrhs)])
907                                               );
908       YYFPRINTF (stderr, "\n");
909     }
910 }
911
912 # define YY_REDUCE_PRINT(Rule)          \
913 do {                                    \
914   if (yydebug)                          \
915     yy_reduce_print (yyssp, yyvsp, Rule); \
916 } while (0)
917
918 /* Nonzero means print parse trace.  It is left uninitialized so that
919    multiple parsers can coexist.  */
920 int yydebug;
921 #else /* !YYDEBUG */
922 # define YYDPRINTF(Args)
923 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
924 # define YY_STACK_PRINT(Bottom, Top)
925 # define YY_REDUCE_PRINT(Rule)
926 #endif /* !YYDEBUG */
927
928
929 /* YYINITDEPTH -- initial size of the parser's stacks.  */
930 #ifndef YYINITDEPTH
931 # define YYINITDEPTH 200
932 #endif
933
934 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
935    if the built-in stack extension method is used).
936
937    Do not make this value too large; the results are undefined if
938    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
939    evaluated with infinite-precision integer arithmetic.  */
940
941 #ifndef YYMAXDEPTH
942 # define YYMAXDEPTH 10000
943 #endif
944
945
946 #if YYERROR_VERBOSE
947
948 # ifndef yystrlen
949 #  if defined __GLIBC__ && defined _STRING_H
950 #   define yystrlen strlen
951 #  else
952 /* Return the length of YYSTR.  */
953 static YYSIZE_T
954 yystrlen (const char *yystr)
955 {
956   YYSIZE_T yylen;
957   for (yylen = 0; yystr[yylen]; yylen++)
958     continue;
959   return yylen;
960 }
961 #  endif
962 # endif
963
964 # ifndef yystpcpy
965 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
966 #   define yystpcpy stpcpy
967 #  else
968 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
969    YYDEST.  */
970 static char *
971 yystpcpy (char *yydest, const char *yysrc)
972 {
973   char *yyd = yydest;
974   const char *yys = yysrc;
975
976   while ((*yyd++ = *yys++) != '\0')
977     continue;
978
979   return yyd - 1;
980 }
981 #  endif
982 # endif
983
984 # ifndef yytnamerr
985 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
986    quotes and backslashes, so that it's suitable for yyerror.  The
987    heuristic is that double-quoting is unnecessary unless the string
988    contains an apostrophe, a comma, or backslash (other than
989    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
990    null, do not copy; instead, return the length of what the result
991    would have been.  */
992 static YYSIZE_T
993 yytnamerr (char *yyres, const char *yystr)
994 {
995   if (*yystr == '"')
996     {
997       YYSIZE_T yyn = 0;
998       char const *yyp = yystr;
999
1000       for (;;)
1001         switch (*++yyp)
1002           {
1003           case '\'':
1004           case ',':
1005             goto do_not_strip_quotes;
1006
1007           case '\\':
1008             if (*++yyp != '\\')
1009               goto do_not_strip_quotes;
1010             /* Fall through.  */
1011           default:
1012             if (yyres)
1013               yyres[yyn] = *yyp;
1014             yyn++;
1015             break;
1016
1017           case '"':
1018             if (yyres)
1019               yyres[yyn] = '\0';
1020             return yyn;
1021           }
1022     do_not_strip_quotes: ;
1023     }
1024
1025   if (! yyres)
1026     return yystrlen (yystr);
1027
1028   return yystpcpy (yyres, yystr) - yyres;
1029 }
1030 # endif
1031
1032 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1033    about the unexpected token YYTOKEN for the state stack whose top is
1034    YYSSP.
1035
1036    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1037    not large enough to hold the message.  In that case, also set
1038    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1039    required number of bytes is too large to store.  */
1040 static int
1041 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1042                 yytype_int16 *yyssp, int yytoken)
1043 {
1044   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1045   YYSIZE_T yysize = yysize0;
1046   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1047   /* Internationalized format string. */
1048   const char *yyformat = YY_NULLPTR;
1049   /* Arguments of yyformat. */
1050   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1051   /* Number of reported tokens (one for the "unexpected", one per
1052      "expected"). */
1053   int yycount = 0;
1054
1055   /* There are many possibilities here to consider:
1056      - If this state is a consistent state with a default action, then
1057        the only way this function was invoked is if the default action
1058        is an error action.  In that case, don't check for expected
1059        tokens because there are none.
1060      - The only way there can be no lookahead present (in yychar) is if
1061        this state is a consistent state with a default action.  Thus,
1062        detecting the absence of a lookahead is sufficient to determine
1063        that there is no unexpected or expected token to report.  In that
1064        case, just report a simple "syntax error".
1065      - Don't assume there isn't a lookahead just because this state is a
1066        consistent state with a default action.  There might have been a
1067        previous inconsistent state, consistent state with a non-default
1068        action, or user semantic action that manipulated yychar.
1069      - Of course, the expected token list depends on states to have
1070        correct lookahead information, and it depends on the parser not
1071        to perform extra reductions after fetching a lookahead from the
1072        scanner and before detecting a syntax error.  Thus, state merging
1073        (from LALR or IELR) and default reductions corrupt the expected
1074        token list.  However, the list is correct for canonical LR with
1075        one exception: it will still contain any token that will not be
1076        accepted due to an error action in a later state.
1077   */
1078   if (yytoken != YYEMPTY)
1079     {
1080       int yyn = yypact[*yyssp];
1081       yyarg[yycount++] = yytname[yytoken];
1082       if (!yypact_value_is_default (yyn))
1083         {
1084           /* Start YYX at -YYN if negative to avoid negative indexes in
1085              YYCHECK.  In other words, skip the first -YYN actions for
1086              this state because they are default actions.  */
1087           int yyxbegin = yyn < 0 ? -yyn : 0;
1088           /* Stay within bounds of both yycheck and yytname.  */
1089           int yychecklim = YYLAST - yyn + 1;
1090           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1091           int yyx;
1092
1093           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1094             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1095                 && !yytable_value_is_error (yytable[yyx + yyn]))
1096               {
1097                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1098                   {
1099                     yycount = 1;
1100                     yysize = yysize0;
1101                     break;
1102                   }
1103                 yyarg[yycount++] = yytname[yyx];
1104                 {
1105                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1106                   if (! (yysize <= yysize1
1107                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1108                     return 2;
1109                   yysize = yysize1;
1110                 }
1111               }
1112         }
1113     }
1114
1115   switch (yycount)
1116     {
1117 # define YYCASE_(N, S)                      \
1118       case N:                               \
1119         yyformat = S;                       \
1120       break
1121     default: /* Avoid compiler warnings. */
1122       YYCASE_(0, YY_("syntax error"));
1123       YYCASE_(1, YY_("syntax error, unexpected %s"));
1124       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1125       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1126       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1127       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1128 # undef YYCASE_
1129     }
1130
1131   {
1132     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1133     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1134       return 2;
1135     yysize = yysize1;
1136   }
1137
1138   if (*yymsg_alloc < yysize)
1139     {
1140       *yymsg_alloc = 2 * yysize;
1141       if (! (yysize <= *yymsg_alloc
1142              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1143         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1144       return 1;
1145     }
1146
1147   /* Avoid sprintf, as that infringes on the user's name space.
1148      Don't have undefined behavior even if the translation
1149      produced a string with the wrong number of "%s"s.  */
1150   {
1151     char *yyp = *yymsg;
1152     int yyi = 0;
1153     while ((*yyp = *yyformat) != '\0')
1154       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1155         {
1156           yyp += yytnamerr (yyp, yyarg[yyi++]);
1157           yyformat += 2;
1158         }
1159       else
1160         {
1161           yyp++;
1162           yyformat++;
1163         }
1164   }
1165   return 0;
1166 }
1167 #endif /* YYERROR_VERBOSE */
1168
1169 /*-----------------------------------------------.
1170 | Release the memory associated to this symbol.  |
1171 `-----------------------------------------------*/
1172
1173 static void
1174 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1175 {
1176   YYUSE (yyvaluep);
1177   if (!yymsg)
1178     yymsg = "Deleting";
1179   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1180
1181   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1182   switch (yytype)
1183     {
1184           case 66: /* choice_entry  */
1185
1186       {
1187         fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1188                 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1189         if (current_menu == ((*yyvaluep).menu))
1190                 menu_end_menu();
1191 }
1192
1193         break;
1194
1195     case 75: /* if_entry  */
1196
1197       {
1198         fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1199                 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1200         if (current_menu == ((*yyvaluep).menu))
1201                 menu_end_menu();
1202 }
1203
1204         break;
1205
1206     case 79: /* menu_entry  */
1207
1208       {
1209         fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1210                 ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno);
1211         if (current_menu == ((*yyvaluep).menu))
1212                 menu_end_menu();
1213 }
1214
1215         break;
1216
1217
1218       default:
1219         break;
1220     }
1221   YY_IGNORE_MAYBE_UNINITIALIZED_END
1222 }
1223
1224
1225
1226
1227 /* The lookahead symbol.  */
1228 int yychar;
1229
1230 /* The semantic value of the lookahead symbol.  */
1231 YYSTYPE yylval;
1232 /* Number of syntax errors so far.  */
1233 int yynerrs;
1234
1235
1236 /*----------.
1237 | yyparse.  |
1238 `----------*/
1239
1240 int
1241 yyparse (void)
1242 {
1243     int yystate;
1244     /* Number of tokens to shift before error messages enabled.  */
1245     int yyerrstatus;
1246
1247     /* The stacks and their tools:
1248        'yyss': related to states.
1249        'yyvs': related to semantic values.
1250
1251        Refer to the stacks through separate pointers, to allow yyoverflow
1252        to reallocate them elsewhere.  */
1253
1254     /* The state stack.  */
1255     yytype_int16 yyssa[YYINITDEPTH];
1256     yytype_int16 *yyss;
1257     yytype_int16 *yyssp;
1258
1259     /* The semantic value stack.  */
1260     YYSTYPE yyvsa[YYINITDEPTH];
1261     YYSTYPE *yyvs;
1262     YYSTYPE *yyvsp;
1263
1264     YYSIZE_T yystacksize;
1265
1266   int yyn;
1267   int yyresult;
1268   /* Lookahead token as an internal (translated) token number.  */
1269   int yytoken = 0;
1270   /* The variables used to return semantic value and location from the
1271      action routines.  */
1272   YYSTYPE yyval;
1273
1274 #if YYERROR_VERBOSE
1275   /* Buffer for error messages, and its allocated size.  */
1276   char yymsgbuf[128];
1277   char *yymsg = yymsgbuf;
1278   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1279 #endif
1280
1281 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1282
1283   /* The number of symbols on the RHS of the reduced rule.
1284      Keep to zero when no symbol should be popped.  */
1285   int yylen = 0;
1286
1287   yyssp = yyss = yyssa;
1288   yyvsp = yyvs = yyvsa;
1289   yystacksize = YYINITDEPTH;
1290
1291   YYDPRINTF ((stderr, "Starting parse\n"));
1292
1293   yystate = 0;
1294   yyerrstatus = 0;
1295   yynerrs = 0;
1296   yychar = YYEMPTY; /* Cause a token to be read.  */
1297   goto yysetstate;
1298
1299 /*------------------------------------------------------------.
1300 | yynewstate -- Push a new state, which is found in yystate.  |
1301 `------------------------------------------------------------*/
1302  yynewstate:
1303   /* In all cases, when you get here, the value and location stacks
1304      have just been pushed.  So pushing a state here evens the stacks.  */
1305   yyssp++;
1306
1307  yysetstate:
1308   *yyssp = yystate;
1309
1310   if (yyss + yystacksize - 1 <= yyssp)
1311     {
1312       /* Get the current used size of the three stacks, in elements.  */
1313       YYSIZE_T yysize = yyssp - yyss + 1;
1314
1315 #ifdef yyoverflow
1316       {
1317         /* Give user a chance to reallocate the stack.  Use copies of
1318            these so that the &'s don't force the real ones into
1319            memory.  */
1320         YYSTYPE *yyvs1 = yyvs;
1321         yytype_int16 *yyss1 = yyss;
1322
1323         /* Each stack pointer address is followed by the size of the
1324            data in use in that stack, in bytes.  This used to be a
1325            conditional around just the two extra args, but that might
1326            be undefined if yyoverflow is a macro.  */
1327         yyoverflow (YY_("memory exhausted"),
1328                     &yyss1, yysize * sizeof (*yyssp),
1329                     &yyvs1, yysize * sizeof (*yyvsp),
1330                     &yystacksize);
1331
1332         yyss = yyss1;
1333         yyvs = yyvs1;
1334       }
1335 #else /* no yyoverflow */
1336 # ifndef YYSTACK_RELOCATE
1337       goto yyexhaustedlab;
1338 # else
1339       /* Extend the stack our own way.  */
1340       if (YYMAXDEPTH <= yystacksize)
1341         goto yyexhaustedlab;
1342       yystacksize *= 2;
1343       if (YYMAXDEPTH < yystacksize)
1344         yystacksize = YYMAXDEPTH;
1345
1346       {
1347         yytype_int16 *yyss1 = yyss;
1348         union yyalloc *yyptr =
1349           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1350         if (! yyptr)
1351           goto yyexhaustedlab;
1352         YYSTACK_RELOCATE (yyss_alloc, yyss);
1353         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1354 #  undef YYSTACK_RELOCATE
1355         if (yyss1 != yyssa)
1356           YYSTACK_FREE (yyss1);
1357       }
1358 # endif
1359 #endif /* no yyoverflow */
1360
1361       yyssp = yyss + yysize - 1;
1362       yyvsp = yyvs + yysize - 1;
1363
1364       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1365                   (unsigned long) yystacksize));
1366
1367       if (yyss + yystacksize - 1 <= yyssp)
1368         YYABORT;
1369     }
1370
1371   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1372
1373   if (yystate == YYFINAL)
1374     YYACCEPT;
1375
1376   goto yybackup;
1377
1378 /*-----------.
1379 | yybackup.  |
1380 `-----------*/
1381 yybackup:
1382
1383   /* Do appropriate processing given the current state.  Read a
1384      lookahead token if we need one and don't already have one.  */
1385
1386   /* First try to decide what to do without reference to lookahead token.  */
1387   yyn = yypact[yystate];
1388   if (yypact_value_is_default (yyn))
1389     goto yydefault;
1390
1391   /* Not known => get a lookahead token if don't already have one.  */
1392
1393   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1394   if (yychar == YYEMPTY)
1395     {
1396       YYDPRINTF ((stderr, "Reading a token: "));
1397       yychar = yylex ();
1398     }
1399
1400   if (yychar <= YYEOF)
1401     {
1402       yychar = yytoken = YYEOF;
1403       YYDPRINTF ((stderr, "Now at end of input.\n"));
1404     }
1405   else
1406     {
1407       yytoken = YYTRANSLATE (yychar);
1408       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1409     }
1410
1411   /* If the proper action on seeing token YYTOKEN is to reduce or to
1412      detect an error, take that action.  */
1413   yyn += yytoken;
1414   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1415     goto yydefault;
1416   yyn = yytable[yyn];
1417   if (yyn <= 0)
1418     {
1419       if (yytable_value_is_error (yyn))
1420         goto yyerrlab;
1421       yyn = -yyn;
1422       goto yyreduce;
1423     }
1424
1425   /* Count tokens shifted since error; after three, turn off error
1426      status.  */
1427   if (yyerrstatus)
1428     yyerrstatus--;
1429
1430   /* Shift the lookahead token.  */
1431   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1432
1433   /* Discard the shifted token.  */
1434   yychar = YYEMPTY;
1435
1436   yystate = yyn;
1437   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1438   *++yyvsp = yylval;
1439   YY_IGNORE_MAYBE_UNINITIALIZED_END
1440
1441   goto yynewstate;
1442
1443
1444 /*-----------------------------------------------------------.
1445 | yydefault -- do the default action for the current state.  |
1446 `-----------------------------------------------------------*/
1447 yydefault:
1448   yyn = yydefact[yystate];
1449   if (yyn == 0)
1450     goto yyerrlab;
1451   goto yyreduce;
1452
1453
1454 /*-----------------------------.
1455 | yyreduce -- Do a reduction.  |
1456 `-----------------------------*/
1457 yyreduce:
1458   /* yyn is the number of a rule to reduce with.  */
1459   yylen = yyr2[yyn];
1460
1461   /* If YYLEN is nonzero, implement the default value of the action:
1462      '$$ = $1'.
1463
1464      Otherwise, the following line sets YYVAL to garbage.
1465      This behavior is undocumented and Bison
1466      users should not rely upon it.  Assigning to YYVAL
1467      unconditionally makes the parser a bit smaller, and it avoids a
1468      GCC warning that YYVAL may be used uninitialized.  */
1469   yyval = yyvsp[1-yylen];
1470
1471
1472   YY_REDUCE_PRINT (yyn);
1473   switch (yyn)
1474     {
1475         case 4:
1476
1477     {
1478         menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1479 }
1480
1481     break;
1482
1483   case 9:
1484
1485     { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); }
1486
1487     break;
1488
1489   case 10:
1490
1491     { zconf_error("invalid statement"); }
1492
1493     break;
1494
1495   case 17:
1496
1497     {
1498         (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL;
1499         menu_add_entry((yyvsp[-1].symbol));
1500         printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name);
1501 }
1502
1503     break;
1504
1505   case 18:
1506
1507     {
1508         printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1509 }
1510
1511     break;
1512
1513   case 19:
1514
1515     {
1516         (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL;
1517         menu_add_entry((yyvsp[-1].symbol));
1518         printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name);
1519 }
1520
1521     break;
1522
1523   case 20:
1524
1525     {
1526         if (current_entry->prompt)
1527                 current_entry->prompt->type = P_MENU;
1528         else
1529                 zconfprint("warning: menuconfig statement without prompt");
1530         printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1531 }
1532
1533     break;
1534
1535   case 25:
1536
1537     {
1538         menu_set_type((yyvsp[-2].type));
1539         printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1540                 zconf_curname(), zconf_lineno(),
1541                 (yyvsp[-2].type));
1542 }
1543
1544     break;
1545
1546   case 26:
1547
1548     {
1549         menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1550         printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1551 }
1552
1553     break;
1554
1555   case 27:
1556
1557     {
1558         menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
1559         if ((yyvsp[-3].type) != S_UNKNOWN)
1560                 menu_set_type((yyvsp[-3].type));
1561         printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
1562                 zconf_curname(), zconf_lineno(),
1563                 (yyvsp[-3].type));
1564 }
1565
1566     break;
1567
1568   case 28:
1569
1570     {
1571         menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1572         printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1573 }
1574
1575     break;
1576
1577   case 29:
1578
1579     {
1580         menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1581         printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1582 }
1583
1584     break;
1585
1586   case 30:
1587
1588     {
1589         menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
1590         printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
1591 }
1592
1593     break;
1594
1595   case 31:
1596
1597     {
1598         menu_add_option_modules();
1599 }
1600
1601     break;
1602
1603   case 32:
1604
1605     {
1606         menu_add_option_defconfig_list();
1607 }
1608
1609     break;
1610
1611   case 33:
1612
1613     {
1614         menu_add_option_allnoconfig_y();
1615 }
1616
1617     break;
1618
1619   case 34:
1620
1621     {
1622         struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE);
1623         sym->flags |= SYMBOL_NO_WRITE;
1624         menu_add_entry(sym);
1625         menu_add_expr(P_CHOICE, NULL, NULL);
1626         free((yyvsp[-1].string));
1627         printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
1628 }
1629
1630     break;
1631
1632   case 35:
1633
1634     {
1635         (yyval.menu) = menu_add_menu();
1636 }
1637
1638     break;
1639
1640   case 36:
1641
1642     {
1643         if (zconf_endtoken((yyvsp[0].string), "choice")) {
1644                 menu_end_menu();
1645                 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1646         }
1647 }
1648
1649     break;
1650
1651   case 42:
1652
1653     {
1654         menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1655         printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1656 }
1657
1658     break;
1659
1660   case 43:
1661
1662     {
1663         menu_set_type((yyvsp[-2].type));
1664         printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
1665                zconf_curname(), zconf_lineno(), (yyvsp[-2].type));
1666 }
1667
1668     break;
1669
1670   case 44:
1671
1672     {
1673         current_entry->sym->flags |= SYMBOL_OPTIONAL;
1674         printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1675 }
1676
1677     break;
1678
1679   case 45:
1680
1681     {
1682         menu_add_prop(P_RESET, NULL, (yyvsp[-1].expr));
1683 }
1684
1685     break;
1686
1687   case 46:
1688
1689     {
1690         menu_add_symbol(P_DEFAULT, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1691         printd(DEBUG_PARSE, "%s:%d:default\n",
1692                zconf_curname(), zconf_lineno());
1693 }
1694
1695     break;
1696
1697   case 48:
1698
1699     { (yyval.type) = S_INT; }
1700
1701     break;
1702
1703   case 49:
1704
1705     { (yyval.type) = S_HEX; }
1706
1707     break;
1708
1709   case 50:
1710
1711     { (yyval.type) = S_STRING; }
1712
1713     break;
1714
1715   case 51:
1716
1717     { (yyval.type) = S_BOOLEAN; }
1718
1719     break;
1720
1721   case 52:
1722
1723     { (yyval.type) = S_TRISTATE; }
1724
1725     break;
1726
1727   case 53:
1728
1729     { (yyval.type) = S_UNKNOWN; }
1730
1731     break;
1732
1733   case 54:
1734
1735     { (yyval.type) = S_BOOLEAN; }
1736
1737     break;
1738
1739   case 55:
1740
1741     { (yyval.type) = S_TRISTATE; }
1742
1743     break;
1744
1745   case 58:
1746
1747     {
1748         printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1749         menu_add_entry(NULL);
1750         menu_add_dep((yyvsp[-1].expr));
1751         (yyval.menu) = menu_add_menu();
1752 }
1753
1754     break;
1755
1756   case 59:
1757
1758     {
1759         if (zconf_endtoken((yyvsp[0].string), "if")) {
1760                 menu_end_menu();
1761                 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1762         }
1763 }
1764
1765     break;
1766
1767   case 61:
1768
1769     {
1770         menu_add_entry(NULL);
1771         menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1772         printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
1773 }
1774
1775     break;
1776
1777   case 62:
1778
1779     {
1780         (yyval.menu) = menu_add_menu();
1781 }
1782
1783     break;
1784
1785   case 63:
1786
1787     {
1788         if (zconf_endtoken((yyvsp[0].string), "menu")) {
1789                 menu_end_menu();
1790                 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1791         }
1792 }
1793
1794     break;
1795
1796   case 68:
1797
1798     {
1799         printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1800         zconf_nextfile((yyvsp[-1].string));
1801         free((yyvsp[-1].string));
1802 }
1803
1804     break;
1805
1806   case 69:
1807
1808     {
1809         menu_add_entry(NULL);
1810         menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL);
1811         printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
1812 }
1813
1814     break;
1815
1816   case 73:
1817
1818     {
1819         printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1820         zconf_starthelp();
1821 }
1822
1823     break;
1824
1825   case 74:
1826
1827     {
1828         /* Is the help text empty or all whitespace? */
1829         if ((yyvsp[0].string)[strspn((yyvsp[0].string), " \f\n\r\t\v")] == '\0')
1830                 zconfprint("warning: '%s' defined with blank help text",
1831                            current_entry->sym->name ?: "<choice>");
1832
1833         current_entry->help = (yyvsp[0].string);
1834 }
1835
1836     break;
1837
1838   case 75:
1839
1840     {
1841         menu_add_dep((yyvsp[-1].expr));
1842         printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1843 }
1844
1845     break;
1846
1847   case 76:
1848
1849     {
1850         menu_add_visibility((yyvsp[-1].expr));
1851 }
1852
1853     break;
1854
1855   case 78:
1856
1857     {
1858         menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1859 }
1860
1861     break;
1862
1863   case 79:
1864
1865     { (yyval.string) = "menu"; }
1866
1867     break;
1868
1869   case 80:
1870
1871     { (yyval.string) = "choice"; }
1872
1873     break;
1874
1875   case 81:
1876
1877     { (yyval.string) = "if"; }
1878
1879     break;
1880
1881   case 82:
1882
1883     { (yyval.expr) = NULL; }
1884
1885     break;
1886
1887   case 83:
1888
1889     { (yyval.expr) = (yyvsp[0].expr); }
1890
1891     break;
1892
1893   case 84:
1894
1895     { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); }
1896
1897     break;
1898
1899   case 85:
1900
1901     { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1902
1903     break;
1904
1905   case 86:
1906
1907     { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1908
1909     break;
1910
1911   case 87:
1912
1913     { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1914
1915     break;
1916
1917   case 88:
1918
1919     { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1920
1921     break;
1922
1923   case 89:
1924
1925     { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1926
1927     break;
1928
1929   case 90:
1930
1931     { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1932
1933     break;
1934
1935   case 91:
1936
1937     { (yyval.expr) = (yyvsp[-1].expr); }
1938
1939     break;
1940
1941   case 92:
1942
1943     { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); }
1944
1945     break;
1946
1947   case 93:
1948
1949     { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1950
1951     break;
1952
1953   case 94:
1954
1955     { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1956
1957     break;
1958
1959   case 95:
1960
1961     { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); }
1962
1963     break;
1964
1965   case 97:
1966
1967     { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); }
1968
1969     break;
1970
1971   case 98:
1972
1973     { (yyval.string) = NULL; }
1974
1975     break;
1976
1977   case 100:
1978
1979     { variable_add((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[-2].flavor)); free((yyvsp[-3].string)); free((yyvsp[-1].string)); }
1980
1981     break;
1982
1983   case 101:
1984
1985     { (yyval.flavor) = VAR_RECURSIVE; }
1986
1987     break;
1988
1989   case 102:
1990
1991     { (yyval.flavor) = VAR_SIMPLE; }
1992
1993     break;
1994
1995   case 103:
1996
1997     { (yyval.flavor) = VAR_APPEND; }
1998
1999     break;
2000
2001   case 104:
2002
2003     { (yyval.string) = xstrdup(""); }
2004
2005     break;
2006
2007
2008
2009       default: break;
2010     }
2011   /* User semantic actions sometimes alter yychar, and that requires
2012      that yytoken be updated with the new translation.  We take the
2013      approach of translating immediately before every use of yytoken.
2014      One alternative is translating here after every semantic action,
2015      but that translation would be missed if the semantic action invokes
2016      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2017      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2018      incorrect destructor might then be invoked immediately.  In the
2019      case of YYERROR or YYBACKUP, subsequent parser actions might lead
2020      to an incorrect destructor call or verbose syntax error message
2021      before the lookahead is translated.  */
2022   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2023
2024   YYPOPSTACK (yylen);
2025   yylen = 0;
2026   YY_STACK_PRINT (yyss, yyssp);
2027
2028   *++yyvsp = yyval;
2029
2030   /* Now 'shift' the result of the reduction.  Determine what state
2031      that goes to, based on the state we popped back to and the rule
2032      number reduced by.  */
2033
2034   yyn = yyr1[yyn];
2035
2036   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2037   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2038     yystate = yytable[yystate];
2039   else
2040     yystate = yydefgoto[yyn - YYNTOKENS];
2041
2042   goto yynewstate;
2043
2044
2045 /*--------------------------------------.
2046 | yyerrlab -- here on detecting error.  |
2047 `--------------------------------------*/
2048 yyerrlab:
2049   /* Make sure we have latest lookahead translation.  See comments at
2050      user semantic actions for why this is necessary.  */
2051   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2052
2053   /* If not already recovering from an error, report this error.  */
2054   if (!yyerrstatus)
2055     {
2056       ++yynerrs;
2057 #if ! YYERROR_VERBOSE
2058       yyerror (YY_("syntax error"));
2059 #else
2060 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2061                                         yyssp, yytoken)
2062       {
2063         char const *yymsgp = YY_("syntax error");
2064         int yysyntax_error_status;
2065         yysyntax_error_status = YYSYNTAX_ERROR;
2066         if (yysyntax_error_status == 0)
2067           yymsgp = yymsg;
2068         else if (yysyntax_error_status == 1)
2069           {
2070             if (yymsg != yymsgbuf)
2071               YYSTACK_FREE (yymsg);
2072             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2073             if (!yymsg)
2074               {
2075                 yymsg = yymsgbuf;
2076                 yymsg_alloc = sizeof yymsgbuf;
2077                 yysyntax_error_status = 2;
2078               }
2079             else
2080               {
2081                 yysyntax_error_status = YYSYNTAX_ERROR;
2082                 yymsgp = yymsg;
2083               }
2084           }
2085         yyerror (yymsgp);
2086         if (yysyntax_error_status == 2)
2087           goto yyexhaustedlab;
2088       }
2089 # undef YYSYNTAX_ERROR
2090 #endif
2091     }
2092
2093
2094
2095   if (yyerrstatus == 3)
2096     {
2097       /* If just tried and failed to reuse lookahead token after an
2098          error, discard it.  */
2099
2100       if (yychar <= YYEOF)
2101         {
2102           /* Return failure if at end of input.  */
2103           if (yychar == YYEOF)
2104             YYABORT;
2105         }
2106       else
2107         {
2108           yydestruct ("Error: discarding",
2109                       yytoken, &yylval);
2110           yychar = YYEMPTY;
2111         }
2112     }
2113
2114   /* Else will try to reuse lookahead token after shifting the error
2115      token.  */
2116   goto yyerrlab1;
2117
2118
2119 /*---------------------------------------------------.
2120 | yyerrorlab -- error raised explicitly by YYERROR.  |
2121 `---------------------------------------------------*/
2122 yyerrorlab:
2123
2124   /* Pacify compilers like GCC when the user code never invokes
2125      YYERROR and the label yyerrorlab therefore never appears in user
2126      code.  */
2127   if (/*CONSTCOND*/ 0)
2128      goto yyerrorlab;
2129
2130   /* Do not reclaim the symbols of the rule whose action triggered
2131      this YYERROR.  */
2132   YYPOPSTACK (yylen);
2133   yylen = 0;
2134   YY_STACK_PRINT (yyss, yyssp);
2135   yystate = *yyssp;
2136   goto yyerrlab1;
2137
2138
2139 /*-------------------------------------------------------------.
2140 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2141 `-------------------------------------------------------------*/
2142 yyerrlab1:
2143   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2144
2145   for (;;)
2146     {
2147       yyn = yypact[yystate];
2148       if (!yypact_value_is_default (yyn))
2149         {
2150           yyn += YYTERROR;
2151           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2152             {
2153               yyn = yytable[yyn];
2154               if (0 < yyn)
2155                 break;
2156             }
2157         }
2158
2159       /* Pop the current state because it cannot handle the error token.  */
2160       if (yyssp == yyss)
2161         YYABORT;
2162
2163
2164       yydestruct ("Error: popping",
2165                   yystos[yystate], yyvsp);
2166       YYPOPSTACK (1);
2167       yystate = *yyssp;
2168       YY_STACK_PRINT (yyss, yyssp);
2169     }
2170
2171   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2172   *++yyvsp = yylval;
2173   YY_IGNORE_MAYBE_UNINITIALIZED_END
2174
2175
2176   /* Shift the error token.  */
2177   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2178
2179   yystate = yyn;
2180   goto yynewstate;
2181
2182
2183 /*-------------------------------------.
2184 | yyacceptlab -- YYACCEPT comes here.  |
2185 `-------------------------------------*/
2186 yyacceptlab:
2187   yyresult = 0;
2188   goto yyreturn;
2189
2190 /*-----------------------------------.
2191 | yyabortlab -- YYABORT comes here.  |
2192 `-----------------------------------*/
2193 yyabortlab:
2194   yyresult = 1;
2195   goto yyreturn;
2196
2197 #if !defined yyoverflow || YYERROR_VERBOSE
2198 /*-------------------------------------------------.
2199 | yyexhaustedlab -- memory exhaustion comes here.  |
2200 `-------------------------------------------------*/
2201 yyexhaustedlab:
2202   yyerror (YY_("memory exhausted"));
2203   yyresult = 2;
2204   /* Fall through.  */
2205 #endif
2206
2207 yyreturn:
2208   if (yychar != YYEMPTY)
2209     {
2210       /* Make sure we have latest lookahead translation.  See comments at
2211          user semantic actions for why this is necessary.  */
2212       yytoken = YYTRANSLATE (yychar);
2213       yydestruct ("Cleanup: discarding lookahead",
2214                   yytoken, &yylval);
2215     }
2216   /* Do not reclaim the symbols of the rule whose action triggered
2217      this YYABORT or YYACCEPT.  */
2218   YYPOPSTACK (yylen);
2219   YY_STACK_PRINT (yyss, yyssp);
2220   while (yyssp != yyss)
2221     {
2222       yydestruct ("Cleanup: popping",
2223                   yystos[*yyssp], yyvsp);
2224       YYPOPSTACK (1);
2225     }
2226 #ifndef yyoverflow
2227   if (yyss != yyssa)
2228     YYSTACK_FREE (yyss);
2229 #endif
2230 #if YYERROR_VERBOSE
2231   if (yymsg != yymsgbuf)
2232     YYSTACK_FREE (yymsg);
2233 #endif
2234   return yyresult;
2235 }
2236
2237
2238
2239 void conf_parse(const char *name)
2240 {
2241         struct symbol *sym;
2242         int i;
2243
2244         zconf_initscan(name);
2245
2246         _menu_init();
2247
2248 #if YYDEBUG
2249         if (getenv("ZCONF_DEBUG"))
2250                 yydebug = 1;
2251 #endif
2252         yyparse();
2253
2254         /* Variables are expanded in the parse phase. We can free them here. */
2255         variable_all_del();
2256
2257         if (yynerrs)
2258                 exit(1);
2259         if (!modules_sym)
2260                 modules_sym = sym_find( "n" );
2261
2262         if (!menu_has_prompt(&rootmenu)) {
2263                 current_entry = &rootmenu;
2264                 menu_add_prompt(P_MENU, "Main menu", NULL);
2265         }
2266
2267         menu_finalize(&rootmenu);
2268         for_all_symbols(i, sym) {
2269                 if (sym_check_deps(sym))
2270                         yynerrs++;
2271         }
2272         if (yynerrs)
2273                 exit(1);
2274         sym_set_change_count(1);
2275 }
2276
2277 static bool zconf_endtoken(const char *tokenname,
2278                            const char *expected_tokenname)
2279 {
2280         if (strcmp(tokenname, expected_tokenname)) {
2281                 zconf_error("unexpected '%s' within %s block",
2282                             tokenname, expected_tokenname);
2283                 yynerrs++;
2284                 return false;
2285         }
2286         if (current_menu->file != current_file) {
2287                 zconf_error("'%s' in different file than '%s'",
2288                             tokenname, expected_tokenname);
2289                 fprintf(stderr, "%s:%d: location of the '%s'\n",
2290                         current_menu->file->name, current_menu->lineno,
2291                         expected_tokenname);
2292                 yynerrs++;
2293                 return false;
2294         }
2295         return true;
2296 }
2297
2298 static void zconfprint(const char *err, ...)
2299 {
2300         va_list ap;
2301
2302         fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2303         va_start(ap, err);
2304         vfprintf(stderr, err, ap);
2305         va_end(ap);
2306         fprintf(stderr, "\n");
2307 }
2308
2309 static void zconf_error(const char *err, ...)
2310 {
2311         va_list ap;
2312
2313         yynerrs++;
2314         fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2315         va_start(ap, err);
2316         vfprintf(stderr, err, ap);
2317         va_end(ap);
2318         fprintf(stderr, "\n");
2319 }
2320
2321 static void yyerror(const char *err)
2322 {
2323         fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2324 }
2325
2326 static void print_quoted_string(FILE *out, const char *str)
2327 {
2328         const char *p;
2329         int len;
2330
2331         putc('"', out);
2332         while ((p = strchr(str, '"'))) {
2333                 len = p - str;
2334                 if (len)
2335                         fprintf(out, "%.*s", len, str);
2336                 fputs("\\\"", out);
2337                 str = p + 1;
2338         }
2339         fputs(str, out);
2340         putc('"', out);
2341 }
2342
2343 static void print_symbol(FILE *out, struct menu *menu)
2344 {
2345         struct symbol *sym = menu->sym;
2346         struct property *prop;
2347
2348         if (sym_is_choice(sym))
2349                 fprintf(out, "\nchoice\n");
2350         else
2351                 fprintf(out, "\nconfig %s\n", sym->name);
2352         switch (sym->type) {
2353         case S_BOOLEAN:
2354                 fputs("  bool\n", out);
2355                 break;
2356         case S_TRISTATE:
2357                 fputs("  tristate\n", out);
2358                 break;
2359         case S_STRING:
2360                 fputs("  string\n", out);
2361                 break;
2362         case S_INT:
2363                 fputs("  integer\n", out);
2364                 break;
2365         case S_HEX:
2366                 fputs("  hex\n", out);
2367                 break;
2368         default:
2369                 fputs("  ???\n", out);
2370                 break;
2371         }
2372         for (prop = sym->prop; prop; prop = prop->next) {
2373                 if (prop->menu != menu)
2374                         continue;
2375                 switch (prop->type) {
2376                 case P_PROMPT:
2377                         fputs("  prompt ", out);
2378                         print_quoted_string(out, prop->text);
2379                         if (!expr_is_yes(prop->visible.expr)) {
2380                                 fputs(" if ", out);
2381                                 expr_fprint(prop->visible.expr, out);
2382                         }
2383                         fputc('\n', out);
2384                         break;
2385                 case P_DEFAULT:
2386                         fputs( "  default ", out);
2387                         expr_fprint(prop->expr, out);
2388                         if (!expr_is_yes(prop->visible.expr)) {
2389                                 fputs(" if ", out);
2390                                 expr_fprint(prop->visible.expr, out);
2391                         }
2392                         fputc('\n', out);
2393                         break;
2394                 case P_CHOICE:
2395                         fputs("  #choice value\n", out);
2396                         break;
2397                 case P_SELECT:
2398                         fputs( "  select ", out);
2399                         expr_fprint(prop->expr, out);
2400                         fputc('\n', out);
2401                         break;
2402                 case P_IMPLY:
2403                         fputs( "  imply ", out);
2404                         expr_fprint(prop->expr, out);
2405                         fputc('\n', out);
2406                         break;
2407                 case P_RANGE:
2408                         fputs( "  range ", out);
2409                         expr_fprint(prop->expr, out);
2410                         fputc('\n', out);
2411                         break;
2412                 case P_MENU:
2413                         fputs( "  menu ", out);
2414                         print_quoted_string(out, prop->text);
2415                         fputc('\n', out);
2416                         break;
2417                 case P_SYMBOL:
2418                         fputs( "  symbol ", out);
2419                         fprintf(out, "%s\n", prop->menu->sym->name);
2420                         break;
2421                 default:
2422                         fprintf(out, "  unknown prop %d!\n", prop->type);
2423                         break;
2424                 }
2425         }
2426         if (menu->help) {
2427                 int len = strlen(menu->help);
2428                 while (menu->help[--len] == '\n')
2429                         menu->help[len] = 0;
2430                 fprintf(out, "  help\n%s\n", menu->help);
2431         }
2432 }
2433
2434 void zconfdump(FILE *out)
2435 {
2436         struct property *prop;
2437         struct symbol *sym;
2438         struct menu *menu;
2439
2440         menu = rootmenu.list;
2441         while (menu) {
2442                 if ((sym = menu->sym))
2443                         print_symbol(out, menu);
2444                 else if ((prop = menu->prompt)) {
2445                         switch (prop->type) {
2446                         case P_COMMENT:
2447                                 fputs("\ncomment ", out);
2448                                 print_quoted_string(out, prop->text);
2449                                 fputs("\n", out);
2450                                 break;
2451                         case P_MENU:
2452                                 fputs("\nmenu ", out);
2453                                 print_quoted_string(out, prop->text);
2454                                 fputs("\n", out);
2455                                 break;
2456                         default:
2457                                 ;
2458                         }
2459                         if (!expr_is_yes(prop->visible.expr)) {
2460                                 fputs("  depends ", out);
2461                                 expr_fprint(prop->visible.expr, out);
2462                                 fputc('\n', out);
2463                         }
2464                 }
2465
2466                 if (menu->list)
2467                         menu = menu->list;
2468                 else if (menu->next)
2469                         menu = menu->next;
2470                 else while ((menu = menu->parent)) {
2471                         if (menu->prompt && menu->prompt->type == P_MENU)
2472                                 fputs("\nendmenu\n", out);
2473                         if (menu->next) {
2474                                 menu = menu->next;
2475                                 break;
2476                         }
2477                 }
2478         }
2479 }
2480
2481 #include "menu.c"