aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-11 06:00:59 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-12-21 10:25:34 -0500
commit3c8f317d4cf15e7a67457cfdd1e63182a34bcb69 (patch)
tree33010572a0d3dcf96be4c70e5d18b8e384451ada /scripts
parenta01e5d242d932f67f2657ceb0d76be777cd05a04 (diff)
kconfig: use distinct tokens for type and default properties
This commit removes kconf_id::stype to prepare for the entire removal of kconf_id.c To simplify the lexer, I want keywords straight-mapped to tokens. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/kconf_id.c16
-rw-r--r--scripts/kconfig/lkc.h1
-rw-r--r--scripts/kconfig/zconf.y62
3 files changed, 47 insertions, 32 deletions
diff --git a/scripts/kconfig/kconf_id.c b/scripts/kconfig/kconf_id.c
index b3e0ea0ac732..ec2c011f9e62 100644
--- a/scripts/kconfig/kconf_id.c
+++ b/scripts/kconfig/kconf_id.c
@@ -15,15 +15,15 @@ static struct kconf_id kconf_id_array[] = {
15 { "endif", T_ENDIF, TF_COMMAND }, 15 { "endif", T_ENDIF, TF_COMMAND },
16 { "depends", T_DEPENDS, TF_COMMAND }, 16 { "depends", T_DEPENDS, TF_COMMAND },
17 { "optional", T_OPTIONAL, TF_COMMAND }, 17 { "optional", T_OPTIONAL, TF_COMMAND },
18 { "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN }, 18 { "default", T_DEFAULT, TF_COMMAND },
19 { "def_bool", T_DEF_BOOL, TF_COMMAND },
20 { "def_tristate", T_DEF_TRISTATE, TF_COMMAND },
19 { "prompt", T_PROMPT, TF_COMMAND }, 21 { "prompt", T_PROMPT, TF_COMMAND },
20 { "tristate", T_TYPE, TF_COMMAND, S_TRISTATE }, 22 { "bool", T_BOOL, TF_COMMAND },
21 { "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE }, 23 { "tristate", T_TRISTATE, TF_COMMAND },
22 { "bool", T_TYPE, TF_COMMAND, S_BOOLEAN }, 24 { "int", T_INT, TF_COMMAND },
23 { "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN }, 25 { "hex", T_HEX, TF_COMMAND },
24 { "int", T_TYPE, TF_COMMAND, S_INT }, 26 { "string", T_STRING, TF_COMMAND },
25 { "hex", T_TYPE, TF_COMMAND, S_HEX },
26 { "string", T_TYPE, TF_COMMAND, S_STRING },
27 { "select", T_SELECT, TF_COMMAND }, 27 { "select", T_SELECT, TF_COMMAND },
28 { "imply", T_IMPLY, TF_COMMAND }, 28 { "imply", T_IMPLY, TF_COMMAND },
29 { "range", T_RANGE, TF_COMMAND }, 29 { "range", T_RANGE, TF_COMMAND },
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 9eb7c837cd8f..b6bbcd1dda2b 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -50,7 +50,6 @@ struct kconf_id {
50 const char *name; 50 const char *name;
51 int token; 51 int token;
52 unsigned int flags; 52 unsigned int flags;
53 enum symbol_type stype;
54}; 53};
55 54
56extern int yylineno; 55extern int yylineno;
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 020454bcdf94..19fa333e9aa1 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -40,6 +40,7 @@ static struct menu *current_menu, *current_entry;
40 struct expr *expr; 40 struct expr *expr;
41 struct menu *menu; 41 struct menu *menu;
42 const struct kconf_id *id; 42 const struct kconf_id *id;
43 enum symbol_type type;
43 enum variable_flavor flavor; 44 enum variable_flavor flavor;
44} 45}
45 46
@@ -59,8 +60,6 @@ static struct menu *current_menu, *current_entry;
59%token <id>T_DEPENDS 60%token <id>T_DEPENDS
60%token <id>T_OPTIONAL 61%token <id>T_OPTIONAL
61%token <id>T_PROMPT 62%token <id>T_PROMPT
62%token <id>T_TYPE
63%token <id>T_DEFAULT
64%token <id>T_SELECT 63%token <id>T_SELECT
65%token <id>T_IMPLY 64%token <id>T_IMPLY
66%token <id>T_RANGE 65%token <id>T_RANGE
@@ -69,8 +68,16 @@ static struct menu *current_menu, *current_entry;
69%token <id>T_ON 68%token <id>T_ON
70%token <string> T_WORD 69%token <string> T_WORD
71%token <string> T_WORD_QUOTE 70%token <string> T_WORD_QUOTE
71%token T_BOOL
72%token T_CLOSE_PAREN 72%token T_CLOSE_PAREN
73%token T_DEFAULT
74%token T_DEF_BOOL
75%token T_DEF_TRISTATE
76%token T_HEX
77%token T_INT
73%token T_OPEN_PAREN 78%token T_OPEN_PAREN
79%token T_STRING
80%token T_TRISTATE
74%token T_EOL 81%token T_EOL
75%token <string> T_VARIABLE 82%token <string> T_VARIABLE
76%token <flavor> T_ASSIGN 83%token <flavor> T_ASSIGN
@@ -85,6 +92,7 @@ static struct menu *current_menu, *current_entry;
85%type <string> prompt 92%type <string> prompt
86%type <symbol> nonconst_symbol 93%type <symbol> nonconst_symbol
87%type <symbol> symbol 94%type <symbol> symbol
95%type <type> type logic_type default
88%type <expr> expr 96%type <expr> expr
89%type <expr> if_expr 97%type <expr> if_expr
90%type <id> end 98%type <id> end
@@ -169,12 +177,12 @@ config_option_list:
169 | config_option_list help 177 | config_option_list help
170; 178;
171 179
172config_option: T_TYPE prompt_stmt_opt T_EOL 180config_option: type prompt_stmt_opt T_EOL
173{ 181{
174 menu_set_type($1->stype); 182 menu_set_type($1);
175 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 183 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
176 zconf_curname(), zconf_lineno(), 184 zconf_curname(), zconf_lineno(),
177 $1->stype); 185 $1);
178}; 186};
179 187
180config_option: T_PROMPT prompt if_expr T_EOL 188config_option: T_PROMPT prompt if_expr T_EOL
@@ -183,14 +191,14 @@ config_option: T_PROMPT prompt if_expr T_EOL
183 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 191 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
184}; 192};
185 193
186config_option: T_DEFAULT expr if_expr T_EOL 194config_option: default expr if_expr T_EOL
187{ 195{
188 menu_add_expr(P_DEFAULT, $2, $3); 196 menu_add_expr(P_DEFAULT, $2, $3);
189 if ($1->stype != S_UNKNOWN) 197 if ($1 != S_UNKNOWN)
190 menu_set_type($1->stype); 198 menu_set_type($1);
191 printd(DEBUG_PARSE, "%s:%d:default(%u)\n", 199 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
192 zconf_curname(), zconf_lineno(), 200 zconf_curname(), zconf_lineno(),
193 $1->stype); 201 $1);
194}; 202};
195 203
196config_option: T_SELECT nonconst_symbol if_expr T_EOL 204config_option: T_SELECT nonconst_symbol if_expr T_EOL
@@ -274,15 +282,11 @@ choice_option: T_PROMPT prompt if_expr T_EOL
274 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); 282 printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno());
275}; 283};
276 284
277choice_option: T_TYPE prompt_stmt_opt T_EOL 285choice_option: logic_type prompt_stmt_opt T_EOL
278{ 286{
279 if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) { 287 menu_set_type($1);
280 menu_set_type($1->stype); 288 printd(DEBUG_PARSE, "%s:%d:type(%u)\n",
281 printd(DEBUG_PARSE, "%s:%d:type(%u)\n", 289 zconf_curname(), zconf_lineno(), $1);
282 zconf_curname(), zconf_lineno(),
283 $1->stype);
284 } else
285 YYERROR;
286}; 290};
287 291
288choice_option: T_OPTIONAL T_EOL 292choice_option: T_OPTIONAL T_EOL
@@ -293,14 +297,26 @@ choice_option: T_OPTIONAL T_EOL
293 297
294choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL 298choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
295{ 299{
296 if ($1->stype == S_UNKNOWN) { 300 menu_add_symbol(P_DEFAULT, $2, $3);
297 menu_add_symbol(P_DEFAULT, $2, $3); 301 printd(DEBUG_PARSE, "%s:%d:default\n",
298 printd(DEBUG_PARSE, "%s:%d:default\n", 302 zconf_curname(), zconf_lineno());
299 zconf_curname(), zconf_lineno());
300 } else
301 YYERROR;
302}; 303};
303 304
305type:
306 logic_type
307 | T_INT { $$ = S_INT; }
308 | T_HEX { $$ = S_HEX; }
309 | T_STRING { $$ = S_STRING; }
310
311logic_type:
312 T_BOOL { $$ = S_BOOLEAN; }
313 | T_TRISTATE { $$ = S_TRISTATE; }
314
315default:
316 T_DEFAULT { $$ = S_UNKNOWN; }
317 | T_DEF_BOOL { $$ = S_BOOLEAN; }
318 | T_DEF_TRISTATE { $$ = S_TRISTATE; }
319
304choice_block: 320choice_block:
305 /* empty */ 321 /* empty */
306 | choice_block common_stmt 322 | choice_block common_stmt