Removed now obsolete ASP variable handling for PDDL.

This commit is contained in:
Patrick Lühne 2016-08-18 00:25:47 +02:00
parent 8251652445
commit 21c337e0fa
2 changed files with 4 additions and 29 deletions

View File

@ -172,31 +172,6 @@ inline LogStream &operator<<(LogStream &stream, const Variable &variable)
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
struct ASPVariable: public Token
{
ASPVariable(const std::string &name)
: Token(name)
{
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////
inline LogStream &operator<<(LogStream &stream, const ASPVariable &aspVariable)
{
if (aspVariable.name.empty())
return stream;
// TODO: check that char cast is safe
return (stream
<< utils::Format(utils::Color::Green, utils::FontWeight::Bold)
<< static_cast<char>(std::toupper(aspVariable.name.front()))
<< aspVariable.name.c_str() + 1
<< utils::ResetFormat());
}
////////////////////////////////////////////////////////////////////////////////////////////////////
struct String: public Token struct String: public Token
{ {
String(const std::string &name) String(const std::string &name)

View File

@ -341,7 +341,7 @@ void TranslatorASP::translateVariablesHead(const expressions::Variables &variabl
{ {
const auto &variable = **i; const auto &variable = **i;
m_outputStream << ", " << utils::ASPVariable(variable.name()); m_outputStream << ", " << utils::Variable(variable.name());
} }
} }
@ -369,13 +369,13 @@ void TranslatorASP::translateVariablesBody(const expressions::Variables &variabl
const auto &type = *dynamic_cast<const expressions::PrimitiveType *>(variable.type()); const auto &type = *dynamic_cast<const expressions::PrimitiveType *>(variable.type());
m_outputStream << utils::RuleName("has") << "(" m_outputStream << utils::RuleName("has") << "("
<< utils::ASPVariable(variable.name()) << ", " << utils::Variable(variable.name()) << ", "
<< utils::Keyword("type") << "(" << utils::String(type.name()) << "))"; << utils::Keyword("type") << "(" << utils::String(type.name()) << "))";
} }
else else
{ {
m_outputStream << utils::RuleName("has") << "(" m_outputStream << utils::RuleName("has") << "("
<< utils::ASPVariable(variable.name()) << ", " << utils::Variable(variable.name()) << ", "
<< utils::Keyword("type") << "(" << utils::String("object") << "))"; << utils::Keyword("type") << "(" << utils::String("object") << "))";
} }
} }
@ -445,7 +445,7 @@ void TranslatorASP::translatePredicate(const expressions::Predicate &predicate)
{ {
const auto &variable = dynamic_cast<const expressions::Variable &>(**i); const auto &variable = dynamic_cast<const expressions::Variable &>(**i);
m_outputStream << utils::ASPVariable(variable.name()); m_outputStream << utils::Variable(variable.name());
} }
else else
throw utils::TranslatorException("only variables and constants supported in predicates currently"); throw utils::TranslatorException("only variables and constants supported in predicates currently");