zconf.tab.c_shipped 73 KB

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