Correct LaCIM for ELTL and make it work with LBTT.

* src/eltlparse/eltlparse.yy: Adjust.
* src/ltlast/automatop.cc, src/ltlast/automatop.hh,
src/ltlvisit/clone.cc, src/ltlvisit/nenoform.cc: Clean the way we
handle the negation of automaton operators.
* src/ltlvisit/tostring.cc, src/ltlvisit/tostring.hh: Add an
optional argument to output a fully parenthesized string.
* src/tgbaalgos/eltl2tgba_lacim.cc: Fix it.
* src/tgbatest/eltl2tgba.cc: Add a new option (-L) to read formulae
from an LBTT-compatible file.
* src/tgbatest/eltl2tgba.test: A new tests.
* src/tgbatest/spotlbtt.test: Add LaCIM for ELTL.
This commit is contained in:
Damien Lefortier 2009-04-08 19:57:27 +02:00
parent 355461ae99
commit 7643c49cbd
12 changed files with 184 additions and 71 deletions

View file

@ -71,7 +71,7 @@ namespace spot
automatop::vec* res = new automatop::vec;
for (unsigned i = 0; i < ao->size(); ++i)
res->push_back(recurse(ao->nth(i)));
result_ = automatop::instance(ao->nfa(), res);
result_ = automatop::instance(ao->nfa(), res, ao->is_negated());
}
void

View file

@ -154,16 +154,13 @@ namespace spot
void
visit(automatop* ao)
{
if (negated_)
{
negated_ = false;
ao->negated_ = true;
}
bool negated = negated_;
negated_ = false;
automatop::vec* res = new automatop::vec;
unsigned aos = ao->size();
for (unsigned i = 0; i < aos; ++i)
res->push_back(recurse(ao->nth(i)));
result_ = automatop::instance(ao->nfa(), res);
result_ = automatop::instance(ao->nfa(), res, negated);
}
void

View file

@ -59,8 +59,8 @@ namespace spot
class to_string_visitor: public const_visitor
{
public:
to_string_visitor(std::ostream& os)
: os_(os), top_level_(true)
to_string_visitor(std::ostream& os, bool full_parent = false)
: os_(os), top_level_(true), full_parent_(full_parent)
{
}
@ -147,17 +147,18 @@ namespace spot
}
top_level_ = false;
if (need_parent)
if (need_parent || full_parent_)
os_ << "(";
uo->child()->accept(*this);
if (need_parent)
if (need_parent || full_parent_)
os_ << ")";
}
void
visit(const automatop* ao)
{
// Warning: this string isn't parsable.
// Warning: this string isn't parsable because the automaton
// operators used may not be defined.
bool top_level = top_level_;
top_level_ = false;
if (!top_level)
@ -206,6 +207,7 @@ namespace spot
protected:
std::ostream& os_;
bool top_level_;
bool full_parent_;
};
class to_spin_string_visitor : public to_string_visitor
@ -308,7 +310,8 @@ namespace spot
void
visit(const automatop* ao)
{
// Warning: this string isn't parsable.
// Warning: this string isn't parsable because the automaton
// operators used may not be defined.
bool top_level = top_level_;
top_level_ = false;
if (!top_level)
@ -359,18 +362,18 @@ namespace spot
} // anonymous
std::ostream&
to_string(const formula* f, std::ostream& os)
to_string(const formula* f, std::ostream& os, bool full_parent)
{
to_string_visitor v(os);
to_string_visitor v(os, full_parent);
f->accept(v);
return os;
}
std::string
to_string(const formula* f)
to_string(const formula* f, bool full_parent)
{
std::ostringstream os;
to_string(f, os);
to_string(f, os, full_parent);
return os.str();
}

View file

@ -32,14 +32,22 @@ namespace spot
/// \addtogroup ltl_io
/// @{
/// \brief Output a formula as a (parsable) string.
/// \brief Output a formula as a string which is parsable unless the formula
/// contains automaton operators (used in ELTL formulae).
/// \param f The formula to translate.
/// \param os The stream where it should be output.
std::ostream& to_string(const formula* f, std::ostream& os);
/// \param full_parent Whether or not the string should by fully
/// parenthesized.
std::ostream&
to_string(const formula* f, std::ostream& os, bool full_parent = false);
/// \brief Convert a formula into a (parsable) string.
/// \brief Output a formula as a string which is parsable unless the formula
/// contains automaton operators (used in ELTL formulae).
/// \param f The formula to translate.
std::string to_string(const formula* f);
/// \param full_parent Whether or not the string should by fully
/// parenthesized.
std::string
to_string(const formula* f, bool full_parent = false);
/// \brief Output a formula as a (parsable by Spin) string.
/// \param f The formula to translate.