diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 05:21:48 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-05-28 14:31:19 -0400 |
commit | 9de071536c87cb814e210bd762fcf7f645d514a9 (patch) | |
tree | e532e85bd127e3e569c454222175a9ea89f8339c | |
parent | 2972666ac94f35760b59c5eccd20f633359b0b46 (diff) |
kconfig: begin PARAM state only when seeing a command keyword
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 <yamada.masahiro@socionext.com>
-rw-r--r-- | scripts/kconfig/zconf.l | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index b3855909913c..9a147977dc3f 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -102,10 +102,10 @@ n [A-Za-z0-9_-] | |||
102 | <COMMAND>{ | 102 | <COMMAND>{ |
103 | {n}+ { | 103 | {n}+ { |
104 | const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | 104 | const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); |
105 | BEGIN(PARAM); | ||
106 | current_pos.file = current_file; | 105 | current_pos.file = current_file; |
107 | current_pos.lineno = yylineno; | 106 | current_pos.lineno = yylineno; |
108 | if (id && id->flags & TF_COMMAND) { | 107 | if (id && id->flags & TF_COMMAND) { |
108 | BEGIN(PARAM); | ||
109 | yylval.id = id; | 109 | yylval.id = id; |
110 | return id->token; | 110 | return id->token; |
111 | } | 111 | } |