bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/12] grammar: introduce %empty


From: Akim Demaille
Subject: Re: [PATCH 01/12] grammar: introduce %empty
Date: Mon, 18 Feb 2013 10:01:17 +0100

Le 16 févr. 2013 à 14:55, Akim Demaille <address@hidden> a écrit :

> 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.

I will squash this in before pushing.

commit c728b8cd8371020827adbe7a323aab7865cd0893
Author: Akim Demaille <address@hidden>
Date:   Mon Feb 18 09:59:52 2013 +0100

    fixup! grammar: introduce %empty

diff --git a/tests/actions.at b/tests/actions.at
index fd69608..3021c7a 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -132,6 +132,7 @@ AT_DATA_GRAMMAR([[two.y]],
 exp:
   'a' %empty    {}
 | %empty 'a'    {}
+| %empty {}     {}
 ;
 ]])
 
@@ -142,6 +143,9 @@ AT_BISON_CHECK([-fcaret two.y], [1], [],
 two.y:12.3-8: error: %empty on non-empty rule
  | %empty 'a'    {}
    ^^^^^^
+two.y:13.3-8: error: %empty on non-empty rule
+ | %empty {}     {}
+   ^^^^^^
 ]])
 
 AT_CLEANUP





reply via email to

[Prev in Thread] Current Thread [Next in Thread]