zconf.tab.c_shipped 59 KB

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