summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-11 20:01:08 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-22 00:25:55 +0900
commit824fa3b3b5e3647de0530328e8734c24418eec49 (patch)
treec0f2f25cc2ab2fc444eb8862575a087d2324bbe5 /scripts
parentb3d1d9d3c36214a50c18ba377b47152c021768df (diff)
downloadlinux-824fa3b3b5e3647de0530328e8734c24418eec49.tar.gz
linux-824fa3b3b5e3647de0530328e8734c24418eec49.tar.bz2
linux-824fa3b3b5e3647de0530328e8734c24418eec49.zip
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@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/zconf.l12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index ed0d0a3b0d62..05e2d95e3b22 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;
@@ -117,9 +118,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 {
@@ -288,6 +289,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;