zconf.tab.c_shipped 71 KB

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