diff options
author | Akim Demaille <akim@lrde.epita.fr> | 2013-01-29 14:19:40 +0100 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2013-02-18 10:01:27 +0100 |
commit | ae2b48f5c00b50f1873dc205020288c19bd1c27c (patch) | |
tree | b187e1b28df1d8632fc726254f5b610f70167095 /src/symlist.c | |
parent | 9e4917b2a146c60f47c96916f2eaad9b43af82c5 (diff) | |
download | bison-ae2b48f5c00b50f1873dc205020288c19bd1c27c.tar.gz |
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.
Diffstat (limited to 'src/symlist.c')
-rw-r--r-- | src/symlist.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/symlist.c b/src/symlist.c index d43591ad..005d808b 100644 --- a/src/symlist.c +++ b/src/symlist.c @@ -44,6 +44,7 @@ symbol_list_sym_new (symbol *sym, location loc) /* Members used for LHS only. */ res->ruleprec = NULL; + res->percent_empty_loc = empty_location; code_props_none_init (&res->action_props); res->dprec = 0; res->merger = 0; |