hoa: make the parser more resilient to errors
* src/hoaparse/hoaparse.yy: Improve error recovery, and fix location tracking in streams. * src/hoaparse/public.hh: Store the last location so that the next parse start at the correct position. * src/bin/autfilt.cc: Stop parsing a stream on irrecoverable errors. * src/tgbatest/hoaparse.test: Adjust tests.
This commit is contained in:
parent
392c527d31
commit
1d962f79ac
4 changed files with 152 additions and 80 deletions
|
|
@ -343,13 +343,14 @@ namespace
|
|||
|
||||
for (;;)
|
||||
{
|
||||
pel.clear();
|
||||
auto haut = hp.parse(pel, b);
|
||||
if (!haut && pel.empty())
|
||||
break;
|
||||
if (spot::format_hoa_parse_errors(std::cerr, filename, pel))
|
||||
err = 2;
|
||||
if (!haut)
|
||||
error(0, 0, "failed to read automaton from %s", filename);
|
||||
error(2, 0, "failed to read automaton from %s", filename);
|
||||
else
|
||||
process_automaton(haut, filename);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue