mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
Generalize the display of semantic values and locations in traces.
* data/glr.c (yy_reduce_print): Fix indices (again). * data/c++.m4 (b4_rhs_value, b4_rhs_location): Don't expect literal integers. * data/lalr1.cc (yyreduce_print): Rename as... (yy_reduce_print): this. Display values and locations. * data/yacc.c (yy_reduce_print): Likewise. (YY_REDUCE_PRINT): Adjust to pass the required arguments. (yysymprint): Move higher to be visible from yy_reduce_print). (yyparse): Adjust. * tests/calc.at: Adjust the expected length of the traces.
This commit is contained in:
@@ -465,21 +465,21 @@ _AT_CHECK_CALC([$1],
|
||||
|
||||
2^2^3 = 256
|
||||
(2^2)^3 = 64],
|
||||
[571])
|
||||
[842])
|
||||
|
||||
# Some syntax errors.
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [13],
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [15],
|
||||
[1.2: syntax error, unexpected number])
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [18],
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
|
||||
[1.2: syntax error, unexpected '/', expecting number or '-' or '(' or '!'])
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [error], [5],
|
||||
[1.0: syntax error, unexpected $undefined])
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [26],
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [30],
|
||||
[1.6: syntax error, unexpected '='])
|
||||
_AT_CHECK_CALC_ERROR([$1], [1],
|
||||
[
|
||||
+1],
|
||||
[16],
|
||||
[20],
|
||||
[2.0: syntax error, unexpected '+'])
|
||||
# Exercise error messages with EOF: work on an empty file.
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4],
|
||||
@@ -503,7 +503,7 @@ _AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4],
|
||||
#
|
||||
_AT_CHECK_CALC_ERROR([$1], [0],
|
||||
[() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1],
|
||||
[189],
|
||||
[250],
|
||||
[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 '!'
|
||||
@@ -512,10 +512,10 @@ 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], [76],
|
||||
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102],
|
||||
[1.9: syntax error, unexpected number
|
||||
calc: error: 2222 != 1])
|
||||
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [86],
|
||||
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
|
||||
[1.3: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
|
||||
1.11: syntax error, unexpected number
|
||||
calc: error: 2222 != 1])
|
||||
|
||||
Reference in New Issue
Block a user