Handling boolean head literals.
This commit is contained in:
parent
bdc560869a
commit
4cbd87c0e1
@ -63,9 +63,8 @@ struct TermCollectFunctionTermsVisitor
|
|||||||
|
|
||||||
struct LiteralCollectFunctionTermsVisitor
|
struct LiteralCollectFunctionTermsVisitor
|
||||||
{
|
{
|
||||||
void visit(const Clingo::AST::Boolean &, const Clingo::AST::Literal &literal, std::vector<const Clingo::AST::Term *> &)
|
void visit(const Clingo::AST::Boolean &, const Clingo::AST::Literal &, std::vector<const Clingo::AST::Term *> &)
|
||||||
{
|
{
|
||||||
throwErrorAtLocation(literal.location, "only disjunctions of literals allowed as head literals");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(const Clingo::AST::Term &term, const Clingo::AST::Literal &, std::vector<const Clingo::AST::Term *> &terms)
|
void visit(const Clingo::AST::Term &term, const Clingo::AST::Literal &, std::vector<const Clingo::AST::Term *> &terms)
|
||||||
@ -188,9 +187,9 @@ struct TermPrintSubstitutedVisitor
|
|||||||
|
|
||||||
struct LiteralPrintSubstitutedVisitor
|
struct LiteralPrintSubstitutedVisitor
|
||||||
{
|
{
|
||||||
void visit(const Clingo::AST::Boolean &, const Clingo::AST::Literal &literal, const std::vector<const Clingo::AST::Term *> &)
|
void visit(const Clingo::AST::Boolean &boolean, const Clingo::AST::Literal &, const std::vector<const Clingo::AST::Term *> &)
|
||||||
{
|
{
|
||||||
throwErrorAtLocation(literal.location, "only disjunctions of literals allowed as head literals");
|
std::cout << (boolean.value == true ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
void visit(const Clingo::AST::Term &term, const Clingo::AST::Literal &, const std::vector<const Clingo::AST::Term *> &terms)
|
void visit(const Clingo::AST::Term &term, const Clingo::AST::Literal &, const std::vector<const Clingo::AST::Term *> &terms)
|
||||||
@ -235,7 +234,7 @@ struct HeadLiteralPrintSubstitutedVisitor
|
|||||||
if (i != disjunction.elements.cbegin())
|
if (i != disjunction.elements.cbegin())
|
||||||
std::cout << " or ";
|
std::cout << " or ";
|
||||||
|
|
||||||
conditionLiteral.literal.data.accept(LiteralPrintSubstitutedVisitor(), conditionLiteral.literal, terms);
|
visit(conditionLiteral.literal, headLiteral, terms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user