Removed now obsolete ASP variable handling for PDDL.
This commit is contained in:
parent
8251652445
commit
21c337e0fa
@ -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)
|
||||||
|
@ -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");
|
||||||
|
Reference in New Issue
Block a user