aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped57
-rw-r--r--scripts/kconfig/lkc.h2
-rw-r--r--scripts/kconfig/menu.c5
-rw-r--r--scripts/kconfig/zconf.l42
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped657
-rw-r--r--scripts/kconfig/zconf.y173
6 files changed, 515 insertions, 421 deletions
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index bedba89a87c6..24e3c8cbb7ac 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -323,7 +323,7 @@ void zconffree (void * );
323 323
324/* Begin user sect3 */ 324/* Begin user sect3 */
325 325
326#define zconfwrap(n) 1 326#define zconfwrap() 1
327#define YY_SKIP_YYWRAP 327#define YY_SKIP_YYWRAP
328 328
329typedef unsigned char YY_CHAR; 329typedef unsigned char YY_CHAR;
@@ -686,10 +686,10 @@ struct yy_trans_info
686static yyconst flex_int16_t yy_accept[61] = 686static yyconst flex_int16_t yy_accept[61] =
687 { 0, 687 { 0,
688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
689 34, 5, 4, 3, 2, 7, 8, 6, 32, 29, 689 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, 690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
691 22, 11, 12, 19, 19, 14, 22, 22, 4, 3, 691 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
692 2, 2, 1, 6, 32, 29, 31, 30, 24, 23, 692 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
694 } ; 694 } ;
695 695
@@ -753,6 +753,11 @@ char *zconftext;
753 753
754#define START_STRSIZE 16 754#define START_STRSIZE 16
755 755
756static struct {
757 struct file *file;
758 int lineno;
759} current_pos;
760
756static char *text; 761static char *text;
757static int text_size, text_asize; 762static int text_size, text_asize;
758 763
@@ -766,7 +771,7 @@ struct buffer *current_buf;
766static int last_ts, first_ts; 771static int last_ts, first_ts;
767 772
768static void zconf_endhelp(void); 773static void zconf_endhelp(void);
769static struct buffer *zconf_endfile(void); 774static void zconf_endfile(void);
770 775
771void new_string(void) 776void new_string(void)
772{ 777{
@@ -993,17 +998,17 @@ do_action: /* This label is used only to access EOF actions. */
993 { /* beginning of action switch */ 998 { /* beginning of action switch */
994case 1: 999case 1:
995/* rule 1 can match eol */ 1000/* rule 1 can match eol */
996YY_RULE_SETUP
997current_file->lineno++;
998 YY_BREAK
999case 2: 1001case 2:
1002/* rule 2 can match eol */
1000YY_RULE_SETUP 1003YY_RULE_SETUP
1001 1004{
1005 current_file->lineno++;
1006 return T_EOL;
1007}
1002 YY_BREAK 1008 YY_BREAK
1003case 3: 1009case 3:
1004/* rule 3 can match eol */
1005YY_RULE_SETUP 1010YY_RULE_SETUP
1006current_file->lineno++; return T_EOL; 1011
1007 YY_BREAK 1012 YY_BREAK
1008case 4: 1013case 4:
1009YY_RULE_SETUP 1014YY_RULE_SETUP
@@ -1023,8 +1028,10 @@ case 6:
1023YY_RULE_SETUP 1028YY_RULE_SETUP
1024{ 1029{
1025 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); 1030 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1031 BEGIN(PARAM);
1032 current_pos.file = current_file;
1033 current_pos.lineno = current_file->lineno;
1026 if (id && id->flags & TF_COMMAND) { 1034 if (id && id->flags & TF_COMMAND) {
1027 BEGIN(PARAM);
1028 zconflval.id = id; 1035 zconflval.id = id;
1029 return id->token; 1036 return id->token;
1030 } 1037 }
@@ -1040,7 +1047,11 @@ YY_RULE_SETUP
1040case 8: 1047case 8:
1041/* rule 8 can match eol */ 1048/* rule 8 can match eol */
1042YY_RULE_SETUP 1049YY_RULE_SETUP
1043current_file->lineno++; BEGIN(INITIAL); 1050{
1051 BEGIN(INITIAL);
1052 current_file->lineno++;
1053 return T_EOL;
1054 }
1044 YY_BREAK 1055 YY_BREAK
1045 1056
1046case 9: 1057case 9:
@@ -1246,9 +1257,9 @@ case YY_STATE_EOF(HELP):
1246case YY_STATE_EOF(INITIAL): 1257case YY_STATE_EOF(INITIAL):
1247case YY_STATE_EOF(COMMAND): 1258case YY_STATE_EOF(COMMAND):
1248{ 1259{
1249 if (current_buf) { 1260 if (current_file) {
1250 zconf_endfile(); 1261 zconf_endfile();
1251 return T_EOF; 1262 return T_EOL;
1252 } 1263 }
1253 fclose(zconfin); 1264 fclose(zconfin);
1254 yyterminate(); 1265 yyterminate();
@@ -1958,7 +1969,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1958 1969
1959/** Setup the input buffer state to scan a string. The next call to zconflex() will 1970/** Setup the input buffer state to scan a string. The next call to zconflex() will
1960 * scan from a @e copy of @a str. 1971 * scan from a @e copy of @a str.
1961 * @param str a NUL-terminated string to scan 1972 * @param yy_str a NUL-terminated string to scan
1962 * 1973 *
1963 * @return the newly allocated buffer state object. 1974 * @return the newly allocated buffer state object.
1964 * @note If you want to scan bytes that may contain NUL values, then use 1975 * @note If you want to scan bytes that may contain NUL values, then use
@@ -2276,7 +2287,7 @@ void zconf_nextfile(const char *name)
2276 current_file = file; 2287 current_file = file;
2277} 2288}
2278 2289
2279static struct buffer *zconf_endfile(void) 2290static void zconf_endfile(void)
2280{ 2291{
2281 struct buffer *parent; 2292 struct buffer *parent;
2282 2293
@@ -2292,23 +2303,15 @@ static struct buffer *zconf_endfile(void)
2292 } 2303 }
2293 free(current_buf); 2304 free(current_buf);
2294 current_buf = parent; 2305 current_buf = parent;
2295
2296 return parent;
2297} 2306}
2298 2307
2299int zconf_lineno(void) 2308int zconf_lineno(void)
2300{ 2309{
2301 if (current_buf) 2310 return current_pos.lineno;
2302 return current_file->lineno - 1;
2303 else
2304 return 0;
2305} 2311}
2306 2312
2307char *zconf_curname(void) 2313char *zconf_curname(void)
2308{ 2314{
2309 if (current_buf) 2315 return current_pos.file ? current_pos.file->name : "<none>";
2310 return current_file->name;
2311 else
2312 return "<none>";
2313} 2316}
2314 2317
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 91491d0a3029..ca02eb42eeb3 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -70,7 +70,7 @@ void kconfig_load(void);
70 70
71/* menu.c */ 71/* menu.c */
72void menu_init(void); 72void menu_init(void);
73void menu_add_menu(void); 73struct menu *menu_add_menu(void);
74void menu_end_menu(void); 74void menu_end_menu(void);
75void menu_add_entry(struct symbol *sym); 75void menu_add_entry(struct symbol *sym);
76void menu_end_entry(void); 76void menu_end_entry(void);
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index c2a423a1c341..0fce20cb7f3c 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -61,10 +61,11 @@ void menu_end_entry(void)
61{ 61{
62} 62}
63 63
64void menu_add_menu(void) 64struct menu *menu_add_menu(void)
65{ 65{
66 current_menu = current_entry; 66 menu_end_entry();
67 last_entry_ptr = &current_entry->list; 67 last_entry_ptr = &current_entry->list;
68 return current_menu = current_entry;
68} 69}
69 70
70void menu_end_menu(void) 71void menu_end_menu(void)
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index cfcfabd7a069..cfa46077c6b4 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -18,6 +18,11 @@
18 18
19#define START_STRSIZE 16 19#define START_STRSIZE 16
20 20
21static struct {
22 struct file *file;
23 int lineno;
24} current_pos;
25
21static char *text; 26static char *text;
22static int text_size, text_asize; 27static int text_size, text_asize;
23 28
@@ -31,7 +36,7 @@ struct buffer *current_buf;
31static int last_ts, first_ts; 36static int last_ts, first_ts;
32 37
33static void zconf_endhelp(void); 38static void zconf_endhelp(void);
34static struct buffer *zconf_endfile(void); 39static void zconf_endfile(void);
35 40
36void new_string(void) 41void new_string(void)
37{ 42{
@@ -70,10 +75,13 @@ n [A-Za-z0-9_]
70 int str = 0; 75 int str = 0;
71 int ts, i; 76 int ts, i;
72 77
73[ \t]*#.*\n current_file->lineno++; 78[ \t]*#.*\n |
79[ \t]*\n {
80 current_file->lineno++;
81 return T_EOL;
82}
74[ \t]*#.* 83[ \t]*#.*
75 84
76[ \t]*\n current_file->lineno++; return T_EOL;
77 85
78[ \t]+ { 86[ \t]+ {
79 BEGIN(COMMAND); 87 BEGIN(COMMAND);
@@ -88,8 +96,10 @@ n [A-Za-z0-9_]
88<COMMAND>{ 96<COMMAND>{
89 {n}+ { 97 {n}+ {
90 struct kconf_id *id = kconf_id_lookup(yytext, yyleng); 98 struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
99 BEGIN(PARAM);
100 current_pos.file = current_file;
101 current_pos.lineno = current_file->lineno;
91 if (id && id->flags & TF_COMMAND) { 102 if (id && id->flags & TF_COMMAND) {
92 BEGIN(PARAM);
93 zconflval.id = id; 103 zconflval.id = id;
94 return id->token; 104 return id->token;
95 } 105 }
@@ -98,7 +108,11 @@ n [A-Za-z0-9_]
98 return T_WORD; 108 return T_WORD;
99 } 109 }
100 . 110 .
101 \n current_file->lineno++; BEGIN(INITIAL); 111 \n {
112 BEGIN(INITIAL);
113 current_file->lineno++;
114 return T_EOL;
115 }
102} 116}
103 117
104<PARAM>{ 118<PARAM>{
@@ -214,9 +228,9 @@ n [A-Za-z0-9_]
214} 228}
215 229
216<<EOF>> { 230<<EOF>> {
217 if (current_buf) { 231 if (current_file) {
218 zconf_endfile(); 232 zconf_endfile();
219 return T_EOF; 233 return T_EOL;
220 } 234 }
221 fclose(yyin); 235 fclose(yyin);
222 yyterminate(); 236 yyterminate();
@@ -307,7 +321,7 @@ void zconf_nextfile(const char *name)
307 current_file = file; 321 current_file = file;
308} 322}
309 323
310static struct buffer *zconf_endfile(void) 324static void zconf_endfile(void)
311{ 325{
312 struct buffer *parent; 326 struct buffer *parent;
313 327
@@ -323,22 +337,14 @@ static struct buffer *zconf_endfile(void)
323 } 337 }
324 free(current_buf); 338 free(current_buf);
325 current_buf = parent; 339 current_buf = parent;
326
327 return parent;
328} 340}
329 341
330int zconf_lineno(void) 342int zconf_lineno(void)
331{ 343{
332 if (current_buf) 344 return current_pos.lineno;
333 return current_file->lineno - 1;
334 else
335 return 0;
336} 345}
337 346
338char *zconf_curname(void) 347char *zconf_curname(void)
339{ 348{
340 if (current_buf) 349 return current_pos.file ? current_pos.file->name : "<none>";
341 return current_file->name;
342 else
343 return "<none>";
344} 350}
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 3fc296274c98..ea7755da82f5 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -89,11 +89,10 @@
89 T_CLOSE_PAREN = 283, 89 T_CLOSE_PAREN = 283,
90 T_OPEN_PAREN = 284, 90 T_OPEN_PAREN = 284,
91 T_EOL = 285, 91 T_EOL = 285,
92 T_EOF = 286, 92 T_OR = 286,
93 T_OR = 287, 93 T_AND = 287,
94 T_AND = 288, 94 T_EQUAL = 288,
95 T_EQUAL = 289, 95 T_NOT = 289
96 T_NOT = 290
97 }; 96 };
98#endif 97#endif
99#define T_MAINMENU 258 98#define T_MAINMENU 258
@@ -124,11 +123,10 @@
124#define T_CLOSE_PAREN 283 123#define T_CLOSE_PAREN 283
125#define T_OPEN_PAREN 284 124#define T_OPEN_PAREN 284
126#define T_EOL 285 125#define T_EOL 285
127#define T_EOF 286 126#define T_OR 286
128#define T_OR 287 127#define T_AND 287
129#define T_AND 288 128#define T_EQUAL 288
130#define T_EQUAL 289 129#define T_NOT 289
131#define T_NOT 290
132 130
133 131
134 132
@@ -162,14 +160,18 @@ int cdebug = PRINTD;
162 160
163extern int zconflex(void); 161extern int zconflex(void);
164static void zconfprint(const char *err, ...); 162static void zconfprint(const char *err, ...);
163static void zconf_error(const char *err, ...);
165static void zconferror(const char *err); 164static void zconferror(const char *err);
166static bool zconf_endtoken(int token, int starttoken, int endtoken); 165static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
167 166
168struct symbol *symbol_hash[257]; 167struct symbol *symbol_hash[257];
169 168
170static struct menu *current_menu, *current_entry; 169static struct menu *current_menu, *current_entry;
171 170
171#define YYDEBUG 0
172#if YYDEBUG
172#define YYERROR_VERBOSE 173#define YYERROR_VERBOSE
174#endif
173 175
174 176
175/* Enabling traces. */ 177/* Enabling traces. */
@@ -188,8 +190,8 @@ static struct menu *current_menu, *current_entry;
188#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 190#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
189 191
190typedef union YYSTYPE { 192typedef union YYSTYPE {
191 int token;
192 char *string; 193 char *string;
194 struct file *file;
193 struct symbol *symbol; 195 struct symbol *symbol;
194 struct expr *expr; 196 struct expr *expr;
195 struct menu *menu; 197 struct menu *menu;
@@ -308,22 +310,22 @@ union yyalloc
308#endif 310#endif
309 311
310/* YYFINAL -- State number of the termination state. */ 312/* YYFINAL -- State number of the termination state. */
311#define YYFINAL 2 313#define YYFINAL 3
312/* YYLAST -- Last index in YYTABLE. */ 314/* YYLAST -- Last index in YYTABLE. */
313#define YYLAST 179 315#define YYLAST 264
314 316
315/* YYNTOKENS -- Number of terminals. */ 317/* YYNTOKENS -- Number of terminals. */
316#define YYNTOKENS 36 318#define YYNTOKENS 35
317/* YYNNTS -- Number of nonterminals. */ 319/* YYNNTS -- Number of nonterminals. */
318#define YYNNTS 41 320#define YYNNTS 42
319/* YYNRULES -- Number of rules. */ 321/* YYNRULES -- Number of rules. */
320#define YYNRULES 97 322#define YYNRULES 104
321/* YYNRULES -- Number of states. */ 323/* YYNRULES -- Number of states. */
322#define YYNSTATES 159 324#define YYNSTATES 175
323 325
324/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 326/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
325#define YYUNDEFTOK 2 327#define YYUNDEFTOK 2
326#define YYMAXUTOK 290 328#define YYMAXUTOK 289
327 329
328#define YYTRANSLATE(YYX) \ 330#define YYTRANSLATE(YYX) \
329 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 331 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -359,8 +361,7 @@ static const unsigned char yytranslate[] =
359 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 361 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
360 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 362 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
361 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 363 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
362 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 364 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
363 35
364}; 365};
365 366
366#if YYDEBUG 367#if YYDEBUG
@@ -368,65 +369,70 @@ static const unsigned char yytranslate[] =
368 YYRHS. */ 369 YYRHS. */
369static const unsigned short int yyprhs[] = 370static const unsigned short int yyprhs[] =
370{ 371{
371 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, 372 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
372 21, 23, 26, 28, 30, 32, 34, 36, 38, 42, 373 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
373 45, 49, 52, 53, 56, 59, 62, 65, 69, 74, 374 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
374 79, 84, 90, 93, 96, 98, 102, 105, 106, 109, 375 81, 84, 85, 88, 91, 94, 97, 100, 104, 109,
375 112, 115, 118, 123, 127, 130, 135, 136, 139, 143, 376 114, 119, 125, 128, 131, 133, 137, 138, 141, 144,
376 145, 149, 152, 153, 156, 159, 162, 166, 169, 171, 377 147, 150, 153, 158, 162, 165, 170, 171, 174, 178,
377 175, 178, 179, 182, 185, 188, 192, 196, 198, 202, 378 180, 184, 185, 188, 191, 194, 198, 201, 203, 207,
378 205, 208, 211, 212, 215, 218, 223, 227, 231, 232, 379 208, 211, 214, 217, 221, 225, 228, 231, 234, 235,
379 235, 237, 239, 242, 245, 248, 250, 252, 253, 256, 380 238, 241, 244, 249, 253, 257, 258, 261, 263, 265,
380 258, 262, 266, 270, 273, 277, 281, 283 381 268, 271, 274, 276, 279, 280, 283, 285, 289, 293,
382 297, 300, 304, 308, 310
381}; 383};
382 384
383/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 385/* YYRHS -- A `-1'-separated list of the rules' RHS. */
384static const yysigned_char yyrhs[] = 386static const yysigned_char yyrhs[] =
385{ 387{
386 37, 0, -1, -1, 37, 38, -1, 39, -1, 49, 388 36, 0, -1, 37, -1, -1, 37, 39, -1, 37,
387 -1, 60, -1, 3, 71, 73, -1, 5, -1, 15, 389 50, -1, 37, 61, -1, 37, 3, 71, 73, -1,
388 -1, 8, -1, 1, 73, -1, 55, -1, 65, -1, 390 37, 72, -1, 37, 25, 1, 30, -1, 37, 38,
389 41, -1, 43, -1, 63, -1, 73, -1, 10, 25, 391 1, 30, -1, 37, 1, 30, -1, 16, -1, 19,
390 30, -1, 40, 44, -1, 11, 25, 30, -1, 42, 392 -1, 20, -1, 22, -1, 18, -1, 23, -1, 21,
391 44, -1, -1, 44, 45, -1, 44, 69, -1, 44, 393 -1, 30, -1, 56, -1, 65, -1, 42, -1, 44,
392 67, -1, 44, 30, -1, 20, 70, 30, -1, 19, 394 -1, 63, -1, 25, 1, 30, -1, 1, 30, -1,
393 71, 74, 30, -1, 21, 75, 74, 30, -1, 22, 395 10, 25, 30, -1, 41, 45, -1, 11, 25, 30,
394 25, 74, 30, -1, 23, 76, 76, 74, 30, -1, 396 -1, 43, 45, -1, -1, 45, 46, -1, 45, 69,
395 7, 30, -1, 46, 50, -1, 72, -1, 47, 52, 397 -1, 45, 67, -1, 45, 40, -1, 45, 30, -1,
396 48, -1, 47, 52, -1, -1, 50, 51, -1, 50, 398 20, 70, 30, -1, 19, 71, 74, 30, -1, 21,
397 69, -1, 50, 67, -1, 50, 30, -1, 19, 71, 399 75, 74, 30, -1, 22, 25, 74, 30, -1, 23,
398 74, 30, -1, 20, 70, 30, -1, 18, 30, -1, 400 76, 76, 74, 30, -1, 7, 30, -1, 47, 51,
399 21, 25, 74, 30, -1, -1, 52, 39, -1, 14, 401 -1, 72, -1, 48, 53, 49, -1, -1, 51, 52,
400 75, 30, -1, 72, -1, 53, 56, 54, -1, 53, 402 -1, 51, 69, -1, 51, 67, -1, 51, 30, -1,
401 56, -1, -1, 56, 39, -1, 56, 60, -1, 56, 403 51, 40, -1, 19, 71, 74, 30, -1, 20, 70,
402 49, -1, 4, 71, 30, -1, 57, 68, -1, 72, 404 30, -1, 18, 30, -1, 21, 25, 74, 30, -1,
403 -1, 58, 61, 59, -1, 58, 61, -1, -1, 61, 405 -1, 53, 39, -1, 14, 75, 73, -1, 72, -1,
404 39, -1, 61, 60, -1, 61, 49, -1, 61, 1, 406 54, 57, 55, -1, -1, 57, 39, -1, 57, 61,
405 30, -1, 6, 71, 30, -1, 62, -1, 9, 71, 407 -1, 57, 50, -1, 4, 71, 30, -1, 58, 68,
406 30, -1, 64, 68, -1, 12, 30, -1, 66, 13, 408 -1, 72, -1, 59, 62, 60, -1, -1, 62, 39,
407 -1, -1, 68, 69, -1, 68, 30, -1, 16, 24, 409 -1, 62, 61, -1, 62, 50, -1, 6, 71, 30,
408 75, 30, -1, 16, 75, 30, -1, 17, 75, 30, 410 -1, 9, 71, 30, -1, 64, 68, -1, 12, 30,
409 -1, -1, 71, 74, -1, 25, -1, 26, -1, 5, 411 -1, 66, 13, -1, -1, 68, 69, -1, 68, 30,
410 73, -1, 8, 73, -1, 15, 73, -1, 30, -1, 412 -1, 68, 40, -1, 16, 24, 75, 30, -1, 16,
411 31, -1, -1, 14, 75, -1, 76, -1, 76, 34, 413 75, 30, -1, 17, 75, 30, -1, -1, 71, 74,
412 76, -1, 76, 27, 76, -1, 29, 75, 28, -1, 414 -1, 25, -1, 26, -1, 5, 30, -1, 8, 30,
413 35, 75, -1, 75, 32, 75, -1, 75, 33, 75, 415 -1, 15, 30, -1, 30, -1, 73, 30, -1, -1,
414 -1, 25, -1, 26, -1 416 14, 75, -1, 76, -1, 76, 33, 76, -1, 76,
417 27, 76, -1, 29, 75, 28, -1, 34, 75, -1,
418 75, 31, 75, -1, 75, 32, 75, -1, 25, -1,
419 26, -1
415}; 420};
416 421
417/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 422/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
418static const unsigned short int yyrline[] = 423static const unsigned short int yyrline[] =
419{ 424{
420 0, 92, 92, 93, 96, 97, 98, 99, 100, 101, 425 0, 103, 103, 105, 107, 108, 109, 110, 111, 112,
421 102, 103, 107, 108, 109, 110, 111, 112, 118, 126, 426 113, 117, 121, 121, 121, 121, 121, 121, 121, 125,
422 132, 140, 150, 152, 153, 154, 155, 158, 166, 172, 427 126, 127, 128, 129, 130, 134, 135, 141, 149, 155,
423 182, 188, 196, 205, 211, 220, 221, 227, 229, 230, 428 163, 173, 175, 176, 177, 178, 179, 182, 190, 196,
424 231, 232, 235, 241, 252, 258, 268, 270, 275, 284, 429 206, 212, 220, 229, 234, 242, 245, 247, 248, 249,
425 293, 294, 300, 302, 303, 304, 309, 316, 322, 331, 430 250, 251, 254, 260, 271, 277, 287, 289, 294, 302,
426 332, 338, 340, 341, 342, 343, 346, 352, 359, 366, 431 310, 313, 315, 316, 317, 322, 329, 334, 342, 345,
427 373, 379, 386, 387, 388, 391, 396, 401, 409, 411, 432 347, 348, 349, 352, 360, 367, 374, 380, 387, 389,
428 416, 417, 420, 421, 422, 426, 426, 428, 429, 432, 433 390, 391, 394, 399, 404, 412, 414, 419, 420, 423,
429 433, 434, 435, 436, 437, 438, 441, 442 434 424, 425, 429, 430, 433, 434, 437, 438, 439, 440,
435 441, 442, 443, 446, 447
430}; 436};
431#endif 437#endif
432 438
@@ -440,16 +446,16 @@ static const char *const yytname[] =
440 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", 446 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
441 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", 447 "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT",
442 "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", 448 "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
443 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_EOF", "T_OR", "T_AND", 449 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
444 "T_EQUAL", "T_NOT", "$accept", "input", "block", "common_block", 450 "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt",
445 "config_entry_start", "config_stmt", "menuconfig_entry_start", 451 "option_error", "config_entry_start", "config_stmt",
446 "menuconfig_stmt", "config_option_list", "config_option", "choice", 452 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
447 "choice_entry", "choice_end", "choice_stmt", "choice_option_list", 453 "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
448 "choice_option", "choice_block", "if", "if_end", "if_stmt", "if_block", 454 "choice_option_list", "choice_option", "choice_block", "if_entry",
449 "menu", "menu_entry", "menu_end", "menu_stmt", "menu_block", "source", 455 "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end",
450 "source_stmt", "comment", "comment_stmt", "help_start", "help", 456 "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt",
451 "depends_list", "depends", "prompt_stmt_opt", "prompt", "end", 457 "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
452 "nl_or_eof", "if_expr", "expr", "symbol", 0 458 "prompt", "end", "nl", "if_expr", "expr", "symbol", 0
453}; 459};
454#endif 460#endif
455 461
@@ -461,38 +467,40 @@ static const unsigned short int yytoknum[] =
461 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 467 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
462 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 468 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
463 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 469 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
464 285, 286, 287, 288, 289, 290 470 285, 286, 287, 288, 289
465}; 471};
466# endif 472# endif
467 473
468/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 474/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
469static const unsigned char yyr1[] = 475static const unsigned char yyr1[] =
470{ 476{
471 0, 36, 37, 37, 38, 38, 38, 38, 38, 38, 477 0, 35, 36, 37, 37, 37, 37, 37, 37, 37,
472 38, 38, 39, 39, 39, 39, 39, 39, 40, 41, 478 37, 37, 38, 38, 38, 38, 38, 38, 38, 39,
473 42, 43, 44, 44, 44, 44, 44, 45, 45, 45, 479 39, 39, 39, 39, 39, 40, 40, 41, 42, 43,
474 45, 45, 46, 47, 48, 49, 49, 50, 50, 50, 480 44, 45, 45, 45, 45, 45, 45, 46, 46, 46,
475 50, 50, 51, 51, 51, 51, 52, 52, 53, 54, 481 46, 46, 47, 48, 49, 50, 51, 51, 51, 51,
476 55, 55, 56, 56, 56, 56, 57, 58, 59, 60, 482 51, 51, 52, 52, 52, 52, 53, 53, 54, 55,
477 60, 61, 61, 61, 61, 61, 62, 63, 64, 65, 483 56, 57, 57, 57, 57, 58, 59, 60, 61, 62,
478 66, 67, 68, 68, 68, 69, 69, 69, 70, 70, 484 62, 62, 62, 63, 64, 65, 66, 67, 68, 68,
479 71, 71, 72, 72, 72, 73, 73, 74, 74, 75, 485 68, 68, 69, 69, 69, 70, 70, 71, 71, 72,
480 75, 75, 75, 75, 75, 75, 76, 76 486 72, 72, 73, 73, 74, 74, 75, 75, 75, 75,
487 75, 75, 75, 76, 76
481}; 488};
482 489
483/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 490/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
484static const unsigned char yyr2[] = 491static const unsigned char yyr2[] =
485{ 492{
486 0, 2, 0, 2, 1, 1, 1, 3, 1, 1, 493 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
487 1, 2, 1, 1, 1, 1, 1, 1, 3, 2, 494 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
488 3, 2, 0, 2, 2, 2, 2, 3, 4, 4, 495 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
489 4, 5, 2, 2, 1, 3, 2, 0, 2, 2, 496 2, 0, 2, 2, 2, 2, 2, 3, 4, 4,
497 4, 5, 2, 2, 1, 3, 0, 2, 2, 2,
490 2, 2, 4, 3, 2, 4, 0, 2, 3, 1, 498 2, 2, 4, 3, 2, 4, 0, 2, 3, 1,
491 3, 2, 0, 2, 2, 2, 3, 2, 1, 3, 499 3, 0, 2, 2, 2, 3, 2, 1, 3, 0,
492 2, 0, 2, 2, 2, 3, 3, 1, 3, 2, 500 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
493 2, 2, 0, 2, 2, 4, 3, 3, 0, 2, 501 2, 2, 4, 3, 3, 0, 2, 1, 1, 2,
494 1, 1, 2, 2, 2, 1, 1, 0, 2, 1, 502 2, 2, 1, 2, 0, 2, 1, 3, 3, 3,
495 3, 3, 3, 2, 3, 3, 1, 1 503 2, 3, 3, 1, 1
496}; 504};
497 505
498/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 506/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -500,136 +508,160 @@ static const unsigned char yyr2[] =
500 means the default is an error. */ 508 means the default is an error. */
501static const unsigned char yydefact[] = 509static const unsigned char yydefact[] =
502{ 510{
503 2, 0, 1, 0, 0, 0, 8, 0, 0, 10, 511 3, 0, 0, 1, 0, 0, 0, 0, 0, 0,
504 0, 0, 0, 0, 9, 85, 86, 3, 4, 22, 512 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
505 14, 22, 15, 37, 46, 5, 52, 12, 72, 61, 513 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
506 6, 67, 16, 72, 13, 17, 11, 80, 81, 0, 514 23, 46, 56, 5, 61, 20, 78, 69, 6, 24,
507 0, 0, 32, 0, 0, 0, 96, 97, 0, 0, 515 78, 21, 8, 11, 87, 88, 0, 0, 89, 0,
508 0, 89, 19, 21, 33, 36, 51, 57, 0, 69, 516 42, 90, 0, 0, 0, 103, 104, 0, 0, 0,
509 7, 56, 66, 68, 18, 20, 0, 93, 48, 0, 517 96, 91, 0, 0, 0, 0, 0, 0, 0, 0,
510 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 518 0, 0, 92, 7, 65, 73, 74, 27, 29, 0,
511 0, 26, 23, 0, 25, 24, 0, 0, 78, 0, 519 100, 0, 0, 58, 0, 0, 9, 10, 0, 0,
512 41, 38, 40, 39, 0, 0, 0, 47, 35, 34, 520 0, 0, 0, 85, 0, 0, 0, 0, 36, 35,
513 53, 55, 50, 54, 49, 74, 73, 0, 62, 64, 521 32, 0, 34, 33, 0, 0, 85, 0, 50, 51,
514 59, 63, 58, 92, 94, 95, 91, 90, 70, 0, 522 47, 49, 48, 57, 45, 44, 62, 64, 60, 63,
515 0, 0, 87, 0, 87, 87, 87, 0, 71, 44, 523 59, 80, 81, 79, 70, 72, 68, 71, 67, 93,
516 87, 0, 87, 82, 83, 84, 65, 0, 76, 77, 524 99, 101, 102, 98, 97, 26, 76, 0, 0, 0,
517 0, 0, 27, 79, 0, 0, 87, 0, 43, 0, 525 94, 0, 94, 94, 94, 0, 0, 77, 54, 94,
518 75, 88, 28, 29, 30, 0, 42, 45, 31 526 0, 94, 0, 83, 84, 0, 0, 37, 86, 0,
527 0, 94, 25, 0, 53, 0, 82, 95, 38, 39,
528 40, 0, 52, 55, 41
519}; 529};
520 530
521/* YYDEFGOTO[NTERM-NUM]. */ 531/* YYDEFGOTO[NTERM-NUM]. */
522static const short int yydefgoto[] = 532static const short int yydefgoto[] =
523{ 533{
524 -1, 1, 17, 18, 19, 20, 21, 22, 52, 82, 534 -1, 1, 2, 25, 26, 99, 27, 28, 29, 30,
525 23, 24, 98, 25, 54, 91, 55, 26, 102, 27, 535 64, 100, 31, 32, 114, 33, 66, 110, 67, 34,
526 56, 28, 29, 110, 30, 58, 31, 32, 33, 34, 536 118, 35, 68, 36, 37, 126, 38, 70, 39, 40,
527 83, 84, 57, 85, 123, 124, 99, 35, 141, 50, 537 41, 101, 102, 69, 103, 141, 142, 42, 73, 156,
528 51 538 59, 60
529}; 539};
530 540
531/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 541/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
532 STATE-NUM. */ 542 STATE-NUM. */
533#define YYPACT_NINF -113 543#define YYPACT_NINF -78
534static const short int yypact[] = 544static const short int yypact[] =
535{ 545{
536 -113, 37, -113, 114, 136, 136, -113, 136, -29, -113, 546 -78, 2, 159, -78, -21, 0, 0, -12, 0, 1,
537 136, -19, -14, -10, -113, -113, -113, -113, -113, -113, 547 4, 0, 27, 38, 60, 58, -78, -78, -78, -78,
538 -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, 548 -78, -78, -78, 100, -78, 104, -78, -78, -78, -78,
539 -113, -113, -113, -113, -113, -113, -113, -113, -113, 114, 549 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
540 9, 25, -113, 56, 60, 65, -113, -113, -10, -10, 550 -78, -78, -78, -78, -78, -78, 86, 113, -78, 114,
541 33, -1, 108, 108, 41, 103, 92, 5, 74, 5, 551 -78, -78, 125, 127, 128, -78, -78, 60, 60, 210,
542 -113, -113, -113, -113, -113, -113, 115, -113, -113, -10, 552 65, -78, 141, 142, 39, 103, 182, 200, 6, 66,
543 -10, 138, 138, 80, 111, -10, 136, 136, -10, 2, 553 6, 131, -78, 146, -78, -78, -78, -78, -78, 196,
544 138, -113, -113, 113, -113, -113, 85, 136, 136, 107, 554 -78, 60, 60, 146, 40, 40, -78, -78, 155, 156,
545 -113, -113, -113, -113, 114, 114, 114, -113, -113, -113, 555 -2, 60, 0, 0, 60, 105, 40, 194, -78, -78,
546 -113, -113, -113, -113, -113, -113, -113, 120, -113, -113, 556 -78, 206, -78, -78, 183, 0, 0, 195, -78, -78,
547 -113, -113, -113, -113, 121, -113, -113, -113, -113, -10, 557 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
548 109, 119, 16, 137, 16, 17, 16, 138, -113, -113, 558 -78, -78, -78, -78, -78, -78, -78, -78, -78, -78,
549 16, 139, 16, -113, -113, -113, -113, 123, -113, -113, 559 -78, 197, -78, -78, -78, -78, -78, 60, 213, 216,
550 -10, 140, -113, -113, 141, 142, 16, 143, -113, 144, 560 212, 203, 212, 190, 212, 40, 208, -78, -78, 212,
551 -113, 133, -113, -113, -113, 145, -113, -113, -113 561 222, 212, 219, -78, -78, 60, 223, -78, -78, 224,
562 225, 212, -78, 226, -78, 227, -78, 47, -78, -78,
563 -78, 228, -78, -78, -78
552}; 564};
553 565
554/* YYPGOTO[NTERM-NUM]. */ 566/* YYPGOTO[NTERM-NUM]. */
555static const short int yypgoto[] = 567static const short int yypgoto[] =
556{ 568{
557 -113, -113, -113, 14, -113, -113, -113, -113, 147, -113, 569 -78, -78, -78, -78, 164, -36, -78, -78, -78, -78,
558 -113, -113, -113, -2, -113, -113, -113, -113, -113, -113, 570 230, -78, -78, -78, -78, 29, -78, -78, -78, -78,
559 -113, -113, -113, -113, 101, -113, -113, -113, -113, -113, 571 -78, -78, -78, -78, -78, -78, 59, -78, -78, -78,
560 -113, 122, 146, 62, 89, 0, 102, -3, -112, -46, 572 -78, -78, 198, 220, 24, 157, -5, 169, 202, 74,
561 -63 573 -53, -77
562}; 574};
563 575
564/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 576/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
565 positive, shift that token. If negative, reduce the rule which 577 positive, shift that token. If negative, reduce the rule which
566 number is the opposite. If zero, do what YYDEFACT says. 578 number is the opposite. If zero, do what YYDEFACT says.
567 If YYTABLE_NINF, syntax error. */ 579 If YYTABLE_NINF, syntax error. */
568#define YYTABLE_NINF -61 580#define YYTABLE_NINF -76
569static const short int yytable[] = 581static const short int yytable[] =
570{ 582{
571 36, 42, 66, 67, 39, 40, 44, 41, 116, 117, 583 46, 47, 3, 49, 79, 80, 52, 133, 134, 43,
572 43, 45, 143, 144, 145, 46, 47, 127, 147, 48, 584 6, 7, 8, 9, 10, 11, 12, 13, 48, 145,
573 149, 74, 75, 114, 115, 49, 71, 126, 120, 121, 585 14, 15, 137, 55, 56, 44, 45, 57, 131, 132,
574 140, 140, 125, 72, 155, 105, 60, 2, 3, 61, 586 109, 50, 58, 122, 51, 122, 24, 138, 139, -28,
575 4, 5, 6, 7, 8, 9, 10, 11, 12, 69, 587 88, 143, -28, -28, -28, -28, -28, -28, -28, -28,
576 70, 13, 14, 73, 101, 62, 109, 74, 75, 86, 588 -28, 89, 53, -28, -28, 90, 91, -28, 92, 93,
577 87, 88, 89, 68, 146, 69, 70, 15, 16, 97, 589 94, 95, 96, 54, 97, 55, 56, 88, 161, 98,
578 100, 90, 108, 137, -60, 107, 122, -60, 5, 94, 590 -66, -66, -66, -66, -66, -66, -66, -66, 81, 82,
579 7, 8, 95, 10, 11, 12, 63, 130, 13, 96, 591 -66, -66, 90, 91, 152, 55, 56, 140, 61, 57,
580 64, 133, 134, 135, 151, 65, 5, 94, 7, 8, 592 112, 97, 84, 123, 58, 123, 121, 117, 85, 125,
581 95, 10, 11, 12, 15, 16, 13, 96, 94, 7, 593 149, 62, 167, -30, 88, 63, -30, -30, -30, -30,
582 118, 95, 10, 11, 12, 129, 93, 13, 96, 106, 594 -30, -30, -30, -30, -30, 89, 72, -30, -30, 90,
583 73, 106, 15, 16, 74, 75, 128, 76, 77, 78, 595 91, -30, 92, 93, 94, 95, 96, 119, 97, 127,
584 79, 80, 132, 15, 16, 119, 46, 47, 81, 138, 596 144, -75, 88, 98, -75, -75, -75, -75, -75, -75,
585 48, 69, 70, 113, 15, 16, 49, 69, 70, 139, 597 -75, -75, -75, 74, 75, -75, -75, 90, 91, -75,
586 136, 69, 70, 150, 70, 69, 70, 103, 104, 111, 598 -75, -75, -75, -75, -75, 76, 97, 77, 78, -2,
587 112, 37, 38, 46, 47, 69, 70, 142, 53, 148, 599 4, 121, 5, 6, 7, 8, 9, 10, 11, 12,
588 152, 153, 154, 156, 157, 158, 92, 131, 0, 59 600 13, 86, 87, 14, 15, 16, 129, 17, 18, 19,
601 20, 21, 22, 88, 23, 135, 136, -43, -43, 24,
602 -43, -43, -43, -43, 89, 146, -43, -43, 90, 91,
603 104, 105, 106, 107, 155, 7, 8, 97, 10, 11,
604 12, 13, 108, 148, 14, 15, 158, 159, 160, 147,
605 151, 81, 82, 163, 130, 165, 155, 81, 82, 82,
606 24, 113, 116, 157, 124, 171, 115, 120, 162, 128,
607 72, 81, 82, 153, 81, 82, 154, 81, 82, 166,
608 81, 82, 164, 168, 169, 170, 172, 173, 174, 65,
609 71, 83, 0, 150, 111
589}; 610};
590 611
591static const short int yycheck[] = 612static const short int yycheck[] =
592{ 613{
593 3, 30, 48, 49, 4, 5, 25, 7, 71, 72, 614 5, 6, 0, 8, 57, 58, 11, 84, 85, 30,
594 10, 25, 124, 125, 126, 25, 26, 80, 130, 29, 615 4, 5, 6, 7, 8, 9, 10, 11, 30, 96,
595 132, 16, 17, 69, 70, 35, 27, 25, 74, 75, 616 14, 15, 24, 25, 26, 25, 26, 29, 81, 82,
596 14, 14, 78, 34, 146, 30, 39, 0, 1, 30, 617 66, 30, 34, 69, 30, 71, 30, 90, 91, 0,
597 3, 4, 5, 6, 7, 8, 9, 10, 11, 32, 618 1, 94, 3, 4, 5, 6, 7, 8, 9, 10,
598 33, 14, 15, 12, 56, 30, 58, 16, 17, 18, 619 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
599 19, 20, 21, 30, 127, 32, 33, 30, 31, 55, 620 21, 22, 23, 25, 25, 25, 26, 1, 145, 30,
600 56, 30, 58, 119, 0, 1, 76, 3, 4, 5, 621 4, 5, 6, 7, 8, 9, 10, 11, 31, 32,
601 6, 7, 8, 9, 10, 11, 30, 87, 14, 15, 622 14, 15, 16, 17, 137, 25, 26, 92, 30, 29,
602 30, 94, 95, 96, 140, 30, 4, 5, 6, 7, 623 66, 25, 27, 69, 34, 71, 30, 68, 33, 70,
603 8, 9, 10, 11, 30, 31, 14, 15, 5, 6, 624 105, 1, 155, 0, 1, 1, 3, 4, 5, 6,
604 30, 8, 9, 10, 11, 30, 54, 14, 15, 57, 625 7, 8, 9, 10, 11, 12, 30, 14, 15, 16,
605 12, 59, 30, 31, 16, 17, 13, 19, 20, 21, 626 17, 18, 19, 20, 21, 22, 23, 68, 25, 70,
606 22, 23, 25, 30, 31, 24, 25, 26, 30, 30, 627 25, 0, 1, 30, 3, 4, 5, 6, 7, 8,
607 29, 32, 33, 28, 30, 31, 35, 32, 33, 30, 628 9, 10, 11, 30, 30, 14, 15, 16, 17, 18,
608 30, 32, 33, 30, 33, 32, 33, 56, 56, 58, 629 19, 20, 21, 22, 23, 30, 25, 30, 30, 0,
609 58, 25, 26, 25, 26, 32, 33, 30, 21, 30, 630 1, 30, 3, 4, 5, 6, 7, 8, 9, 10,
610 30, 30, 30, 30, 30, 30, 54, 88, -1, 33 631 11, 30, 30, 14, 15, 16, 30, 18, 19, 20,
632 21, 22, 23, 1, 25, 30, 30, 5, 6, 30,
633 8, 9, 10, 11, 12, 1, 14, 15, 16, 17,
634 18, 19, 20, 21, 14, 5, 6, 25, 8, 9,
635 10, 11, 30, 30, 14, 15, 142, 143, 144, 13,
636 25, 31, 32, 149, 28, 151, 14, 31, 32, 32,
637 30, 67, 68, 30, 70, 161, 67, 68, 30, 70,
638 30, 31, 32, 30, 31, 32, 30, 31, 32, 30,
639 31, 32, 30, 30, 30, 30, 30, 30, 30, 29,
640 40, 59, -1, 106, 66
611}; 641};
612 642
613/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 643/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
614 symbol of state STATE-NUM. */ 644 symbol of state STATE-NUM. */
615static const unsigned char yystos[] = 645static const unsigned char yystos[] =
616{ 646{
617 0, 37, 0, 1, 3, 4, 5, 6, 7, 8, 647 0, 36, 37, 0, 1, 3, 4, 5, 6, 7,
618 9, 10, 11, 14, 15, 30, 31, 38, 39, 40, 648 8, 9, 10, 11, 14, 15, 16, 18, 19, 20,
619 41, 42, 43, 46, 47, 49, 53, 55, 57, 58, 649 21, 22, 23, 25, 30, 38, 39, 41, 42, 43,
620 60, 62, 63, 64, 65, 73, 73, 25, 26, 71, 650 44, 47, 48, 50, 54, 56, 58, 59, 61, 63,
621 71, 71, 30, 71, 25, 25, 25, 26, 29, 35, 651 64, 65, 72, 30, 25, 26, 71, 71, 30, 71,
622 75, 76, 44, 44, 50, 52, 56, 68, 61, 68, 652 30, 30, 71, 25, 25, 25, 26, 29, 34, 75,
623 73, 30, 30, 30, 30, 30, 75, 75, 30, 32, 653 76, 30, 1, 1, 45, 45, 51, 53, 57, 68,
624 33, 27, 34, 12, 16, 17, 19, 20, 21, 22, 654 62, 68, 30, 73, 30, 30, 30, 30, 30, 75,
625 23, 30, 45, 66, 67, 69, 18, 19, 20, 21, 655 75, 31, 32, 73, 27, 33, 30, 30, 1, 12,
626 30, 51, 67, 69, 5, 8, 15, 39, 48, 72, 656 16, 17, 19, 20, 21, 22, 23, 25, 30, 40,
627 39, 49, 54, 60, 72, 30, 69, 1, 39, 49, 657 46, 66, 67, 69, 18, 19, 20, 21, 30, 40,
628 59, 60, 72, 28, 75, 75, 76, 76, 30, 24, 658 52, 67, 69, 39, 49, 72, 39, 50, 55, 61,
629 75, 75, 71, 70, 71, 75, 25, 76, 13, 30, 659 72, 30, 40, 69, 39, 50, 60, 61, 72, 30,
630 71, 70, 25, 73, 73, 73, 30, 75, 30, 30, 660 28, 75, 75, 76, 76, 30, 30, 24, 75, 75,
631 14, 74, 30, 74, 74, 74, 76, 74, 30, 74, 661 71, 70, 71, 75, 25, 76, 1, 13, 30, 71,
632 30, 75, 30, 30, 30, 74, 30, 30, 30 662 70, 25, 75, 30, 30, 14, 74, 30, 74, 74,
663 74, 76, 30, 74, 30, 74, 30, 75, 30, 30,
664 30, 74, 30, 30, 30
633}; 665};
634 666
635#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 667#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -966,6 +998,36 @@ yydestruct (yymsg, yytype, yyvaluep)
966 998
967 switch (yytype) 999 switch (yytype)
968 { 1000 {
1001 case 48: /* choice_entry */
1002
1003 {
1004 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1005 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1006 if (current_menu == (yyvaluep->menu))
1007 menu_end_menu();
1008};
1009
1010 break;
1011 case 54: /* if_entry */
1012
1013 {
1014 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1015 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1016 if (current_menu == (yyvaluep->menu))
1017 menu_end_menu();
1018};
1019
1020 break;
1021 case 59: /* menu_entry */
1022
1023 {
1024 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
1025 (yyvaluep->menu)->file->name, (yyvaluep->menu)->lineno);
1026 if (current_menu == (yyvaluep->menu))
1027 menu_end_menu();
1028};
1029
1030 break;
969 1031
970 default: 1032 default:
971 break; 1033 break;
@@ -1271,25 +1333,37 @@ yyreduce:
1271 { 1333 {
1272 case 8: 1334 case 8:
1273 1335
1274 { zconfprint("unexpected 'endmenu' statement"); ;} 1336 { zconf_error("unexpected end statement"); ;}
1275 break; 1337 break;
1276 1338
1277 case 9: 1339 case 9:
1278 1340
1279 { zconfprint("unexpected 'endif' statement"); ;} 1341 { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); ;}
1280 break; 1342 break;
1281 1343
1282 case 10: 1344 case 10:
1283 1345
1284 { zconfprint("unexpected 'endchoice' statement"); ;} 1346 {
1347 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[-2].id)->name);
1348;}
1285 break; 1349 break;
1286 1350
1287 case 11: 1351 case 11:
1288 1352
1289 { zconfprint("syntax error"); yyerrok; ;} 1353 { zconf_error("invalid statement"); ;}
1290 break; 1354 break;
1291 1355
1292 case 18: 1356 case 25:
1357
1358 { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); ;}
1359 break;
1360
1361 case 26:
1362
1363 { zconf_error("invalid option"); ;}
1364 break;
1365
1366 case 27:
1293 1367
1294 { 1368 {
1295 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); 1369 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
@@ -1299,7 +1373,7 @@ yyreduce:
1299;} 1373;}
1300 break; 1374 break;
1301 1375
1302 case 19: 1376 case 28:
1303 1377
1304 { 1378 {
1305 menu_end_entry(); 1379 menu_end_entry();
@@ -1307,7 +1381,7 @@ yyreduce:
1307;} 1381;}
1308 break; 1382 break;
1309 1383
1310 case 20: 1384 case 29:
1311 1385
1312 { 1386 {
1313 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0); 1387 struct symbol *sym = sym_lookup((yyvsp[-1].string), 0);
@@ -1317,7 +1391,7 @@ yyreduce:
1317;} 1391;}
1318 break; 1392 break;
1319 1393
1320 case 21: 1394 case 30:
1321 1395
1322 { 1396 {
1323 if (current_entry->prompt) 1397 if (current_entry->prompt)
@@ -1329,7 +1403,7 @@ yyreduce:
1329;} 1403;}
1330 break; 1404 break;
1331 1405
1332 case 27: 1406 case 37:
1333 1407
1334 { 1408 {
1335 menu_set_type((yyvsp[-2].id)->stype); 1409 menu_set_type((yyvsp[-2].id)->stype);
@@ -1339,7 +1413,7 @@ yyreduce:
1339;} 1413;}
1340 break; 1414 break;
1341 1415
1342 case 28: 1416 case 38:
1343 1417
1344 { 1418 {
1345 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); 1419 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
@@ -1347,7 +1421,7 @@ yyreduce:
1347;} 1421;}
1348 break; 1422 break;
1349 1423
1350 case 29: 1424 case 39:
1351 1425
1352 { 1426 {
1353 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); 1427 menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr));
@@ -1359,7 +1433,7 @@ yyreduce:
1359;} 1433;}
1360 break; 1434 break;
1361 1435
1362 case 30: 1436 case 40:
1363 1437
1364 { 1438 {
1365 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); 1439 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr));
@@ -1367,7 +1441,7 @@ yyreduce:
1367;} 1441;}
1368 break; 1442 break;
1369 1443
1370 case 31: 1444 case 41:
1371 1445
1372 { 1446 {
1373 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); 1447 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr));
@@ -1375,7 +1449,7 @@ yyreduce:
1375;} 1449;}
1376 break; 1450 break;
1377 1451
1378 case 32: 1452 case 42:
1379 1453
1380 { 1454 {
1381 struct symbol *sym = sym_lookup(NULL, 0); 1455 struct symbol *sym = sym_lookup(NULL, 0);
@@ -1386,33 +1460,24 @@ yyreduce:
1386;} 1460;}
1387 break; 1461 break;
1388 1462
1389 case 33: 1463 case 43:
1390 1464
1391 { 1465 {
1392 menu_end_entry(); 1466 (yyval.menu) = menu_add_menu();
1393 menu_add_menu();
1394;} 1467;}
1395 break; 1468 break;
1396 1469
1397 case 34: 1470 case 44:
1398 1471
1399 { 1472 {
1400 if (zconf_endtoken((yyvsp[0].token), T_CHOICE, T_ENDCHOICE)) { 1473 if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) {
1401 menu_end_menu(); 1474 menu_end_menu();
1402 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); 1475 printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno());
1403 } 1476 }
1404;} 1477;}
1405 break; 1478 break;
1406 1479
1407 case 36: 1480 case 52:
1408
1409 {
1410 printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
1411 zconfnerrs++;
1412;}
1413 break;
1414
1415 case 42:
1416 1481
1417 { 1482 {
1418 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); 1483 menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr));
@@ -1420,7 +1485,7 @@ yyreduce:
1420;} 1485;}
1421 break; 1486 break;
1422 1487
1423 case 43: 1488 case 53:
1424 1489
1425 { 1490 {
1426 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { 1491 if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) {
@@ -1433,7 +1498,7 @@ yyreduce:
1433;} 1498;}
1434 break; 1499 break;
1435 1500
1436 case 44: 1501 case 54:
1437 1502
1438 { 1503 {
1439 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1504 current_entry->sym->flags |= SYMBOL_OPTIONAL;
@@ -1441,7 +1506,7 @@ yyreduce:
1441;} 1506;}
1442 break; 1507 break;
1443 1508
1444 case 45: 1509 case 55:
1445 1510
1446 { 1511 {
1447 if ((yyvsp[-3].id)->stype == S_UNKNOWN) { 1512 if ((yyvsp[-3].id)->stype == S_UNKNOWN) {
@@ -1453,36 +1518,27 @@ yyreduce:
1453;} 1518;}
1454 break; 1519 break;
1455 1520
1456 case 48: 1521 case 58:
1457 1522
1458 { 1523 {
1459 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 1524 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
1460 menu_add_entry(NULL); 1525 menu_add_entry(NULL);
1461 menu_add_dep((yyvsp[-1].expr)); 1526 menu_add_dep((yyvsp[-1].expr));
1462 menu_end_entry(); 1527 (yyval.menu) = menu_add_menu();
1463 menu_add_menu();
1464;} 1528;}
1465 break; 1529 break;
1466 1530
1467 case 49: 1531 case 59:
1468 1532
1469 { 1533 {
1470 if (zconf_endtoken((yyvsp[0].token), T_IF, T_ENDIF)) { 1534 if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) {
1471 menu_end_menu(); 1535 menu_end_menu();
1472 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); 1536 printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno());
1473 } 1537 }
1474;} 1538;}
1475 break; 1539 break;
1476 1540
1477 case 51: 1541 case 65:
1478
1479 {
1480 printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
1481 zconfnerrs++;
1482;}
1483 break;
1484
1485 case 56:
1486 1542
1487 { 1543 {
1488 menu_add_entry(NULL); 1544 menu_add_entry(NULL);
@@ -1491,53 +1547,32 @@ yyreduce:
1491;} 1547;}
1492 break; 1548 break;
1493 1549
1494 case 57: 1550 case 66:
1495 1551
1496 { 1552 {
1497 menu_end_entry(); 1553 (yyval.menu) = menu_add_menu();
1498 menu_add_menu();
1499;} 1554;}
1500 break; 1555 break;
1501 1556
1502 case 58: 1557 case 67:
1503 1558
1504 { 1559 {
1505 if (zconf_endtoken((yyvsp[0].token), T_MENU, T_ENDMENU)) { 1560 if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) {
1506 menu_end_menu(); 1561 menu_end_menu();
1507 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); 1562 printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno());
1508 } 1563 }
1509;} 1564;}
1510 break; 1565 break;
1511 1566
1512 case 60: 1567 case 73:
1513 1568
1514 { 1569 {
1515 printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
1516 zconfnerrs++;
1517;}
1518 break;
1519
1520 case 65:
1521
1522 { zconfprint("invalid menu option"); yyerrok; ;}
1523 break;
1524
1525 case 66:
1526
1527 {
1528 (yyval.string) = (yyvsp[-1].string);
1529 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); 1570 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string));
1571 zconf_nextfile((yyvsp[-1].string));
1530;} 1572;}
1531 break; 1573 break;
1532 1574
1533 case 67: 1575 case 74:
1534
1535 {
1536 zconf_nextfile((yyvsp[0].string));
1537;}
1538 break;
1539
1540 case 68:
1541 1576
1542 { 1577 {
1543 menu_add_entry(NULL); 1578 menu_add_entry(NULL);
@@ -1546,14 +1581,14 @@ yyreduce:
1546;} 1581;}
1547 break; 1582 break;
1548 1583
1549 case 69: 1584 case 75:
1550 1585
1551 { 1586 {
1552 menu_end_entry(); 1587 menu_end_entry();
1553;} 1588;}
1554 break; 1589 break;
1555 1590
1556 case 70: 1591 case 76:
1557 1592
1558 { 1593 {
1559 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1594 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
@@ -1561,14 +1596,14 @@ yyreduce:
1561;} 1596;}
1562 break; 1597 break;
1563 1598
1564 case 71: 1599 case 77:
1565 1600
1566 { 1601 {
1567 current_entry->sym->help = (yyvsp[0].string); 1602 current_entry->sym->help = (yyvsp[0].string);
1568;} 1603;}
1569 break; 1604 break;
1570 1605
1571 case 75: 1606 case 82:
1572 1607
1573 { 1608 {
1574 menu_add_dep((yyvsp[-1].expr)); 1609 menu_add_dep((yyvsp[-1].expr));
@@ -1576,7 +1611,7 @@ yyreduce:
1576;} 1611;}
1577 break; 1612 break;
1578 1613
1579 case 76: 1614 case 83:
1580 1615
1581 { 1616 {
1582 menu_add_dep((yyvsp[-1].expr)); 1617 menu_add_dep((yyvsp[-1].expr));
@@ -1584,7 +1619,7 @@ yyreduce:
1584;} 1619;}
1585 break; 1620 break;
1586 1621
1587 case 77: 1622 case 84:
1588 1623
1589 { 1624 {
1590 menu_add_dep((yyvsp[-1].expr)); 1625 menu_add_dep((yyvsp[-1].expr));
@@ -1592,79 +1627,79 @@ yyreduce:
1592;} 1627;}
1593 break; 1628 break;
1594 1629
1595 case 79: 1630 case 86:
1596 1631
1597 { 1632 {
1598 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); 1633 menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr));
1599;} 1634;}
1600 break; 1635 break;
1601 1636
1602 case 82: 1637 case 89:
1603 1638
1604 { (yyval.token) = T_ENDMENU; ;} 1639 { (yyval.id) = (yyvsp[-1].id); ;}
1605 break; 1640 break;
1606 1641
1607 case 83: 1642 case 90:
1608 1643
1609 { (yyval.token) = T_ENDCHOICE; ;} 1644 { (yyval.id) = (yyvsp[-1].id); ;}
1610 break; 1645 break;
1611 1646
1612 case 84: 1647 case 91:
1613 1648
1614 { (yyval.token) = T_ENDIF; ;} 1649 { (yyval.id) = (yyvsp[-1].id); ;}
1615 break; 1650 break;
1616 1651
1617 case 87: 1652 case 94:
1618 1653
1619 { (yyval.expr) = NULL; ;} 1654 { (yyval.expr) = NULL; ;}
1620 break; 1655 break;
1621 1656
1622 case 88: 1657 case 95:
1623 1658
1624 { (yyval.expr) = (yyvsp[0].expr); ;} 1659 { (yyval.expr) = (yyvsp[0].expr); ;}
1625 break; 1660 break;
1626 1661
1627 case 89: 1662 case 96:
1628 1663
1629 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} 1664 { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;}
1630 break; 1665 break;
1631 1666
1632 case 90: 1667 case 97:
1633 1668
1634 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} 1669 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1635 break; 1670 break;
1636 1671
1637 case 91: 1672 case 98:
1638 1673
1639 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} 1674 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;}
1640 break; 1675 break;
1641 1676
1642 case 92: 1677 case 99:
1643 1678
1644 { (yyval.expr) = (yyvsp[-1].expr); ;} 1679 { (yyval.expr) = (yyvsp[-1].expr); ;}
1645 break; 1680 break;
1646 1681
1647 case 93: 1682 case 100:
1648 1683
1649 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} 1684 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;}
1650 break; 1685 break;
1651 1686
1652 case 94: 1687 case 101:
1653 1688
1654 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} 1689 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1655 break; 1690 break;
1656 1691
1657 case 95: 1692 case 102:
1658 1693
1659 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} 1694 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;}
1660 break; 1695 break;
1661 1696
1662 case 96: 1697 case 103:
1663 1698
1664 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} 1699 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;}
1665 break; 1700 break;
1666 1701
1667 case 97: 1702 case 104:
1668 1703
1669 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} 1704 { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;}
1670 break; 1705 break;
@@ -1916,7 +1951,10 @@ void conf_parse(const char *name)
1916 modules_sym = sym_lookup("MODULES", 0); 1951 modules_sym = sym_lookup("MODULES", 0);
1917 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 1952 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
1918 1953
1919 //zconfdebug = 1; 1954#if YYDEBUG
1955 if (getenv("ZCONF_DEBUG"))
1956 zconfdebug = 1;
1957#endif
1920 zconfparse(); 1958 zconfparse();
1921 if (zconfnerrs) 1959 if (zconfnerrs)
1922 exit(1); 1960 exit(1);
@@ -1937,20 +1975,25 @@ const char *zconf_tokenname(int token)
1937 case T_ENDCHOICE: return "endchoice"; 1975 case T_ENDCHOICE: return "endchoice";
1938 case T_IF: return "if"; 1976 case T_IF: return "if";
1939 case T_ENDIF: return "endif"; 1977 case T_ENDIF: return "endif";
1978 case T_DEPENDS: return "depends";
1940 } 1979 }
1941 return "<token>"; 1980 return "<token>";
1942} 1981}
1943 1982
1944static bool zconf_endtoken(int token, int starttoken, int endtoken) 1983static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
1945{ 1984{
1946 if (token != endtoken) { 1985 if (id->token != endtoken) {
1947 zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); 1986 zconf_error("unexpected '%s' within %s block",
1987 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1948 zconfnerrs++; 1988 zconfnerrs++;
1949 return false; 1989 return false;
1950 } 1990 }
1951 if (current_menu->file != current_file) { 1991 if (current_menu->file != current_file) {
1952 zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); 1992 zconf_error("'%s' in different file than '%s'",
1953 zconfprint("location of the '%s'", zconf_tokenname(starttoken)); 1993 kconf_id_strings + id->name, zconf_tokenname(starttoken));
1994 fprintf(stderr, "%s:%d: location of the '%s'\n",
1995 current_menu->file->name, current_menu->lineno,
1996 zconf_tokenname(starttoken));
1954 zconfnerrs++; 1997 zconfnerrs++;
1955 return false; 1998 return false;
1956 } 1999 }
@@ -1961,7 +2004,19 @@ static void zconfprint(const char *err, ...)
1961{ 2004{
1962 va_list ap; 2005 va_list ap;
1963 2006
1964 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); 2007 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
2008 va_start(ap, err);
2009 vfprintf(stderr, err, ap);
2010 va_end(ap);
2011 fprintf(stderr, "\n");
2012}
2013
2014static void zconf_error(const char *err, ...)
2015{
2016 va_list ap;
2017
2018 zconfnerrs++;
2019 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
1965 va_start(ap, err); 2020 va_start(ap, err);
1966 vfprintf(stderr, err, ap); 2021 vfprintf(stderr, err, ap);
1967 va_end(ap); 2022 va_end(ap);
@@ -1970,7 +2025,9 @@ static void zconfprint(const char *err, ...)
1970 2025
1971static void zconferror(const char *err) 2026static void zconferror(const char *err)
1972{ 2027{
2028#if YYDEBUG
1973 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); 2029 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
2030#endif
1974} 2031}
1975 2032
1976void print_quoted_string(FILE *out, const char *str) 2033void print_quoted_string(FILE *out, const char *str)
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 1211781675b8..1f61fba6aa28 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -25,21 +25,25 @@ int cdebug = PRINTD;
25 25
26extern int zconflex(void); 26extern int zconflex(void);
27static void zconfprint(const char *err, ...); 27static void zconfprint(const char *err, ...);
28static void zconf_error(const char *err, ...);
28static void zconferror(const char *err); 29static void zconferror(const char *err);
29static bool zconf_endtoken(int token, int starttoken, int endtoken); 30static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
30 31
31struct symbol *symbol_hash[257]; 32struct symbol *symbol_hash[257];
32 33
33static struct menu *current_menu, *current_entry; 34static struct menu *current_menu, *current_entry;
34 35
36#define YYDEBUG 0
37#if YYDEBUG
35#define YYERROR_VERBOSE 38#define YYERROR_VERBOSE
39#endif
36%} 40%}
37%expect 40 41%expect 26
38 42
39%union 43%union
40{ 44{
41 int token;
42 char *string; 45 char *string;
46 struct file *file;
43 struct symbol *symbol; 47 struct symbol *symbol;
44 struct expr *expr; 48 struct expr *expr;
45 struct menu *menu; 49 struct menu *menu;
@@ -74,7 +78,6 @@ static struct menu *current_menu, *current_entry;
74%token T_CLOSE_PAREN 78%token T_CLOSE_PAREN
75%token T_OPEN_PAREN 79%token T_OPEN_PAREN
76%token T_EOL 80%token T_EOL
77%token T_EOF
78 81
79%left T_OR 82%left T_OR
80%left T_AND 83%left T_AND
@@ -82,34 +85,54 @@ static struct menu *current_menu, *current_entry;
82%nonassoc T_NOT 85%nonassoc T_NOT
83 86
84%type <string> prompt 87%type <string> prompt
85%type <string> source
86%type <symbol> symbol 88%type <symbol> symbol
87%type <expr> expr 89%type <expr> expr
88%type <expr> if_expr 90%type <expr> if_expr
89%type <token> end 91%type <id> end
92%type <id> option_name
93%type <menu> if_entry menu_entry choice_entry
94
95%destructor {
96 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
97 $$->file->name, $$->lineno);
98 if (current_menu == $$)
99 menu_end_menu();
100} if_entry menu_entry choice_entry
90 101
91%% 102%%
92input: /* empty */ 103input: stmt_list;
93 | input block 104
105stmt_list:
106 /* empty */
107 | stmt_list common_stmt
108 | stmt_list choice_stmt
109 | stmt_list menu_stmt
110 | stmt_list T_MAINMENU prompt nl
111 | stmt_list end { zconf_error("unexpected end statement"); }
112 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
113 | stmt_list option_name error T_EOL
114{
115 zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
116}
117 | stmt_list error T_EOL { zconf_error("invalid statement"); }
94; 118;
95 119
96block: common_block 120option_name:
97 | choice_stmt 121 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT
98 | menu_stmt
99 | T_MAINMENU prompt nl_or_eof
100 | T_ENDMENU { zconfprint("unexpected 'endmenu' statement"); }
101 | T_ENDIF { zconfprint("unexpected 'endif' statement"); }
102 | T_ENDCHOICE { zconfprint("unexpected 'endchoice' statement"); }
103 | error nl_or_eof { zconfprint("syntax error"); yyerrok; }
104; 122;
105 123
106common_block: 124common_stmt:
107 if_stmt 125 T_EOL
126 | if_stmt
108 | comment_stmt 127 | comment_stmt
109 | config_stmt 128 | config_stmt
110 | menuconfig_stmt 129 | menuconfig_stmt
111 | source_stmt 130 | source_stmt
112 | nl_or_eof 131;
132
133option_error:
134 T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); }
135 | error T_EOL { zconf_error("invalid option"); }
113; 136;
114 137
115 138
@@ -152,6 +175,7 @@ config_option_list:
152 | config_option_list config_option 175 | config_option_list config_option
153 | config_option_list depends 176 | config_option_list depends
154 | config_option_list help 177 | config_option_list help
178 | config_option_list option_error
155 | config_option_list T_EOL 179 | config_option_list T_EOL
156; 180;
157 181
@@ -204,8 +228,7 @@ choice: T_CHOICE T_EOL
204 228
205choice_entry: choice choice_option_list 229choice_entry: choice choice_option_list
206{ 230{
207 menu_end_entry(); 231 $$ = menu_add_menu();
208 menu_add_menu();
209}; 232};
210 233
211choice_end: end 234choice_end: end
@@ -216,13 +239,8 @@ choice_end: end
216 } 239 }
217}; 240};
218 241
219choice_stmt: 242choice_stmt: choice_entry choice_block choice_end
220 choice_entry choice_block choice_end 243;
221 | choice_entry choice_block
222{
223 printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno);
224 zconfnerrs++;
225};
226 244
227choice_option_list: 245choice_option_list:
228 /* empty */ 246 /* empty */
@@ -230,6 +248,7 @@ choice_option_list:
230 | choice_option_list depends 248 | choice_option_list depends
231 | choice_option_list help 249 | choice_option_list help
232 | choice_option_list T_EOL 250 | choice_option_list T_EOL
251 | choice_option_list option_error
233; 252;
234 253
235choice_option: T_PROMPT prompt if_expr T_EOL 254choice_option: T_PROMPT prompt if_expr T_EOL
@@ -267,18 +286,17 @@ choice_option: T_DEFAULT T_WORD if_expr T_EOL
267 286
268choice_block: 287choice_block:
269 /* empty */ 288 /* empty */
270 | choice_block common_block 289 | choice_block common_stmt
271; 290;
272 291
273/* if entry */ 292/* if entry */
274 293
275if: T_IF expr T_EOL 294if_entry: T_IF expr nl
276{ 295{
277 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 296 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
278 menu_add_entry(NULL); 297 menu_add_entry(NULL);
279 menu_add_dep($2); 298 menu_add_dep($2);
280 menu_end_entry(); 299 $$ = menu_add_menu();
281 menu_add_menu();
282}; 300};
283 301
284if_end: end 302if_end: end
@@ -289,17 +307,12 @@ if_end: end
289 } 307 }
290}; 308};
291 309
292if_stmt: 310if_stmt: if_entry if_block if_end
293 if if_block if_end 311;
294 | if if_block
295{
296 printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno);
297 zconfnerrs++;
298};
299 312
300if_block: 313if_block:
301 /* empty */ 314 /* empty */
302 | if_block common_block 315 | if_block common_stmt
303 | if_block menu_stmt 316 | if_block menu_stmt
304 | if_block choice_stmt 317 | if_block choice_stmt
305; 318;
@@ -315,8 +328,7 @@ menu: T_MENU prompt T_EOL
315 328
316menu_entry: menu depends_list 329menu_entry: menu depends_list
317{ 330{
318 menu_end_entry(); 331 $$ = menu_add_menu();
319 menu_add_menu();
320}; 332};
321 333
322menu_end: end 334menu_end: end
@@ -327,31 +339,20 @@ menu_end: end
327 } 339 }
328}; 340};
329 341
330menu_stmt: 342menu_stmt: menu_entry menu_block menu_end
331 menu_entry menu_block menu_end 343;
332 | menu_entry menu_block
333{
334 printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno);
335 zconfnerrs++;
336};
337 344
338menu_block: 345menu_block:
339 /* empty */ 346 /* empty */
340 | menu_block common_block 347 | menu_block common_stmt
341 | menu_block menu_stmt 348 | menu_block menu_stmt
342 | menu_block choice_stmt 349 | menu_block choice_stmt
343 | menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; }
344; 350;
345 351
346source: T_SOURCE prompt T_EOL 352source_stmt: T_SOURCE prompt T_EOL
347{ 353{
348 $$ = $2;
349 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); 354 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
350}; 355 zconf_nextfile($2);
351
352source_stmt: source
353{
354 zconf_nextfile($1);
355}; 356};
356 357
357/* comment entry */ 358/* comment entry */
@@ -383,9 +384,11 @@ help: help_start T_HELPTEXT
383 384
384/* depends option */ 385/* depends option */
385 386
386depends_list: /* empty */ 387depends_list:
387 | depends_list depends 388 /* empty */
388 | depends_list T_EOL 389 | depends_list depends
390 | depends_list T_EOL
391 | depends_list option_error
389; 392;
390 393
391depends: T_DEPENDS T_ON expr T_EOL 394depends: T_DEPENDS T_ON expr T_EOL
@@ -417,13 +420,15 @@ prompt: T_WORD
417 | T_WORD_QUOTE 420 | T_WORD_QUOTE
418; 421;
419 422
420end: T_ENDMENU nl_or_eof { $$ = T_ENDMENU; } 423end: T_ENDMENU T_EOL { $$ = $1; }
421 | T_ENDCHOICE nl_or_eof { $$ = T_ENDCHOICE; } 424 | T_ENDCHOICE T_EOL { $$ = $1; }
422 | T_ENDIF nl_or_eof { $$ = T_ENDIF; } 425 | T_ENDIF T_EOL { $$ = $1; }
423; 426;
424 427
425nl_or_eof: 428nl:
426 T_EOL | T_EOF; 429 T_EOL
430 | nl T_EOL
431;
427 432
428if_expr: /* empty */ { $$ = NULL; } 433if_expr: /* empty */ { $$ = NULL; }
429 | T_IF expr { $$ = $2; } 434 | T_IF expr { $$ = $2; }
@@ -456,7 +461,10 @@ void conf_parse(const char *name)
456 modules_sym = sym_lookup("MODULES", 0); 461 modules_sym = sym_lookup("MODULES", 0);
457 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); 462 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
458 463
459 //zconfdebug = 1; 464#if YYDEBUG
465 if (getenv("ZCONF_DEBUG"))
466 zconfdebug = 1;
467#endif
460 zconfparse(); 468 zconfparse();
461 if (zconfnerrs) 469 if (zconfnerrs)
462 exit(1); 470 exit(1);
@@ -477,20 +485,25 @@ const char *zconf_tokenname(int token)
477 case T_ENDCHOICE: return "endchoice"; 485 case T_ENDCHOICE: return "endchoice";
478 case T_IF: return "if"; 486 case T_IF: return "if";
479 case T_ENDIF: return "endif"; 487 case T_ENDIF: return "endif";
488 case T_DEPENDS: return "depends";
480 } 489 }
481 return "<token>"; 490 return "<token>";
482} 491}
483 492
484static bool zconf_endtoken(int token, int starttoken, int endtoken) 493static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken)
485{ 494{
486 if (token != endtoken) { 495 if (id->token != endtoken) {
487 zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); 496 zconf_error("unexpected '%s' within %s block",
497 kconf_id_strings + id->name, zconf_tokenname(starttoken));
488 zconfnerrs++; 498 zconfnerrs++;
489 return false; 499 return false;
490 } 500 }
491 if (current_menu->file != current_file) { 501 if (current_menu->file != current_file) {
492 zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); 502 zconf_error("'%s' in different file than '%s'",
493 zconfprint("location of the '%s'", zconf_tokenname(starttoken)); 503 kconf_id_strings + id->name, zconf_tokenname(starttoken));
504 fprintf(stderr, "%s:%d: location of the '%s'\n",
505 current_menu->file->name, current_menu->lineno,
506 zconf_tokenname(starttoken));
494 zconfnerrs++; 507 zconfnerrs++;
495 return false; 508 return false;
496 } 509 }
@@ -501,7 +514,19 @@ static void zconfprint(const char *err, ...)
501{ 514{
502 va_list ap; 515 va_list ap;
503 516
504 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); 517 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
518 va_start(ap, err);
519 vfprintf(stderr, err, ap);
520 va_end(ap);
521 fprintf(stderr, "\n");
522}
523
524static void zconf_error(const char *err, ...)
525{
526 va_list ap;
527
528 zconfnerrs++;
529 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
505 va_start(ap, err); 530 va_start(ap, err);
506 vfprintf(stderr, err, ap); 531 vfprintf(stderr, err, ap);
507 va_end(ap); 532 va_end(ap);
@@ -510,7 +535,9 @@ static void zconfprint(const char *err, ...)
510 535
511static void zconferror(const char *err) 536static void zconferror(const char *err)
512{ 537{
538#if YYDEBUG
513 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); 539 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
540#endif
514} 541}
515 542
516void print_quoted_string(FILE *out, const char *str) 543void print_quoted_string(FILE *out, const char *str)