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:
Akim Demaille
2013-01-29 14:19:40 +01:00
parent 9e4917b2a1
commit ae2b48f5c0
8 changed files with 98 additions and 0 deletions

1
THANKS
View File

@@ -44,6 +44,7 @@ Fabrice Bauzac noon@cote-dazur.com
Florian Krohm florian@edamail.fishkill.ibm.com
Frank Heckenbach frank@g-n-u.de
Frans Englich frans.englich@telia.com
Gabriel Rassoul gabriel.rassoul@epita.fr
Georg Sauthoff gsauthof@TechFak.Uni-Bielefeld.DE
George Neuner gneuner2@comcast.net
Gilles Espinasse g.esp@free.fr