Commit d4f8a453 authored by Roman Zippel's avatar Roman Zippel Committed by Ben Collins

[PATCH] add new keywords to parser

Add the following new keywords: def_tristate, def_bool, def_boolean,
select, enable and range.

Add support for def_tristate and def_bool, which combines default and
bool/tristate into a single statement and a allows simpler definition
of derived symbols.
parent 30e61a48
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -106,11 +106,17 @@ n [A-Za-z0-9_]
"default" BEGIN(PARAM); return T_DEFAULT;
"prompt" BEGIN(PARAM); return T_PROMPT;
"tristate" BEGIN(PARAM); return T_TRISTATE;
"def_tristate" BEGIN(PARAM); return T_DEF_TRISTATE;
"bool" BEGIN(PARAM); return T_BOOLEAN;
"boolean" BEGIN(PARAM); return T_BOOLEAN;
"def_bool" BEGIN(PARAM); return T_DEF_BOOLEAN;
"def_boolean" BEGIN(PARAM); return T_DEF_BOOLEAN;
"int" BEGIN(PARAM); return T_INT;
"hex" BEGIN(PARAM); return T_HEX;
"string" BEGIN(PARAM); return T_STRING;
"select" BEGIN(PARAM); return T_SELECT;
"enable" BEGIN(PARAM); return T_SELECT;
"range" BEGIN(PARAM); return T_RANGE;
{n}+ {
alloc_string(yytext, yyleng);
zconflval.string = text;
......@@ -208,7 +214,6 @@ n [A-Za-z0-9_]
}
append_string(" ", ts);
}
}
[ \t]*\n/[^ \t\n] {
current_file->lineno++;
......@@ -250,11 +255,11 @@ void zconf_starthelp(void)
static void zconf_endhelp(void)
{
zconflval.string = text;
BEGIN(INITIAL);
BEGIN(INITIAL);
}
/*
/*
* Try to open specified file with following names:
* ./name
* $(srctree)/name
......@@ -347,7 +352,7 @@ static struct buffer *zconf_endfile(void)
int zconf_lineno(void)
{
if (current_buf)
return current_file->lineno;
return current_file->lineno - 1;
else
return 0;
}
......
......@@ -81,22 +81,26 @@
T_PROMPT = 274,
T_DEFAULT = 275,
T_TRISTATE = 276,
T_BOOLEAN = 277,
T_STRING = 278,
T_INT = 279,
T_HEX = 280,
T_WORD = 281,
T_WORD_QUOTE = 282,
T_UNEQUAL = 283,
T_EOF = 284,
T_EOL = 285,
T_CLOSE_PAREN = 286,
T_OPEN_PAREN = 287,
T_ON = 288,
T_OR = 289,
T_AND = 290,
T_EQUAL = 291,
T_NOT = 292
T_DEF_TRISTATE = 277,
T_BOOLEAN = 278,
T_DEF_BOOLEAN = 279,
T_STRING = 280,
T_INT = 281,
T_HEX = 282,
T_WORD = 283,
T_WORD_QUOTE = 284,
T_UNEQUAL = 285,
T_EOF = 286,
T_EOL = 287,
T_CLOSE_PAREN = 288,
T_OPEN_PAREN = 289,
T_ON = 290,
T_SELECT = 291,
T_RANGE = 292,
T_OR = 293,
T_AND = 294,
T_EQUAL = 295,
T_NOT = 296
};
#endif
#define T_MAINMENU 258
......@@ -118,22 +122,26 @@
#define T_PROMPT 274
#define T_DEFAULT 275
#define T_TRISTATE 276
#define T_BOOLEAN 277
#define T_STRING 278
#define T_INT 279
#define T_HEX 280
#define T_WORD 281
#define T_WORD_QUOTE 282
#define T_UNEQUAL 283
#define T_EOF 284
#define T_EOL 285
#define T_CLOSE_PAREN 286
#define T_OPEN_PAREN 287
#define T_ON 288
#define T_OR 289
#define T_AND 290
#define T_EQUAL 291
#define T_NOT 292
#define T_DEF_TRISTATE 277
#define T_BOOLEAN 278
#define T_DEF_BOOLEAN 279
#define T_STRING 280
#define T_INT 281
#define T_HEX 282
#define T_WORD 283
#define T_WORD_QUOTE 284
#define T_UNEQUAL 285
#define T_EOF 286
#define T_EOL 287
#define T_CLOSE_PAREN 288
#define T_OPEN_PAREN 289
#define T_ON 290
#define T_SELECT 291
#define T_RANGE 292
#define T_OR 293
#define T_AND 294
#define T_EQUAL 295
#define T_NOT 296
......@@ -172,7 +180,7 @@ struct symbol *symbol_hash[257];
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
# define YYDEBUG 0
#endif
/* Enabling verbose error messages. */
......@@ -308,20 +316,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 160
#define YYLAST 201
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 38
#define YYNTOKENS 42
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 41
/* YYNRULES -- Number of rules. */
#define YYNRULES 99
#define YYNRULES 104
/* YYNRULES -- Number of states. */
#define YYNSTATES 152
#define YYNSTATES 182
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 292
#define YYMAXUTOK 296
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
......@@ -358,7 +366,7 @@ static const unsigned char yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37
35, 36, 37, 38, 39, 40, 41
};
#if YYDEBUG
......@@ -367,64 +375,69 @@ static const unsigned char yytranslate[] =
static const unsigned short yyprhs[] =
{
0, 0, 3, 4, 7, 9, 11, 13, 17, 19,
21, 23, 26, 28, 30, 32, 34, 36, 38, 41,
45, 48, 52, 53, 57, 61, 64, 67, 70, 73,
76, 79, 82, 86, 90, 92, 96, 98, 103, 106,
107, 111, 115, 118, 121, 125, 127, 131, 132, 135,
138, 140, 146, 150, 151, 154, 157, 160, 163, 167,
169, 174, 177, 178, 181, 184, 187, 191, 194, 197,
200, 204, 207, 210, 211, 215, 218, 222, 225, 228,
229, 231, 235, 237, 239, 241, 243, 245, 247, 249,
250, 253, 255, 259, 263, 267, 270, 274, 278, 280
21, 23, 26, 28, 30, 32, 34, 36, 38, 42,
45, 49, 52, 53, 56, 59, 62, 65, 69, 74,
78, 83, 87, 91, 95, 100, 105, 110, 116, 119,
122, 124, 128, 131, 132, 135, 138, 141, 144, 149,
153, 157, 160, 165, 166, 169, 173, 175, 179, 182,
183, 186, 189, 192, 196, 199, 201, 205, 208, 209,
212, 215, 218, 222, 226, 228, 232, 235, 238, 241,
242, 245, 248, 253, 257, 261, 262, 265, 267, 269,
272, 275, 278, 280, 282, 283, 286, 288, 292, 296,
300, 303, 307, 311, 313
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
39, 0, -1, -1, 39, 40, -1, 41, -1, 51,
-1, 62, -1, 3, 73, 75, -1, 5, -1, 15,
-1, 8, -1, 1, 75, -1, 57, -1, 67, -1,
43, -1, 45, -1, 65, -1, 75, -1, 10, 26,
-1, 42, 30, 46, -1, 11, 26, -1, 44, 30,
46, -1, -1, 46, 47, 30, -1, 46, 71, 30,
-1, 46, 69, -1, 46, 30, -1, 21, 72, -1,
22, 72, -1, 24, 72, -1, 25, 72, -1, 23,
72, -1, 19, 73, 76, -1, 20, 78, 76, -1,
7, -1, 48, 30, 52, -1, 74, -1, 49, 54,
50, 30, -1, 49, 54, -1, -1, 52, 53, 30,
-1, 52, 71, 30, -1, 52, 69, -1, 52, 30,
-1, 19, 73, 76, -1, 18, -1, 20, 78, 76,
-1, -1, 54, 41, -1, 14, 77, -1, 74, -1,
55, 30, 58, 56, 30, -1, 55, 30, 58, -1,
-1, 58, 41, -1, 58, 62, -1, 58, 51, -1,
4, 73, -1, 59, 30, 70, -1, 74, -1, 60,
63, 61, 30, -1, 60, 63, -1, -1, 63, 41,
-1, 63, 62, -1, 63, 51, -1, 63, 1, 30,
-1, 6, 73, -1, 64, 30, -1, 9, 73, -1,
66, 30, 70, -1, 12, 30, -1, 68, 13, -1,
-1, 70, 71, 30, -1, 70, 30, -1, 16, 33,
77, -1, 16, 77, -1, 17, 77, -1, -1, 73,
-1, 73, 14, 77, -1, 26, -1, 27, -1, 5,
-1, 8, -1, 15, -1, 30, -1, 29, -1, -1,
14, 77, -1, 78, -1, 78, 36, 78, -1, 78,
28, 78, -1, 32, 77, 31, -1, 37, 77, -1,
77, 34, 77, -1, 77, 35, 77, -1, 26, -1,
27, -1
43, 0, -1, -1, 43, 44, -1, 45, -1, 55,
-1, 66, -1, 3, 77, 79, -1, 5, -1, 15,
-1, 8, -1, 1, 79, -1, 61, -1, 71, -1,
47, -1, 49, -1, 69, -1, 79, -1, 10, 28,
32, -1, 46, 50, -1, 11, 28, 32, -1, 48,
50, -1, -1, 50, 51, -1, 50, 75, -1, 50,
73, -1, 50, 32, -1, 21, 76, 32, -1, 22,
81, 80, 32, -1, 23, 76, 32, -1, 24, 81,
80, 32, -1, 26, 76, 32, -1, 27, 76, 32,
-1, 25, 76, 32, -1, 19, 77, 80, 32, -1,
20, 82, 80, 32, -1, 36, 28, 80, 32, -1,
37, 82, 82, 80, 32, -1, 7, 32, -1, 52,
56, -1, 78, -1, 53, 58, 54, -1, 53, 58,
-1, -1, 56, 57, -1, 56, 75, -1, 56, 73,
-1, 56, 32, -1, 19, 77, 80, 32, -1, 21,
76, 32, -1, 23, 76, 32, -1, 18, 32, -1,
20, 28, 80, 32, -1, -1, 58, 45, -1, 14,
81, 32, -1, 78, -1, 59, 62, 60, -1, 59,
62, -1, -1, 62, 45, -1, 62, 66, -1, 62,
55, -1, 4, 77, 32, -1, 63, 74, -1, 78,
-1, 64, 67, 65, -1, 64, 67, -1, -1, 67,
45, -1, 67, 66, -1, 67, 55, -1, 67, 1,
32, -1, 6, 77, 32, -1, 68, -1, 9, 77,
32, -1, 70, 74, -1, 12, 32, -1, 72, 13,
-1, -1, 74, 75, -1, 74, 32, -1, 16, 35,
81, 32, -1, 16, 81, 32, -1, 17, 81, 32,
-1, -1, 77, 80, -1, 28, -1, 29, -1, 5,
79, -1, 8, 79, -1, 15, 79, -1, 32, -1,
31, -1, -1, 14, 81, -1, 82, -1, 82, 40,
82, -1, 82, 30, 82, -1, 34, 81, 33, -1,
41, 81, -1, 81, 38, 81, -1, 81, 39, 81,
-1, 28, -1, 29, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short yyrline[] =
{
0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
100, 101, 105, 106, 107, 108, 109, 110, 116, 124,
130, 138, 148, 150, 151, 152, 153, 156, 162, 168,
174, 180, 186, 192, 200, 209, 215, 224, 225, 231,
233, 234, 235, 236, 239, 245, 251, 257, 259, 264,
273, 282, 283, 289, 291, 292, 293, 298, 305, 311,
320, 321, 327, 329, 330, 331, 332, 335, 341, 348,
355, 362, 368, 375, 376, 377, 380, 385, 390, 398,
400, 404, 409, 410, 413, 414, 415, 419, 419, 421,
422, 425, 426, 427, 428, 429, 430, 431, 434, 435
0, 94, 94, 95, 98, 99, 100, 101, 102, 103,
104, 105, 109, 110, 111, 112, 113, 114, 120, 128,
134, 142, 152, 154, 155, 156, 157, 160, 166, 171,
177, 182, 188, 194, 200, 206, 212, 217, 224, 233,
239, 248, 249, 255, 257, 258, 259, 260, 263, 269,
275, 281, 287, 293, 295, 300, 309, 318, 319, 325,
327, 328, 329, 334, 341, 347, 356, 357, 363, 365,
366, 367, 368, 371, 377, 384, 391, 398, 404, 411,
412, 413, 416, 421, 426, 434, 436, 441, 442, 445,
446, 447, 451, 451, 453, 454, 457, 458, 459, 460,
461, 462, 463, 466, 467
};
#endif
......@@ -437,9 +450,10 @@ static const char *const yytname[] =
"T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
"T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
"T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE",
"T_BOOLEAN", "T_STRING", "T_INT", "T_HEX", "T_WORD", "T_WORD_QUOTE",
"T_UNEQUAL", "T_EOF", "T_EOL", "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON",
"T_OR", "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block",
"T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT",
"T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL",
"T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR",
"T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block",
"common_block", "config_entry_start", "config_stmt",
"menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
"config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
......@@ -459,38 +473,41 @@ static const unsigned short yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const unsigned char yyr1[] =
{
0, 38, 39, 39, 40, 40, 40, 40, 40, 40,
40, 40, 41, 41, 41, 41, 41, 41, 42, 43,
44, 45, 46, 46, 46, 46, 46, 47, 47, 47,
47, 47, 47, 47, 48, 49, 50, 51, 51, 52,
52, 52, 52, 52, 53, 53, 53, 54, 54, 55,
56, 57, 57, 58, 58, 58, 58, 59, 60, 61,
62, 62, 63, 63, 63, 63, 63, 64, 65, 66,
67, 68, 69, 70, 70, 70, 71, 71, 71, 72,
72, 72, 73, 73, 74, 74, 74, 75, 75, 76,
76, 77, 77, 77, 77, 77, 77, 77, 78, 78
0, 42, 43, 43, 44, 44, 44, 44, 44, 44,
44, 44, 45, 45, 45, 45, 45, 45, 46, 47,
48, 49, 50, 50, 50, 50, 50, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 52, 53,
54, 55, 55, 56, 56, 56, 56, 56, 57, 57,
57, 57, 57, 58, 58, 59, 60, 61, 61, 62,
62, 62, 62, 63, 64, 65, 66, 66, 67, 67,
67, 67, 67, 68, 69, 70, 71, 72, 73, 74,
74, 74, 75, 75, 75, 76, 76, 77, 77, 78,
78, 78, 79, 79, 80, 80, 81, 81, 81, 81,
81, 81, 81, 82, 82
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const unsigned char yyr2[] =
{
0, 2, 0, 2, 1, 1, 1, 3, 1, 1,
1, 2, 1, 1, 1, 1, 1, 1, 2, 3,
2, 3, 0, 3, 3, 2, 2, 2, 2, 2,
2, 2, 3, 3, 1, 3, 1, 4, 2, 0,
3, 3, 2, 2, 3, 1, 3, 0, 2, 2,
1, 5, 3, 0, 2, 2, 2, 2, 3, 1,
4, 2, 0, 2, 2, 2, 3, 2, 2, 2,
3, 2, 2, 0, 3, 2, 3, 2, 2, 0,
1, 3, 1, 1, 1, 1, 1, 1, 1, 0,
2, 1, 3, 3, 3, 2, 3, 3, 1, 1
1, 2, 1, 1, 1, 1, 1, 1, 3, 2,
3, 2, 0, 2, 2, 2, 2, 3, 4, 3,
4, 3, 3, 3, 4, 4, 4, 5, 2, 2,
1, 3, 2, 0, 2, 2, 2, 2, 4, 3,
3, 2, 4, 0, 2, 3, 1, 3, 2, 0,
2, 2, 2, 3, 2, 1, 3, 2, 0, 2,
2, 2, 3, 3, 1, 3, 2, 2, 2, 0,
2, 2, 4, 3, 3, 0, 2, 1, 1, 2,
2, 2, 1, 1, 0, 2, 1, 3, 3, 3,
2, 3, 3, 1, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
......@@ -498,134 +515,151 @@ static const unsigned char yyr2[] =
means the default is an error. */
static const unsigned char yydefact[] =
{
2, 0, 1, 0, 0, 0, 8, 0, 34, 10,
0, 0, 0, 0, 9, 88, 87, 3, 4, 0,
14, 0, 15, 0, 47, 5, 0, 12, 0, 62,
6, 0, 16, 0, 13, 17, 11, 82, 83, 0,
57, 67, 69, 18, 20, 98, 99, 0, 0, 49,
91, 22, 22, 39, 38, 53, 73, 0, 68, 73,
7, 0, 95, 0, 0, 0, 0, 19, 21, 35,
84, 85, 86, 48, 0, 36, 52, 58, 0, 63,
65, 0, 64, 59, 70, 94, 96, 97, 93, 92,
0, 0, 0, 0, 0, 79, 79, 79, 79, 79,
26, 0, 0, 25, 0, 45, 0, 0, 43, 0,
42, 0, 37, 54, 56, 0, 55, 50, 75, 0,
66, 60, 71, 0, 77, 78, 89, 89, 27, 80,
28, 31, 29, 30, 23, 72, 24, 89, 89, 40,
41, 51, 74, 76, 0, 32, 33, 0, 44, 46,
90, 81
2, 0, 1, 0, 0, 0, 8, 0, 0, 10,
0, 0, 0, 0, 9, 93, 92, 3, 4, 22,
14, 22, 15, 43, 53, 5, 59, 12, 79, 68,
6, 74, 16, 79, 13, 17, 11, 87, 88, 0,
0, 0, 38, 0, 0, 0, 103, 104, 0, 0,
0, 96, 19, 21, 39, 42, 58, 64, 0, 76,
7, 63, 73, 75, 18, 20, 0, 100, 55, 0,
0, 0, 0, 0, 0, 0, 0, 0, 85, 0,
85, 0, 85, 85, 85, 26, 0, 0, 23, 0,
25, 24, 0, 0, 0, 85, 85, 47, 44, 46,
45, 0, 0, 0, 54, 41, 40, 60, 62, 57,
61, 56, 81, 80, 0, 69, 71, 66, 70, 65,
99, 101, 102, 98, 97, 77, 0, 0, 0, 94,
94, 0, 94, 94, 0, 94, 0, 0, 0, 94,
0, 78, 51, 94, 94, 0, 0, 89, 90, 91,
72, 0, 83, 84, 0, 0, 0, 27, 86, 0,
29, 0, 33, 31, 32, 0, 94, 0, 0, 49,
50, 82, 95, 34, 35, 28, 30, 36, 0, 48,
52, 37
};
/* YYDEFGOTO[NTERM-NUM]. */
static const short yydefgoto[] =
{
-1, 1, 17, 18, 19, 20, 21, 22, 67, 101,
23, 24, 74, 25, 69, 109, 54, 26, 115, 27,
76, 28, 29, 81, 30, 57, 31, 32, 33, 34,
102, 103, 77, 104, 128, 129, 75, 35, 145, 49,
50
-1, 1, 17, 18, 19, 20, 21, 22, 52, 88,
23, 24, 105, 25, 54, 98, 55, 26, 109, 27,
56, 28, 29, 117, 30, 58, 31, 32, 33, 34,
89, 90, 57, 91, 131, 132, 106, 35, 155, 50,
51
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -121
#define YYPACT_NINF -99
static const short yypact[] =
{
-121, 25, -121, -18, -11, -11, -121, -11, -121, -121,
-11, 21, 27, 112, -121, -121, -121, -121, -121, 51,
-121, 54, -121, 57, -121, -121, 58, -121, 62, -121,
-121, 80, -121, 96, -121, -121, -121, -121, -121, -18,
-121, -121, -121, -121, -121, -121, -121, 112, 112, 17,
77, -121, -121, -121, 85, -121, -121, 56, -121, -121,
-121, -21, -121, 112, 112, 42, 42, 100, 100, 115,
-121, -121, -121, -121, 98, -121, 68, 28, 99, -121,
-121, 111, -121, -121, 28, -121, 105, -121, -121, -121,
116, 110, 112, -11, 42, -11, -11, -11, -11, -11,
-121, 118, 137, -121, 121, -121, -11, 42, -121, 122,
-121, 123, -121, -121, -121, 124, -121, -121, -121, 125,
-121, -121, -121, 112, 17, 17, 142, 142, -121, 143,
-121, -121, -121, -121, -121, -121, -121, 142, 142, -121,
-121, -121, -121, 17, 112, -121, -121, 112, -121, -121,
17, 17
-99, 48, -99, -12, 46, 46, -99, 46, -29, -99,
46, -17, -3, -11, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, -99, -99, -99, -99, -99, -12,
12, 15, -99, 18, 51, 62, -99, -99, -11, -11,
4, -24, 138, 138, 160, 121, 110, -4, 81, -4,
-99, -99, -99, -99, -99, -99, 31, -99, -99, -11,
-11, 70, 70, 73, 32, -11, 46, 70, 46, -11,
46, -11, 46, 46, 46, -99, 80, 70, -99, 16,
-99, -99, 96, 46, 106, 46, 46, -99, -99, -99,
-99, -12, -12, -12, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, 112, -99, -99, -99, -99, -99,
-99, 117, -99, -99, -99, -99, -11, 33, 65, 131,
131, 119, 131, 1, 136, 1, 153, 154, 155, 131,
70, -99, -99, 131, 131, 156, 157, -99, -99, -99,
-99, 101, -99, -99, -11, 158, 159, -99, -99, 161,
-99, 162, -99, -99, -99, 163, 131, 164, 165, -99,
-99, -99, 99, -99, -99, -99, -99, -99, 166, -99,
-99, -99
};
/* YYPGOTO[NTERM-NUM]. */
static const yysigned_char yypgoto[] =
static const short yypgoto[] =
{
-121, -121, -121, -35, -121, -121, -121, -121, 106, -121,
-121, -121, -121, -34, -121, -121, -121, -121, -121, -121,
-121, -121, -121, -121, -33, -121, -121, -121, -121, -121,
-121, 90, 101, 34, 10, -4, -30, -1, -120, -43,
-57
-99, -99, -99, 111, -99, -99, -99, -99, 178, -99,
-99, -99, -99, 91, -99, -99, -99, -99, -99, -99,
-99, -99, -99, -99, 115, -99, -99, -99, -99, -99,
-99, 146, 168, 89, 27, 0, 126, -1, -98, -48,
-63
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -62
#define YYTABLE_NINF -68
static const short yytable[] =
{
39, 40, 36, 41, 61, 62, 42, 146, 88, 89,
85, 15, 16, 63, 64, 37, 38, 148, 149, 73,
86, 87, 79, 80, 82, 2, 3, 83, 4, 5,
6, 7, 8, 9, 10, 11, 12, 127, 60, 13,
14, 113, 114, 116, 91, 92, 117, 43, 124, 125,
138, 63, 64, 44, 15, 16, -61, 78, 118, -61,
5, 70, 7, 8, 71, 10, 11, 12, 45, 46,
13, 72, 5, 70, 7, 8, 71, 10, 11, 12,
143, 51, 13, 72, 52, 15, 16, 53, 55, 126,
70, 7, 56, 71, 10, 11, 12, 15, 16, 13,
72, 150, 137, 111, 151, 65, 130, 131, 132, 133,
58, 119, 90, 66, 15, 16, 91, 92, 119, 93,
94, 95, 96, 97, 98, 99, 59, 90, 112, 120,
100, 91, 92, 105, 106, 107, 45, 46, 45, 46,
64, 121, 47, 123, 47, 108, 122, 48, 134, 48,
135, 136, 139, 140, 141, 142, 144, 147, 68, 110,
84
66, 67, 36, 42, 39, 40, 71, 41, 123, 124,
43, 44, 74, 75, 130, 154, 72, 46, 47, 15,
16, 121, 122, 48, 140, 45, 127, 128, 112, 141,
49, 133, 156, 135, 158, 159, 68, 161, 60, 69,
70, 165, 69, 70, 61, 167, 168, 62, 2, 3,
63, 4, 5, 6, 7, 8, 9, 10, 11, 12,
46, 47, 13, 14, 120, 152, 48, 126, 178, 69,
70, 69, 70, 49, 37, 38, 129, 166, 151, 15,
16, -67, 114, 64, -67, 5, 101, 7, 8, 102,
10, 11, 12, 143, 65, 13, 103, 153, 46, 47,
147, 148, 149, 69, 70, 125, 172, 134, 139, 136,
137, 138, 15, 16, 5, 101, 7, 8, 102, 10,
11, 12, 145, 146, 13, 103, 101, 7, 142, 102,
10, 11, 12, 171, 144, 13, 103, 69, 70, 69,
70, 15, 16, 100, 150, 154, 113, 108, 113, 116,
73, 157, 15, 16, 74, 75, 70, 76, 77, 78,
79, 80, 81, 82, 83, 84, 104, 107, 160, 115,
85, 110, 73, 118, 86, 87, 74, 75, 92, 93,
94, 95, 111, 96, 119, 162, 163, 164, 169, 170,
173, 174, 97, 175, 176, 177, 179, 180, 181, 53,
99, 59
};
static const unsigned char yycheck[] =
{
4, 5, 3, 7, 47, 48, 10, 127, 65, 66,
31, 29, 30, 34, 35, 26, 27, 137, 138, 54,
63, 64, 57, 57, 57, 0, 1, 57, 3, 4,
5, 6, 7, 8, 9, 10, 11, 94, 39, 14,
15, 76, 76, 76, 16, 17, 76, 26, 91, 92,
107, 34, 35, 26, 29, 30, 0, 1, 30, 3,
4, 5, 6, 7, 8, 9, 10, 11, 26, 27,
14, 15, 4, 5, 6, 7, 8, 9, 10, 11,
123, 30, 14, 15, 30, 29, 30, 30, 30, 93,
5, 6, 30, 8, 9, 10, 11, 29, 30, 14,
15, 144, 106, 69, 147, 28, 96, 97, 98, 99,
30, 77, 12, 36, 29, 30, 16, 17, 84, 19,
20, 21, 22, 23, 24, 25, 30, 12, 30, 30,
30, 16, 17, 18, 19, 20, 26, 27, 26, 27,
35, 30, 32, 33, 32, 30, 30, 37, 30, 37,
13, 30, 30, 30, 30, 30, 14, 14, 52, 69,
59
48, 49, 3, 32, 4, 5, 30, 7, 71, 72,
10, 28, 16, 17, 77, 14, 40, 28, 29, 31,
32, 69, 70, 34, 87, 28, 74, 75, 32, 13,
41, 79, 130, 81, 132, 133, 32, 135, 39, 38,
39, 139, 38, 39, 32, 143, 144, 32, 0, 1,
32, 3, 4, 5, 6, 7, 8, 9, 10, 11,
28, 29, 14, 15, 33, 32, 34, 35, 166, 38,
39, 38, 39, 41, 28, 29, 76, 140, 126, 31,
32, 0, 1, 32, 3, 4, 5, 6, 7, 8,
9, 10, 11, 93, 32, 14, 15, 32, 28, 29,
101, 102, 103, 38, 39, 32, 154, 80, 28, 82,
83, 84, 31, 32, 4, 5, 6, 7, 8, 9,
10, 11, 95, 96, 14, 15, 5, 6, 32, 8,
9, 10, 11, 32, 28, 14, 15, 38, 39, 38,
39, 31, 32, 54, 32, 14, 57, 56, 59, 58,
12, 32, 31, 32, 16, 17, 39, 19, 20, 21,
22, 23, 24, 25, 26, 27, 55, 56, 32, 58,
32, 56, 12, 58, 36, 37, 16, 17, 18, 19,
20, 21, 56, 23, 58, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 21,
54, 33
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const unsigned char yystos[] =
{
0, 39, 0, 1, 3, 4, 5, 6, 7, 8,
9, 10, 11, 14, 15, 29, 30, 40, 41, 42,
43, 44, 45, 48, 49, 51, 55, 57, 59, 60,
62, 64, 65, 66, 67, 75, 75, 26, 27, 73,
73, 73, 73, 26, 26, 26, 27, 32, 37, 77,
78, 30, 30, 30, 54, 30, 30, 63, 30, 30,
75, 77, 77, 34, 35, 28, 36, 46, 46, 52,
5, 8, 15, 41, 50, 74, 58, 70, 1, 41,
51, 61, 62, 74, 70, 31, 77, 77, 78, 78,
12, 16, 17, 19, 20, 21, 22, 23, 24, 25,
30, 47, 68, 69, 71, 18, 19, 20, 30, 53,
69, 71, 30, 41, 51, 56, 62, 74, 30, 71,
30, 30, 30, 33, 77, 77, 73, 78, 72, 73,
72, 72, 72, 72, 30, 13, 30, 73, 78, 30,
30, 30, 30, 77, 14, 76, 76, 14, 76, 76,
77, 77
0, 43, 0, 1, 3, 4, 5, 6, 7, 8,
9, 10, 11, 14, 15, 31, 32, 44, 45, 46,
47, 48, 49, 52, 53, 55, 59, 61, 63, 64,
66, 68, 69, 70, 71, 79, 79, 28, 29, 77,
77, 77, 32, 77, 28, 28, 28, 29, 34, 41,
81, 82, 50, 50, 56, 58, 62, 74, 67, 74,
79, 32, 32, 32, 32, 32, 81, 81, 32, 38,
39, 30, 40, 12, 16, 17, 19, 20, 21, 22,
23, 24, 25, 26, 27, 32, 36, 37, 51, 72,
73, 75, 18, 19, 20, 21, 23, 32, 57, 73,
75, 5, 8, 15, 45, 54, 78, 45, 55, 60,
66, 78, 32, 75, 1, 45, 55, 65, 66, 78,
33, 81, 81, 82, 82, 32, 35, 81, 81, 77,
82, 76, 77, 81, 76, 81, 76, 76, 76, 28,
82, 13, 32, 77, 28, 76, 76, 79, 79, 79,
32, 81, 32, 32, 14, 80, 80, 32, 80, 80,
32, 80, 32, 32, 32, 80, 82, 80, 80, 32,
32, 32, 81, 32, 32, 32, 32, 32, 80, 32,
32, 32
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
......@@ -1258,10 +1292,10 @@ yyreduce:
case 18:
{
struct symbol *sym = sym_lookup(yyvsp[0].string, 0);
struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
sym->flags |= SYMBOL_OPTIONAL;
menu_add_entry(sym);
printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string);
printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
;}
break;
......@@ -1276,10 +1310,10 @@ yyreduce:
case 20:
{
struct symbol *sym = sym_lookup(yyvsp[0].string, 0);
struct symbol *sym = sym_lookup(yyvsp[-1].string, 0);
sym->flags |= SYMBOL_OPTIONAL;
menu_add_entry(sym);
printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string);
printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
;}
break;
......@@ -1295,11 +1329,6 @@ yyreduce:
;}
break;
case 26:
{ ;}
break;
case 27:
{
......@@ -1310,13 +1339,27 @@ yyreduce:
case 28:
{
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
;}
break;
case 29:
{
menu_set_type(S_BOOLEAN);
printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
;}
break;
case 29:
case 30:
{
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
;}
break;
case 31:
{
menu_set_type(S_INT);
......@@ -1324,7 +1367,7 @@ yyreduce:
;}
break;
case 30:
case 32:
{
menu_set_type(S_HEX);
......@@ -1332,7 +1375,7 @@ yyreduce:
;}
break;
case 31:
case 33:
{
menu_set_type(S_STRING);
......@@ -1340,23 +1383,37 @@ yyreduce:
;}
break;
case 32:
case 34:
{
menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
;}
break;
case 33:
case 35:
{
menu_add_prop(P_DEFAULT, NULL, yyvsp[-1].symbol, yyvsp[0].expr);
menu_add_prop(P_DEFAULT, NULL, yyvsp[-2].symbol, yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
;}
break;
case 34:
case 36:
{
printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
;}
break;
case 37:
{
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
;}
break;
case 38:
{
struct symbol *sym = sym_lookup(NULL, 0);
......@@ -1367,7 +1424,7 @@ yyreduce:
;}
break;
case 35:
case 39:
{
menu_end_entry();
......@@ -1375,7 +1432,7 @@ yyreduce:
;}
break;
case 36:
case 40:
{
if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) {
......@@ -1385,7 +1442,7 @@ yyreduce:
;}
break;
case 38:
case 42:
{
printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
......@@ -1393,15 +1450,31 @@ yyreduce:
;}
break;
case 44:
case 48:
{
menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
;}
break;
case 45:
case 49:
{
menu_set_type(S_TRISTATE);
printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
;}
break;
case 50:
{
menu_set_type(S_BOOLEAN);
printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
;}
break;
case 51:
{
current_entry->sym->flags |= SYMBOL_OPTIONAL;
......@@ -1409,26 +1482,26 @@ yyreduce:
;}
break;
case 46:
case 52:
{
menu_add_prop(P_DEFAULT, NULL, yyvsp[-1].symbol, yyvsp[0].expr);
menu_add_prop(P_DEFAULT, NULL, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
;}
break;
case 49:
case 55:
{
printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
menu_add_entry(NULL);
menu_add_dep(yyvsp[0].expr);
menu_add_dep(yyvsp[-1].expr);
menu_end_entry();
menu_add_menu();
;}
break;
case 50:
case 56:
{
if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) {
......@@ -1438,7 +1511,7 @@ yyreduce:
;}
break;
case 52:
case 58:
{
printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
......@@ -1446,16 +1519,16 @@ yyreduce:
;}
break;
case 57:
case 63:
{
menu_add_entry(NULL);
menu_add_prop(P_MENU, yyvsp[0].string, NULL, NULL);
menu_add_prop(P_MENU, yyvsp[-1].string, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
;}
break;
case 58:
case 64:
{
menu_end_entry();
......@@ -1463,7 +1536,7 @@ yyreduce:
;}
break;
case 59:
case 65:
{
if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) {
......@@ -1473,7 +1546,7 @@ yyreduce:
;}
break;
case 61:
case 67:
{
printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
......@@ -1481,43 +1554,43 @@ yyreduce:
;}
break;
case 66:
case 72:
{ zconfprint("invalid menu option"); yyerrok; ;}
break;
case 67:
case 73:
{
yyval.string = yyvsp[0].string;
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string);
yyval.string = yyvsp[-1].string;
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string);
;}
break;
case 68:
case 74:
{
zconf_nextfile(yyvsp[-1].string);
zconf_nextfile(yyvsp[0].string);
;}
break;
case 69:
case 75:
{
menu_add_entry(NULL);
menu_add_prop(P_COMMENT, yyvsp[0].string, NULL, NULL);
menu_add_prop(P_COMMENT, yyvsp[-1].string, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
;}
break;
case 70:
case 76:
{
menu_end_entry();
;}
break;
case 71:
case 77:
{
printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
......@@ -1525,122 +1598,110 @@ yyreduce:
;}
break;
case 72:
case 78:
{
current_entry->sym->help = yyvsp[0].string;
;}
break;
case 75:
{ ;}
break;
case 76:
case 82:
{
menu_add_dep(yyvsp[0].expr);
menu_add_dep(yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
;}
break;
case 77:
case 83:
{
menu_add_dep(yyvsp[0].expr);
menu_add_dep(yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
;}
break;
case 78:
case 84:
{
menu_add_dep(yyvsp[0].expr);
menu_add_dep(yyvsp[-1].expr);
printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
;}
break;
case 80:
{
menu_add_prop(P_PROMPT, yyvsp[0].string, NULL, NULL);
;}
break;
case 81:
case 86:
{
menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[0].expr);
menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr);
;}
break;
case 84:
case 89:
{ yyval.token = T_ENDMENU; ;}
break;
case 85:
case 90:
{ yyval.token = T_ENDCHOICE; ;}
break;
case 86:
case 91:
{ yyval.token = T_ENDIF; ;}
break;
case 89:
case 94:
{ yyval.expr = NULL; ;}
break;
case 90:
case 95:
{ yyval.expr = yyvsp[0].expr; ;}
break;
case 91:
case 96:
{ yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;}
break;
case 92:
case 97:
{ yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
break;
case 93:
case 98:
{ yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;}
break;
case 94:
case 99:
{ yyval.expr = yyvsp[-1].expr; ;}
break;
case 95:
case 100:
{ yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;}
break;
case 96:
case 101:
{ yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;}
break;
case 97:
case 102:
{ yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;}
break;
case 98:
case 103:
{ yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;}
break;
case 99:
case 104:
{ yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;}
break;
......@@ -1875,7 +1936,7 @@ const char *zconf_tokenname(int token)
case T_ENDIF: return "endif";
}
return "<token>";
}
}
static bool zconf_endtoken(int token, int starttoken, int endtoken)
{
......@@ -1897,7 +1958,7 @@ static void zconfprint(const char *err, ...)
{
va_list ap;
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1);
va_start(ap, err);
vfprintf(stderr, err, ap);
va_end(ap);
......@@ -1906,7 +1967,7 @@ static void zconfprint(const char *err, ...)
static void zconferror(const char *err)
{
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err);
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
}
void print_quoted_string(FILE *out, const char *str)
......
......@@ -57,7 +57,9 @@ struct symbol *symbol_hash[257];
%token T_PROMPT
%token T_DEFAULT
%token T_TRISTATE
%token T_DEF_TRISTATE
%token T_BOOLEAN
%token T_DEF_BOOLEAN
%token T_STRING
%token T_INT
%token T_HEX
......@@ -69,6 +71,8 @@ struct symbol *symbol_hash[257];
%token T_CLOSE_PAREN
%token T_OPEN_PAREN
%token T_ON
%token T_SELECT
%token T_RANGE
%left T_OR
%left T_AND
......@@ -113,7 +117,7 @@ common_block:
/* config/menuconfig entry */
config_entry_start: T_CONFIG T_WORD
config_entry_start: T_CONFIG T_WORD T_EOL
{
struct symbol *sym = sym_lookup($2, 0);
sym->flags |= SYMBOL_OPTIONAL;
......@@ -121,13 +125,13 @@ config_entry_start: T_CONFIG T_WORD
printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2);
};
config_stmt: config_entry_start T_EOL config_option_list
config_stmt: config_entry_start config_option_list
{
menu_end_entry();
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
};
menuconfig_entry_start: T_MENUCONFIG T_WORD
menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL
{
struct symbol *sym = sym_lookup($2, 0);
sym->flags |= SYMBOL_OPTIONAL;
......@@ -135,7 +139,7 @@ menuconfig_entry_start: T_MENUCONFIG T_WORD
printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
};
menuconfig_stmt: menuconfig_entry_start T_EOL config_option_list
menuconfig_stmt: menuconfig_entry_start config_option_list
{
if (current_entry->prompt)
current_entry->prompt->type = P_MENU;
......@@ -147,57 +151,77 @@ menuconfig_stmt: menuconfig_entry_start T_EOL config_option_list
config_option_list:
/* empty */
| config_option_list config_option T_EOL
| config_option_list depends T_EOL
| config_option_list config_option
| config_option_list depends
| config_option_list help
| config_option_list T_EOL
{ };
;
config_option: T_TRISTATE prompt_stmt_opt
config_option: T_TRISTATE prompt_stmt_opt T_EOL
{
menu_set_type(S_TRISTATE);
printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
};
config_option: T_BOOLEAN prompt_stmt_opt
config_option: T_DEF_TRISTATE expr if_expr T_EOL
{
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
};
config_option: T_BOOLEAN prompt_stmt_opt T_EOL
{
menu_set_type(S_BOOLEAN);
printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
};
config_option: T_INT prompt_stmt_opt
config_option: T_DEF_BOOLEAN expr if_expr T_EOL
{
printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno());
};
config_option: T_INT prompt_stmt_opt T_EOL
{
menu_set_type(S_INT);
printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno());
};
config_option: T_HEX prompt_stmt_opt
config_option: T_HEX prompt_stmt_opt T_EOL
{
menu_set_type(S_HEX);
printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno());
};
config_option: T_STRING prompt_stmt_opt
config_option: T_STRING prompt_stmt_opt T_EOL
{
menu_set_type(S_STRING);
printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno());
};
config_option: T_PROMPT prompt if_expr
config_option: T_PROMPT prompt if_expr T_EOL
{
menu_add_prop(P_PROMPT, $2, NULL, $3);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
};
config_option: T_DEFAULT symbol if_expr
config_option: T_DEFAULT symbol if_expr T_EOL
{
menu_add_prop(P_DEFAULT, NULL, $2, $3);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
};
config_option: T_SELECT T_WORD if_expr T_EOL
{
printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
};
config_option: T_RANGE symbol symbol if_expr T_EOL
{
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
};
/* choice entry */
choice: T_CHOICE
choice: T_CHOICE T_EOL
{
struct symbol *sym = sym_lookup(NULL, 0);
sym->flags |= SYMBOL_CHOICE;
......@@ -206,7 +230,7 @@ choice: T_CHOICE
printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
};
choice_entry: choice T_EOL choice_option_list
choice_entry: choice choice_option_list
{
menu_end_entry();
menu_add_menu();
......@@ -221,7 +245,7 @@ choice_end: end
};
choice_stmt:
choice_entry choice_block choice_end T_EOL
choice_entry choice_block choice_end
| choice_entry choice_block
{
printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
......@@ -230,27 +254,39 @@ choice_stmt:
choice_option_list:
/* empty */
| choice_option_list choice_option T_EOL
| choice_option_list depends T_EOL
| choice_option_list choice_option
| choice_option_list depends
| choice_option_list help
| choice_option_list T_EOL
;
choice_option: T_PROMPT prompt if_expr
choice_option: T_PROMPT prompt if_expr T_EOL
{
menu_add_prop(P_PROMPT, $2, NULL, $3);
printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
};
choice_option: T_OPTIONAL
choice_option: T_TRISTATE prompt_stmt_opt T_EOL
{
menu_set_type(S_TRISTATE);
printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno());
};
choice_option: T_BOOLEAN prompt_stmt_opt T_EOL
{
menu_set_type(S_BOOLEAN);
printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno());
};
choice_option: T_OPTIONAL T_EOL
{
current_entry->sym->flags |= SYMBOL_OPTIONAL;
printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
};
choice_option: T_DEFAULT symbol if_expr
choice_option: T_DEFAULT T_WORD if_expr T_EOL
{
menu_add_prop(P_DEFAULT, NULL, $2, $3);
menu_add_prop(P_DEFAULT, NULL, sym_lookup($2, 0), $3);
printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
};
......@@ -261,7 +297,7 @@ choice_block:
/* if entry */
if: T_IF expr
if: T_IF expr T_EOL
{
printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
menu_add_entry(NULL);
......@@ -279,8 +315,8 @@ if_end: end
};
if_stmt:
if T_EOL if_block if_end T_EOL
| if T_EOL if_block
if if_block if_end
| if if_block
{
printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
zconfnerrs++;
......@@ -295,14 +331,14 @@ if_block:
/* menu entry */
menu: T_MENU prompt
menu: T_MENU prompt T_EOL
{
menu_add_entry(NULL);
menu_add_prop(P_MENU, $2, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
};
menu_entry: menu T_EOL depends_list
menu_entry: menu depends_list
{
menu_end_entry();
menu_add_menu();
......@@ -317,7 +353,7 @@ menu_end: end
};
menu_stmt:
menu_entry menu_block menu_end T_EOL
menu_entry menu_block menu_end
| menu_entry menu_block
{
printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
......@@ -332,27 +368,27 @@ menu_block:
| menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; }
;
source: T_SOURCE prompt
source: T_SOURCE prompt T_EOL
{
$$ = $2;
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
};
source_stmt: source T_EOL
source_stmt: source
{
zconf_nextfile($1);
};
/* comment entry */
comment: T_COMMENT prompt
comment: T_COMMENT prompt T_EOL
{
menu_add_entry(NULL);
menu_add_prop(P_COMMENT, $2, NULL, NULL);
printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
};
comment_stmt: comment T_EOL depends_list
comment_stmt: comment depends_list
{
menu_end_entry();
};
......@@ -373,21 +409,21 @@ help: help_start T_HELPTEXT
/* depends option */
depends_list: /* empty */
| depends_list depends T_EOL
| depends_list depends
| depends_list T_EOL
{ };
;
depends: T_DEPENDS T_ON expr
depends: T_DEPENDS T_ON expr T_EOL
{
menu_add_dep($3);
printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
}
| T_DEPENDS expr
| T_DEPENDS expr T_EOL
{
menu_add_dep($2);
printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
}
| T_REQUIRES expr
| T_REQUIRES expr T_EOL
{
menu_add_dep($2);
printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
......@@ -397,22 +433,18 @@ depends: T_DEPENDS T_ON expr
prompt_stmt_opt:
/* empty */
| prompt
| prompt if_expr
{
menu_add_prop(P_PROMPT, $1, NULL, NULL);
}
| prompt T_IF expr
{
menu_add_prop(P_PROMPT, $1, NULL, $3);
menu_add_prop(P_PROMPT, $1, NULL, $2);
};
prompt: T_WORD
| T_WORD_QUOTE
;
end: T_ENDMENU { $$ = T_ENDMENU; }
| T_ENDCHOICE { $$ = T_ENDCHOICE; }
| T_ENDIF { $$ = T_ENDIF; }
end: T_ENDMENU nl_or_eof { $$ = T_ENDMENU; }
| T_ENDCHOICE nl_or_eof { $$ = T_ENDCHOICE; }
| T_ENDIF nl_or_eof { $$ = T_ENDIF; }
;
nl_or_eof:
......@@ -466,7 +498,7 @@ const char *zconf_tokenname(int token)
case T_ENDIF: return "endif";
}
return "<token>";
}
}
static bool zconf_endtoken(int token, int starttoken, int endtoken)
{
......@@ -488,7 +520,7 @@ static void zconfprint(const char *err, ...)
{
va_list ap;
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1);
va_start(ap, err);
vfprintf(stderr, err, ap);
va_end(ap);
......@@ -497,7 +529,7 @@ static void zconfprint(const char *err, ...)
static void zconferror(const char *err)
{
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err);
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
}
void print_quoted_string(FILE *out, const char *str)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment