diff options
Diffstat (limited to 'scripts/kconfig/zconf.y')
-rw-r--r-- | scripts/kconfig/zconf.y | 130 |
1 files changed, 48 insertions, 82 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 43021d436baf..1211781675b8 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -43,43 +43,38 @@ static struct menu *current_menu, *current_entry; | |||
43 | struct symbol *symbol; | 43 | struct symbol *symbol; |
44 | struct expr *expr; | 44 | struct expr *expr; |
45 | struct menu *menu; | 45 | struct menu *menu; |
46 | struct kconf_id *id; | ||
46 | } | 47 | } |
47 | 48 | ||
48 | %token T_MAINMENU | 49 | %token <id>T_MAINMENU |
49 | %token T_MENU | 50 | %token <id>T_MENU |
50 | %token T_ENDMENU | 51 | %token <id>T_ENDMENU |
51 | %token T_SOURCE | 52 | %token <id>T_SOURCE |
52 | %token T_CHOICE | 53 | %token <id>T_CHOICE |
53 | %token T_ENDCHOICE | 54 | %token <id>T_ENDCHOICE |
54 | %token T_COMMENT | 55 | %token <id>T_COMMENT |
55 | %token T_CONFIG | 56 | %token <id>T_CONFIG |
56 | %token T_MENUCONFIG | 57 | %token <id>T_MENUCONFIG |
57 | %token T_HELP | 58 | %token <id>T_HELP |
58 | %token <string> T_HELPTEXT | 59 | %token <string> T_HELPTEXT |
59 | %token T_IF | 60 | %token <id>T_IF |
60 | %token T_ENDIF | 61 | %token <id>T_ENDIF |
61 | %token T_DEPENDS | 62 | %token <id>T_DEPENDS |
62 | %token T_REQUIRES | 63 | %token <id>T_REQUIRES |
63 | %token T_OPTIONAL | 64 | %token <id>T_OPTIONAL |
64 | %token T_PROMPT | 65 | %token <id>T_PROMPT |
65 | %token T_DEFAULT | 66 | %token <id>T_TYPE |
66 | %token T_TRISTATE | 67 | %token <id>T_DEFAULT |
67 | %token T_DEF_TRISTATE | 68 | %token <id>T_SELECT |
68 | %token T_BOOLEAN | 69 | %token <id>T_RANGE |
69 | %token T_DEF_BOOLEAN | 70 | %token <id>T_ON |
70 | %token T_STRING | ||
71 | %token T_INT | ||
72 | %token T_HEX | ||
73 | %token <string> T_WORD | 71 | %token <string> T_WORD |
74 | %token <string> T_WORD_QUOTE | 72 | %token <string> T_WORD_QUOTE |
75 | %token T_UNEQUAL | 73 | %token T_UNEQUAL |
76 | %token T_EOF | ||
77 | %token T_EOL | ||
78 | %token T_CLOSE_PAREN | 74 | %token T_CLOSE_PAREN |
79 | %token T_OPEN_PAREN | 75 | %token T_OPEN_PAREN |
80 | %token T_ON | 76 | %token T_EOL |
81 | %token T_SELECT | 77 | %token T_EOF |
82 | %token T_RANGE | ||
83 | 78 | ||
84 | %left T_OR | 79 | %left T_OR |
85 | %left T_AND | 80 | %left T_AND |
@@ -160,48 +155,12 @@ config_option_list: | |||
160 | | config_option_list T_EOL | 155 | | config_option_list T_EOL |
161 | ; | 156 | ; |
162 | 157 | ||
163 | config_option: T_TRISTATE prompt_stmt_opt T_EOL | 158 | config_option: T_TYPE prompt_stmt_opt T_EOL |
164 | { | ||
165 | menu_set_type(S_TRISTATE); | ||
166 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
167 | }; | ||
168 | |||
169 | config_option: T_DEF_TRISTATE expr if_expr T_EOL | ||
170 | { | 159 | { |
171 | menu_add_expr(P_DEFAULT, $2, $3); | 160 | menu_set_type($1->stype); |
172 | menu_set_type(S_TRISTATE); | 161 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", |
173 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | 162 | zconf_curname(), zconf_lineno(), |
174 | }; | 163 | $1->stype); |
175 | |||
176 | config_option: T_BOOLEAN prompt_stmt_opt T_EOL | ||
177 | { | ||
178 | menu_set_type(S_BOOLEAN); | ||
179 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
180 | }; | ||
181 | |||
182 | config_option: T_DEF_BOOLEAN expr if_expr T_EOL | ||
183 | { | ||
184 | menu_add_expr(P_DEFAULT, $2, $3); | ||
185 | menu_set_type(S_BOOLEAN); | ||
186 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
187 | }; | ||
188 | |||
189 | config_option: T_INT prompt_stmt_opt T_EOL | ||
190 | { | ||
191 | menu_set_type(S_INT); | ||
192 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); | ||
193 | }; | ||
194 | |||
195 | config_option: T_HEX prompt_stmt_opt T_EOL | ||
196 | { | ||
197 | menu_set_type(S_HEX); | ||
198 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); | ||
199 | }; | ||
200 | |||
201 | config_option: T_STRING prompt_stmt_opt T_EOL | ||
202 | { | ||
203 | menu_set_type(S_STRING); | ||
204 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); | ||
205 | }; | 164 | }; |
206 | 165 | ||
207 | config_option: T_PROMPT prompt if_expr T_EOL | 166 | config_option: T_PROMPT prompt if_expr T_EOL |
@@ -213,7 +172,11 @@ config_option: T_PROMPT prompt if_expr T_EOL | |||
213 | config_option: T_DEFAULT expr if_expr T_EOL | 172 | config_option: T_DEFAULT expr if_expr T_EOL |
214 | { | 173 | { |
215 | menu_add_expr(P_DEFAULT, $2, $3); | 174 | menu_add_expr(P_DEFAULT, $2, $3); |
216 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | 175 | if ($1->stype != S_UNKNOWN) |
176 | menu_set_type($1->stype); | ||
177 | printd(DEBUG_PARSE, "%s:%d:default(%u)\n", | ||
178 | zconf_curname(), zconf_lineno(), | ||
179 | $1->stype); | ||
217 | }; | 180 | }; |
218 | 181 | ||
219 | config_option: T_SELECT T_WORD if_expr T_EOL | 182 | config_option: T_SELECT T_WORD if_expr T_EOL |
@@ -275,16 +238,15 @@ choice_option: T_PROMPT prompt if_expr T_EOL | |||
275 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | 238 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
276 | }; | 239 | }; |
277 | 240 | ||
278 | choice_option: T_TRISTATE prompt_stmt_opt T_EOL | 241 | choice_option: T_TYPE prompt_stmt_opt T_EOL |
279 | { | ||
280 | menu_set_type(S_TRISTATE); | ||
281 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
282 | }; | ||
283 | |||
284 | choice_option: T_BOOLEAN prompt_stmt_opt T_EOL | ||
285 | { | 242 | { |
286 | menu_set_type(S_BOOLEAN); | 243 | if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) { |
287 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | 244 | menu_set_type($1->stype); |
245 | printd(DEBUG_PARSE, "%s:%d:type(%u)\n", | ||
246 | zconf_curname(), zconf_lineno(), | ||
247 | $1->stype); | ||
248 | } else | ||
249 | YYERROR; | ||
288 | }; | 250 | }; |
289 | 251 | ||
290 | choice_option: T_OPTIONAL T_EOL | 252 | choice_option: T_OPTIONAL T_EOL |
@@ -295,8 +257,12 @@ choice_option: T_OPTIONAL T_EOL | |||
295 | 257 | ||
296 | choice_option: T_DEFAULT T_WORD if_expr T_EOL | 258 | choice_option: T_DEFAULT T_WORD if_expr T_EOL |
297 | { | 259 | { |
298 | menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); | 260 | if ($1->stype == S_UNKNOWN) { |
299 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | 261 | menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); |
262 | printd(DEBUG_PARSE, "%s:%d:default\n", | ||
263 | zconf_curname(), zconf_lineno()); | ||
264 | } else | ||
265 | YYERROR; | ||
300 | }; | 266 | }; |
301 | 267 | ||
302 | choice_block: | 268 | choice_block: |