From: Masahiro Yamada Date: Tue, 11 Dec 2018 11:01:02 +0000 (+0900) Subject: kconfig: use T_WORD instead of T_VARIABLE for variables X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=800db6e4d8853227062024e8d842f962924d39a6;p=carl9170fw.git kconfig: use T_WORD instead of T_VARIABLE for variables There is no grammatical ambiguity by using T_WORD for variables. The parser can distinguish variables from symbols from the context. Signed-off-by: Masahiro Yamada Signed-off-by: Christian Lamparter --- diff --git a/config/zconf.l b/config/zconf.l index 418ade9..eec4a5a 100644 --- a/config/zconf.l +++ b/config/zconf.l @@ -109,13 +109,13 @@ n [A-Za-z0-9_-] } alloc_string(yytext, yyleng); yylval.string = text; - return T_VARIABLE; + return T_WORD; } ({n}|$)+ { /* this token includes at least one '$' */ yylval.string = expand_token(yytext, yyleng); if (strlen(yylval.string)) - return T_VARIABLE; + return T_WORD; free(yylval.string); } "=" { BEGIN(ASSIGN_VAL); return T_EQUAL; } diff --git a/config/zconf.y b/config/zconf.y index 653ef2c..ac5935c 100644 --- a/config/zconf.y +++ b/config/zconf.y @@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry; %token T_STRING %token T_TRISTATE %token T_EOL -%token T_VARIABLE %token T_ASSIGN_VAL %left T_OR @@ -480,7 +479,7 @@ word_opt: /* empty */ { $$ = NULL; } /* assignment statement */ -assignment_stmt: T_VARIABLE assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } +assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } assign_op: T_EQUAL { $$ = VAR_RECURSIVE; }