diff options
Diffstat (limited to 'scripts/kconfig/zconf.y')
-rw-r--r-- | scripts/kconfig/zconf.y | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 23dfd3baa7a1..49fb4ab664c3 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry; | |||
36 | #define YYERROR_VERBOSE | 36 | #define YYERROR_VERBOSE |
37 | #endif | 37 | #endif |
38 | %} | 38 | %} |
39 | %expect 26 | 39 | %expect 30 |
40 | 40 | ||
41 | %union | 41 | %union |
42 | { | 42 | { |
@@ -68,6 +68,7 @@ static struct menu *current_menu, *current_entry; | |||
68 | %token <id>T_DEFAULT | 68 | %token <id>T_DEFAULT |
69 | %token <id>T_SELECT | 69 | %token <id>T_SELECT |
70 | %token <id>T_RANGE | 70 | %token <id>T_RANGE |
71 | %token <id>T_VISIBLE | ||
71 | %token <id>T_OPTION | 72 | %token <id>T_OPTION |
72 | %token <id>T_ON | 73 | %token <id>T_ON |
73 | %token <string> T_WORD | 74 | %token <string> T_WORD |
@@ -104,14 +105,15 @@ static struct menu *current_menu, *current_entry; | |||
104 | %} | 105 | %} |
105 | 106 | ||
106 | %% | 107 | %% |
107 | input: stmt_list; | 108 | input: nl start | start; |
109 | |||
110 | start: mainmenu_stmt stmt_list | stmt_list; | ||
108 | 111 | ||
109 | stmt_list: | 112 | stmt_list: |
110 | /* empty */ | 113 | /* empty */ |
111 | | stmt_list common_stmt | 114 | | stmt_list common_stmt |
112 | | stmt_list choice_stmt | 115 | | stmt_list choice_stmt |
113 | | stmt_list menu_stmt | 116 | | stmt_list menu_stmt |
114 | | stmt_list T_MAINMENU prompt nl | ||
115 | | stmt_list end { zconf_error("unexpected end statement"); } | 117 | | stmt_list end { zconf_error("unexpected end statement"); } |
116 | | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } | 118 | | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } |
117 | | stmt_list option_name error T_EOL | 119 | | stmt_list option_name error T_EOL |
@@ -122,7 +124,7 @@ stmt_list: | |||
122 | ; | 124 | ; |
123 | 125 | ||
124 | option_name: | 126 | option_name: |
125 | T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | 127 | T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE |
126 | ; | 128 | ; |
127 | 129 | ||
128 | common_stmt: | 130 | common_stmt: |
@@ -342,6 +344,13 @@ if_block: | |||
342 | | if_block choice_stmt | 344 | | if_block choice_stmt |
343 | ; | 345 | ; |
344 | 346 | ||
347 | /* mainmenu entry */ | ||
348 | |||
349 | mainmenu_stmt: T_MAINMENU prompt nl | ||
350 | { | ||
351 | menu_add_prompt(P_MENU, $2, NULL); | ||
352 | }; | ||
353 | |||
345 | /* menu entry */ | 354 | /* menu entry */ |
346 | 355 | ||
347 | menu: T_MENU prompt T_EOL | 356 | menu: T_MENU prompt T_EOL |
@@ -351,7 +360,7 @@ menu: T_MENU prompt T_EOL | |||
351 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | 360 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); |
352 | }; | 361 | }; |
353 | 362 | ||
354 | menu_entry: menu depends_list | 363 | menu_entry: menu visibility_list depends_list |
355 | { | 364 | { |
356 | $$ = menu_add_menu(); | 365 | $$ = menu_add_menu(); |
357 | }; | 366 | }; |
@@ -422,6 +431,19 @@ depends: T_DEPENDS T_ON expr T_EOL | |||
422 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | 431 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); |
423 | }; | 432 | }; |
424 | 433 | ||
434 | /* visibility option */ | ||
435 | |||
436 | visibility_list: | ||
437 | /* empty */ | ||
438 | | visibility_list visible | ||
439 | | visibility_list T_EOL | ||
440 | ; | ||
441 | |||
442 | visible: T_VISIBLE if_expr | ||
443 | { | ||
444 | menu_add_visibility($2); | ||
445 | }; | ||
446 | |||
425 | /* prompt statement */ | 447 | /* prompt statement */ |
426 | 448 | ||
427 | prompt_stmt_opt: | 449 | prompt_stmt_opt: |
@@ -494,6 +516,10 @@ void conf_parse(const char *name) | |||
494 | prop = prop_alloc(P_DEFAULT, modules_sym); | 516 | prop = prop_alloc(P_DEFAULT, modules_sym); |
495 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); | 517 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); |
496 | } | 518 | } |
519 | |||
520 | rootmenu.prompt->text = _(rootmenu.prompt->text); | ||
521 | rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); | ||
522 | |||
497 | menu_finalize(&rootmenu); | 523 | menu_finalize(&rootmenu); |
498 | for_all_symbols(i, sym) { | 524 | for_all_symbols(i, sym) { |
499 | if (sym_check_deps(sym)) | 525 | if (sym_check_deps(sym)) |
@@ -514,6 +540,7 @@ static const char *zconf_tokenname(int token) | |||
514 | case T_IF: return "if"; | 540 | case T_IF: return "if"; |
515 | case T_ENDIF: return "endif"; | 541 | case T_ENDIF: return "endif"; |
516 | case T_DEPENDS: return "depends"; | 542 | case T_DEPENDS: return "depends"; |
543 | case T_VISIBLE: return "visible"; | ||
517 | } | 544 | } |
518 | return "<token>"; | 545 | return "<token>"; |
519 | } | 546 | } |