From: Masahiro Yamada Date: Mon, 28 May 2018 09:21:48 +0000 (+0900) Subject: kconfig: begin PARAM state only when seeing a command keyword X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=5b345dbb8935d88986224f18f63d605bfa64e12c;p=carl9170fw.git 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 Signed-off-by: Christian Lamparter --- diff --git a/config/zconf.l b/config/zconf.l index 3c3f52a..fde86ba 100644 --- a/config/zconf.l +++ b/config/zconf.l @@ -102,10 +102,10 @@ n [A-Za-z0-9_-] { {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; }