%expect-rr is for GLR only

* 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.
This commit is contained in:
Akim Demaille
2012-09-21 15:19:12 +02:00
parent 51c994d8f0
commit d140056923
3 changed files with 40 additions and 4 deletions

View File

@@ -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]])