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: NMasahiro Yamada <yamada.masahiro@socionext.com>
上级 c3d22871
...@@ -109,13 +109,13 @@ n [A-Za-z0-9_-] ...@@ -109,13 +109,13 @@ n [A-Za-z0-9_-]
} }
alloc_string(yytext, yyleng); alloc_string(yytext, yyleng);
yylval.string = text; yylval.string = text;
return T_VARIABLE; return T_WORD;
} }
({n}|$)+ { ({n}|$)+ {
/* this token includes at least one '$' */ /* this token includes at least one '$' */
yylval.string = expand_token(yytext, yyleng); yylval.string = expand_token(yytext, yyleng);
if (strlen(yylval.string)) if (strlen(yylval.string))
return T_VARIABLE; return T_WORD;
free(yylval.string); free(yylval.string);
} }
"=" { BEGIN(ASSIGN_VAL); return T_EQUAL; } "=" { BEGIN(ASSIGN_VAL); return T_EQUAL; }
......
...@@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry; ...@@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry;
%token T_STRING %token T_STRING
%token T_TRISTATE %token T_TRISTATE
%token T_EOL %token T_EOL
%token <string> T_VARIABLE
%token <string> T_ASSIGN_VAL %token <string> T_ASSIGN_VAL
%left T_OR %left T_OR
...@@ -480,7 +479,7 @@ word_opt: /* empty */ { $$ = NULL; } ...@@ -480,7 +479,7 @@ word_opt: /* empty */ { $$ = NULL; }
/* assignment statement */ /* 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: assign_op:
T_EQUAL { $$ = VAR_RECURSIVE; } T_EQUAL { $$ = VAR_RECURSIVE; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部