Skip to content

Commit

Permalink
kconfig: use T_WORD instead of T_VARIABLE for variables
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
masahir0y committed Dec 21, 2018
1 parent c3d2287 commit 171a515
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scripts/kconfig/zconf.l
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
3 changes: 1 addition & 2 deletions scripts/kconfig/zconf.y
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry;
%token T_STRING
%token T_TRISTATE
%token T_EOL
%token <string> T_VARIABLE
%token <string> T_ASSIGN_VAL

%left T_OR
Expand Down Expand Up @@ -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; }
Expand Down

0 comments on commit 171a515

Please sign in to comment.