grammar: introduce %empty
authorAkim Demaille <akim@lrde.epita.fr>
Tue, 29 Jan 2013 13:19:40 +0000 (14:19 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Mon, 18 Feb 2013 09:01:27 +0000 (10:01 +0100)
commitae2b48f5c00b50f1873dc205020288c19bd1c27c
treeb187e1b28df1d8632fc726254f5b610f70167095
parent9e4917b2a146c60f47c96916f2eaad9b43af82c5
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.
THANKS
src/parse-gram.y
src/reader.c
src/reader.h
src/scan-gram.l
src/symlist.c
src/symlist.h
tests/actions.at