* [PATCH 1/2] kconfig: narrow the scope of variables in the lexer
@ 2021-09-27 12:54 Masahiro Yamada
2021-09-27 12:54 ` [PATCH 2/2] kconfig: rename a variable in the lexer to a clearer name Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2021-09-27 12:54 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
The variables, "ts" and "i", are used locally in the action of
the [ \t]+ pattern in the <HELP> start state.
Define them where they are used.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/lexer.l | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index 312cbad2d34d..efe487859308 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -85,7 +85,6 @@ n [A-Za-z0-9_-]
%%
int str = 0;
- int ts, i;
#.* /* ignore comment */
[ \t]* /* whitespaces */
@@ -196,6 +195,8 @@ n [A-Za-z0-9_-]
<HELP>{
[ \t]+ {
+ int ts, i;
+
ts = 0;
for (i = 0; i < yyleng; i++) {
if (yytext[i] == '\t')
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] kconfig: rename a variable in the lexer to a clearer name
2021-09-27 12:54 [PATCH 1/2] kconfig: narrow the scope of variables in the lexer Masahiro Yamada
@ 2021-09-27 12:54 ` Masahiro Yamada
2021-09-29 14:01 ` Boris Kolpackov
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2021-09-27 12:54 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
In Kconfig, like Python, you can enclose a string by double-quotes or
single-quotes. So, both "foo" and 'foo' are allowed.
The variable, "str", is used to remember whether the string started with
a double-quote or a single-quote.
Rename it to a clearer name. The type should be 'char'.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/lexer.l | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index efe487859308..cc386e443683 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -84,7 +84,7 @@ static void warn_ignored_character(char chr)
n [A-Za-z0-9_-]
%%
- int str = 0;
+ char open_quote = 0;
#.* /* ignore comment */
[ \t]* /* whitespaces */
@@ -133,7 +133,7 @@ n [A-Za-z0-9_-]
":=" return T_COLON_EQUAL;
"+=" return T_PLUS_EQUAL;
\"|\' {
- str = yytext[0];
+ open_quote = yytext[0];
new_string();
BEGIN(STRING);
}
@@ -170,7 +170,7 @@ n [A-Za-z0-9_-]
append_string(yytext + 1, yyleng - 1);
}
\'|\" {
- if (str == yytext[0]) {
+ if (open_quote == yytext[0]) {
BEGIN(INITIAL);
yylval.string = text;
return T_WORD_QUOTE;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] kconfig: rename a variable in the lexer to a clearer name
2021-09-27 12:54 ` [PATCH 2/2] kconfig: rename a variable in the lexer to a clearer name Masahiro Yamada
@ 2021-09-29 14:01 ` Boris Kolpackov
0 siblings, 0 replies; 3+ messages in thread
From: Boris Kolpackov @ 2021-09-29 14:01 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel
Masahiro Yamada <masahiroy@kernel.org> writes:
> In Kconfig, like Python, you can enclose a string by double-quotes or
> single-quotes. So, both "foo" and 'foo' are allowed.
>
> The variable, "str", is used to remember whether the string started with
> a double-quote or a single-quote.
>
> Rename it to a clearer name. The type should be 'char'.
LGTM.
Reviewed-by: Boris Kolpackov <boris@codesynthesis.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-29 14:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 12:54 [PATCH 1/2] kconfig: narrow the scope of variables in the lexer Masahiro Yamada
2021-09-27 12:54 ` [PATCH 2/2] kconfig: rename a variable in the lexer to a clearer name Masahiro Yamada
2021-09-29 14:01 ` Boris Kolpackov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.