From 21c337e0fa9f7136a1df0fc2ad6daa7c7854bea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Thu, 18 Aug 2016 00:25:47 +0200 Subject: [PATCH] Removed now obsolete ASP variable handling for PDDL. --- include/plasp/utils/Formatting.h | 25 ------------------------- src/plasp/pddl/TranslatorASP.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/include/plasp/utils/Formatting.h b/include/plasp/utils/Formatting.h index 35034cf..631f36a 100644 --- a/include/plasp/utils/Formatting.h +++ b/include/plasp/utils/Formatting.h @@ -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(std::toupper(aspVariable.name.front())) - << aspVariable.name.c_str() + 1 - << utils::ResetFormat()); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - struct String: public Token { String(const std::string &name) diff --git a/src/plasp/pddl/TranslatorASP.cpp b/src/plasp/pddl/TranslatorASP.cpp index 85ef17c..984fdd2 100644 --- a/src/plasp/pddl/TranslatorASP.cpp +++ b/src/plasp/pddl/TranslatorASP.cpp @@ -341,7 +341,7 @@ void TranslatorASP::translateVariablesHead(const expressions::Variables &variabl { 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(variable.type()); m_outputStream << utils::RuleName("has") << "(" - << utils::ASPVariable(variable.name()) << ", " + << utils::Variable(variable.name()) << ", " << utils::Keyword("type") << "(" << utils::String(type.name()) << "))"; } else { m_outputStream << utils::RuleName("has") << "(" - << utils::ASPVariable(variable.name()) << ", " + << utils::Variable(variable.name()) << ", " << utils::Keyword("type") << "(" << utils::String("object") << "))"; } } @@ -445,7 +445,7 @@ void TranslatorASP::translatePredicate(const expressions::Predicate &predicate) { const auto &variable = dynamic_cast(**i); - m_outputStream << utils::ASPVariable(variable.name()); + m_outputStream << utils::Variable(variable.name()); } else throw utils::TranslatorException("only variables and constants supported in predicates currently");