[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] %expect-rr is for GLR only
From: |
Akim Demaille |
Subject: |
[PATCH 1/3] %expect-rr is for GLR only |
Date: |
Fri, 21 Sep 2012 18:00:22 +0200 |
* src/conflicts.c (conflicts_print): Complain about %expect-rr if not
in GLR mode, regardless of the number of reduce/reduce conflicts.
* tests/conflicts.at (%expect-rr non GLR): New test.
* NEWS: Update.
---
NEWS | 5 +++++
src/conflicts.c | 2 +-
tests/conflicts.at | 37 ++++++++++++++++++++++++++++++++++---
3 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index f6e6a8c..9cabf05 100644
--- a/NEWS
+++ b/NEWS
@@ -145,6 +145,11 @@ GNU Bison NEWS
the programmer to prune possible parses based on the values of run-time
expressions.
+** The directive %expect-rr is now an error in non GLR mode
+
+ It used to be an error only if used in non GLR mode, _and_ if there are
+ reduce/reduce conflicts.
+
* Noteworthy changes in release ?.? (????-??-??) [?]
diff --git a/src/conflicts.c b/src/conflicts.c
index 989dfc2..0db0f57 100644
--- a/src/conflicts.c
+++ b/src/conflicts.c
@@ -576,7 +576,7 @@ conflicts_print (void)
}
}
- if (! glr_parser && rrc_total > 0 && expected_rr_conflicts != -1)
+ if (! glr_parser && expected_rr_conflicts != -1)
{
complain (Wother, _("%%expect-rr applies only to GLR parsers"));
expected_rr_conflicts = -1;
diff --git a/tests/conflicts.at b/tests/conflicts.at
index c4515e8..169509f 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -1459,9 +1459,40 @@ state 1
AT_CLEANUP
-## --------------------------------- ##
-## -W versus %expect and %expect-rr ##
-## --------------------------------- ##
+## -------------------- ##
+## %expect-rr non GLR. ##
+## -------------------- ##
+
+AT_SETUP([[%expect-rr non GLR]])
+
+AT_DATA([[1.y]],
+[[%expect-rr 0
+%%
+exp: 'a'
+]])
+
+AT_BISON_CHECK([[1.y]], [[0]], [],
+[[1.y: warning: %expect-rr applies only to GLR parsers [-Wother]
+]])
+
+AT_DATA([[2.y]],
+[[%expect-rr 1
+%%
+exp: 'a' | 'a';
+]])
+
+AT_BISON_CHECK([[2.y]], [[0]], [],
+[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
+2.y: conflicts: 1 reduce/reduce
+2.y:3.12-14: warning: rule useless in parser due to conflicts: exp: 'a'
[-Wother]
+]])
+
+AT_CLEANUP
+
+
+## ---------------------------------- ##
+## -W versus %expect and %expect-rr. ##
+## ---------------------------------- ##
AT_SETUP([[-W versus %expect and %expect-rr]])
--
1.7.12.1
- [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Akim Demaille, 2012/09/21
- [PATCH 1/3] %expect-rr is for GLR only,
Akim Demaille <=
- [PATCH 2/3] conflicts: refactor the counting routines, Akim Demaille, 2012/09/21
- [PATCH 3/3] use the regular warning interface for s/r and r/r conflicts, Akim Demaille, 2012/09/21
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Paul Eggert, 2012/09/21
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Akim Demaille, 2012/09/23
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Paul Eggert, 2012/09/23
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Akim Demaille, 2012/09/23
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Paul Eggert, 2012/09/23
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Akim Demaille, 2012/09/24
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Akim Demaille, 2012/09/24
- Re: [PATCH 0/3] {master} convert the conflict messages to a more bison-like form, Paul Eggert, 2012/09/24