zconf.tab.c_shipped 54 KB

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