zconf.tab.c_shipped 68 KB

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