zconf.tab.c_shipped 70 KB

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