2
0

zconf.tab.c_shipped 59 KB

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