zconf.tab.c_shipped 71 KB

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