From 2ef710642bc5d4c68279f0aec3fd57c4624d6814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 23 May 2016 02:03:52 +0200 Subject: [PATCH] Fixed unescaped fluent names. --- src/plasp/sas/TranslatorASP.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plasp/sas/TranslatorASP.cpp b/src/plasp/sas/TranslatorASP.cpp index 94b320b..1e7e2ce 100644 --- a/src/plasp/sas/TranslatorASP.cpp +++ b/src/plasp/sas/TranslatorASP.cpp @@ -1,6 +1,7 @@ #include #include +#include namespace plasp { @@ -64,7 +65,7 @@ void TranslatorASP::translate(std::ostream &ostream) const ostream << "#program base." << std::endl << std::endl; - std::vector fluents; + std::vector fluents; const auto &variables = m_description.variables(); @@ -82,14 +83,14 @@ void TranslatorASP::translate(std::ostream &ostream) const const auto match = std::find_if(fluents.cbegin(), fluents.cend(), [&](const auto &fluent) { - return value.name() == *fluent; + return value.name() == fluent->name(); }); // Don’t add fluents if their negated form has already been added if (match != fluents.cend()) return; - fluents.push_back(&value.name()); + fluents.push_back(&value); }); }); @@ -130,7 +131,9 @@ void TranslatorASP::translate(std::ostream &ostream) const std::for_each(fluents.cbegin(), fluents.cend(), [&](const auto *fluent) { - ostream << "fluent(" << *fluent << ")." << std::endl; + ostream << "fluent("; + fluent->printAsASP(ostream); + ostream << ")." << std::endl; }); ostream << std::endl;