zconf.tab.c_shipped 70 KB

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