zconf.tab.c_shipped 64 KB

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