zconf.tab.c_shipped 57 KB

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