Escaping predicates containing hyphens for ASP output.

This commit is contained in:
2016-05-22 20:19:45 +02:00
parent 4258dfcfd0
commit d8d6998936
4 changed files with 48 additions and 5 deletions

View File

@@ -85,18 +85,18 @@ void Predicate::printAsASP(std::ostream &ostream) const
{
if (m_arguments.empty())
{
ostream << m_name;
ostream << utils::escapeASP(m_name);
return;
}
ostream << m_name << "(";
ostream << utils::escapeASP(m_name) << "(";
for (size_t i = 0; i < m_arguments.size(); i++)
{
if (i > 0)
ostream << ", ";
ostream << m_arguments[i];
ostream << utils::escapeASP(m_arguments[i]);
}
ostream << ")";

View File

@@ -108,14 +108,14 @@ void Value::printAsASP(std::ostream &ostream) const
if (m_sign == Value::Sign::Negative)
ostream << "not ";
ostream << m_name;
ostream << utils::escapeASP(m_name);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Value::printAsASPCommaSeparated(std::ostream &ostream) const
{
ostream << m_name << ", " << (m_sign == Sign::Positive ? "true" : "false");
ostream << utils::escapeASP(m_name) << ", " << (m_sign == Sign::Positive ? "true" : "false");
}
////////////////////////////////////////////////////////////////////////////////////////////////////