zconf.tab.c_shipped 69 KB

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