diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2008-02-28 23:11:50 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@uranus.ravnborg.org> | 2008-04-28 17:05:48 -0400 |
commit | 5a1aa8a1aff6191ecc55f21d8b5f0e47108ed91b (patch) | |
tree | 3e812a8027332c872f3ae3afb39212f4f9639361 /scripts/kconfig/zconf.y | |
parent | 48981178869bf7d9770f11fc361996ad11217a75 (diff) |
kconfig: add named choice group
As choice dependency are now fully checked, it's quite easy to add support
for named choices. This lifts the restriction that a choice value can only
appear once, although it still has to be within the same group,
but multiple choices can be joined by giving them a name.
While at it I cleaned up a little the choice type logic to simplify it a
bit.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/zconf.y')
-rw-r--r-- | scripts/kconfig/zconf.y | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index d9b96ba8e38c..9710b82466f2 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -91,7 +91,7 @@ static struct menu *current_menu, *current_entry; | |||
91 | %type <id> end | 91 | %type <id> end |
92 | %type <id> option_name | 92 | %type <id> option_name |
93 | %type <menu> if_entry menu_entry choice_entry | 93 | %type <menu> if_entry menu_entry choice_entry |
94 | %type <string> symbol_option_arg | 94 | %type <string> symbol_option_arg word_opt |
95 | 95 | ||
96 | %destructor { | 96 | %destructor { |
97 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 97 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -239,10 +239,10 @@ symbol_option_arg: | |||
239 | 239 | ||
240 | /* choice entry */ | 240 | /* choice entry */ |
241 | 241 | ||
242 | choice: T_CHOICE T_EOL | 242 | choice: T_CHOICE word_opt T_EOL |
243 | { | 243 | { |
244 | struct symbol *sym = sym_lookup(NULL, 0); | 244 | struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE); |
245 | sym->flags |= SYMBOL_CHOICE; | 245 | sym->flags |= SYMBOL_AUTO; |
246 | menu_add_entry(sym); | 246 | menu_add_entry(sym); |
247 | menu_add_expr(P_CHOICE, NULL, NULL); | 247 | menu_add_expr(P_CHOICE, NULL, NULL); |
248 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | 248 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); |
@@ -456,9 +456,12 @@ expr: symbol { $$ = expr_alloc_symbol($1); } | |||
456 | ; | 456 | ; |
457 | 457 | ||
458 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } | 458 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } |
459 | | T_WORD_QUOTE { $$ = sym_lookup($1, 1); free($1); } | 459 | | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); } |
460 | ; | 460 | ; |
461 | 461 | ||
462 | word_opt: /* empty */ { $$ = NULL; } | ||
463 | | T_WORD | ||
464 | |||
462 | %% | 465 | %% |
463 | 466 | ||
464 | void conf_parse(const char *name) | 467 | void conf_parse(const char *name) |