Minor restructuring.
This commit is contained in:
parent
70cb79b233
commit
71e6e4107a
@ -36,8 +36,6 @@ struct StatementVisitor
|
||||
rule.head.data.accept(HeadLiteralCollectFunctionTermsVisitor(), rule.head, context);
|
||||
|
||||
// Print auxiliary variables replacing the head atom’s arguments
|
||||
if (!context.headTerms.empty())
|
||||
{
|
||||
for (auto i = context.headTerms.cbegin(); i != context.headTerms.cend(); i++)
|
||||
{
|
||||
const auto &headTerm = **i;
|
||||
@ -51,12 +49,7 @@ struct StatementVisitor
|
||||
<< output::Variable(variableName.c_str())
|
||||
<< " " << output::Keyword("in") << " " << headTerm;
|
||||
}
|
||||
}
|
||||
|
||||
if (rule.body.empty() && context.headTerms.empty() && !context.isChoiceRule)
|
||||
outputStream << Clingo::AST::Boolean({true});
|
||||
else
|
||||
{
|
||||
// Print translated body literals
|
||||
for (auto i = rule.body.cbegin(); i != rule.body.cend(); i++)
|
||||
{
|
||||
@ -70,7 +63,6 @@ struct StatementVisitor
|
||||
|
||||
bodyLiteral.data.accept(BodyLiteralPrintVisitor(), bodyLiteral, context);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle choice rules
|
||||
if (context.isChoiceRule)
|
||||
@ -89,6 +81,10 @@ struct StatementVisitor
|
||||
outputStream << ")";
|
||||
}
|
||||
|
||||
// Print “true” on the left side of the formula in case there is nothing else
|
||||
if (rule.body.empty() && context.headTerms.empty() && !context.isChoiceRule)
|
||||
outputStream << Clingo::AST::Boolean({true});
|
||||
|
||||
outputStream << " " << output::Operator("->") << " ";
|
||||
|
||||
// Print consequent of the implication
|
||||
|
Loading…
Reference in New Issue
Block a user