diff options
| author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-11 06:00:53 -0500 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-12-15 03:45:20 -0500 |
| commit | 2f60e46e605a9bcd8dc4fe7745b5576084900850 (patch) | |
| tree | b65340cd102494113ba4931c2837e914454a660d /scripts | |
| parent | 6900ae9eeee397436df25ef51835a8b27865d46d (diff) | |
kconfig: remove grammatically ambiguous option_error
This commit decreases 6 shift/reduce conflicts, and finally achieves
conflict-free parser.
Since Kconfig has no terminator for a config block, detecting the end
of config_stmt is not easy.
For example, there are two ways for handling the error in the following
code:
1 config FOO
2 =
[A] Print "unknown option" error, assuming the line 2 is a part of
config_option_list
[B] Print "invalid statement", assuming the line 1 is reduced into
a config_stmt by itself
Bison actually chooses [A] because it performs the shift rather than
the reduction where both are possible.
However, there is no reason to choose one over the other.
Let's remove the option_error, and let it fall back to [B].
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/kconfig/zconf.y | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index cef6123228c0..a92f167e8267 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
| @@ -31,7 +31,6 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; | |||
| 31 | static struct menu *current_menu, *current_entry; | 31 | static struct menu *current_menu, *current_entry; |
| 32 | 32 | ||
| 33 | %} | 33 | %} |
| 34 | %expect 6 | ||
| 35 | 34 | ||
| 36 | %union | 35 | %union |
| 37 | { | 36 | { |
| @@ -138,12 +137,6 @@ common_stmt: | |||
| 138 | | assignment_stmt | 137 | | assignment_stmt |
| 139 | ; | 138 | ; |
| 140 | 139 | ||
| 141 | option_error: | ||
| 142 | T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); } | ||
| 143 | | error T_EOL { zconf_error("invalid option"); } | ||
| 144 | ; | ||
| 145 | |||
| 146 | |||
| 147 | /* config/menuconfig entry */ | 140 | /* config/menuconfig entry */ |
| 148 | 141 | ||
| 149 | config_entry_start: T_CONFIG nonconst_symbol T_EOL | 142 | config_entry_start: T_CONFIG nonconst_symbol T_EOL |
| @@ -180,7 +173,6 @@ config_option_list: | |||
| 180 | | config_option_list symbol_option | 173 | | config_option_list symbol_option |
| 181 | | config_option_list depends | 174 | | config_option_list depends |
| 182 | | config_option_list help | 175 | | config_option_list help |
| 183 | | config_option_list option_error | ||
| 184 | ; | 176 | ; |
| 185 | 177 | ||
| 186 | config_option: T_TYPE prompt_stmt_opt T_EOL | 178 | config_option: T_TYPE prompt_stmt_opt T_EOL |
| @@ -280,7 +272,6 @@ choice_option_list: | |||
| 280 | | choice_option_list choice_option | 272 | | choice_option_list choice_option |
| 281 | | choice_option_list depends | 273 | | choice_option_list depends |
| 282 | | choice_option_list help | 274 | | choice_option_list help |
| 283 | | choice_option_list option_error | ||
| 284 | ; | 275 | ; |
| 285 | 276 | ||
| 286 | choice_option: T_PROMPT prompt if_expr T_EOL | 277 | choice_option: T_PROMPT prompt if_expr T_EOL |
| @@ -429,7 +420,6 @@ help: help_start T_HELPTEXT | |||
| 429 | depends_list: | 420 | depends_list: |
| 430 | /* empty */ | 421 | /* empty */ |
| 431 | | depends_list depends | 422 | | depends_list depends |
| 432 | | depends_list option_error | ||
| 433 | ; | 423 | ; |
| 434 | 424 | ||
| 435 | depends: T_DEPENDS T_ON expr T_EOL | 425 | depends: T_DEPENDS T_ON expr T_EOL |
