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:
parent
355461ae99
commit
7643c49cbd
12 changed files with 184 additions and 71 deletions
|
|
@ -27,10 +27,11 @@ namespace spot
|
|||
{
|
||||
namespace ltl
|
||||
{
|
||||
automatop::automatop(const nfa::ptr nfa, vec* v)
|
||||
: negated_(false), nfa_(nfa), children_(v)
|
||||
automatop::automatop(const nfa::ptr nfa, vec* v, bool negated)
|
||||
: nfa_(nfa), children_(v), negated_(negated)
|
||||
{
|
||||
dump_= nfa->get_name();
|
||||
dump_ = negated ? "!" : "";
|
||||
dump_ += nfa->get_name();
|
||||
dump_ += "(";
|
||||
dump_ += (*v)[0]->dump();
|
||||
for (unsigned n = 1; n < v->size(); ++n)
|
||||
|
|
@ -42,7 +43,7 @@ namespace spot
|
|||
automatop::~automatop()
|
||||
{
|
||||
// Get this instance out of the instance map.
|
||||
pair p(nfa(), children_);
|
||||
triplet p(std::make_pair(nfa(), negated_), children_);
|
||||
map::iterator i = instances.find(p);
|
||||
assert (i != instances.end());
|
||||
instances.erase(i);
|
||||
|
|
@ -65,17 +66,17 @@ namespace spot
|
|||
automatop::map automatop::instances;
|
||||
|
||||
automatop*
|
||||
automatop::instance(const nfa::ptr nfa, vec* v)
|
||||
automatop::instance(const nfa::ptr nfa, vec* v, bool negated)
|
||||
{
|
||||
assert(nfa != 0);
|
||||
pair p(nfa, v);
|
||||
triplet p(std::make_pair(nfa, negated), v);
|
||||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
delete v;
|
||||
return static_cast<automatop*>(i->second->ref());
|
||||
}
|
||||
automatop* res = new automatop(nfa, v);
|
||||
automatop* res = new automatop(nfa, v, negated);
|
||||
instances[p] = res;
|
||||
return static_cast<automatop*>(res->ref());
|
||||
}
|
||||
|
|
@ -104,5 +105,11 @@ namespace spot
|
|||
assert(nfa_ != 0);
|
||||
return nfa_;
|
||||
}
|
||||
|
||||
bool
|
||||
automatop::is_negated() const
|
||||
{
|
||||
return negated_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace spot
|
|||
/// (especially not destroy it) after it has been passed to
|
||||
/// spot::ltl::automatop.
|
||||
static automatop*
|
||||
instance(const nfa::ptr nfa, vec* v);
|
||||
instance(const nfa::ptr nfa, vec* v, bool negated);
|
||||
|
||||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
|
@ -68,29 +68,33 @@ namespace spot
|
|||
/// Get the NFA of this operator.
|
||||
const nfa::ptr nfa() const;
|
||||
|
||||
bool negated_;
|
||||
bool is_negated() const;
|
||||
|
||||
protected:
|
||||
typedef std::pair<nfa::ptr, vec*> pair;
|
||||
typedef std::pair<std::pair<nfa::ptr, bool>, vec*> triplet;
|
||||
/// Comparison functor used internally by ltl::automatop.
|
||||
struct paircmp
|
||||
{
|
||||
bool
|
||||
operator () (const pair& p1, const pair& p2) const
|
||||
operator () (const triplet& p1, const triplet& p2) const
|
||||
{
|
||||
if (p1.first != p2.first)
|
||||
return p1.first < p2.first;
|
||||
if (p1.first.first != p2.first.first)
|
||||
return p1.first.first < p2.first.first;
|
||||
if (p1.first.second != p2.first.second)
|
||||
return p1.first.second < p2.first.second;
|
||||
return *p1.second < *p2.second;
|
||||
}
|
||||
};
|
||||
typedef std::map<pair, formula*, paircmp> map;
|
||||
typedef std::map<triplet, formula*, paircmp> map;
|
||||
static map instances;
|
||||
|
||||
automatop(const nfa::ptr nfa, vec* v);
|
||||
automatop(const nfa::ptr nfa, vec* v, bool negated);
|
||||
virtual ~automatop();
|
||||
|
||||
private:
|
||||
nfa::ptr nfa_;
|
||||
vec* children_;
|
||||
bool negated_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue