Remove Constant class
Constants are not a construct present in Clingo’s AST and were unintentionally made part of anthem’s AST. This removes the unused classes for clarity.
This commit is contained in:
parent
9a59ac17f5
commit
e15a6b2e88
@ -103,23 +103,6 @@ struct Comparison
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Constant
|
||||
{
|
||||
explicit Constant(std::string &&name)
|
||||
: name{std::move(name)}
|
||||
{
|
||||
}
|
||||
|
||||
Constant(const Constant &other) = delete;
|
||||
Constant &operator=(const Constant &other) = delete;
|
||||
Constant(Constant &&other) = default;
|
||||
Constant &operator=(Constant &&other) = default;
|
||||
|
||||
std::string name;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Function
|
||||
{
|
||||
explicit Function(std::string &&name)
|
||||
|
@ -22,7 +22,6 @@ namespace ast
|
||||
BinaryOperation prepareCopy(const BinaryOperation &other);
|
||||
Boolean prepareCopy(const Boolean &other);
|
||||
Comparison prepareCopy(const Comparison &other);
|
||||
Constant prepareCopy(const Constant &other);
|
||||
Function prepareCopy(const Function &other);
|
||||
In prepareCopy(const In &other);
|
||||
Integer prepareCopy(const Integer &other);
|
||||
|
@ -24,7 +24,6 @@ struct BinaryOperation;
|
||||
struct Biconditional;
|
||||
struct Boolean;
|
||||
struct Comparison;
|
||||
struct Constant;
|
||||
struct Exists;
|
||||
struct ForAll;
|
||||
struct Function;
|
||||
@ -63,7 +62,6 @@ using Formula = Clingo::Variant<
|
||||
using Term = Clingo::Variant<
|
||||
BinaryOperation,
|
||||
Boolean,
|
||||
Constant,
|
||||
Function,
|
||||
Integer,
|
||||
Interval,
|
||||
|
@ -123,12 +123,6 @@ struct RecursiveTermVisitor
|
||||
return T::accept(boolean, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
ReturnType visit(Constant &constant, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(constant, term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
ReturnType visit(Function &function, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
|
@ -298,18 +298,6 @@ struct TermEqualityVisitor
|
||||
: Tristate::False;
|
||||
}
|
||||
|
||||
Tristate visit(const Constant &constant, const Term &otherTerm)
|
||||
{
|
||||
if (!otherTerm.is<Constant>())
|
||||
return Tristate::Unknown;
|
||||
|
||||
const auto &otherConstant = otherTerm.get<Constant>();
|
||||
|
||||
return (constant.name == otherConstant.name)
|
||||
? Tristate::True
|
||||
: Tristate::False;
|
||||
}
|
||||
|
||||
Tristate visit(const Function &function, const Term &otherTerm)
|
||||
{
|
||||
if (!otherTerm.is<Function>())
|
||||
|
@ -137,12 +137,6 @@ struct TermSimplificationVisitor
|
||||
return T::accept(term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
SimplificationResult visit(Constant &, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
return T::accept(term, std::forward<Arguments>(arguments)...);
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
SimplificationResult visit(Function &function, Term &term, Arguments &&... arguments)
|
||||
{
|
||||
|
@ -46,7 +46,6 @@ output::ColorStream &print(output::ColorStream &stream, const BinaryOperation &b
|
||||
output::ColorStream &print(output::ColorStream &stream, const Boolean &boolean, PrintContext &printContext, bool omitParentheses = false);
|
||||
output::ColorStream &print(output::ColorStream &stream, const Comparison &comparison, PrintContext &printContext, bool omitParentheses = false);
|
||||
output::ColorStream &print(output::ColorStream &stream, Comparison::Operator operator_, PrintContext &printContext, bool omitParentheses = false);
|
||||
output::ColorStream &print(output::ColorStream &stream, const Constant &constant, PrintContext &printContext, bool omitParentheses = false);
|
||||
output::ColorStream &print(output::ColorStream &stream, const Function &function, PrintContext &printContext, bool omitParentheses = false);
|
||||
output::ColorStream &print(output::ColorStream &stream, const In &in, PrintContext &printContext, bool omitParentheses = false);
|
||||
output::ColorStream &print(output::ColorStream &stream, const Integer &integer, PrintContext &printContext, bool omitParentheses = false);
|
||||
@ -167,13 +166,6 @@ inline output::ColorStream &print(output::ColorStream &stream, const Comparison
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &print(output::ColorStream &stream, const Constant &constant, PrintContext &, bool)
|
||||
{
|
||||
return (stream << constant.name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &print(output::ColorStream &stream, const Function &function, PrintContext &printContext, bool)
|
||||
{
|
||||
stream << function.name;
|
||||
|
@ -103,13 +103,6 @@ Comparison prepareCopy(const Comparison &other)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Constant prepareCopy(const Constant &other)
|
||||
{
|
||||
return Constant(std::string(other.name));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Function prepareCopy(const Function &other)
|
||||
{
|
||||
return Function(std::string(other.name), prepareCopy(other.arguments));
|
||||
@ -293,11 +286,6 @@ struct FixDanglingVariablesInTermVisitor
|
||||
{
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(Constant &, Arguments &&...)
|
||||
{
|
||||
}
|
||||
|
||||
template <class... Arguments>
|
||||
void visit(Function &function, Arguments &&... arguments)
|
||||
{
|
||||
|
@ -150,10 +150,6 @@ struct CollectFreeVariablesVisitor
|
||||
binaryOperation.right.accept(*this, variableStack, freeVariables);
|
||||
}
|
||||
|
||||
void visit(Constant &, VariableStack &, std::vector<VariableDeclaration *> &)
|
||||
{
|
||||
}
|
||||
|
||||
void visit(Function &function, VariableStack &variableStack, std::vector<VariableDeclaration *> &freeVariables)
|
||||
{
|
||||
for (auto &argument : function.arguments)
|
||||
|
Loading…
Reference in New Issue
Block a user