20230310
[build-config.git] / src / bconfig / lxrgmr / zconf.tab.c
blob638a729b5c0dde4d6882dc1cdad61c47fc366377
1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
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.
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.
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/>. */
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.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
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. */
43 /* Identify Bison output. */
44 #define YYBISON 1
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
52 /* Pure parsers. */
53 #define YYPURE 0
55 /* Push parsers. */
56 #define YYPUSH 0
58 /* Pull parsers. */
59 #define YYPULL 1
64 /* Copy the first part of user declarations. */
68 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
69 * Released under the terms of the GNU GPL v2.0.
72 #include <ctype.h>
73 #include <stdarg.h>
74 #include <stdio.h>
75 #include <stdlib.h>
76 #include <string.h>
77 #include <stdbool.h>
79 #include "lkglob.h"
81 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
83 #define PRINTD 0x0001
84 #define DEBUG_PARSE 0x0002
86 int cdebug = PRINTD;
88 int yylex(void);
89 static void yyerror(const char *err);
90 static void zconfprint(const char *err, ...);
91 static void zconf_error(const char *err, ...);
92 static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
94 struct symbol *symbol_hash[SYMBOL_HASHSIZE];
96 static struct menu *current_menu, *current_entry;
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
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
118 /* Debug traces. */
119 #ifndef YYDEBUG
120 # define YYDEBUG 1
121 #endif
122 #if YYDEBUG
123 extern int yydebug;
124 #endif
126 /* Token type. */
127 #ifndef YYTOKENTYPE
128 # define YYTOKENTYPE
129 enum yytokentype
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
170 #endif
172 /* Value type. */
173 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
175 union YYSTYPE
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;
189 typedef union YYSTYPE YYSTYPE;
190 # define YYSTYPE_IS_TRIVIAL 1
191 # define YYSTYPE_IS_DECLARED 1
192 #endif
195 extern YYSTYPE yylval;
197 int yyparse (void);
201 /* Copy the second part of user declarations. */
204 /* Include kconf_id.c here so it can see the token constants. */
205 #include "kconf_id.c"
209 #ifdef short
210 # undef short
211 #endif
213 #ifdef YYTYPE_UINT8
214 typedef YYTYPE_UINT8 yytype_uint8;
215 #else
216 typedef unsigned char yytype_uint8;
217 #endif
219 #ifdef YYTYPE_INT8
220 typedef YYTYPE_INT8 yytype_int8;
221 #else
222 typedef signed char yytype_int8;
223 #endif
225 #ifdef YYTYPE_UINT16
226 typedef YYTYPE_UINT16 yytype_uint16;
227 #else
228 typedef unsigned short int yytype_uint16;
229 #endif
231 #ifdef YYTYPE_INT16
232 typedef YYTYPE_INT16 yytype_int16;
233 #else
234 typedef short int yytype_int16;
235 #endif
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
250 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
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
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
274 #ifndef YY_ATTRIBUTE_PURE
275 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
276 #endif
278 #ifndef YY_ATTRIBUTE_UNUSED
279 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
280 #endif
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
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
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
318 #if ! defined yyoverflow || YYERROR_VERBOSE
320 /* The parser invokes alloca or malloc; define the necessary symbols. */
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 <malloglob.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
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
373 void *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
379 void free (void *); /* INFRINGES ON USER NAME SPACE */
380 # endif
381 # endif
382 # endif
383 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
386 #if (! defined yyoverflow \
387 && (! defined __cplusplus \
388 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
390 /* A type that is properly aligned for any stack member. */
391 union yyalloc
393 yytype_int16 yyss_alloc;
394 YYSTYPE yyvs_alloc;
397 /* The size of the maximum gap between one aligned stack and the next. */
398 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
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)
406 # define YYCOPY_NEEDED 1
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 \
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); \
422 while (0)
424 #endif
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 \
437 YYSIZE_T yyi; \
438 for (yyi = 0; yyi < (Count); yyi++) \
439 (Dst)[yyi] = (Src)[yyi]; \
441 while (0)
442 # endif
443 # endif
444 #endif /* !YYCOPY_NEEDED */
446 /* YYFINAL -- State number of the termination state. */
447 #define YYFINAL 11
448 /* YYLAST -- Last index in YYTABLE. */
449 #define YYLAST 325
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
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
465 #define YYTRANSLATE(YYX) \
466 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
468 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
469 as returned by yylex, without out-of-bounds checking. */
470 static const yytype_uint8 yytranslate[] =
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
504 #if YYDEBUG
505 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
506 static const yytype_uint16 yyrline[] =
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
522 #endif
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. */
527 static const char *const yytname[] =
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
549 #endif
551 # ifdef YYPRINT
552 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
553 (internal) symbol number NUM (which must be that of a token). */
554 static const yytype_uint16 yytoknum[] =
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,
562 # endif
564 #define YYPACT_NINF -92
566 #define yypact_value_is_default(Yystate) \
567 (!!((Yystate) == (-92)))
569 #define YYTABLE_NINF -89
571 #define yytable_value_is_error(Yytable_value) \
574 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
575 STATE-NUM. */
576 static const yytype_int16 yypact[] =
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
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. */
604 static const yytype_uint8 yydefact[] =
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
629 /* YYPGOTO[NTERM-NUM]. */
630 static const yytype_int16 yypgoto[] =
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
640 /* YYDEFGOTO[NTERM-NUM]. */
641 static const yytype_int16 yydefgoto[] =
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
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. */
654 static const yytype_int16 yytable[] =
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
691 static const yytype_int16 yycheck[] =
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
728 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
729 symbol of state STATE-NUM. */
730 static const yytype_uint8 yystos[] =
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
755 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
756 static const yytype_uint8 yyr1[] =
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
773 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
774 static const yytype_uint8 yyr2[] =
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
792 #define yyerrok (yyerrstatus = 0)
793 #define yyclearin (yychar = YYEMPTY)
794 #define YYEMPTY (-2)
795 #define YYEOF 0
797 #define YYACCEPT goto yyacceptlab
798 #define YYABORT goto yyabortlab
799 #define YYERROR goto yyerrorlab
802 #define YYRECOVERING() (!!yyerrstatus)
804 #define YYBACKUP(Token, Value) \
805 do \
806 if (yychar == YYEMPTY) \
808 yychar = (Token); \
809 yylval = (Value); \
810 YYPOPSTACK (yylen); \
811 yystate = *yyssp; \
812 goto yybackup; \
814 else \
816 yyerror (YY_("syntax error: cannot back up")); \
817 YYERROR; \
819 while (0)
821 /* Error token number */
822 #define YYTERROR 1
823 #define YYERRCODE 256
827 /* Enable debugging if requested. */
828 #if YYDEBUG
830 # ifndef YYFPRINTF
831 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
832 # define YYFPRINTF fprintf
833 # endif
835 # define YYDPRINTF(Args) \
836 do { \
837 if (yydebug) \
838 YYFPRINTF Args; \
839 } while (0)
841 /* This macro is provided for backward compatibility. */
842 #ifndef YY_LOCATION_PRINT
843 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
844 #endif
847 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
848 do { \
849 if (yydebug) \
851 YYFPRINTF (stderr, "%s ", Title); \
852 yy_symbol_print (stderr, \
853 Type, Value); \
854 YYFPRINTF (stderr, "\n"); \
856 } while (0)
859 /*----------------------------------------.
860 | Print this symbol's value on YYOUTPUT. |
861 `----------------------------------------*/
863 static void
864 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
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);
878 /*--------------------------------.
879 | Print this symbol on YYOUTPUT. |
880 `--------------------------------*/
882 static void
883 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
885 YYFPRINTF (yyoutput, "%s %s (",
886 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
888 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
889 YYFPRINTF (yyoutput, ")");
892 /*------------------------------------------------------------------.
893 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
894 | TOP (included). |
895 `------------------------------------------------------------------*/
897 static void
898 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
900 YYFPRINTF (stderr, "Stack now");
901 for (; yybottom <= yytop; yybottom++)
903 int yybot = *yybottom;
904 YYFPRINTF (stderr, " %d", yybot);
906 YYFPRINTF (stderr, "\n");
909 # define YY_STACK_PRINT(Bottom, Top) \
910 do { \
911 if (yydebug) \
912 yy_stack_print ((Bottom), (Top)); \
913 } while (0)
916 /*------------------------------------------------.
917 | Report that the YYRULE is going to be reduced. |
918 `------------------------------------------------*/
920 static void
921 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
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++)
931 YYFPRINTF (stderr, " $%d = ", yyi + 1);
932 yy_symbol_print (stderr,
933 yystos[yyssp[yyi + 1 - yynrhs]],
934 &(yyvsp[(yyi + 1) - (yynrhs)])
936 YYFPRINTF (stderr, "\n");
940 # define YY_REDUCE_PRINT(Rule) \
941 do { \
942 if (yydebug) \
943 yy_reduce_print (yyssp, yyvsp, Rule); \
944 } while (0)
946 /* Nonzero means print parse trace. It is left uninitialized so that
947 multiple parsers can coexist. */
948 int 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 */
957 /* YYINITDEPTH -- initial size of the parser's stacks. */
958 #ifndef YYINITDEPTH
959 # define YYINITDEPTH 200
960 #endif
962 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
963 if the built-in stack extension method is used).
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. */
969 #ifndef YYMAXDEPTH
970 # define YYMAXDEPTH 10000
971 #endif
974 #if YYERROR_VERBOSE
976 # ifndef yystrlen
977 # if defined __GLIBC__ && defined _STRING_H
978 # define yystrlen strlen
979 # else
980 /* Return the length of YYSTR. */
981 static YYSIZE_T
982 yystrlen (const char *yystr)
984 YYSIZE_T yylen;
985 for (yylen = 0; yystr[yylen]; yylen++)
986 continue;
987 return yylen;
989 # endif
990 # endif
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. */
998 static char *
999 yystpcpy (char *yydest, const char *yysrc)
1001 char *yyd = yydest;
1002 const char *yys = yysrc;
1004 while ((*yyd++ = *yys++) != '\0')
1005 continue;
1007 return yyd - 1;
1009 # endif
1010 # endif
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. */
1020 static YYSIZE_T
1021 yytnamerr (char *yyres, const char *yystr)
1023 if (*yystr == '"')
1025 YYSIZE_T yyn = 0;
1026 char const *yyp = yystr;
1028 for (;;)
1029 switch (*++yyp)
1031 case '\'':
1032 case ',':
1033 goto do_not_strip_quotes;
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;
1045 case '"':
1046 if (yyres)
1047 yyres[yyn] = '\0';
1048 return yyn;
1050 do_not_strip_quotes: ;
1053 if (! yyres)
1054 return yystrlen (yystr);
1056 return yystpcpy (yyres, yystr) - yyres;
1058 # endif
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.
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. */
1068 static int
1069 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1070 yytype_int16 *yyssp, int yytoken)
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;
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.
1106 if (yytoken != YYEMPTY)
1108 int yyn = yypact[*yyssp];
1109 yyarg[yycount++] = yytname[yytoken];
1110 if (!yypact_value_is_default (yyn))
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;
1121 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1122 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1123 && !yytable_value_is_error (yytable[yyx + yyn]))
1125 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1127 yycount = 1;
1128 yysize = yysize0;
1129 break;
1131 yyarg[yycount++] = yytname[yyx];
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;
1143 switch (yycount)
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_
1159 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1160 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1161 return 2;
1162 yysize = yysize1;
1165 if (*yymsg_alloc < yysize)
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;
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. */
1178 char *yyp = *yymsg;
1179 int yyi = 0;
1180 while ((*yyp = *yyformat) != '\0')
1181 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1183 yyp += yytnamerr (yyp, yyarg[yyi++]);
1184 yyformat += 2;
1186 else
1188 yyp++;
1189 yyformat++;
1192 return 0;
1194 #endif /* YYERROR_VERBOSE */
1196 /*-----------------------------------------------.
1197 | Release the memory associated to this symbol. |
1198 `-----------------------------------------------*/
1200 static void
1201 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1203 YYUSE (yyvaluep);
1204 if (!yymsg)
1205 yymsg = "Deleting";
1206 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1208 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1209 switch (yytype)
1211 case 60: /* choice_entry */
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();
1220 break;
1222 case 66: /* if_entry */
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();
1231 break;
1233 case 71: /* menu_entry */
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();
1242 break;
1245 default:
1246 break;
1248 YY_IGNORE_MAYBE_UNINITIALIZED_END
1254 /* The lookahead symbol. */
1255 int yychar;
1257 /* The semantic value of the lookahead symbol. */
1258 YYSTYPE yylval;
1259 /* Number of syntax errors so far. */
1260 int yynerrs;
1263 /*----------.
1264 | yyparse. |
1265 `----------*/
1268 yyparse (void)
1270 int yystate;
1271 /* Number of tokens to shift before error messages enabled. */
1272 int yyerrstatus;
1274 /* The stacks and their tools:
1275 'yyss': related to states.
1276 'yyvs': related to semantic values.
1278 Refer to the stacks through separate pointers, to allow yyoverflow
1279 to reallocate them elsewhere. */
1281 /* The state stack. */
1282 yytype_int16 yyssa[YYINITDEPTH];
1283 yytype_int16 *yyss;
1284 yytype_int16 *yyssp;
1286 /* The semantic value stack. */
1287 YYSTYPE yyvsa[YYINITDEPTH];
1288 YYSTYPE *yyvs;
1289 YYSTYPE *yyvsp;
1291 YYSIZE_T yystacksize;
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;
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
1308 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
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;
1314 yyssp = yyss = yyssa;
1315 yyvsp = yyvs = yyvsa;
1316 yystacksize = YYINITDEPTH;
1318 YYDPRINTF ((stderr, "Starting parse\n"));
1320 yystate = 0;
1321 yyerrstatus = 0;
1322 yynerrs = 0;
1323 yychar = YYEMPTY; /* Cause a token to be read. */
1324 goto yysetstate;
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++;
1334 yysetstate:
1335 *yyssp = yystate;
1337 if (yyss + yystacksize - 1 <= yyssp)
1339 /* Get the current used size of the three stacks, in elements. */
1340 YYSIZE_T yysize = yyssp - yyss + 1;
1342 #ifdef yyoverflow
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;
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);
1359 yyss = yyss1;
1360 yyvs = yyvs1;
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;
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);
1385 # endif
1386 #endif /* no yyoverflow */
1388 yyssp = yyss + yysize - 1;
1389 yyvsp = yyvs + yysize - 1;
1391 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1392 (unsigned long int) yystacksize));
1394 if (yyss + yystacksize - 1 <= yyssp)
1395 YYABORT;
1398 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1400 if (yystate == YYFINAL)
1401 YYACCEPT;
1403 goto yybackup;
1405 /*-----------.
1406 | yybackup. |
1407 `-----------*/
1408 yybackup:
1410 /* Do appropriate processing given the current state. Read a
1411 lookahead token if we need one and don't already have one. */
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;
1418 /* Not known => get a lookahead token if don't already have one. */
1420 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1421 if (yychar == YYEMPTY)
1423 YYDPRINTF ((stderr, "Reading a token: "));
1424 yychar = yylex ();
1427 if (yychar <= YYEOF)
1429 yychar = yytoken = YYEOF;
1430 YYDPRINTF ((stderr, "Now at end of input.\n"));
1432 else
1434 yytoken = YYTRANSLATE (yychar);
1435 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
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)
1446 if (yytable_value_is_error (yyn))
1447 goto yyerrlab;
1448 yyn = -yyn;
1449 goto yyreduce;
1452 /* Count tokens shifted since error; after three, turn off error
1453 status. */
1454 if (yyerrstatus)
1455 yyerrstatus--;
1457 /* Shift the lookahead token. */
1458 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1460 /* Discard the shifted token. */
1461 yychar = YYEMPTY;
1463 yystate = yyn;
1464 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1465 *++yyvsp = yylval;
1466 YY_IGNORE_MAYBE_UNINITIALIZED_END
1468 goto yynewstate;
1471 /*-----------------------------------------------------------.
1472 | yydefault -- do the default action for the current state. |
1473 `-----------------------------------------------------------*/
1474 yydefault:
1475 yyn = yydefact[yystate];
1476 if (yyn == 0)
1477 goto yyerrlab;
1478 goto yyreduce;
1481 /*-----------------------------.
1482 | yyreduce -- Do a reduction. |
1483 `-----------------------------*/
1484 yyreduce:
1485 /* yyn is the number of a rule to reduce with. */
1486 yylen = yyr2[yyn];
1488 /* If YYLEN is nonzero, implement the default value of the action:
1489 '$$ = $1'.
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];
1499 YY_REDUCE_PRINT (yyn);
1500 switch (yyn)
1502 case 6:
1505 menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL);
1508 break;
1510 case 7:
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
1518 menu_add_prompt(P_MENU, xstrdup("Buildroot Configuration"), NULL);
1521 break;
1523 case 12:
1525 { zconf_error("unexpected end statement"); }
1527 break;
1529 case 13:
1531 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); }
1533 break;
1535 case 14:
1538 zconf_error("unexpected option \"%s\"", (yyvsp[-2].id)->name);
1541 break;
1543 case 15:
1545 { zconf_error("invalid statement"); }
1547 break;
1549 case 31:
1551 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); }
1553 break;
1555 case 32:
1557 { zconf_error("invalid option"); }
1559 break;
1561 case 33:
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);
1569 break;
1571 case 34:
1574 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
1577 break;
1579 case 35:
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);
1587 break;
1589 case 36:
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());
1599 break;
1601 case 44:
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);
1610 break;
1612 case 45:
1615 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1616 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1619 break;
1621 case 46:
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);
1632 break;
1634 case 47:
1637 menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1638 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
1641 break;
1643 case 48:
1646 menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr));
1647 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
1650 break;
1652 case 49:
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());
1659 break;
1661 case 52:
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));
1669 else
1670 zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string));
1671 free((yyvsp[-1].string));
1674 break;
1676 case 53:
1678 { (yyval.string) = NULL; }
1680 break;
1682 case 54:
1684 { (yyval.string) = (yyvsp[0].string); }
1686 break;
1688 case 55:
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());
1699 break;
1701 case 56:
1704 (yyval.menu) = menu_add_menu();
1707 break;
1709 case 57:
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());
1718 break;
1720 case 65:
1723 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
1724 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
1727 break;
1729 case 66:
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;
1741 break;
1743 case 67:
1746 current_entry->sym->flags |= SYMBOL_OPTIONAL;
1747 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
1750 break;
1752 case 68:
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;
1763 break;
1765 case 71:
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();
1774 break;
1776 case 72:
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());
1785 break;
1787 case 78:
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());
1795 break;
1797 case 79:
1800 (yyval.menu) = menu_add_menu();
1803 break;
1805 case 80:
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());
1814 break;
1816 case 86:
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));
1824 break;
1826 case 87:
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());
1834 break;
1836 case 89:
1839 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
1840 zconf_starthelp();
1843 break;
1845 case 90:
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>");
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>");
1859 current_entry->help = (yyvsp[0].string);
1862 break;
1864 case 95:
1867 menu_add_dep((yyvsp[-1].expr));
1868 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
1871 break;
1873 case 99:
1876 menu_add_visibility((yyvsp[0].expr));
1879 break;
1881 case 101:
1884 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1887 break;
1889 case 104:
1891 { (yyval.id) = (yyvsp[-1].id); }
1893 break;
1895 case 105:
1897 { (yyval.id) = (yyvsp[-1].id); }
1899 break;
1901 case 106:
1903 { (yyval.id) = (yyvsp[-1].id); }
1905 break;
1907 case 109:
1909 { (yyval.expr) = NULL; }
1911 break;
1913 case 110:
1915 { (yyval.expr) = (yyvsp[0].expr); }
1917 break;
1919 case 111:
1921 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); }
1923 break;
1925 case 112:
1927 { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1929 break;
1931 case 113:
1933 { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1935 break;
1937 case 114:
1939 { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1941 break;
1943 case 115:
1945 { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1947 break;
1949 case 116:
1951 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1953 break;
1955 case 117:
1957 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); }
1959 break;
1961 case 118:
1963 { (yyval.expr) = (yyvsp[-1].expr); }
1965 break;
1967 case 119:
1969 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); }
1971 break;
1973 case 120:
1975 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1977 break;
1979 case 121:
1981 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); }
1983 break;
1985 case 122:
1987 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); }
1989 break;
1991 case 124:
1993 { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); }
1995 break;
1997 case 125:
1999 { (yyval.string) = NULL; }
2001 break;
2005 default: break;
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);
2020 YYPOPSTACK (yylen);
2021 yylen = 0;
2022 YY_STACK_PRINT (yyss, yyssp);
2024 *++yyvsp = yyval;
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. */
2030 yyn = yyr1[yyn];
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];
2038 goto yynewstate;
2041 /*--------------------------------------.
2042 | yyerrlab -- here on detecting error. |
2043 `--------------------------------------*/
2044 yyerrlab:
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);
2049 /* If not already recovering from an error, report this error. */
2050 if (!yyerrstatus)
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)
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)
2066 if (yymsg != yymsgbuf)
2067 YYSTACK_FREE (yymsg);
2068 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2069 if (!yymsg)
2071 yymsg = yymsgbuf;
2072 yymsg_alloc = sizeof yymsgbuf;
2073 yysyntax_error_status = 2;
2075 else
2077 yysyntax_error_status = YYSYNTAX_ERROR;
2078 yymsgp = yymsg;
2081 yyerror (yymsgp);
2082 if (yysyntax_error_status == 2)
2083 goto yyexhaustedlab;
2085 # undef YYSYNTAX_ERROR
2086 #endif
2091 if (yyerrstatus == 3)
2093 /* If just tried and failed to reuse lookahead token after an
2094 error, discard it. */
2096 if (yychar <= YYEOF)
2098 /* Return failure if at end of input. */
2099 if (yychar == YYEOF)
2100 YYABORT;
2102 else
2104 yydestruct ("Error: discarding",
2105 yytoken, &yylval);
2106 yychar = YYEMPTY;
2110 /* Else will try to reuse lookahead token after shifting the error
2111 token. */
2112 goto yyerrlab1;
2115 /*---------------------------------------------------.
2116 | yyerrorlab -- error raised explicitly by YYERROR. |
2117 `---------------------------------------------------*/
2118 yyerrorlab:
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;
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;
2135 /*-------------------------------------------------------------.
2136 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2137 `-------------------------------------------------------------*/
2138 yyerrlab1:
2139 yyerrstatus = 3; /* Each real token shifted decrements this. */
2141 for (;;)
2143 yyn = yypact[yystate];
2144 if (!yypact_value_is_default (yyn))
2146 yyn += YYTERROR;
2147 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2149 yyn = yytable[yyn];
2150 if (0 < yyn)
2151 break;
2155 /* Pop the current state because it cannot handle the error token. */
2156 if (yyssp == yyss)
2157 YYABORT;
2160 yydestruct ("Error: popping",
2161 yystos[yystate], yyvsp);
2162 YYPOPSTACK (1);
2163 yystate = *yyssp;
2164 YY_STACK_PRINT (yyss, yyssp);
2167 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2168 *++yyvsp = yylval;
2169 YY_IGNORE_MAYBE_UNINITIALIZED_END
2172 /* Shift the error token. */
2173 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2175 yystate = yyn;
2176 goto yynewstate;
2179 /*-------------------------------------.
2180 | yyacceptlab -- YYACCEPT comes here. |
2181 `-------------------------------------*/
2182 yyacceptlab:
2183 yyresult = 0;
2184 goto yyreturn;
2186 /*-----------------------------------.
2187 | yyabortlab -- YYABORT comes here. |
2188 `-----------------------------------*/
2189 yyabortlab:
2190 yyresult = 1;
2191 goto yyreturn;
2193 #if !defined yyoverflow || YYERROR_VERBOSE
2194 /*-------------------------------------------------.
2195 | yyexhaustedlab -- memory exhaustion comes here. |
2196 `-------------------------------------------------*/
2197 yyexhaustedlab:
2198 yyerror (YY_("memory exhausted"));
2199 yyresult = 2;
2200 /* Fall through. */
2201 #endif
2203 yyreturn:
2204 if (yychar != YYEMPTY)
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);
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)
2218 yydestruct ("Cleanup: popping",
2219 yystos[*yyssp], yyvsp);
2220 YYPOPSTACK (1);
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;
2235 void conf_parse(const char *name)
2237 const char *tmp;
2238 struct symbol *sym;
2239 int i;
2241 zconf_initscan(name);
2243 sym_init();
2244 _menu_init();
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" );
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);
2259 menu_finalize(&rootmenu);
2260 for_all_symbols(i, sym) {
2261 if (sym_check_deps(sym))
2262 yynerrs++;
2264 if (yynerrs)
2265 exit(1);
2266 sym_set_change_count(1);
2269 static const char *zconf_tokenname(int token)
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";
2281 return "<token>";
2284 static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
2286 if (id->token != endtoken) {
2287 zconf_error("unexpected '%s' within %s block",
2288 id->name, zconf_tokenname(starttoken));
2289 yynerrs++;
2290 return false;
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;
2301 return true;
2304 static void zconfprint(const char *err, ...)
2306 va_list ap;
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");
2315 static void zconf_error(const char *err, ...)
2317 va_list ap;
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");
2327 static void yyerror(const char *err)
2329 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2332 static void print_quoted_string(FILE *out, const char *str)
2334 const char *p;
2335 int len;
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;
2345 fputs(str, out);
2346 putc('"', out);
2349 static void print_symbol(FILE *out, struct menu *menu)
2351 struct symbol *sym = menu->sym;
2352 struct property *prop;
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;
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);
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);
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;
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);
2436 void zconfdump(FILE *out)
2438 struct property *prop;
2439 struct symbol *sym;
2440 struct menu *menu;
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:
2461 if (!expr_is_yes(prop->visible.expr)) {
2462 fputs(" depends ", out);
2463 expr_fprint(prop->visible.expr, out);
2464 fputc('\n', out);
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;
2483 #include "zconf.lex.c"
2484 #include "../src/util.c"
2485 #include "confdata.c"
2486 #include "../src/expr.c"
2487 #include "../src/symbol.c"
2488 #include "../src/menu.c"