kconfig: use T_WORD instead of T_VARIABLE for variables
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 11 Dec 2018 11:01:02 +0000 (20:01 +0900)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 10 Feb 2019 21:32:14 +0000 (22:32 +0100)
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>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
config/zconf.l
config/zconf.y

index 418ade946405a8dbf01b3c2154edbeeda9f360a7..eec4a5a97639d509104da10d367e95fa9039eadd 100644 (file)
@@ -109,13 +109,13 @@ n [A-Za-z0-9_-]
                }
                alloc_string(yytext, yyleng);
                yylval.string = text;
-               return T_VARIABLE;
+               return T_WORD;
        }
        ({n}|$)+        {
                /* this token includes at least one '$' */
                yylval.string = expand_token(yytext, yyleng);
                if (strlen(yylval.string))
-                       return T_VARIABLE;
+                       return T_WORD;
                free(yylval.string);
        }
        "="     { BEGIN(ASSIGN_VAL); return T_EQUAL; }
index 653ef2c7c42e24e34e08829ab2e679f210c5db43..ac5935c84b48a7699e2d69799d52f651718fec0f 100644 (file)
@@ -84,7 +84,6 @@ static struct menu *current_menu, *current_entry;
 %token T_STRING
 %token T_TRISTATE
 %token T_EOL
-%token <string> T_VARIABLE
 %token <string> T_ASSIGN_VAL
 
 %left T_OR
@@ -480,7 +479,7 @@ word_opt: /* empty */                       { $$ = NULL; }
 
 /* assignment statement */
 
-assignment_stmt:  T_VARIABLE assign_op assign_val T_EOL        { variable_add($1, $3, $2); free($1); free($3); }
+assignment_stmt:  T_WORD assign_op assign_val T_EOL    { variable_add($1, $3, $2); free($1); free($3); }
 
 assign_op:
          T_EQUAL       { $$ = VAR_RECURSIVE; }