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