From a2c4d87852dd7f9b452ba47a2c2d65fc4ea480ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 20 Apr 2018 16:32:18 +0200 Subject: [PATCH] =?UTF-8?q?Prefix=20integer=20variables=20with=20=E2=80=9C?= =?UTF-8?q?N=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prefixes integer variables with ā€œNā€ to distinguish them from general variables in the output in analogy to common mathematical notations. --- include/anthem/Utils.h | 1 + include/anthem/output/AST.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/anthem/Utils.h b/include/anthem/Utils.h index f10f1f5..2f6456e 100644 --- a/include/anthem/Utils.h +++ b/include/anthem/Utils.h @@ -13,6 +13,7 @@ namespace anthem constexpr const auto HeadVariablePrefix = "V"; constexpr const auto BodyVariablePrefix = "X"; constexpr const auto UserVariablePrefix = "U"; +constexpr const auto IntegerVariablePrefix = "N"; //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/anthem/output/AST.h b/include/anthem/output/AST.h index 7aa1957..20e04eb 100644 --- a/include/anthem/output/AST.h +++ b/include/anthem/output/AST.h @@ -35,6 +35,7 @@ struct PrintContext std::map userVariableIDs; std::map headVariableIDs; std::map bodyVariableIDs; + std::map integerVariableIDs; const Context &context; }; @@ -339,6 +340,9 @@ inline output::ColorStream &print(output::ColorStream &stream, const VariableDec return (stream << output::Variable(variableName.c_str())); }; + if (variableDeclaration.domain == Domain::Integer) + return printVariableDeclaration(IntegerVariablePrefix, printContext.integerVariableIDs); + switch (variableDeclaration.type) { case VariableDeclaration::Type::UserDefined: