Skip to content

Commit

Permalink
kconfig: begin PARAM state only when seeing a command keyword
Browse files Browse the repository at this point in the history
Currently, any statement line starts with a keyword with TF_COMMAND
flag.  So, the following three lines are dead code.

        alloc_string(yytext, yyleng);
        zconflval.string = text;
        return T_WORD;

If a T_WORD token is returned in this context, it will cause syntax
error in the parser anyway.

The next commit will support the assignment statement where a line
starts with an arbitrary identifier.  So, I want the lexer to switch
to the PARAM state only when it sees a command keyword.

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed May 28, 2018
1 parent 2972666 commit 9de0715
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/kconfig/zconf.l
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ n [A-Za-z0-9_-]
<COMMAND>{
{n}+ {
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
BEGIN(PARAM);
current_pos.file = current_file;
current_pos.lineno = yylineno;
if (id && id->flags & TF_COMMAND) {
BEGIN(PARAM);
yylval.id = id;
return id->token;
}
Expand Down

0 comments on commit 9de0715

Please sign in to comment.