Skip to content

Commit 6988f70

Browse files
committed
kconfig: rename a variable in the lexer to a clearer name
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 because open/closing quotation marks must match. The name "str" is too generic to understand the intent. Rename it to "open_quote", which is easier to understand. The type should be 'char'. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Boris Kolpackov <[email protected]>
1 parent 65017d8 commit 6988f70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/kconfig/lexer.l

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static void warn_ignored_character(char chr)
8484
n [A-Za-z0-9_-]
8585

8686
%%
87-
int str = 0;
87+
char open_quote = 0;
8888

8989
#.* /* ignore comment */
9090
[ \t]* /* whitespaces */
@@ -133,7 +133,7 @@ n [A-Za-z0-9_-]
133133
":=" return T_COLON_EQUAL;
134134
"+=" return T_PLUS_EQUAL;
135135
\"|\' {
136-
str = yytext[0];
136+
open_quote = yytext[0];
137137
new_string();
138138
BEGIN(STRING);
139139
}
@@ -170,7 +170,7 @@ n [A-Za-z0-9_-]
170170
append_string(yytext + 1, yyleng - 1);
171171
}
172172
\'|\" {
173-
if (str == yytext[0]) {
173+
if (open_quote == yytext[0]) {
174174
BEGIN(INITIAL);
175175
yylval.string = text;
176176
return T_WORD_QUOTE;

0 commit comments

Comments
 (0)