mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
c: don't emit an error message when the scanner returns YYERRCODE
* data/skeletons/yacc.c (yyparse): When the scanner returns YYERRCODE, go directly to error recovery (yyerrlab1). However, don't keep the error token as lookahead, that token is too special. * data/skeletons/lalr1.cc: Likewise. * examples/c/bistromathic/parse.y (yylex): Use that feature to report nicely invalid characters. * examples/c/bistromathic/bistromathic.test: Check that. * examples/test: Neutralize gratuitous differences such as rule position. * tests/calc.at: Check that case in C only. The other case seem to be working, but that's an illusion that the next commit will address (in fact, they can enter endless loops, and report the error several times anyway).
This commit is contained in:
@@ -89,11 +89,13 @@ run ()
|
||||
shift
|
||||
|
||||
# Expected output.
|
||||
if $strip_prompt; then
|
||||
$echo "$1" | sed -e '/^> /d' >exp
|
||||
else
|
||||
$echo "$1" >exp
|
||||
fi
|
||||
$echo "$1" |
|
||||
sed -e 's/Reducing stack by rule .* (line .*):/Reducing stack by rule XX (line XXX):/g' |
|
||||
if $strip_prompt; then
|
||||
sed -e '/^> /d'
|
||||
else
|
||||
cat
|
||||
fi >exp
|
||||
shift
|
||||
|
||||
# Effective exit status.
|
||||
@@ -102,7 +104,14 @@ run ()
|
||||
prog "$@" - <input >out_eff 2>err_eff || sta_eff=$?
|
||||
|
||||
# Combine effective output and error streams.
|
||||
{ cat out_eff && $noerr || sed -e 's/^/err: /g' err_eff; } >eff
|
||||
{
|
||||
cat out_eff
|
||||
if ! $noerr; then
|
||||
sed -e 's/^/err: /g' \
|
||||
-e 's/Reducing stack by rule .* (line .*):/Reducing stack by rule XX (line XXX):/g' \
|
||||
err_eff
|
||||
fi
|
||||
} >eff
|
||||
|
||||
if test $sta_eff -eq $sta_exp; then
|
||||
if cmp eff exp 2>/dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user