zconf.tab.c_shipped 56 KB

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