Skip to content

Commit 171a515

Browse files
committed
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 <yamada.masahiro@socionext.com>
1 parent c3d2287 commit 171a515

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎scripts/kconfig/zconf.l‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ n [A-Za-z0-9_-]
109109
}
110110
alloc_string(yytext, yyleng);
111111
yylval.string = text;
112-
return T_VARIABLE;
112+
return T_WORD;
113113
}
114114
({n}|$)+ {
115115
/* this token includes at least one '$' */
116116
yylval.string = expand_token(yytext, yyleng);
117117
if (strlen(yylval.string))
118-
return T_VARIABLE;
118+
return T_WORD;
119119
free(yylval.string);
120120
}
121121
"=" { BEGIN(ASSIGN_VAL); return T_EQUAL; }

‎scripts/kconfig/zconf.y‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry;
8484
%token T_STRING
8585
%token T_TRISTATE
8686
%token T_EOL
87-
%token <string> T_VARIABLE
8887
%token <string> T_ASSIGN_VAL
8988

9089
%left T_OR
@@ -480,7 +479,7 @@ word_opt: /* empty */ { $$ = NULL; }
480479

481480
/* assignment statement */
482481

483-
assignment_stmt: T_VARIABLE assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); }
482+
assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); }
484483

485484
assign_op:
486485
T_EQUAL { $$ = VAR_RECURSIVE; }

0 commit comments

Comments
 (0)