* src/ltlenv/environment.hh (require): Return a formula, not

an atomic_prop.
* src/ltlast/atomic_prop.hh (atomic_prop): New argument env.
(environment_): New member.
(env): New method.
* src/ltlast/atomic_prop.cc (atomic_prop, env): Likewise.
* src/ltlenv/defaultenv.cc (require): Pass *this as the
environment argument to atomic_prop.
* src/ltlvisit/clone.cc (visit(const atomic_prop*)): Also copy
the environment.
* src/ltlvisit/nenoform.cc (visit(const atomic_prop*)): Likewise.
This commit is contained in:
Alexandre Duret-Lutz 2003-04-17 15:47:56 +00:00
parent a30a0638b9
commit 2a0f88373e
8 changed files with 37 additions and 10 deletions

View file

@ -5,10 +5,10 @@ namespace spot
namespace ltl
{
atomic_prop*
formula*
default_environment::require(const std::string& s)
{
return new atomic_prop(s);
return new atomic_prop(s, *this);
}
const std::string&

View file

@ -2,6 +2,7 @@
# define SPOT_LTLENV_DEFAULT_ENVIRONMENT_HH
# include "environment.hh"
# include "ltlast/atomic_prop.hh"
namespace spot
{
@ -11,7 +12,7 @@ namespace spot
class default_environment : public environment
{
public:
virtual atomic_prop* require(const std::string& prop_str);
virtual formula* require(const std::string& prop_str);
virtual const std::string& name();
/* This class is a singleton. */

View file

@ -1,7 +1,7 @@
#ifndef SPOT_LTLENV_ENVIRONMENT_HH
# define SPOT_LTLENV_ENVIRONMENT_HH
# include "ltlast/atomic_prop.hh"
# include "ltlast/formula.hh"
# include <string>
namespace spot
@ -16,7 +16,11 @@ namespace spot
// described by prop_str.
// Note this is NOT a const method. Some environment will
// "create" the atomic proposition when asked.
virtual atomic_prop* require(const std::string& prop_str) = 0;
// We return a formula instead of an atomic_prop, because this
// will allow nifty tricks (e.g., we could name formulae in an
// environment, and let the parser build a larger tree from
// these).
virtual formula* require(const std::string& prop_str) = 0;
virtual const std::string& name() = 0;
// FIXME: More functions will be needed later, but