From 4cbd87c0e1ca987cf60f1beb5b7bee842b037f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 23 Nov 2016 03:51:45 +0100 Subject: [PATCH] Handling boolean head literals. --- include/anthem/Head.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/anthem/Head.h b/include/anthem/Head.h index 958c22d..29df6a2 100644 --- a/include/anthem/Head.h +++ b/include/anthem/Head.h @@ -63,9 +63,8 @@ struct TermCollectFunctionTermsVisitor struct LiteralCollectFunctionTermsVisitor { - void visit(const Clingo::AST::Boolean &, const Clingo::AST::Literal &literal, std::vector &) + void visit(const Clingo::AST::Boolean &, const Clingo::AST::Literal &, std::vector &) { - throwErrorAtLocation(literal.location, "only disjunctions of literals allowed as head literals"); } void visit(const Clingo::AST::Term &term, const Clingo::AST::Literal &, std::vector &terms) @@ -188,9 +187,9 @@ struct TermPrintSubstitutedVisitor struct LiteralPrintSubstitutedVisitor { - void visit(const Clingo::AST::Boolean &, const Clingo::AST::Literal &literal, const std::vector &) + void visit(const Clingo::AST::Boolean &boolean, const Clingo::AST::Literal &, const std::vector &) { - 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 &terms) @@ -235,7 +234,7 @@ struct HeadLiteralPrintSubstitutedVisitor if (i != disjunction.elements.cbegin()) std::cout << " or "; - conditionLiteral.literal.data.accept(LiteralPrintSubstitutedVisitor(), conditionLiteral.literal, terms); + visit(conditionLiteral.literal, headLiteral, terms); } }