diff --git a/ChangeLog b/ChangeLog index 5600f12f2..752b2a1aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-03-10 Alexandre Duret-Lutz + + 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. + 2010-03-07 Alexandre Duret-Lutz Do not rewrite F(a & GF(b)) = F(a) & GF(b), this can be harmful. diff --git a/src/ltlparse/fmterror.cc b/src/ltlparse/fmterror.cc index 62020b4cb..64eb99723 100644 --- a/src/ltlparse/fmterror.cc +++ b/src/ltlparse/fmterror.cc @@ -1,6 +1,8 @@ -// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre -// et Marie Curie. +// Copyright (C) 2010 Laboratoire de Recherche et Développement de +// l'Epita (LRDE). +// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris +// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), +// Université Pierre et Marie Curie. // // This file is part of Spot, a model checking library. // @@ -39,7 +41,7 @@ namespace spot os << ">>> " << ltl_string << std::endl; ltlyy::location& l = it->first; - unsigned n = 0; + unsigned n = 1; for (; n < 4 + l.begin.column; ++n) os << ' '; // Write at least one '^', even if begin==end. diff --git a/src/ltltest/parseerr.test b/src/ltltest/parseerr.test index 89e048aa4..20d0c2714 100755 --- a/src/ltltest/parseerr.test +++ b/src/ltltest/parseerr.test @@ -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 +'