zconf.tab.c_shipped 68 KB

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