parse_aut: simplify the interface

* src/parseaut/public.hh, src/parseaut/parseaut.yy,
src/parseaut/fmterror.cc: Add a raise_errors options.  Remove the
parse_strict() method.  Store parse errors and filename in the output
parsed_aut to simplify usage.
* doc/org/tut20.org, doc/org/tut21.org, doc/org/tut30.org,
src/bin/autfilt.cc, src/bin/common_hoaread.cc, src/bin/dstar2tgba.cc,
src/bin/ltlcross.cc, src/bin/ltldo.cc, src/tests/complementation.cc,
src/tests/ikwiad.cc, src/tests/ltlcross3.test, src/tests/ltldo.test,
wrap/python/spot.py, wrap/python/tests/parsetgba.py: Adjust usage.
* NEWS: Mention the changes.
This commit is contained in:
Alexandre Duret-Lutz 2015-10-25 20:41:35 +01:00
parent 3d5d160635
commit dee73ee342
18 changed files with 228 additions and 215 deletions

View file

@ -371,6 +371,7 @@ def automata(*sources, timeout=None, ignore_abort=True,
o.debug = debug
o.ignore_abort = ignore_abort
o.trust_hoa = trust_hoa
o.raise_errors = True
for filename in sources:
try:
p = None
@ -409,7 +410,7 @@ def automata(*sources, timeout=None, ignore_abort=True,
a = True
while a:
# This returns None when we reach the end of the file.
a = p.parse_strict(_bdd_dict)
a = p.parse(_bdd_dict).aut
if a:
yield a
finally:

View file

@ -32,14 +32,12 @@ out = open(filename, 'w+')
out.write(contents)
out.close()
p = spot.empty_parse_aut_error_list()
a = spot.parse_aut(filename, p, spot.make_bdd_dict())
a = spot.parse_aut(filename, spot.make_bdd_dict())
assert not p
assert not a.errors
spot.print_dot(spot.get_cout(), a.aut)
del p
del a
os.unlink(filename)