java: example: properly track the locations

This example, so far, was tracking the current token number, not the
current column number.  This is not nice for an example...

* examples/java/Calc.y (PositionReader): New.
Use it.
* examples/java/Calc.test: Check the output.
This commit is contained in:
Akim Demaille
2020-02-02 09:18:00 +01:00
parent 7e99f67592
commit c16fcaf2fb
2 changed files with 59 additions and 21 deletions

View File

@@ -30,4 +30,4 @@ run 0 '7
cat >input <<EOF
1 + 2 * * 3
EOF
run 0 "err: 1.5: syntax error, unexpected '*', expecting number or '-' or '(' or '!'"
run 0 "err: 1.8-1.9: syntax error, unexpected '*', expecting number or '-' or '(' or '!'"