summaryrefslogtreecommitdiff
path: root/scripts/kconfig/zconf.y
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-06-08 22:12:44 -0700
committerSam Ravnborg <sam@mars.ravnborg.org>2006-06-09 07:31:30 +0200
commitf6a88aa86027bdecfc74ef7c6bf6c68233e86bb3 (patch)
tree524a366add362ffae3fa550fd822293ffd84984e /scripts/kconfig/zconf.y
parentf1d28fb043b325dad8944647a52b20287e59d8a1 (diff)
kconfig: add symbol option config syntax
This adds the general framework to the parser to define options for config symbols with a syntax like: config FOO option bar[="arg"] Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/zconf.y')
-rw-r--r--scripts/kconfig/zconf.y23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 1f61fba6aa28..9d08582f2aa6 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -71,6 +71,7 @@ static struct menu *current_menu, *current_entry;
%token <id>T_DEFAULT
%token <id>T_SELECT
%token <id>T_RANGE
+%token <id>T_OPTION
%token <id>T_ON
%token <string> T_WORD
%token <string> T_WORD_QUOTE
@@ -91,6 +92,7 @@ static struct menu *current_menu, *current_entry;
%type <id> end
%type <id> option_name
%type <menu> if_entry menu_entry choice_entry
+%type <string> symbol_option_arg
%destructor {
fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -173,6 +175,7 @@ menuconfig_stmt: menuconfig_entry_start config_option_list
config_option_list:
/* empty */
| config_option_list config_option
+ | config_option_list symbol_option
| config_option_list depends
| config_option_list help
| config_option_list option_error
@@ -215,6 +218,26 @@ config_option: T_RANGE symbol symbol if_expr T_EOL
printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
};
+symbol_option: T_OPTION symbol_option_list T_EOL
+;
+
+symbol_option_list:
+ /* empty */
+ | symbol_option_list T_WORD symbol_option_arg
+{
+ struct kconf_id *id = kconf_id_lookup($2, strlen($2));
+ if (id && id->flags & TF_OPTION)
+ menu_add_option(id->token, $3);
+ else
+ zconfprint("warning: ignoring unknown option %s", $2);
+ free($2);
+};
+
+symbol_option_arg:
+ /* empty */ { $$ = NULL; }
+ | T_EQUAL prompt { $$ = $2; }
+;
+
/* choice entry */
choice: T_CHOICE T_EOL