00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #define YYBISON 1
00038
00039
00040 #define YYSKELETON_NAME "yacc.c"
00041
00042
00043 #define YYPURE 0
00044
00045
00046 #define YYLSP_NEEDED 0
00047
00048
00049
00050 #define yyparse zconfparse
00051 #define yylex zconflex
00052 #define yyerror zconferror
00053 #define yylval zconflval
00054 #define yychar zconfchar
00055 #define yydebug zconfdebug
00056 #define yynerrs zconfnerrs
00057
00058
00059
00060 #ifndef YYTOKENTYPE
00061 # define YYTOKENTYPE
00062
00063
00064 enum yytokentype {
00065 T_MAINMENU = 258,
00066 T_MENU = 259,
00067 T_ENDMENU = 260,
00068 T_SOURCE = 261,
00069 T_CHOICE = 262,
00070 T_ENDCHOICE = 263,
00071 T_COMMENT = 264,
00072 T_CONFIG = 265,
00073 T_MENUCONFIG = 266,
00074 T_HELP = 267,
00075 T_HELPTEXT = 268,
00076 T_IF = 269,
00077 T_ENDIF = 270,
00078 T_DEPENDS = 271,
00079 T_REQUIRES = 272,
00080 T_OPTIONAL = 273,
00081 T_PROMPT = 274,
00082 T_DEFAULT = 275,
00083 T_TRISTATE = 276,
00084 T_DEF_TRISTATE = 277,
00085 T_BOOLEAN = 278,
00086 T_DEF_BOOLEAN = 279,
00087 T_STRING = 280,
00088 T_INT = 281,
00089 T_HEX = 282,
00090 T_WORD = 283,
00091 T_WORD_QUOTE = 284,
00092 T_UNEQUAL = 285,
00093 T_EOF = 286,
00094 T_EOL = 287,
00095 T_CLOSE_PAREN = 288,
00096 T_OPEN_PAREN = 289,
00097 T_ON = 290,
00098 T_SELECT = 291,
00099 T_RANGE = 292,
00100 T_OR = 293,
00101 T_AND = 294,
00102 T_EQUAL = 295,
00103 T_NOT = 296
00104 };
00105 #endif
00106 #define T_MAINMENU 258
00107 #define T_MENU 259
00108 #define T_ENDMENU 260
00109 #define T_SOURCE 261
00110 #define T_CHOICE 262
00111 #define T_ENDCHOICE 263
00112 #define T_COMMENT 264
00113 #define T_CONFIG 265
00114 #define T_MENUCONFIG 266
00115 #define T_HELP 267
00116 #define T_HELPTEXT 268
00117 #define T_IF 269
00118 #define T_ENDIF 270
00119 #define T_DEPENDS 271
00120 #define T_REQUIRES 272
00121 #define T_OPTIONAL 273
00122 #define T_PROMPT 274
00123 #define T_DEFAULT 275
00124 #define T_TRISTATE 276
00125 #define T_DEF_TRISTATE 277
00126 #define T_BOOLEAN 278
00127 #define T_DEF_BOOLEAN 279
00128 #define T_STRING 280
00129 #define T_INT 281
00130 #define T_HEX 282
00131 #define T_WORD 283
00132 #define T_WORD_QUOTE 284
00133 #define T_UNEQUAL 285
00134 #define T_EOF 286
00135 #define T_EOL 287
00136 #define T_CLOSE_PAREN 288
00137 #define T_OPEN_PAREN 289
00138 #define T_ON 290
00139 #define T_SELECT 291
00140 #define T_RANGE 292
00141 #define T_OR 293
00142 #define T_AND 294
00143 #define T_EQUAL 295
00144 #define T_NOT 296
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157 #include <ctype.h>
00158 #include <stdarg.h>
00159 #include <stdio.h>
00160 #include <stdlib.h>
00161 #include <string.h>
00162 #include <stdbool.h>
00163
00164 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
00165
00166 #define PRINTD 0x0001
00167 #define DEBUG_PARSE 0x0002
00168
00169 int cdebug = PRINTD;
00170
00171 extern int zconflex(void);
00172 static void zconfprint(const char *err, ...);
00173 static void zconferror(const char *err);
00174 static bool zconf_endtoken(int token, int starttoken, int endtoken);
00175
00176 struct symbol *symbol_hash[257];
00177
00178 #define YYERROR_VERBOSE
00179
00180
00181
00182 #ifndef YYDEBUG
00183 # define YYDEBUG 0
00184 #endif
00185
00186
00187 #ifdef YYERROR_VERBOSE
00188 # undef YYERROR_VERBOSE
00189 # define YYERROR_VERBOSE 1
00190 #else
00191 # define YYERROR_VERBOSE 0
00192 #endif
00193
00194 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
00195
00196 typedef union YYSTYPE {
00197 int token;
00198 char *string;
00199 struct symbol *symbol;
00200 struct expr *expr;
00201 struct menu *menu;
00202 } YYSTYPE;
00203
00204
00205 # define yystype YYSTYPE
00206 # define YYSTYPE_IS_DECLARED 1
00207 # define YYSTYPE_IS_TRIVIAL 1
00208 #endif
00209
00210
00211
00212
00213
00214
00215 #define LKC_DIRECT_LINK
00216 #include "lkc.h"
00217
00218
00219
00220
00221
00222 #if ! defined (yyoverflow) || YYERROR_VERBOSE
00223
00224
00225
00226 # if YYSTACK_USE_ALLOCA
00227 # define YYSTACK_ALLOC alloca
00228 # else
00229 # ifndef YYSTACK_USE_ALLOCA
00230 # if defined (alloca) || defined (_ALLOCA_H)
00231 # define YYSTACK_ALLOC alloca
00232 # else
00233 # ifdef __GNUC__
00234 # define YYSTACK_ALLOC __builtin_alloca
00235 # endif
00236 # endif
00237 # endif
00238 # endif
00239
00240 # ifdef YYSTACK_ALLOC
00241
00242 # define YYSTACK_FREE(Ptr) do { ; } while (0)
00243 # else
00244 # if defined (__STDC__) || defined (__cplusplus)
00245 # include <stdlib.h>
00246 # define YYSIZE_T size_t
00247 # endif
00248 # define YYSTACK_ALLOC malloc
00249 # define YYSTACK_FREE free
00250 # endif
00251 #endif
00252
00253
00254 #if (! defined (yyoverflow) \
00255 && (! defined (__cplusplus) \
00256 || (YYSTYPE_IS_TRIVIAL)))
00257
00258
00259 union yyalloc
00260 {
00261 short yyss;
00262 YYSTYPE yyvs;
00263 };
00264
00265
00266 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00267
00268
00269
00270 # define YYSTACK_BYTES(N) \
00271 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
00272 + YYSTACK_GAP_MAXIMUM)
00273
00274
00275
00276 # ifndef YYCOPY
00277 # if 1 < __GNUC__
00278 # define YYCOPY(To, From, Count) \
00279 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00280 # else
00281 # define YYCOPY(To, From, Count) \
00282 do \
00283 { \
00284 register YYSIZE_T yyi; \
00285 for (yyi = 0; yyi < (Count); yyi++) \
00286 (To)[yyi] = (From)[yyi]; \
00287 } \
00288 while (0)
00289 # endif
00290 # endif
00291
00292
00293
00294
00295
00296
00297 # define YYSTACK_RELOCATE(Stack) \
00298 do \
00299 { \
00300 YYSIZE_T yynewbytes; \
00301 YYCOPY (&yyptr->Stack, Stack, yysize); \
00302 Stack = &yyptr->Stack; \
00303 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00304 yyptr += yynewbytes / sizeof (*yyptr); \
00305 } \
00306 while (0)
00307
00308 #endif
00309
00310 #if defined (__STDC__) || defined (__cplusplus)
00311 typedef signed char yysigned_char;
00312 #else
00313 typedef short yysigned_char;
00314 #endif
00315
00316
00317 #define YYFINAL 2
00318
00319 #define YYLAST 201
00320
00321
00322 #define YYNTOKENS 42
00323
00324 #define YYNNTS 41
00325
00326 #define YYNRULES 104
00327
00328 #define YYNSTATES 182
00329
00330
00331 #define YYUNDEFTOK 2
00332 #define YYMAXUTOK 296
00333
00334 #define YYTRANSLATE(YYX) \
00335 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00336
00337
00338 static const unsigned char yytranslate[] =
00339 {
00340 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00356 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00357 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00365 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00366 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
00367 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
00368 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
00369 35, 36, 37, 38, 39, 40, 41
00370 };
00371
00372 #if YYDEBUG
00373
00374
00375 static const unsigned short yyprhs[] =
00376 {
00377 0, 0, 3, 4, 7, 9, 11, 13, 17, 19,
00378 21, 23, 26, 28, 30, 32, 34, 36, 38, 42,
00379 45, 49, 52, 53, 56, 59, 62, 65, 69, 74,
00380 78, 83, 87, 91, 95, 100, 105, 110, 116, 119,
00381 122, 124, 128, 131, 132, 135, 138, 141, 144, 149,
00382 153, 157, 160, 165, 166, 169, 173, 175, 179, 182,
00383 183, 186, 189, 192, 196, 199, 201, 205, 208, 209,
00384 212, 215, 218, 222, 226, 228, 232, 235, 238, 241,
00385 242, 245, 248, 253, 257, 261, 262, 265, 267, 269,
00386 272, 275, 278, 280, 282, 283, 286, 288, 292, 296,
00387 300, 303, 307, 311, 313
00388 };
00389
00390
00391 static const yysigned_char yyrhs[] =
00392 {
00393 43, 0, -1, -1, 43, 44, -1, 45, -1, 55,
00394 -1, 66, -1, 3, 77, 79, -1, 5, -1, 15,
00395 -1, 8, -1, 1, 79, -1, 61, -1, 71, -1,
00396 47, -1, 49, -1, 69, -1, 79, -1, 10, 28,
00397 32, -1, 46, 50, -1, 11, 28, 32, -1, 48,
00398 50, -1, -1, 50, 51, -1, 50, 75, -1, 50,
00399 73, -1, 50, 32, -1, 21, 76, 32, -1, 22,
00400 81, 80, 32, -1, 23, 76, 32, -1, 24, 81,
00401 80, 32, -1, 26, 76, 32, -1, 27, 76, 32,
00402 -1, 25, 76, 32, -1, 19, 77, 80, 32, -1,
00403 20, 81, 80, 32, -1, 36, 28, 80, 32, -1,
00404 37, 82, 82, 80, 32, -1, 7, 32, -1, 52,
00405 56, -1, 78, -1, 53, 58, 54, -1, 53, 58,
00406 -1, -1, 56, 57, -1, 56, 75, -1, 56, 73,
00407 -1, 56, 32, -1, 19, 77, 80, 32, -1, 21,
00408 76, 32, -1, 23, 76, 32, -1, 18, 32, -1,
00409 20, 28, 80, 32, -1, -1, 58, 45, -1, 14,
00410 81, 32, -1, 78, -1, 59, 62, 60, -1, 59,
00411 62, -1, -1, 62, 45, -1, 62, 66, -1, 62,
00412 55, -1, 4, 77, 32, -1, 63, 74, -1, 78,
00413 -1, 64, 67, 65, -1, 64, 67, -1, -1, 67,
00414 45, -1, 67, 66, -1, 67, 55, -1, 67, 1,
00415 32, -1, 6, 77, 32, -1, 68, -1, 9, 77,
00416 32, -1, 70, 74, -1, 12, 32, -1, 72, 13,
00417 -1, -1, 74, 75, -1, 74, 32, -1, 16, 35,
00418 81, 32, -1, 16, 81, 32, -1, 17, 81, 32,
00419 -1, -1, 77, 80, -1, 28, -1, 29, -1, 5,
00420 79, -1, 8, 79, -1, 15, 79, -1, 32, -1,
00421 31, -1, -1, 14, 81, -1, 82, -1, 82, 40,
00422 82, -1, 82, 30, 82, -1, 34, 81, 33, -1,
00423 41, 81, -1, 81, 38, 81, -1, 81, 39, 81,
00424 -1, 28, -1, 29, -1
00425 };
00426
00427
00428 static const unsigned short yyrline[] =
00429 {
00430 0, 94, 94, 95, 98, 99, 100, 101, 102, 103,
00431 104, 105, 109, 110, 111, 112, 113, 114, 120, 128,
00432 134, 142, 152, 154, 155, 156, 157, 160, 166, 173,
00433 179, 186, 192, 198, 204, 210, 216, 222, 230, 239,
00434 245, 254, 255, 261, 263, 264, 265, 266, 269, 275,
00435 281, 287, 293, 299, 301, 306, 315, 324, 325, 331,
00436 333, 334, 335, 340, 347, 353, 362, 363, 369, 371,
00437 372, 373, 374, 377, 383, 390, 397, 404, 410, 417,
00438 418, 419, 422, 427, 432, 440, 442, 447, 448, 451,
00439 452, 453, 457, 457, 459, 460, 463, 464, 465, 466,
00440 467, 468, 469, 472, 473
00441 };
00442 #endif
00443
00444 #if YYDEBUG || YYERROR_VERBOSE
00445
00446
00447 static const char *const yytname[] =
00448 {
00449 "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
00450 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
00451 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
00452 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE",
00453 "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT",
00454 "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL",
00455 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR",
00456 "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block",
00457 "common_block", "config_entry_start", "config_stmt",
00458 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
00459 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
00460 "choice_option_list", "choice_option", "choice_block", "if", "if_end",
00461 "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt",
00462 "menu_block", "source", "source_stmt", "comment", "comment_stmt",
00463 "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
00464 "prompt", "end", "nl_or_eof", "if_expr", "expr", "symbol", 0
00465 };
00466 #endif
00467
00468 # ifdef YYPRINT
00469
00470
00471 static const unsigned short yytoknum[] =
00472 {
00473 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
00474 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
00475 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
00476 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
00477 295, 296
00478 };
00479 # endif
00480
00481
00482 static const unsigned char yyr1[] =
00483 {
00484 0, 42, 43, 43, 44, 44, 44, 44, 44, 44,
00485 44, 44, 45, 45, 45, 45, 45, 45, 46, 47,
00486 48, 49, 50, 50, 50, 50, 50, 51, 51, 51,
00487 51, 51, 51, 51, 51, 51, 51, 51, 52, 53,
00488 54, 55, 55, 56, 56, 56, 56, 56, 57, 57,
00489 57, 57, 57, 58, 58, 59, 60, 61, 61, 62,
00490 62, 62, 62, 63, 64, 65, 66, 66, 67, 67,
00491 67, 67, 67, 68, 69, 70, 71, 72, 73, 74,
00492 74, 74, 75, 75, 75, 76, 76, 77, 77, 78,
00493 78, 78, 79, 79, 80, 80, 81, 81, 81, 81,
00494 81, 81, 81, 82, 82
00495 };
00496
00497
00498 static const unsigned char yyr2[] =
00499 {
00500 0, 2, 0, 2, 1, 1, 1, 3, 1, 1,
00501 1, 2, 1, 1, 1, 1, 1, 1, 3, 2,
00502 3, 2, 0, 2, 2, 2, 2, 3, 4, 3,
00503 4, 3, 3, 3, 4, 4, 4, 5, 2, 2,
00504 1, 3, 2, 0, 2, 2, 2, 2, 4, 3,
00505 3, 2, 4, 0, 2, 3, 1, 3, 2, 0,
00506 2, 2, 2, 3, 2, 1, 3, 2, 0, 2,
00507 2, 2, 3, 3, 1, 3, 2, 2, 2, 0,
00508 2, 2, 4, 3, 3, 0, 2, 1, 1, 2,
00509 2, 2, 1, 1, 0, 2, 1, 3, 3, 3,
00510 2, 3, 3, 1, 1
00511 };
00512
00513
00514
00515
00516 static const unsigned char yydefact[] =
00517 {
00518 2, 0, 1, 0, 0, 0, 8, 0, 0, 10,
00519 0, 0, 0, 0, 9, 93, 92, 3, 4, 22,
00520 14, 22, 15, 43, 53, 5, 59, 12, 79, 68,
00521 6, 74, 16, 79, 13, 17, 11, 87, 88, 0,
00522 0, 0, 38, 0, 0, 0, 103, 104, 0, 0,
00523 0, 96, 19, 21, 39, 42, 58, 64, 0, 76,
00524 7, 63, 73, 75, 18, 20, 0, 100, 55, 0,
00525 0, 0, 0, 0, 0, 0, 0, 0, 85, 0,
00526 85, 0, 85, 85, 85, 26, 0, 0, 23, 0,
00527 25, 24, 0, 0, 0, 85, 85, 47, 44, 46,
00528 45, 0, 0, 0, 54, 41, 40, 60, 62, 57,
00529 61, 56, 81, 80, 0, 69, 71, 66, 70, 65,
00530 99, 101, 102, 98, 97, 77, 0, 0, 0, 94,
00531 94, 0, 94, 94, 0, 94, 0, 0, 0, 94,
00532 0, 78, 51, 94, 94, 0, 0, 89, 90, 91,
00533 72, 0, 83, 84, 0, 0, 0, 27, 86, 0,
00534 29, 0, 33, 31, 32, 0, 94, 0, 0, 49,
00535 50, 82, 95, 34, 35, 28, 30, 36, 0, 48,
00536 52, 37
00537 };
00538
00539
00540 static const short yydefgoto[] =
00541 {
00542 -1, 1, 17, 18, 19, 20, 21, 22, 52, 88,
00543 23, 24, 105, 25, 54, 98, 55, 26, 109, 27,
00544 56, 28, 29, 117, 30, 58, 31, 32, 33, 34,
00545 89, 90, 57, 91, 131, 132, 106, 35, 155, 50,
00546 51
00547 };
00548
00549
00550
00551 #define YYPACT_NINF -99
00552 static const short yypact[] =
00553 {
00554 -99, 48, -99, 38, 46, 46, -99, 46, -29, -99,
00555 46, -17, -3, -11, -99, -99, -99, -99, -99, -99,
00556 -99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
00557 -99, -99, -99, -99, -99, -99, -99, -99, -99, 38,
00558 12, 15, -99, 18, 51, 62, -99, -99, -11, -11,
00559 4, -24, 138, 138, 160, 121, 110, -4, 81, -4,
00560 -99, -99, -99, -99, -99, -99, -19, -99, -99, -11,
00561 -11, 70, 70, 73, 32, -11, 46, -11, 46, -11,
00562 46, -11, 46, 46, 46, -99, 36, 70, -99, 95,
00563 -99, -99, 96, 46, 106, 46, 46, -99, -99, -99,
00564 -99, 38, 38, 38, -99, -99, -99, -99, -99, -99,
00565 -99, -99, -99, -99, 112, -99, -99, -99, -99, -99,
00566 -99, 117, -99, -99, -99, -99, -11, 33, 65, 131,
00567 1, 119, 131, 1, 136, 1, 153, 154, 155, 131,
00568 70, -99, -99, 131, 131, 156, 157, -99, -99, -99,
00569 -99, 101, -99, -99, -11, 158, 159, -99, -99, 161,
00570 -99, 162, -99, -99, -99, 163, 131, 164, 165, -99,
00571 -99, -99, 99, -99, -99, -99, -99, -99, 166, -99,
00572 -99, -99
00573 };
00574
00575
00576 static const short yypgoto[] =
00577 {
00578 -99, -99, -99, 111, -99, -99, -99, -99, 178, -99,
00579 -99, -99, -99, 91, -99, -99, -99, -99, -99, -99,
00580 -99, -99, -99, -99, 115, -99, -99, -99, -99, -99,
00581 -99, 146, 168, 89, 27, 0, 126, -1, -98, -48,
00582 -63
00583 };
00584
00585
00586
00587
00588
00589 #define YYTABLE_NINF -68
00590 static const short yytable[] =
00591 {
00592 66, 67, 36, 42, 39, 40, 71, 41, 123, 124,
00593 43, 44, 74, 75, 120, 154, 72, 46, 47, 69,
00594 70, 121, 122, 48, 140, 45, 127, 128, 112, 130,
00595 49, 133, 156, 135, 158, 159, 68, 161, 60, 69,
00596 70, 165, 69, 70, 61, 167, 168, 62, 2, 3,
00597 63, 4, 5, 6, 7, 8, 9, 10, 11, 12,
00598 46, 47, 13, 14, 139, 152, 48, 126, 178, 15,
00599 16, 69, 70, 49, 37, 38, 129, 166, 151, 15,
00600 16, -67, 114, 64, -67, 5, 101, 7, 8, 102,
00601 10, 11, 12, 143, 65, 13, 103, 153, 46, 47,
00602 147, 148, 149, 69, 70, 125, 172, 134, 141, 136,
00603 137, 138, 15, 16, 5, 101, 7, 8, 102, 10,
00604 11, 12, 145, 146, 13, 103, 101, 7, 142, 102,
00605 10, 11, 12, 171, 144, 13, 103, 69, 70, 69,
00606 70, 15, 16, 100, 150, 154, 113, 108, 113, 116,
00607 73, 157, 15, 16, 74, 75, 70, 76, 77, 78,
00608 79, 80, 81, 82, 83, 84, 104, 107, 160, 115,
00609 85, 110, 73, 118, 86, 87, 74, 75, 92, 93,
00610 94, 95, 111, 96, 119, 162, 163, 164, 169, 170,
00611 173, 174, 97, 175, 176, 177, 179, 180, 181, 53,
00612 99, 59
00613 };
00614
00615 static const unsigned char yycheck[] =
00616 {
00617 48, 49, 3, 32, 4, 5, 30, 7, 71, 72,
00618 10, 28, 16, 17, 33, 14, 40, 28, 29, 38,
00619 39, 69, 70, 34, 87, 28, 74, 75, 32, 77,
00620 41, 79, 130, 81, 132, 133, 32, 135, 39, 38,
00621 39, 139, 38, 39, 32, 143, 144, 32, 0, 1,
00622 32, 3, 4, 5, 6, 7, 8, 9, 10, 11,
00623 28, 29, 14, 15, 28, 32, 34, 35, 166, 31,
00624 32, 38, 39, 41, 28, 29, 76, 140, 126, 31,
00625 32, 0, 1, 32, 3, 4, 5, 6, 7, 8,
00626 9, 10, 11, 93, 32, 14, 15, 32, 28, 29,
00627 101, 102, 103, 38, 39, 32, 154, 80, 13, 82,
00628 83, 84, 31, 32, 4, 5, 6, 7, 8, 9,
00629 10, 11, 95, 96, 14, 15, 5, 6, 32, 8,
00630 9, 10, 11, 32, 28, 14, 15, 38, 39, 38,
00631 39, 31, 32, 54, 32, 14, 57, 56, 59, 58,
00632 12, 32, 31, 32, 16, 17, 39, 19, 20, 21,
00633 22, 23, 24, 25, 26, 27, 55, 56, 32, 58,
00634 32, 56, 12, 58, 36, 37, 16, 17, 18, 19,
00635 20, 21, 56, 23, 58, 32, 32, 32, 32, 32,
00636 32, 32, 32, 32, 32, 32, 32, 32, 32, 21,
00637 54, 33
00638 };
00639
00640
00641
00642 static const unsigned char yystos[] =
00643 {
00644 0, 43, 0, 1, 3, 4, 5, 6, 7, 8,
00645 9, 10, 11, 14, 15, 31, 32, 44, 45, 46,
00646 47, 48, 49, 52, 53, 55, 59, 61, 63, 64,
00647 66, 68, 69, 70, 71, 79, 79, 28, 29, 77,
00648 77, 77, 32, 77, 28, 28, 28, 29, 34, 41,
00649 81, 82, 50, 50, 56, 58, 62, 74, 67, 74,
00650 79, 32, 32, 32, 32, 32, 81, 81, 32, 38,
00651 39, 30, 40, 12, 16, 17, 19, 20, 21, 22,
00652 23, 24, 25, 26, 27, 32, 36, 37, 51, 72,
00653 73, 75, 18, 19, 20, 21, 23, 32, 57, 73,
00654 75, 5, 8, 15, 45, 54, 78, 45, 55, 60,
00655 66, 78, 32, 75, 1, 45, 55, 65, 66, 78,
00656 33, 81, 81, 82, 82, 32, 35, 81, 81, 77,
00657 81, 76, 77, 81, 76, 81, 76, 76, 76, 28,
00658 82, 13, 32, 77, 28, 76, 76, 79, 79, 79,
00659 32, 81, 32, 32, 14, 80, 80, 32, 80, 80,
00660 32, 80, 32, 32, 32, 80, 82, 80, 80, 32,
00661 32, 32, 81, 32, 32, 32, 32, 32, 80, 32,
00662 32, 32
00663 };
00664
00665 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00666 # define YYSIZE_T __SIZE_TYPE__
00667 #endif
00668 #if ! defined (YYSIZE_T) && defined (size_t)
00669 # define YYSIZE_T size_t
00670 #endif
00671 #if ! defined (YYSIZE_T)
00672 # if defined (__STDC__) || defined (__cplusplus)
00673 # include <stddef.h>
00674 # define YYSIZE_T size_t
00675 # endif
00676 #endif
00677 #if ! defined (YYSIZE_T)
00678 # define YYSIZE_T unsigned int
00679 #endif
00680
00681 #define yyerrok (yyerrstatus = 0)
00682 #define yyclearin (yychar = YYEMPTY)
00683 #define YYEMPTY (-2)
00684 #define YYEOF 0
00685
00686 #define YYACCEPT goto yyacceptlab
00687 #define YYABORT goto yyabortlab
00688 #define YYERROR goto yyerrlab1
00689
00690
00691
00692
00693
00694
00695 #define YYFAIL goto yyerrlab
00696
00697 #define YYRECOVERING() (!!yyerrstatus)
00698
00699 #define YYBACKUP(Token, Value) \
00700 do \
00701 if (yychar == YYEMPTY && yylen == 1) \
00702 { \
00703 yychar = (Token); \
00704 yylval = (Value); \
00705 yytoken = YYTRANSLATE (yychar); \
00706 YYPOPSTACK; \
00707 goto yybackup; \
00708 } \
00709 else \
00710 { \
00711 yyerror ("syntax error: cannot back up");\
00712 YYERROR; \
00713 } \
00714 while (0)
00715
00716 #define YYTERROR 1
00717 #define YYERRCODE 256
00718
00719
00720
00721
00722 #ifndef YYLLOC_DEFAULT
00723 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00724 Current.first_line = Rhs[1].first_line; \
00725 Current.first_column = Rhs[1].first_column; \
00726 Current.last_line = Rhs[N].last_line; \
00727 Current.last_column = Rhs[N].last_column;
00728 #endif
00729
00730
00731
00732 #ifdef YYLEX_PARAM
00733 # define YYLEX yylex (YYLEX_PARAM)
00734 #else
00735 # define YYLEX yylex ()
00736 #endif
00737
00738
00739 #if YYDEBUG
00740
00741 # ifndef YYFPRINTF
00742 # include <stdio.h>
00743 # define YYFPRINTF fprintf
00744 # endif
00745
00746 # define YYDPRINTF(Args) \
00747 do { \
00748 if (yydebug) \
00749 YYFPRINTF Args; \
00750 } while (0)
00751
00752 # define YYDSYMPRINT(Args) \
00753 do { \
00754 if (yydebug) \
00755 yysymprint Args; \
00756 } while (0)
00757
00758 # define YYDSYMPRINTF(Title, Token, Value, Location) \
00759 do { \
00760 if (yydebug) \
00761 { \
00762 YYFPRINTF (stderr, "%s ", Title); \
00763 yysymprint (stderr, \
00764 Token, Value); \
00765 YYFPRINTF (stderr, "\n"); \
00766 } \
00767 } while (0)
00768
00769
00770
00771
00772
00773
00774 #if defined (__STDC__) || defined (__cplusplus)
00775 static void
00776 yy_stack_print (short *bottom, short *top)
00777 #else
00778 static void
00779 yy_stack_print (bottom, top)
00780 short *bottom;
00781 short *top;
00782 #endif
00783 {
00784 YYFPRINTF (stderr, "Stack now");
00785 for (; bottom <= top; ++bottom)
00786 YYFPRINTF (stderr, " %d", *bottom);
00787 YYFPRINTF (stderr, "\n");
00788 }
00789
00790 # define YY_STACK_PRINT(Bottom, Top) \
00791 do { \
00792 if (yydebug) \
00793 yy_stack_print ((Bottom), (Top)); \
00794 } while (0)
00795
00796
00797
00798
00799
00800
00801 #if defined (__STDC__) || defined (__cplusplus)
00802 static void
00803 yy_reduce_print (int yyrule)
00804 #else
00805 static void
00806 yy_reduce_print (yyrule)
00807 int yyrule;
00808 #endif
00809 {
00810 int yyi;
00811 unsigned int yylineno = yyrline[yyrule];
00812 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
00813 yyrule - 1, yylineno);
00814
00815 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
00816 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
00817 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
00818 }
00819
00820 # define YY_REDUCE_PRINT(Rule) \
00821 do { \
00822 if (yydebug) \
00823 yy_reduce_print (Rule); \
00824 } while (0)
00825
00826
00827
00828 int yydebug;
00829 #else
00830 # define YYDPRINTF(Args)
00831 # define YYDSYMPRINT(Args)
00832 # define YYDSYMPRINTF(Title, Token, Value, Location)
00833 # define YY_STACK_PRINT(Bottom, Top)
00834 # define YY_REDUCE_PRINT(Rule)
00835 #endif
00836
00837
00838
00839 #ifndef YYINITDEPTH
00840 # define YYINITDEPTH 200
00841 #endif
00842
00843
00844
00845
00846
00847
00848
00849
00850 #if YYMAXDEPTH == 0
00851 # undef YYMAXDEPTH
00852 #endif
00853
00854 #ifndef YYMAXDEPTH
00855 # define YYMAXDEPTH 10000
00856 #endif
00857
00858
00859
00860 #if YYERROR_VERBOSE
00861
00862 # ifndef yystrlen
00863 # if defined (__GLIBC__) && defined (_STRING_H)
00864 # define yystrlen strlen
00865 # else
00866
00867 static YYSIZE_T
00868 # if defined (__STDC__) || defined (__cplusplus)
00869 yystrlen (const char *yystr)
00870 # else
00871 yystrlen (yystr)
00872 const char *yystr;
00873 # endif
00874 {
00875 register const char *yys = yystr;
00876
00877 while (*yys++ != '\0')
00878 continue;
00879
00880 return yys - yystr - 1;
00881 }
00882 # endif
00883 # endif
00884
00885 # ifndef yystpcpy
00886 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00887 # define yystpcpy stpcpy
00888 # else
00889
00890
00891 static char *
00892 # if defined (__STDC__) || defined (__cplusplus)
00893 yystpcpy (char *yydest, const char *yysrc)
00894 # else
00895 yystpcpy (yydest, yysrc)
00896 char *yydest;
00897 const char *yysrc;
00898 # endif
00899 {
00900 register char *yyd = yydest;
00901 register const char *yys = yysrc;
00902
00903 while ((*yyd++ = *yys++) != '\0')
00904 continue;
00905
00906 return yyd - 1;
00907 }
00908 # endif
00909 # endif
00910
00911 #endif
00912
00913
00914
00915 #if YYDEBUG
00916
00917
00918
00919
00920 #if defined (__STDC__) || defined (__cplusplus)
00921 static void
00922 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
00923 #else
00924 static void
00925 yysymprint (yyoutput, yytype, yyvaluep)
00926 FILE *yyoutput;
00927 int yytype;
00928 YYSTYPE *yyvaluep;
00929 #endif
00930 {
00931
00932 (void) yyvaluep;
00933
00934 if (yytype < YYNTOKENS)
00935 {
00936 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00937 # ifdef YYPRINT
00938 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00939 # endif
00940 }
00941 else
00942 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00943
00944 switch (yytype)
00945 {
00946 default:
00947 break;
00948 }
00949 YYFPRINTF (yyoutput, ")");
00950 }
00951
00952 #endif
00953
00954
00955
00956
00957 #if defined (__STDC__) || defined (__cplusplus)
00958 static void
00959 yydestruct (int yytype, YYSTYPE *yyvaluep)
00960 #else
00961 static void
00962 yydestruct (yytype, yyvaluep)
00963 int yytype;
00964 YYSTYPE *yyvaluep;
00965 #endif
00966 {
00967
00968 (void) yyvaluep;
00969
00970 switch (yytype)
00971 {
00972
00973 default:
00974 break;
00975 }
00976 }
00977
00978
00979
00980
00981 #ifdef YYPARSE_PARAM
00982 # if defined (__STDC__) || defined (__cplusplus)
00983 int yyparse (void *YYPARSE_PARAM);
00984 # else
00985 int yyparse ();
00986 # endif
00987 #else
00988 #if defined (__STDC__) || defined (__cplusplus)
00989 int yyparse (void);
00990 #else
00991 int yyparse ();
00992 #endif
00993 #endif
00994
00995
00996
00997
00998 int yychar;
00999
01000
01001 YYSTYPE yylval;
01002
01003
01004 int yynerrs;
01005
01006
01007
01008
01009
01010
01011
01012 #ifdef YYPARSE_PARAM
01013 # if defined (__STDC__) || defined (__cplusplus)
01014 int yyparse (void *YYPARSE_PARAM)
01015 # else
01016 int yyparse (YYPARSE_PARAM)
01017 void *YYPARSE_PARAM;
01018 # endif
01019 #else
01020 #if defined (__STDC__) || defined (__cplusplus)
01021 int
01022 yyparse (void)
01023 #else
01024 int
01025 yyparse ()
01026
01027 #endif
01028 #endif
01029 {
01030
01031 register int yystate;
01032 register int yyn;
01033 int yyresult;
01034
01035 int yyerrstatus;
01036
01037 int yytoken = 0;
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048 short yyssa[YYINITDEPTH];
01049 short *yyss = yyssa;
01050 register short *yyssp;
01051
01052
01053 YYSTYPE yyvsa[YYINITDEPTH];
01054 YYSTYPE *yyvs = yyvsa;
01055 register YYSTYPE *yyvsp;
01056
01057
01058
01059 #define YYPOPSTACK (yyvsp--, yyssp--)
01060
01061 YYSIZE_T yystacksize = YYINITDEPTH;
01062
01063
01064
01065 YYSTYPE yyval;
01066
01067
01068
01069
01070 int yylen;
01071
01072 YYDPRINTF ((stderr, "Starting parse\n"));
01073
01074 yystate = 0;
01075 yyerrstatus = 0;
01076 yynerrs = 0;
01077 yychar = YYEMPTY;
01078
01079
01080
01081
01082
01083
01084 yyssp = yyss;
01085 yyvsp = yyvs;
01086
01087 goto yysetstate;
01088
01089
01090
01091
01092 yynewstate:
01093
01094
01095
01096 yyssp++;
01097
01098 yysetstate:
01099 *yyssp = yystate;
01100
01101 if (yyss + yystacksize - 1 <= yyssp)
01102 {
01103
01104 YYSIZE_T yysize = yyssp - yyss + 1;
01105
01106 #ifdef yyoverflow
01107 {
01108
01109
01110
01111 YYSTYPE *yyvs1 = yyvs;
01112 short *yyss1 = yyss;
01113
01114
01115
01116
01117
01118
01119 yyoverflow ("parser stack overflow",
01120 &yyss1, yysize * sizeof (*yyssp),
01121 &yyvs1, yysize * sizeof (*yyvsp),
01122
01123 &yystacksize);
01124
01125 yyss = yyss1;
01126 yyvs = yyvs1;
01127 }
01128 #else
01129 # ifndef YYSTACK_RELOCATE
01130 goto yyoverflowlab;
01131 # else
01132
01133 if (YYMAXDEPTH <= yystacksize)
01134 goto yyoverflowlab;
01135 yystacksize *= 2;
01136 if (YYMAXDEPTH < yystacksize)
01137 yystacksize = YYMAXDEPTH;
01138
01139 {
01140 short *yyss1 = yyss;
01141 union yyalloc *yyptr =
01142 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01143 if (! yyptr)
01144 goto yyoverflowlab;
01145 YYSTACK_RELOCATE (yyss);
01146 YYSTACK_RELOCATE (yyvs);
01147
01148 # undef YYSTACK_RELOCATE
01149 if (yyss1 != yyssa)
01150 YYSTACK_FREE (yyss1);
01151 }
01152 # endif
01153 #endif
01154
01155 yyssp = yyss + yysize - 1;
01156 yyvsp = yyvs + yysize - 1;
01157
01158
01159 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01160 (unsigned long int) yystacksize));
01161
01162 if (yyss + yystacksize - 1 <= yyssp)
01163 YYABORT;
01164 }
01165
01166 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01167
01168 goto yybackup;
01169
01170
01171
01172
01173 yybackup:
01174
01175
01176
01177
01178
01179
01180
01181 yyn = yypact[yystate];
01182 if (yyn == YYPACT_NINF)
01183 goto yydefault;
01184
01185
01186
01187
01188 if (yychar == YYEMPTY)
01189 {
01190 YYDPRINTF ((stderr, "Reading a token: "));
01191 yychar = YYLEX;
01192 }
01193
01194 if (yychar <= YYEOF)
01195 {
01196 yychar = yytoken = YYEOF;
01197 YYDPRINTF ((stderr, "Now at end of input.\n"));
01198 }
01199 else
01200 {
01201 yytoken = YYTRANSLATE (yychar);
01202 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
01203 }
01204
01205
01206
01207 yyn += yytoken;
01208 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01209 goto yydefault;
01210 yyn = yytable[yyn];
01211 if (yyn <= 0)
01212 {
01213 if (yyn == 0 || yyn == YYTABLE_NINF)
01214 goto yyerrlab;
01215 yyn = -yyn;
01216 goto yyreduce;
01217 }
01218
01219 if (yyn == YYFINAL)
01220 YYACCEPT;
01221
01222
01223 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
01224
01225
01226 if (yychar != YYEOF)
01227 yychar = YYEMPTY;
01228
01229 *++yyvsp = yylval;
01230
01231
01232
01233
01234 if (yyerrstatus)
01235 yyerrstatus--;
01236
01237 yystate = yyn;
01238 goto yynewstate;
01239
01240
01241
01242
01243
01244 yydefault:
01245 yyn = yydefact[yystate];
01246 if (yyn == 0)
01247 goto yyerrlab;
01248 goto yyreduce;
01249
01250
01251
01252
01253
01254 yyreduce:
01255
01256 yylen = yyr2[yyn];
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266 yyval = yyvsp[1-yylen];
01267
01268
01269 YY_REDUCE_PRINT (yyn);
01270 switch (yyn)
01271 {
01272 case 8:
01273
01274 { zconfprint("unexpected 'endmenu' statement"); ;}
01275 break;
01276
01277 case 9:
01278
01279 { zconfprint("unexpected 'endif' statement"); ;}
01280 break;
01281
01282 case 10:
01283
01284 { zconfprint("unexpected 'endchoice' statement"); ;}
01285 break;
01286
01287 case 11:
01288
01289 { zconfprint("syntax error"); yyerrok; ;}
01290 break;
01291
01292 case 18:
01293
01294 {
01295 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
01296 sym->flags |= SYMBOL_OPTIONAL;
01297 menu_add_entry(sym);
01298 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
01299 ;}
01300 break;
01301
01302 case 19:
01303
01304 {
01305 menu_end_entry();
01306 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
01307 ;}
01308 break;
01309
01310 case 20:
01311
01312 {
01313 struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
01314 sym->flags |= SYMBOL_OPTIONAL;
01315 menu_add_entry(sym);
01316 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
01317 ;}
01318 break;
01319
01320 case 21:
01321
01322 {
01323 if (current_entry->prompt)
01324 current_entry->prompt->type = P_MENU;
01325 else
01326 zconfprint("warning: menuconfig statement without prompt");
01327 menu_end_entry();
01328 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
01329 ;}
01330 break;
01331
01332 case 27:
01333
01334 {
01335 menu_set_type(S_TRISTATE);
01336 printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
01337 ;}
01338 break;
01339
01340 case 28:
01341
01342 {
01343 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
01344 menu_set_type(S_TRISTATE);
01345 printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
01346 ;}
01347 break;
01348
01349 case 29:
01350
01351 {
01352 menu_set_type(S_BOOLEAN);
01353 printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
01354 ;}
01355 break;
01356
01357 case 30:
01358
01359 {
01360 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
01361 menu_set_type(S_BOOLEAN);
01362 printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
01363 ;}
01364 break;
01365
01366 case 31:
01367
01368 {
01369 menu_set_type(S_INT);
01370 printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno());
01371 ;}
01372 break;
01373
01374 case 32:
01375
01376 {
01377 menu_set_type(S_HEX);
01378 printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno());
01379 ;}
01380 break;
01381
01382 case 33:
01383
01384 {
01385 menu_set_type(S_STRING);
01386 printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno());
01387 ;}
01388 break;
01389
01390 case 34:
01391
01392 {
01393 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
01394 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
01395 ;}
01396 break;
01397
01398 case 35:
01399
01400 {
01401 menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr);
01402 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
01403 ;}
01404 break;
01405
01406 case 36:
01407
01408 {
01409 menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
01410 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
01411 ;}
01412 break;
01413
01414 case 37:
01415
01416 {
01417 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr);
01418 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
01419 ;}
01420 break;
01421
01422 case 38:
01423
01424 {
01425 struct symbol *sym = sym_lookup(NULL, 0);
01426 sym->flags |= SYMBOL_CHOICE;
01427 menu_add_entry(sym);
01428 menu_add_expr(P_CHOICE, NULL, NULL);
01429 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
01430 ;}
01431 break;
01432
01433 case 39:
01434
01435 {
01436 menu_end_entry();
01437 menu_add_menu();
01438 ;}
01439 break;
01440
01441 case 40:
01442
01443 {
01444 if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) {
01445 menu_end_menu();
01446 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
01447 }
01448 ;}
01449 break;
01450
01451 case 42:
01452
01453 {
01454 printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
01455 zconfnerrs++;
01456 ;}
01457 break;
01458
01459 case 48:
01460
01461 {
01462 menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr);
01463 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
01464 ;}
01465 break;
01466
01467 case 49:
01468
01469 {
01470 menu_set_type(S_TRISTATE);
01471 printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
01472 ;}
01473 break;
01474
01475 case 50:
01476
01477 {
01478 menu_set_type(S_BOOLEAN);
01479 printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
01480 ;}
01481 break;
01482
01483 case 51:
01484
01485 {
01486 current_entry->sym->flags |= SYMBOL_OPTIONAL;
01487 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
01488 ;}
01489 break;
01490
01491 case 52:
01492
01493 {
01494 menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
01495 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
01496 ;}
01497 break;
01498
01499 case 55:
01500
01501 {
01502 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
01503 menu_add_entry(NULL);
01504 menu_add_dep(yyvsp[-1].expr);
01505 menu_end_entry();
01506 menu_add_menu();
01507 ;}
01508 break;
01509
01510 case 56:
01511
01512 {
01513 if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) {
01514 menu_end_menu();
01515 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
01516 }
01517 ;}
01518 break;
01519
01520 case 58:
01521
01522 {
01523 printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
01524 zconfnerrs++;
01525 ;}
01526 break;
01527
01528 case 63:
01529
01530 {
01531 menu_add_entry(NULL);
01532 menu_add_prop(P_MENU, yyvsp[-1].string, NULL, NULL);
01533 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
01534 ;}
01535 break;
01536
01537 case 64:
01538
01539 {
01540 menu_end_entry();
01541 menu_add_menu();
01542 ;}
01543 break;
01544
01545 case 65:
01546
01547 {
01548 if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) {
01549 menu_end_menu();
01550 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
01551 }
01552 ;}
01553 break;
01554
01555 case 67:
01556
01557 {
01558 printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
01559 zconfnerrs++;
01560 ;}
01561 break;
01562
01563 case 72:
01564
01565 { zconfprint("invalid menu option"); yyerrok; ;}
01566 break;
01567
01568 case 73:
01569
01570 {
01571 yyval.string = yyvsp[-1].string;
01572 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
01573 ;}
01574 break;
01575
01576 case 74:
01577
01578 {
01579 zconf_nextfile(yyvsp[0].string);
01580 ;}
01581 break;
01582
01583 case 75:
01584
01585 {
01586 menu_add_entry(NULL);
01587 menu_add_prop(P_COMMENT, yyvsp[-1].string, NULL, NULL);
01588 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
01589 ;}
01590 break;
01591
01592 case 76:
01593
01594 {
01595 menu_end_entry();
01596 ;}
01597 break;
01598
01599 case 77:
01600
01601 {
01602 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
01603 zconf_starthelp();
01604 ;}
01605 break;
01606
01607 case 78:
01608
01609 {
01610 current_entry->sym->help = yyvsp[0].string;
01611 ;}
01612 break;
01613
01614 case 82:
01615
01616 {
01617 menu_add_dep(yyvsp[-1].expr);
01618 printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
01619 ;}
01620 break;
01621
01622 case 83:
01623
01624 {
01625 menu_add_dep(yyvsp[-1].expr);
01626 printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
01627 ;}
01628 break;
01629
01630 case 84:
01631
01632 {
01633 menu_add_dep(yyvsp[-1].expr);
01634 printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
01635 ;}
01636 break;
01637
01638 case 86:
01639
01640 {
01641 menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
01642 ;}
01643 break;
01644
01645 case 89:
01646
01647 { yyval.token = T_ENDMENU; ;}
01648 break;
01649
01650 case 90:
01651
01652 { yyval.token = T_ENDCHOICE; ;}
01653 break;
01654
01655 case 91:
01656
01657 { yyval.token = T_ENDIF; ;}
01658 break;
01659
01660 case 94:
01661
01662 { yyval.expr = NULL; ;}
01663 break;
01664
01665 case 95:
01666
01667 { yyval.expr = yyvsp[0].expr; ;}
01668 break;
01669
01670 case 96:
01671
01672 { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;}
01673 break;
01674
01675 case 97:
01676
01677 { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
01678 break;
01679
01680 case 98:
01681
01682 { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
01683 break;
01684
01685 case 99:
01686
01687 { yyval.expr = yyvsp[-1].expr; ;}
01688 break;
01689
01690 case 100:
01691
01692 { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;}
01693 break;
01694
01695 case 101:
01696
01697 { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;}
01698 break;
01699
01700 case 102:
01701
01702 { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;}
01703 break;
01704
01705 case 103:
01706
01707 { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;}
01708 break;
01709
01710 case 104:
01711
01712 { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;}
01713 break;
01714
01715
01716 }
01717
01718
01719
01720
01721 yyvsp -= yylen;
01722 yyssp -= yylen;
01723
01724
01725 YY_STACK_PRINT (yyss, yyssp);
01726
01727 *++yyvsp = yyval;
01728
01729
01730
01731
01732
01733
01734 yyn = yyr1[yyn];
01735
01736 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01737 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01738 yystate = yytable[yystate];
01739 else
01740 yystate = yydefgoto[yyn - YYNTOKENS];
01741
01742 goto yynewstate;
01743
01744
01745
01746
01747
01748 yyerrlab:
01749
01750 if (!yyerrstatus)
01751 {
01752 ++yynerrs;
01753 #if YYERROR_VERBOSE
01754 yyn = yypact[yystate];
01755
01756 if (YYPACT_NINF < yyn && yyn < YYLAST)
01757 {
01758 YYSIZE_T yysize = 0;
01759 int yytype = YYTRANSLATE (yychar);
01760 char *yymsg;
01761 int yyx, yycount;
01762
01763 yycount = 0;
01764
01765
01766 for (yyx = yyn < 0 ? -yyn : 0;
01767 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
01768 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01769 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
01770 yysize += yystrlen ("syntax error, unexpected ") + 1;
01771 yysize += yystrlen (yytname[yytype]);
01772 yymsg = (char *) YYSTACK_ALLOC (yysize);
01773 if (yymsg != 0)
01774 {
01775 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
01776 yyp = yystpcpy (yyp, yytname[yytype]);
01777
01778 if (yycount < 5)
01779 {
01780 yycount = 0;
01781 for (yyx = yyn < 0 ? -yyn : 0;
01782 yyx < (int) (sizeof (yytname) / sizeof (char *));
01783 yyx++)
01784 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01785 {
01786 const char *yyq = ! yycount ? ", expecting " : " or ";
01787 yyp = yystpcpy (yyp, yyq);
01788 yyp = yystpcpy (yyp, yytname[yyx]);
01789 yycount++;
01790 }
01791 }
01792 yyerror (yymsg);
01793 YYSTACK_FREE (yymsg);
01794 }
01795 else
01796 yyerror ("syntax error; also virtual memory exhausted");
01797 }
01798 else
01799 #endif
01800 yyerror ("syntax error");
01801 }
01802
01803
01804
01805 if (yyerrstatus == 3)
01806 {
01807
01808
01809
01810
01811 if (yychar == YYEOF)
01812 {
01813
01814 YYPOPSTACK;
01815
01816 while (yyss < yyssp)
01817 {
01818 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
01819 yydestruct (yystos[*yyssp], yyvsp);
01820 YYPOPSTACK;
01821 }
01822 YYABORT;
01823 }
01824
01825 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
01826 yydestruct (yytoken, &yylval);
01827 yychar = YYEMPTY;
01828
01829 }
01830
01831
01832
01833 goto yyerrlab1;
01834
01835
01836
01837
01838
01839 yyerrlab1:
01840 yyerrstatus = 3;
01841
01842 for (;;)
01843 {
01844 yyn = yypact[yystate];
01845 if (yyn != YYPACT_NINF)
01846 {
01847 yyn += YYTERROR;
01848 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01849 {
01850 yyn = yytable[yyn];
01851 if (0 < yyn)
01852 break;
01853 }
01854 }
01855
01856
01857 if (yyssp == yyss)
01858 YYABORT;
01859
01860 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
01861 yydestruct (yystos[yystate], yyvsp);
01862 yyvsp--;
01863 yystate = *--yyssp;
01864
01865 YY_STACK_PRINT (yyss, yyssp);
01866 }
01867
01868 if (yyn == YYFINAL)
01869 YYACCEPT;
01870
01871 YYDPRINTF ((stderr, "Shifting error token, "));
01872
01873 *++yyvsp = yylval;
01874
01875
01876 yystate = yyn;
01877 goto yynewstate;
01878
01879
01880
01881
01882
01883 yyacceptlab:
01884 yyresult = 0;
01885 goto yyreturn;
01886
01887
01888
01889
01890 yyabortlab:
01891 yyresult = 1;
01892 goto yyreturn;
01893
01894 #ifndef yyoverflow
01895
01896
01897
01898 yyoverflowlab:
01899 yyerror ("parser stack overflow");
01900 yyresult = 2;
01901
01902 #endif
01903
01904 yyreturn:
01905 #ifndef yyoverflow
01906 if (yyss != yyssa)
01907 YYSTACK_FREE (yyss);
01908 #endif
01909 return yyresult;
01910 }
01911
01912
01913
01914
01915
01916 void conf_parse(const char *name)
01917 {
01918 struct symbol *sym;
01919 int i;
01920
01921 zconf_initscan(name);
01922
01923 sym_init();
01924 menu_init();
01925 modules_sym = sym_lookup("MODULES", 0);
01926 rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL);
01927
01928
01929 zconfparse();
01930 if (zconfnerrs)
01931 exit(1);
01932 menu_finalize(&rootmenu);
01933 for_all_symbols(i, sym) {
01934 if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym))
01935 printf("\n");
01936 else
01937 sym->flags |= SYMBOL_CHECK_DONE;
01938 }
01939
01940 sym_change_count = 1;
01941 }
01942
01943 const char *zconf_tokenname(int token)
01944 {
01945 switch (token) {
01946 case T_MENU: return "menu";
01947 case T_ENDMENU: return "endmenu";
01948 case T_CHOICE: return "choice";
01949 case T_ENDCHOICE: return "endchoice";
01950 case T_IF: return "if";
01951 case T_ENDIF: return "endif";
01952 }
01953 return "<token>";
01954 }
01955
01956 static bool zconf_endtoken(int token, int starttoken, int endtoken)
01957 {
01958 if (token != endtoken) {
01959 zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken));
01960 zconfnerrs++;
01961 return false;
01962 }
01963 if (current_menu->file != current_file) {
01964 zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken));
01965 zconfprint("location of the '%s'", zconf_tokenname(starttoken));
01966 zconfnerrs++;
01967 return false;
01968 }
01969 return true;
01970 }
01971
01972 static void zconfprint(const char *err, ...)
01973 {
01974 va_list ap;
01975
01976 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1);
01977 va_start(ap, err);
01978 vfprintf(stderr, err, ap);
01979 va_end(ap);
01980 fprintf(stderr, "\n");
01981 }
01982
01983 static void zconferror(const char *err)
01984 {
01985 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
01986 }
01987
01988 void print_quoted_string(FILE *out, const char *str)
01989 {
01990 const char *p;
01991 int len;
01992
01993 putc('"', out);
01994 while ((p = strchr(str, '"'))) {
01995 len = p - str;
01996 if (len)
01997 fprintf(out, "%.*s", len, str);
01998 fputs("\\\"", out);
01999 str = p + 1;
02000 }
02001 fputs(str, out);
02002 putc('"', out);
02003 }
02004
02005 void print_symbol(FILE *out, struct menu *menu)
02006 {
02007 struct symbol *sym = menu->sym;
02008 struct property *prop;
02009
02010 if (sym_is_choice(sym))
02011 fprintf(out, "choice\n");
02012 else
02013 fprintf(out, "config %s\n", sym->name);
02014 switch (sym->type) {
02015 case S_BOOLEAN:
02016 fputs(" boolean\n", out);
02017 break;
02018 case S_TRISTATE:
02019 fputs(" tristate\n", out);
02020 break;
02021 case S_STRING:
02022 fputs(" string\n", out);
02023 break;
02024 case S_INT:
02025 fputs(" integer\n", out);
02026 break;
02027 case S_HEX:
02028 fputs(" hex\n", out);
02029 break;
02030 default:
02031 fputs(" ???\n", out);
02032 break;
02033 }
02034 for (prop = sym->prop; prop; prop = prop->next) {
02035 if (prop->menu != menu)
02036 continue;
02037 switch (prop->type) {
02038 case P_PROMPT:
02039 fputs(" prompt ", out);
02040 print_quoted_string(out, prop->text);
02041 if (!expr_is_yes(prop->visible.expr)) {
02042 fputs(" if ", out);
02043 expr_fprint(prop->visible.expr, out);
02044 }
02045 fputc('\n', out);
02046 break;
02047 case P_DEFAULT:
02048 fputs( " default ", out);
02049 expr_fprint(prop->expr, out);
02050 if (!expr_is_yes(prop->visible.expr)) {
02051 fputs(" if ", out);
02052 expr_fprint(prop->visible.expr, out);
02053 }
02054 fputc('\n', out);
02055 break;
02056 case P_CHOICE:
02057 fputs(" #choice value\n", out);
02058 break;
02059 default:
02060 fprintf(out, " unknown prop %d!\n", prop->type);
02061 break;
02062 }
02063 }
02064 if (sym->help) {
02065 int len = strlen(sym->help);
02066 while (sym->help[--len] == '\n')
02067 sym->help[len] = 0;
02068 fprintf(out, " help\n%s\n", sym->help);
02069 }
02070 fputc('\n', out);
02071 }
02072
02073 void zconfdump(FILE *out)
02074 {
02075 struct property *prop;
02076 struct symbol *sym;
02077 struct menu *menu;
02078
02079 menu = rootmenu.list;
02080 while (menu) {
02081 if ((sym = menu->sym))
02082 print_symbol(out, menu);
02083 else if ((prop = menu->prompt)) {
02084 switch (prop->type) {
02085 case P_COMMENT:
02086 fputs("\ncomment ", out);
02087 print_quoted_string(out, prop->text);
02088 fputs("\n", out);
02089 break;
02090 case P_MENU:
02091 fputs("\nmenu ", out);
02092 print_quoted_string(out, prop->text);
02093 fputs("\n", out);
02094 break;
02095 default:
02096 ;
02097 }
02098 if (!expr_is_yes(prop->visible.expr)) {
02099 fputs(" depends ", out);
02100 expr_fprint(prop->visible.expr, out);
02101 fputc('\n', out);
02102 }
02103 fputs("\n", out);
02104 }
02105
02106 if (menu->list)
02107 menu = menu->list;
02108 else if (menu->next)
02109 menu = menu->next;
02110 else while ((menu = menu->parent)) {
02111 if (menu->prompt && menu->prompt->type == P_MENU)
02112 fputs("\nendmenu\n", out);
02113 if (menu->next) {
02114 menu = menu->next;
02115 break;
02116 }
02117 }
02118 }
02119 }
02120
02121 #include "lex.zconf.c"
02122 #include "confdata.c"
02123 #include "expr.c"
02124 #include "symbol.c"
02125 #include "menu.c"
02126
02127