[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1544526070-16690-26-git-send-email-yamada.masahiro@socionext.com>
Date: Tue, 11 Dec 2018 20:01:08 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: linux-kbuild@...r.kernel.org
Cc: Ulf Magnusson <ulfalizer@...il.com>, linux-kernel@...r.kernel.org,
Masahiro Yamada <yamada.masahiro@...ionext.com>
Subject: [PATCH 25/27] kconfig: switch to ASSIGN_VAL state in the second lexer
To simplify the generated lexer, switch to the ASSIGN_VAL state in
the hand-made lexer.
Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
---
scripts/kconfig/zconf.l | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index c8823a4..d462507 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -25,6 +25,7 @@ static struct {
int lineno;
} current_pos;
+static int prev_prev_token = T_EOL;
static int prev_token = T_EOL;
static char *text;
static int text_size, text_asize;
@@ -124,9 +125,9 @@ n [A-Za-z0-9_-]
return T_WORD;
free(yylval.string);
}
- "=" { BEGIN(ASSIGN_VAL); return T_EQUAL; }
- ":=" { BEGIN(ASSIGN_VAL); return T_COLON_EQUAL; }
- "+=" { BEGIN(ASSIGN_VAL); return T_PLUS_EQUAL; }
+ "=" return T_EQUAL;
+ ":=" return T_COLON_EQUAL;
+ "+=" return T_PLUS_EQUAL;
[[:blank:]]+
. warn_ignored_character(*yytext);
\n {
@@ -294,6 +295,11 @@ repeat:
if ((prev_token == T_EOL || prev_token == T_HELPTEXT) && token == T_EOL)
goto repeat;
+ if (prev_prev_token == T_EOL && prev_token == T_WORD &&
+ (token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL))
+ BEGIN(ASSIGN_VAL);
+
+ prev_prev_token = prev_token;
prev_token = token;
return token;
--
2.7.4
Powered by blists - more mailing lists