From c3d228713b10e6dd1bd44853168cec8e23ae7e0f Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Tue, 11 Dec 2018 20:01:01 +0900 Subject: kconfig: use specific tokens instead of T_ASSIGN for assignments Currently, the lexer returns T_ASSIGN for all of =, :=, and += associating yylval with the flavor. I want to make the generated lexer as simple as possible. So, the lexer should convert keywords to tokens without thinking about the meaning. = -> T_EQUAL := -> T_COLON_EQUAL += -> T_PLUS_EQUAL Unfortunately, Kconfig uses = instead of == for the equal operator. So, the same token T_EQUAL is used for assignment and comparison. The parser can still distinguish them from the context. Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.l | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/kconfig/zconf.l') diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 30380790bab4..b1a71f612c11 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -118,9 +118,9 @@ n [A-Za-z0-9_-] return T_VARIABLE; free(yylval.string); } - "=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_RECURSIVE; return T_ASSIGN; } - ":=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_SIMPLE; return T_ASSIGN; } - "+=" { BEGIN(ASSIGN_VAL); yylval.flavor = VAR_APPEND; return T_ASSIGN; } + "=" { BEGIN(ASSIGN_VAL); return T_EQUAL; } + ":=" { BEGIN(ASSIGN_VAL); return T_COLON_EQUAL; } + "+=" { BEGIN(ASSIGN_VAL); return T_PLUS_EQUAL; } [[:blank:]]+ . warn_ignored_character(*yytext); \n { -- cgit v1.2.3-59-g8ed1b