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.h | |
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.h')
-rw-r--r-- | src/symlist.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/symlist.h b/src/symlist.h index 657efacd..9b0f1172 100644 --- a/src/symlist.h +++ b/src/symlist.h @@ -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; |