Fix column in LTL error messages, it was off by one.

* src/ltlparse/fmterror.cc (format_parse_errors): Count columns
starting at 1.  Older Bison used to start at 0 but changed to
match the GNU Coding Standards.
* src/ltltest/parseerr.test: Add a test case.
This commit is contained in:
Alexandre Duret-Lutz 2010-03-10 15:17:05 +01:00
parent 3cf2ddbcb0
commit d71ceb3b04
3 changed files with 39 additions and 7 deletions

View file

@ -1,5 +1,5 @@
#! /bin/sh
# Copyright (C) 2009 Laboratoire de Recherche et Développement
# Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
# de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -30,7 +30,7 @@
check()
{
run 1 ../ltl2text "$1" >stdout
set +x; run 1 ../ltl2text "$1" >stdout 2>stderr; set -x
if test -n "$2"; then
echo "$2" >expect
else
@ -43,9 +43,21 @@ check()
cat stdout
echo "instead of"
cat expect
rm -f stdout expect
exit 1
fi
if test -n "$3"; then
echo "$3" >expect
if cmp stderr expect; then
:
else
echo "==== Error output was ===="
cat stderr
echo "==== instead of ===="
cat expect
exit 1
fi
fi
}
# Empty or unparsable strings
@ -72,3 +84,12 @@ run 0 ../equals -E 'a & (a + b' 'a & (a + b)'
run 0 ../equals -E 'a & (a + b c' 'a & (0)'
run 0 ../equals -E 'a & (+' 'a & (0)'
run 0 ../equals -E 'a & (' 'a & (0)'
check 'a - b' 'AP(a)' '>>> a - b
^
syntax error, unexpected $undefined
>>> a - b
^^^
ignoring trailing garbage
'