-# hence be sure i. to have several errors, ii. to test the action
-# associated to `error'.
-_AT_CHECK_CALC_ERROR([$1], [(1 ++ 2) + (0 0) = 1], [82],
-[1.5-1.6: parse error, unexpected '+', expecting "number" or '-' or '('
-1.15-1.16: parse error, unexpected "number"
-calc: error: 0 != 1])
-
-# Add a studid example demonstrating that Bison can further improve the
-# error message. FIXME: Fix this ridiculous message.
-_AT_CHECK_CALC_ERROR([$1], [()], [21],
-[1.2-1.3: parse error, unexpected ')', expecting "number" or '-' or '('])
+# hence be sure to
+#
+# - have several errors which exercise different shift/discardings
+# - (): nothing to pop, nothing to discard
+# - (1 + 1 + 1 +): a lot to pop, nothing to discard
+# - (* * *): nothing to pop, a lot to discard
+# - (1 + 2 * *): some to pop and discard
+#
+# - test the action associated to `error'
+#
+# - check the look-ahead that triggers an error is not discarded
+# when we enter error recovery. Below, the look-ahead causing the
+# first error is ")", which is needed to recover from the error and
+# produce the "0" that triggers the "0 != 1" error.
+#
+_AT_CHECK_CALC_ERROR([$1], [0],
+ [() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1],
+ [188],
+[1.1: syntax error, unexpected ')', expecting number or '-' or '(' or '!'
+1.17: syntax error, unexpected ')', expecting number or '-' or '(' or '!'
+1.22: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
+1.40: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
+calc: error: 4444 != 1])
+
+# The same, but this time exercising explicitly triggered syntax errors.
+# POSIX says the look-ahead causing the error should not be discarded.
+_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [75],
+[1.9: syntax error, unexpected number
+calc: error: 2222 != 1])
+_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [85],
+[1.3: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
+1.11: syntax error, unexpected number
+calc: error: 2222 != 1])
+AT_BISON_OPTION_POPDEFS