zconf.tab.c_shipped 69 KB

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