diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-11 06:01:02 -0500 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-21 10:25:53 -0500 |
commit | 171a515d080327b861d5e5fc9bbfa77f10cfddd7 (patch) | |
tree | 1d4ff1b5728d7aa35dde44073a38699d949648ef /scripts/kconfig | |
parent | c3d228713b10e6dd1bd44853168cec8e23ae7e0f (diff) |
kconfig: use T_WORD instead of T_VARIABLE for variables
There is no grammatical ambiguity by using T_WORD for variables.
The parser can distinguish variables from symbols from the context.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/zconf.l | 4 | ||||
-rw-r--r-- | scripts/kconfig/zconf.y | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index b1a71f612c11..f8bd84714e00 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -109,13 +109,13 @@ n [A-Za-z0-9_-] | |||
109 | } | 109 | } |
110 | alloc_string(yytext, yyleng); | 110 | alloc_string(yytext, yyleng); |
111 | yylval.string = text; | 111 | yylval.string = text; |
112 | return T_VARIABLE; | 112 | return T_WORD; |
113 | } | 113 | } |
114 | ({n}|$)+ { | 114 | ({n}|$)+ { |
115 | /* this token includes at least one '$' */ | 115 | /* this token includes at least one '$' */ |
116 | yylval.string = expand_token(yytext, yyleng); | 116 | yylval.string = expand_token(yytext, yyleng); |
117 | if (strlen(yylval.string)) | 117 | if (strlen(yylval.string)) |
118 | return T_VARIABLE; | 118 | return T_WORD; |
119 | free(yylval.string); | 119 | free(yylval.string); |
120 | } | 120 | } |
121 | "=" { BEGIN(ASSIGN_VAL); return T_EQUAL; } | 121 | "=" { BEGIN(ASSIGN_VAL); return T_EQUAL; } |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 3b7ebd363e7e..2127f1d65170 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry; | |||
84 | %token T_STRING | 84 | %token T_STRING |
85 | %token T_TRISTATE | 85 | %token T_TRISTATE |
86 | %token T_EOL | 86 | %token T_EOL |
87 | %token <string> T_VARIABLE | ||
88 | %token <string> T_ASSIGN_VAL | 87 | %token <string> T_ASSIGN_VAL |
89 | 88 | ||
90 | %left T_OR | 89 | %left T_OR |
@@ -480,7 +479,7 @@ word_opt: /* empty */ { $$ = NULL; } | |||
480 | 479 | ||
481 | /* assignment statement */ | 480 | /* assignment statement */ |
482 | 481 | ||
483 | assignment_stmt: T_VARIABLE assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } | 482 | assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } |
484 | 483 | ||
485 | assign_op: | 484 | assign_op: |
486 | T_EQUAL { $$ = VAR_RECURSIVE; } | 485 | T_EQUAL { $$ = VAR_RECURSIVE; } |