POSIX: warn if %prec's token was not defined.

Reported by Florian Krohm at
<http://lists.gnu.org/archive/html/bug-bison/2009-12/msg00005.html>.
* NEWS (2.4.2): Document.
* src/reader.c (grammar_rule_check): Implement.
(grammar_current_rule_prec_set): Add comments explaining that we
here assume a %prec identifier is a token, but we still manage
to support POSIX.
* tests/input.at (%prec's token must be defined): New test
group.
(cherry picked from commit f1ceed0774)
This commit is contained in:
Joel E. Denny
2009-12-30 03:20:11 -05:00
parent 505e155199
commit 8bb3a2e7df
4 changed files with 62 additions and 0 deletions

View File

@@ -794,6 +794,26 @@ AT_BISON_CHECK([input.y], [1], [],
AT_CLEANUP
## ------------------------------- ##
## %prec's token must be defined. ##
## ------------------------------- ##
AT_SETUP([[%prec's token must be defined]])
# According to POSIX, a %prec token must be defined separately.
AT_DATA([[input.y]],
[[%%
start: %prec PREC ;
]])
AT_BISON_CHECK([[input.y]], [[0]], [],
[[input.y:2.8-17: warning: token for %prec is not defined: PREC
]])
AT_CLEANUP
## -------------------------------- ##
## Reject unused %code qualifiers. ##
## -------------------------------- ##