%expext was not functioning at all.

* src/conflicts.c (expected_conflicts): Set to -1.
(conflict_report): Use ngettext.
(conflicts_print): Check %expect and make its violation an error.
* doc/bison.texinfo (Expect Decl): Adjust.
* configure.in (AM_GNU_GETTEXT): Ask for ngettext.
* tests/regression.at (%expect not enough, %expect right)
(%expect too much): New.
This commit is contained in:
Akim Demaille
2001-11-12 09:33:38 +00:00
parent ba9dda1a2e
commit 7da99edea7
6 changed files with 113 additions and 35 deletions

View File

@@ -239,6 +239,66 @@ state 6
AT_CLEANUP(input.c input.output)
## -------------------- ##
## %expect not enough. ##
## -------------------- ##
AT_SETUP([%expect not enough])
AT_DATA([input.y],
[[%token NUM OP
%expect 0
%%
exp: exp OP exp | NUM;
]])
AT_CHECK([bison input.y -o input.c], 1, [],
[input.y contains 1 shift/reduce conflict.
expected 0 shift/reduce conflicts
])
AT_CLEANUP(input.c)
## --------------- ##
## %expect right. ##
## --------------- ##
AT_SETUP([%expect right])
AT_DATA([input.y],
[[%token NUM OP
%expect 1
%%
exp: exp OP exp | NUM;
]])
AT_CHECK([bison input.y -o input.c], 0, [],
[input.y contains 1 shift/reduce conflict.
])
AT_CLEANUP(input.c)
## ------------------ ##
## %expect too much. ##
## ------------------ ##
AT_SETUP([%expect too much])
AT_DATA([input.y],
[[%token NUM OP
%expect 2
%%
exp: exp OP exp | NUM;
]])
AT_CHECK([bison input.y -o input.c], 1, [],
[input.y contains 1 shift/reduce conflict.
expected 2 shift/reduce conflicts
])
AT_CLEANUP(input.c)
## ---------------------- ##
## Mixing %token styles. ##
## ---------------------- ##