parser.tab.c 68 KB

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