PageRenderTime 72ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/kconfig/zconf.tab.c_shipped

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