diagnostics: also show suggested %empty

* src/reader.c (grammar_rule_check_and_complete): Suggest to add %empty.
* tests/actions.at, tests/diagnostics.at: Adjust expectations.
This commit is contained in:
Akim Demaille
2019-10-06 10:48:59 +02:00
parent fec13ce2db
commit 9e6c5328d3
4 changed files with 42 additions and 0 deletions

View File

@@ -358,6 +358,8 @@ grammar_rule_check_and_complete (symbol_list *r)
&& warning_is_enabled (Wempty_rule))
{
complain (&r->rhs_loc, Wempty_rule, _("empty rule without %%empty"));
if (feature_flag & feature_caret)
location_caret_suggestion (r->rhs_loc, "%empty", stderr);
location loc = r->rhs_loc;
loc.end = loc.start;
fixits_register (&loc, " %empty ");