message for people to play with, just to show what I mean. Please note
that this draft patch is just what zconf.y confessed after I tortured it
to say what I need.
Thanks,
Paul Bolle
@@ -344,7 +344,9 @@ void menu_finalize(struct menu *parent)
basedep = expr_eliminate_dups(expr_transform(basedep));
last_menu = NULL;
for (menu = parent->next; menu; menu = menu->next) {
- dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
+ dep = menu->prompt ? menu->prompt->visible.expr
+ : menu->visibility ? menu->visibility
+ : menu->dep;
if (!expr_contains_symbol(dep, sym))
break;
if (expr_depends_symbol(dep, sym))
@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
static struct menu *current_menu, *current_entry;
%}
-%expect 30
+%expect 32
%union
{
@@ -64,6 +64,7 @@ static struct menu *current_menu, *current_entry;
%token <id>T_SELECT
%token <id>T_RANGE
%token <id>T_VISIBLE
+%token <id>T_ENDVISIBLE
%token <id>T_OPTION
%token <id>T_ON
%token <string> T_WORD
@@ -84,7 +85,7 @@ static struct menu *current_menu, *current_entry;
%type <expr> if_expr
%type <id> end
%type <id> option_name
-%type <menu> if_entry menu_entry choice_entry
+%type <menu> if_entry visible_entry menu_entry choice_entry
%type <string> symbol_option_arg word_opt
%destructor {
@@ -92,7 +93,7 @@ static struct menu *current_menu, *current_entry;
$$->file->name, $$->lineno);
if (current_menu == $$)
menu_end_menu();
-} if_entry menu_entry choice_entry
+} if_entry visible_entry menu_entry choice_entry
%{
/* Include zconf.hash.c here so it can see the token constants. */
@@ -125,6 +126,7 @@ option_name:
common_stmt:
T_EOL
| if_stmt
+ | visible_stmt
| comment_stmt
| config_stmt
| menuconfig_stmt
@@ -332,6 +334,27 @@ if_end: end
if_stmt: if_entry if_block if_end
;
+/* visible entry */
+
+visible_entry: T_VISIBLE if_expr nl
+{
+ printd(DEBUG_PARSE, "%s:%d:visible\n", zconf_curname(), zconf_lineno());
+ menu_add_entry(NULL);
+ menu_add_visibility($2);
+ $$ = menu_add_menu();
+};
+
+visible_end: end
+{
+ if (zconf_endtoken($1, T_VISIBLE, T_ENDVISIBLE)) {
+ menu_end_menu();
+ printd(DEBUG_PARSE, "%s:%d:endvisible\n", zconf_curname(), zconf_lineno());
+ }
+};
+
+visible_stmt: visible_entry if_block visible_end
+;
+
if_block:
/* empty */
| if_block common_stmt
@@ -455,6 +478,7 @@ prompt: T_WORD
end: T_ENDMENU T_EOL { $$ = $1; }
| T_ENDCHOICE T_EOL { $$ = $1; }
| T_ENDIF T_EOL { $$ = $1; }
+ | T_ENDVISIBLE T_EOL { $$ = $1; }
;
nl:
@@ -527,6 +551,7 @@ static const char *zconf_tokenname(int token)
case T_ENDIF: return "endif";
case T_DEPENDS: return "depends";
case T_VISIBLE: return "visible";
+ case T_ENDVISIBLE: return "endvisible";
}
return "<token>";
}