parsetl: change the interface to return a parsed_formula
This gets the interface of all the functions parsing formula in line with the interface of the automaton parser: both return a "parsed_*" object (parsed_formula or parsed_automaton) that contains the said object and its list of errors. Doing so avoid having to declare the parse_error_list in advance. * spot/tl/parse.hh, spot/parsetl/parsetl.yy: Do the change. * spot/parsetl/fmterror.cc: Adjust the error printer. * NEWS: Document it. * bin/common_finput.cc, bin/common_finput.hh, bin/ltlcross.cc, bin/ltldo.cc, bin/ltlfilt.cc, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut10.org, doc/org/tut20.org, python/ajax/spotcgi.in, python/spot/impl.i, spot/parseaut/parseaut.yy, tests/core/checkpsl.cc, tests/core/checkta.cc, tests/core/consterm.cc, tests/core/emptchk.cc, tests/core/equalsf.cc, tests/core/ikwiad.cc, tests/core/kind.cc, tests/core/length.cc, tests/core/ltlprod.cc, tests/core/ltlrel.cc, tests/core/randtgba.cc, tests/core/readltl.cc, tests/core/reduc.cc, tests/core/safra.cc, tests/core/syntimpl.cc, tests/core/tostring.cc, tests/ltsmin/modelcheck.cc, tests/python/alarm.py, tests/python/interdep.py, tests/python/ltl2tgba.py, tests/python/ltlparse.py: Adjust all uses.
This commit is contained in:
parent
cf4f58c34b
commit
22f442f758
37 changed files with 359 additions and 374 deletions
|
|
@ -1633,10 +1633,9 @@ nc-formula: nc-formula-or-ident
|
|||
auto i = res.fcache.find(*$1);
|
||||
if (i == res.fcache.end())
|
||||
{
|
||||
spot::parse_error_list pel;
|
||||
auto f = spot::parse_infix_boolean(*$1, pel, *res.env,
|
||||
debug_level(), true);
|
||||
for (auto& j: pel)
|
||||
auto pf = spot::parse_infix_boolean(*$1, *res.env, debug_level(),
|
||||
true);
|
||||
for (auto& j: pf.errors)
|
||||
{
|
||||
// Adjust the diagnostic to the current position.
|
||||
spot::location here = @1;
|
||||
|
|
@ -1647,8 +1646,9 @@ nc-formula: nc-formula-or-ident
|
|||
res.h->errors.emplace_back(here, j.second);
|
||||
}
|
||||
bdd cond = bddfalse;
|
||||
if (f)
|
||||
cond = spot::formula_to_bdd(f, res.h->aut->get_dict(), res.h->aut);
|
||||
if (pf.f)
|
||||
cond = spot::formula_to_bdd(pf.f,
|
||||
res.h->aut->get_dict(), res.h->aut);
|
||||
$$ = (res.fcache[*$1] = cond).id();
|
||||
}
|
||||
else
|
||||
|
|
@ -1814,16 +1814,15 @@ lbtt-acc: { $$ = 0U; }
|
|||
}
|
||||
lbtt-guard: STRING
|
||||
{
|
||||
spot::parse_error_list pel;
|
||||
auto f = spot::parse_prefix_ltl(*$1, pel, *res.env);
|
||||
if (!f || !pel.empty())
|
||||
auto pf = spot::parse_prefix_ltl(*$1, *res.env);
|
||||
if (!pf.f || !pf.errors.empty())
|
||||
{
|
||||
std::string s = "failed to parse guard: ";
|
||||
s += *$1;
|
||||
error(@$, s);
|
||||
}
|
||||
if (!pel.empty())
|
||||
for (auto& j: pel)
|
||||
if (!pf.errors.empty())
|
||||
for (auto& j: pf.errors)
|
||||
{
|
||||
// Adjust the diagnostic to the current position.
|
||||
spot::location here = @1;
|
||||
|
|
@ -1833,13 +1832,13 @@ lbtt-guard: STRING
|
|||
here.begin.column += j.first.begin.column - 1;
|
||||
res.h->errors.emplace_back(here, j.second);
|
||||
}
|
||||
if (!f)
|
||||
if (!pf.f)
|
||||
{
|
||||
res.cur_label = bddtrue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!f.is_boolean())
|
||||
if (!pf.f.is_boolean())
|
||||
{
|
||||
error(@$,
|
||||
"non-Boolean transition label (replaced by true)");
|
||||
|
|
@ -1848,7 +1847,7 @@ lbtt-guard: STRING
|
|||
else
|
||||
{
|
||||
res.cur_label =
|
||||
formula_to_bdd(f, res.h->aut->get_dict(), res.h->aut);
|
||||
formula_to_bdd(pf.f, res.h->aut->get_dict(), res.h->aut);
|
||||
}
|
||||
}
|
||||
delete $1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue