new keyword in the ELTL format: finish, which applies to an automaton operator and tells whether it just completed. * src/eltlparse/eltlparse.yy: Clean it. Add finish. * src/eltlparse/eltlscan.ll: Add finish. * src/formula_tree.cc, src/formula_tree.hh: New files. Define a small AST representing formulae where atomic props are unknown which is used in the ELTL parser. * src/ltlast/automatop.cc, ltlast/automatop.hh, ltlast/nfa.cc, ltlast/nfa.hh: Adjust. * src/ltlast/unop.cc, src/ltlast/unop.hh: Finish is an unop. * src/ltlvisit/basicreduce.cc, src/ltlvisit/nenoform.cc, src/ltlvisit/reduce.cc, src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc, src/ltlvisit/tunabbrev.cc, src/tgba/formula2bdd.cc, src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_lacim.cc: Handle finish in switches. * src/tgbaalgos/eltl2tgba_lacim.cc: Translate finish. * src/tgbatest/eltl2tgba.test: More tests.
121 lines
2.5 KiB
C++
121 lines
2.5 KiB
C++
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
|
// et Marie Curie.
|
|
//
|
|
// This file is part of Spot, a model checking library.
|
|
//
|
|
// Spot is free software; you can redistribute it and/or modify it
|
|
// under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
// License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Spot; see the file COPYING. If not, write to the Free
|
|
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
// 02111-1307, USA.
|
|
|
|
#include "unop.hh"
|
|
#include "visitor.hh"
|
|
#include <cassert>
|
|
|
|
namespace spot
|
|
{
|
|
namespace ltl
|
|
{
|
|
unop::unop(type op, formula* child)
|
|
: op_(op), child_(child)
|
|
{
|
|
dump_ = "unop(";
|
|
dump_ += op_name();
|
|
dump_ += ", " + child->dump() + ")";
|
|
set_key_();
|
|
}
|
|
|
|
unop::~unop()
|
|
{
|
|
// Get this instance out of the instance map.
|
|
pair p(op(), child());
|
|
map::iterator i = instances.find(p);
|
|
assert (i != instances.end());
|
|
instances.erase(i);
|
|
}
|
|
|
|
void
|
|
unop::accept(visitor& v)
|
|
{
|
|
v.visit(this);
|
|
}
|
|
|
|
void
|
|
unop::accept(const_visitor& v) const
|
|
{
|
|
v.visit(this);
|
|
}
|
|
|
|
const formula*
|
|
unop::child() const
|
|
{
|
|
return child_;
|
|
}
|
|
|
|
formula*
|
|
unop::child()
|
|
{
|
|
return child_;
|
|
}
|
|
|
|
unop::type
|
|
unop::op() const
|
|
{
|
|
return op_;
|
|
}
|
|
|
|
const char*
|
|
unop::op_name() const
|
|
{
|
|
switch (op_)
|
|
{
|
|
case Not:
|
|
return "Not";
|
|
case X:
|
|
return "X";
|
|
case F:
|
|
return "F";
|
|
case G:
|
|
return "G";
|
|
case Finish:
|
|
return "Finish";
|
|
}
|
|
// Unreachable code.
|
|
assert(0);
|
|
return 0;
|
|
}
|
|
|
|
unop::map unop::instances;
|
|
|
|
unop*
|
|
unop::instance(type op, formula* child)
|
|
{
|
|
pair p(op, child);
|
|
map::iterator i = instances.find(p);
|
|
if (i != instances.end())
|
|
{
|
|
return static_cast<unop*>(i->second->ref());
|
|
}
|
|
unop* ap = new unop(op, child);
|
|
instances[p] = ap;
|
|
return static_cast<unop*>(ap->ref());
|
|
}
|
|
|
|
unsigned
|
|
unop::instance_count()
|
|
{
|
|
return instances.size();
|
|
}
|
|
}
|
|
}
|