Prefix integer variables with “N”

This prefixes integer variables with “N” to distinguish them from
general variables in the output in analogy to common mathematical
notations.
This commit is contained in:
Patrick Lühne 2018-04-20 16:32:18 +02:00
parent b60c65a810
commit a2c4d87852
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 5 additions and 0 deletions

View File

@ -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";
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -35,6 +35,7 @@ struct PrintContext
std::map<const VariableDeclaration *, size_t> userVariableIDs;
std::map<const VariableDeclaration *, size_t> headVariableIDs;
std::map<const VariableDeclaration *, size_t> bodyVariableIDs;
std::map<const VariableDeclaration *, size_t> 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: