mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
grammar: introduce %empty
Provide a means to explicitly denote empty right-hand sides of rules:
instead of
exp: { ... }
allow
exp: %empty { ... }
Make sure that %empty is properly used.
With help from Joel E. Denny and Gabriel Rassoul.
http://lists.gnu.org/archive/html/bison-patches/2013-01/msg00142.html
* src/reader.h, src/reader.c (grammar_current_rule_empty_set): New.
* src/parse-gram.y (%empty): New token.
Use it.
* src/scan-gram.l (%empty): Scan it.
* src/reader.c (grammar_rule_check): Check that %empty is properly used.
* tests/actions.at (Invalid uses of %empty, Valid uses of %empty): New.
This commit is contained in:
@@ -78,6 +78,10 @@ typedef struct symbol_list
|
||||
* each RHS are also stored here. */
|
||||
code_props action_props;
|
||||
|
||||
/* The location of the first %empty for this rule, or \a
|
||||
empty_location. */
|
||||
location percent_empty_loc;
|
||||
|
||||
int dprec;
|
||||
int merger;
|
||||
location merger_declaration_location;
|
||||
|
||||
Reference in New Issue
Block a user