zconf.tab.c_shipped 69 KB

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