fmterror.cc 724 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "public.hh"

namespace spot 
{
  namespace ltl
  {

    bool 
    format_parse_errors(std::ostream& os,
			const std::string& ltl_string,
			parse_error_list& error_list)
    {
      bool printed = false;
      spot::ltl::parse_error_list::iterator it;
      for (it = error_list.begin(); it != error_list.end(); ++it)
	{
	  os << ">>> " << ltl_string << std::endl;
	  yy::Location& l = it->first;

	  unsigned n = 0;
	  for (; n < 4 + l.begin.column; ++n)
	    os << ' ';
	  // Write at least one '^', even if begin==end.
	  os << '^';
	  ++n;
	  for (; n < 4 + l.end.column; ++n)
	    os << '^';
	  os << std::endl << it->second << std::endl << std::endl;
	  printed = true;
	}
      return printed;
    }

  }
}