Removed unnecessary namespace identifiers.
This commit is contained in:
@@ -20,14 +20,14 @@ namespace ast
|
||||
class VariableStack
|
||||
{
|
||||
public:
|
||||
using Layer = ast::VariableDeclarationPointers *;
|
||||
using Layer = VariableDeclarationPointers *;
|
||||
|
||||
public:
|
||||
void push(Layer layer);
|
||||
void pop();
|
||||
|
||||
std::experimental::optional<ast::VariableDeclaration *> findUserVariableDeclaration(const char *variableName) const;
|
||||
bool contains(const ast::VariableDeclaration &variableDeclaration) const;
|
||||
std::experimental::optional<VariableDeclaration *> findUserVariableDeclaration(const char *variableName) const;
|
||||
bool contains(const VariableDeclaration &variableDeclaration) const;
|
||||
|
||||
private:
|
||||
std::vector<Layer> m_layers;
|
||||
@@ -35,11 +35,11 @@ class VariableStack
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::vector<ast::VariableDeclaration *> collectFreeVariables(ast::Formula &formula);
|
||||
std::vector<ast::VariableDeclaration *> collectFreeVariables(ast::Formula &formula, ast::VariableStack &variableStack);
|
||||
std::vector<VariableDeclaration *> collectFreeVariables(Formula &formula);
|
||||
std::vector<VariableDeclaration *> collectFreeVariables(Formula &formula, VariableStack &variableStack);
|
||||
|
||||
bool matches(const ast::Predicate &lhs, const ast::Predicate &rhs);
|
||||
void collectPredicates(const ast::Formula &formula, std::vector<const ast::Predicate *> &predicates);
|
||||
bool matches(const Predicate &lhs, const Predicate &rhs);
|
||||
void collectPredicates(const Formula &formula, std::vector<const Predicate *> &predicates);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@@ -5,6 +5,8 @@
|
||||
|
||||
namespace anthem
|
||||
{
|
||||
namespace ast
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -12,16 +14,11 @@ namespace anthem
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace ast
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class T>
|
||||
struct RecursiveFormulaVisitor
|
||||
{
|
||||
template <class... Arguments>
|
||||
void visit(ast::And &and_, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(And &and_, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
for (auto &argument : and_.arguments)
|
||||
argument.accept(*this, argument, std::forward<Arguments>(arguments)...);
|
||||
@@ -30,7 +27,7 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Biconditional &biconditional, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Biconditional &biconditional, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
biconditional.left.accept(*this, biconditional.left, std::forward<Arguments>(arguments)...);
|
||||
biconditional.right.accept(*this, biconditional.right, std::forward<Arguments>(arguments)...);
|
||||
@@ -39,19 +36,19 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Boolean &boolean, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Boolean &boolean, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(boolean, formula, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Comparison &comparison, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Comparison &comparison, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(comparison, formula, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Exists &exists, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Exists &exists, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
exists.argument.accept(*this, exists.argument, std::forward<Arguments>(arguments)...);
|
||||
|
||||
@@ -59,7 +56,7 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::ForAll &forAll, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(ForAll &forAll, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
forAll.argument.accept(*this, forAll.argument, std::forward<Arguments>(arguments)...);
|
||||
|
||||
@@ -67,7 +64,7 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Implies &implies, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Implies &implies, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
implies.antecedent.accept(*this, implies.antecedent, std::forward<Arguments>(arguments)...);
|
||||
implies.consequent.accept(*this, implies.consequent, std::forward<Arguments>(arguments)...);
|
||||
@@ -76,13 +73,13 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::In &in, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(In &in, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(in, formula, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Not ¬_, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Not ¬_, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
not_.argument.accept(*this, not_.argument, std::forward<Arguments>(arguments)...);
|
||||
|
||||
@@ -90,7 +87,7 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Or &or_, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Or &or_, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
for (auto &argument : or_.arguments)
|
||||
argument.accept(*this, argument, std::forward<Arguments>(arguments)...);
|
||||
@@ -99,7 +96,7 @@ struct RecursiveFormulaVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Predicate &predicate, ast::Formula &formula, Arguments &&... arguments)
|
||||
void visit(Predicate &predicate, Formula &formula, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(predicate, formula, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
@@ -112,7 +109,7 @@ struct RecursiveTermVisitor
|
||||
{
|
||||
// TODO: return type is incorrect
|
||||
template <class... Arguments>
|
||||
void visit(ast::BinaryOperation &binaryOperation, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(BinaryOperation &binaryOperation, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
binaryOperation.left.accept(*this, binaryOperation.left, std::forward<Arguments>(arguments)...);
|
||||
binaryOperation.right.accept(*this, binaryOperation.left, std::forward<Arguments>(arguments)...);
|
||||
@@ -121,19 +118,19 @@ struct RecursiveTermVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Boolean &boolean, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(Boolean &boolean, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(boolean, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Constant &constant, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(Constant &constant, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(constant, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Function &function, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(Function &function, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
for (auto &argument : function.arguments)
|
||||
argument.accept(*this, argument, std::forward<Arguments>(arguments)...);
|
||||
@@ -142,13 +139,13 @@ struct RecursiveTermVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Integer &integer, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(Integer &integer, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(integer, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Interval &interval, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(Interval &interval, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
interval.from.accept(*this, interval.from, std::forward<Arguments>(arguments)...);
|
||||
interval.to.accept(*this, interval.to, std::forward<Arguments>(arguments)...);
|
||||
@@ -157,19 +154,19 @@ struct RecursiveTermVisitor
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::SpecialInteger &specialInteger, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(SpecialInteger &specialInteger, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(specialInteger, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::String &string, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(String &string, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(string, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(ast::Variable &variable, ast::Term &term, Arguments &&... arguments)
|
||||
void visit(Variable &variable, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(variable, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
Reference in New Issue
Block a user