zconf.tab.c_shipped 57 KB

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