Moved color logging to separate library for reusing it in PDDL parser.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#ifndef __PLASP__LANGUAGE_DETECTION_H
|
||||
#define __PLASP__LANGUAGE_DETECTION_H
|
||||
|
||||
#include <plasp/Language.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/Language.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
|
||||
|
@@ -1,13 +1,11 @@
|
||||
#ifndef __PLASP__OUTPUT__TRANSLATOR_EXCEPTION_H
|
||||
#define __PLASP__OUTPUT__TRANSLATOR_EXCEPTION_H
|
||||
#ifndef __PLASP__TRANSLATOR_EXCEPTION_H
|
||||
#define __PLASP__TRANSLATOR_EXCEPTION_H
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -50,7 +48,6 @@ class TranslatorException: public std::exception
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,294 +0,0 @@
|
||||
#ifndef __PLASP__OUTPUT__COLOR_STREAM_H
|
||||
#define __PLASP__OUTPUT__COLOR_STREAM_H
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ColorStream
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ColorStream
|
||||
{
|
||||
public:
|
||||
enum class ColorPolicy
|
||||
{
|
||||
Never,
|
||||
Auto,
|
||||
Always
|
||||
};
|
||||
|
||||
private:
|
||||
using CharacterType = std::ostream::char_type;
|
||||
using TraitsType = std::ostream::traits_type;
|
||||
|
||||
public:
|
||||
ColorStream(std::ostream &stream)
|
||||
: m_stream{stream},
|
||||
m_colorPolicy{ColorPolicy::Auto}
|
||||
{
|
||||
}
|
||||
|
||||
void setColorPolicy(ColorPolicy colorPolicy)
|
||||
{
|
||||
m_colorPolicy = colorPolicy;
|
||||
}
|
||||
|
||||
bool supportsColor() const
|
||||
{
|
||||
if (m_colorPolicy == ColorPolicy::Never)
|
||||
return false;
|
||||
|
||||
if (m_colorPolicy == ColorPolicy::Always)
|
||||
return true;
|
||||
|
||||
if (&m_stream == &std::cout)
|
||||
return isatty(fileno(stdout));
|
||||
|
||||
if (&m_stream == &std::cerr)
|
||||
return isatty(fileno(stderr));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ostream &stream()
|
||||
{
|
||||
return m_stream;
|
||||
}
|
||||
|
||||
inline ColorStream &operator<<(short value);
|
||||
inline ColorStream &operator<<(unsigned short value);
|
||||
inline ColorStream &operator<<(int value);
|
||||
inline ColorStream &operator<<(unsigned int value);
|
||||
inline ColorStream &operator<<(long value);
|
||||
inline ColorStream &operator<<(unsigned long value);
|
||||
inline ColorStream &operator<<(long long value);
|
||||
inline ColorStream &operator<<(unsigned long long value);
|
||||
inline ColorStream &operator<<(float value);
|
||||
inline ColorStream &operator<<(double value);
|
||||
inline ColorStream &operator<<(long double value);
|
||||
inline ColorStream &operator<<(bool value);
|
||||
inline ColorStream &operator<<(const void *value);
|
||||
inline ColorStream &operator<<(const char *value);
|
||||
inline ColorStream &operator<<(const signed char *value);
|
||||
inline ColorStream &operator<<(const unsigned char *value);
|
||||
inline ColorStream &operator<<(std::basic_streambuf<CharacterType, TraitsType> *sb);
|
||||
inline ColorStream &operator<<(std::ios_base &(*func)(std::ios_base &));
|
||||
inline ColorStream &operator<<(std::basic_ios<CharacterType, TraitsType> &(*func)(std::basic_ios<CharacterType, TraitsType> &));
|
||||
inline ColorStream &operator<<(std::basic_ostream<CharacterType, TraitsType> &(*func)(std::basic_ostream<CharacterType, TraitsType> &));
|
||||
|
||||
inline ColorStream &operator<<(char value);
|
||||
inline ColorStream &operator<<(signed char value);
|
||||
inline ColorStream &operator<<(unsigned char value);
|
||||
|
||||
private:
|
||||
std::ostream &m_stream;
|
||||
ColorPolicy m_colorPolicy;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(short value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(unsigned short value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(int value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(unsigned int value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(long value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(unsigned long value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(long long value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(unsigned long long value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(float value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(double value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(long double value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(bool value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(const void *value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(const char *value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(const signed char *value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(const unsigned char *value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(std::basic_streambuf<CharacterType, TraitsType>* sb)
|
||||
{
|
||||
m_stream << sb;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(std::ios_base &(*func)(std::ios_base &))
|
||||
{
|
||||
m_stream << func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(std::basic_ios<CharacterType, TraitsType> &(*func)(std::basic_ios<CharacterType, TraitsType> &))
|
||||
{
|
||||
m_stream << func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(std::basic_ostream<CharacterType, TraitsType> &(*func)(std::basic_ostream<CharacterType, TraitsType> &))
|
||||
{
|
||||
m_stream << func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class CharacterType, class Traits, class Allocator>
|
||||
inline ColorStream &operator<<(ColorStream &colorStream, const std::basic_string<CharacterType, Traits, Allocator> &string)
|
||||
{
|
||||
colorStream.stream() << string;
|
||||
return colorStream;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(char value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(signed char value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ColorStream &ColorStream::operator<<(unsigned char value)
|
||||
{
|
||||
m_stream << value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,313 +0,0 @@
|
||||
#ifndef __PLASP__OUTPUT__FORMATTING_H
|
||||
#define __PLASP__OUTPUT__FORMATTING_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Formatting
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum class Color
|
||||
{
|
||||
Default = 39,
|
||||
Black = 30,
|
||||
Red = 31,
|
||||
Green = 32,
|
||||
Yellow = 33,
|
||||
Blue = 34,
|
||||
Magenta = 35,
|
||||
Cyan = 36,
|
||||
LightGray = 37,
|
||||
DarkGray = 90,
|
||||
LightRed = 91,
|
||||
LightGreen = 92,
|
||||
LightYellow = 93,
|
||||
LightBlue = 94,
|
||||
LightMagenta = 95,
|
||||
LightCyan = 96,
|
||||
White = 97
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum class FontWeight
|
||||
{
|
||||
Normal = 21,
|
||||
Bold = 1
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Format
|
||||
{
|
||||
Color color = Color::Default;
|
||||
FontWeight fontWeight = FontWeight::Normal;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Format &format)
|
||||
{
|
||||
if (!stream.supportsColor())
|
||||
return stream;
|
||||
|
||||
const auto fontWeightCode = static_cast<int>(format.fontWeight);
|
||||
const auto colorCode = static_cast<int>(format.color);
|
||||
|
||||
return (stream << "\033[" << fontWeightCode << ";" << colorCode << "m");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct ResetFormat
|
||||
{
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const ResetFormat &)
|
||||
{
|
||||
if (!stream.supportsColor())
|
||||
return stream;
|
||||
|
||||
return (stream << "\033[0m");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Function
|
||||
{
|
||||
Function(const char *name)
|
||||
: name{name}
|
||||
{
|
||||
};
|
||||
|
||||
const char *name;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Function &function)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::White, FontWeight::Normal})
|
||||
<< function.name
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Keyword
|
||||
{
|
||||
Keyword(const char *name)
|
||||
: name{name}
|
||||
{
|
||||
};
|
||||
|
||||
const char *name;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Keyword &keyword)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Blue, FontWeight::Normal})
|
||||
<< keyword.name
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Operator
|
||||
{
|
||||
Operator(const char *name)
|
||||
: name{name}
|
||||
{
|
||||
};
|
||||
|
||||
const char *name;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Operator &operator_)
|
||||
{
|
||||
return (stream << operator_.name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T>
|
||||
struct Number
|
||||
{
|
||||
Number(T value)
|
||||
: value{value}
|
||||
{
|
||||
};
|
||||
|
||||
T value;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename T>
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Number<T> &number)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Yellow, FontWeight::Normal})
|
||||
<< number.value
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Variable
|
||||
{
|
||||
Variable(const char *name)
|
||||
: name{name}
|
||||
{
|
||||
};
|
||||
|
||||
const char *name;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Variable &variable)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Green, FontWeight::Bold})
|
||||
<< variable.name
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct String
|
||||
{
|
||||
String(const char *content)
|
||||
: content{content}
|
||||
{
|
||||
};
|
||||
|
||||
const char *content;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const String &string)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Green, FontWeight::Normal})
|
||||
<< "\"" << string.content << "\""
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Boolean
|
||||
{
|
||||
Boolean(const char *value)
|
||||
: value{value}
|
||||
{
|
||||
};
|
||||
|
||||
const char *value;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Boolean &boolean)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Red, FontWeight::Normal})
|
||||
<< boolean.value
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Reserved
|
||||
{
|
||||
Reserved(const char *name)
|
||||
: name{name}
|
||||
{
|
||||
};
|
||||
|
||||
const char *name;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Reserved &reserved)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::White, FontWeight::Normal})
|
||||
<< reserved.name
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Heading1
|
||||
{
|
||||
Heading1(const char *content)
|
||||
: content{content}
|
||||
{
|
||||
};
|
||||
|
||||
const char *content;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Heading1 &heading1)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Blue, FontWeight::Bold})
|
||||
<< "%---------------------------------------" << std::endl
|
||||
<< "% " << heading1.content << std::endl
|
||||
<< "%---------------------------------------"
|
||||
<< ResetFormat()
|
||||
<< std::endl);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct Heading2
|
||||
{
|
||||
Heading2(const char *content)
|
||||
: content{content}
|
||||
{
|
||||
};
|
||||
|
||||
const char *content;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline ColorStream &operator<<(ColorStream &stream, const Heading2 &heading2)
|
||||
{
|
||||
return (stream
|
||||
<< Format({Color::Blue, FontWeight::Bold})
|
||||
<< "% " << heading2.content
|
||||
<< ResetFormat());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,56 +0,0 @@
|
||||
#ifndef __PLASP__OUTPUT__LOGGER_H
|
||||
#define __PLASP__OUTPUT__LOGGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
#include <plasp/output/Priority.h>
|
||||
|
||||
#include <tokenize/Location.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Logger
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
explicit Logger();
|
||||
explicit Logger(ColorStream &&outputStream);
|
||||
explicit Logger(ColorStream &&outputStream, ColorStream &&errorStream);
|
||||
|
||||
ColorStream &outputStream();
|
||||
ColorStream &errorStream();
|
||||
|
||||
// The priority from which on messages should be printed
|
||||
void setLogPriority(Priority logPriority);
|
||||
// Messages with this priority (or higher) will terminate the program’s execution
|
||||
void setAbortPriority(Priority abortPriority);
|
||||
void setColorPolicy(ColorStream::ColorPolicy colorPolicy);
|
||||
|
||||
void log(Priority priority, const char *message);
|
||||
void log(Priority priority, const std::string &message);
|
||||
void log(Priority priority, const tokenize::Location &location, const char *message);
|
||||
void log(Priority priority, const tokenize::Location &location, const std::string &message);
|
||||
|
||||
private:
|
||||
ColorStream m_outputStream;
|
||||
ColorStream m_errorStream;
|
||||
|
||||
Priority m_logPriority;
|
||||
Priority m_abortPriority;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,66 +0,0 @@
|
||||
#ifndef __PLASP__OUTPUT__PRIORITY_H
|
||||
#define __PLASP__OUTPUT__PRIORITY_H
|
||||
|
||||
#include <cstring>
|
||||
#include <exception>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Priority
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum class Priority
|
||||
{
|
||||
Debug,
|
||||
Info,
|
||||
Warning,
|
||||
Error
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline constexpr const char *priorityName(Priority priority)
|
||||
{
|
||||
switch (priority)
|
||||
{
|
||||
case Priority::Debug:
|
||||
return "debug";
|
||||
case Priority::Info:
|
||||
return "info";
|
||||
case Priority::Warning:
|
||||
return "warning";
|
||||
case Priority::Error:
|
||||
return "error";
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline Priority priorityFromName(const char *priorityName)
|
||||
{
|
||||
if (std::strcmp(priorityName, "debug") == 0)
|
||||
return Priority::Debug;
|
||||
if (std::strcmp(priorityName, "info") == 0)
|
||||
return Priority::Info;
|
||||
if (std::strcmp(priorityName, "warning") == 0)
|
||||
return Priority::Warning;
|
||||
if (std::strcmp(priorityName, "error") == 0)
|
||||
return Priority::Error;
|
||||
|
||||
throw std::runtime_error("unknown log priority");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,7 +1,7 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATOR_ASP_H
|
||||
#define __PLASP__PDDL__TRANSLATOR_ASP_H
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
#include <pddlparse/ASTForward.h>
|
||||
#include <pddlparse/Parse.h>
|
||||
@@ -20,7 +20,7 @@ namespace pddl
|
||||
class TranslatorASP
|
||||
{
|
||||
public:
|
||||
explicit TranslatorASP(const ::pddl::ast::Description &description, output::ColorStream &outputStream);
|
||||
explicit TranslatorASP(const ::pddl::ast::Description &description, colorlog::ColorStream &outputStream);
|
||||
|
||||
void translate() const;
|
||||
|
||||
@@ -36,7 +36,7 @@ class TranslatorASP
|
||||
void translateConstants(const std::string &heading, const ::pddl::ast::ConstantDeclarations &constants) const;
|
||||
|
||||
const ::pddl::ast::Description &m_description;
|
||||
output::ColorStream &m_outputStream;
|
||||
colorlog::ColorStream &m_outputStream;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATION__EFFECT_H
|
||||
#define __PLASP__PDDL__TRANSLATION__EFFECT_H
|
||||
|
||||
#include <colorlog/Formatting.h>
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
|
||||
#include <plasp/output/Formatting.h>
|
||||
#include <plasp/output/TranslatorException.h>
|
||||
#include <plasp/TranslatorException.h>
|
||||
|
||||
#include <plasp/pddl/translation/Predicate.h>
|
||||
#include <plasp/pddl/translation/Primitives.h>
|
||||
@@ -21,25 +22,25 @@ namespace pddl
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename PrintObjectName>
|
||||
inline void translateEffect(output::ColorStream &outputStream, const ::pddl::ast::Effect &effect, const std::string &objectType, PrintObjectName printObjectName)
|
||||
inline void translateEffect(colorlog::ColorStream &outputStream, const ::pddl::ast::Effect &effect, const std::string &objectType, PrintObjectName printObjectName)
|
||||
{
|
||||
const auto handleUnsupported =
|
||||
[](const auto &)
|
||||
{
|
||||
throw output::TranslatorException("only “and” expressions and (negated) predicates supported as action effects currently");
|
||||
throw TranslatorException("only “and” expressions and (negated) predicates supported as action effects currently");
|
||||
};
|
||||
|
||||
const auto handlePredicate =
|
||||
[&](const ::pddl::ast::PredicatePointer &predicate, bool isPositive = true)
|
||||
{
|
||||
outputStream << std::endl << output::Function("postcondition") << "(";
|
||||
outputStream << std::endl << colorlog::Function("postcondition") << "(";
|
||||
printObjectName();
|
||||
outputStream
|
||||
<< ", " << output::Keyword("effect") << "("
|
||||
<< output::Reserved("unconditional") << ")"
|
||||
<< ", " << colorlog::Keyword("effect") << "("
|
||||
<< colorlog::Reserved("unconditional") << ")"
|
||||
<< ", ";
|
||||
translatePredicateToVariable(outputStream, *predicate, isPositive);
|
||||
outputStream << ") :- " << output::Function(objectType.c_str()) << "(";
|
||||
outputStream << ") :- " << colorlog::Function(objectType.c_str()) << "(";
|
||||
printObjectName();
|
||||
outputStream << ").";
|
||||
};
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATION__GOAL_H
|
||||
#define __PLASP__PDDL__TRANSLATION__GOAL_H
|
||||
|
||||
#include <colorlog/Formatting.h>
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
|
||||
#include <plasp/output/Formatting.h>
|
||||
#include <plasp/output/TranslatorException.h>
|
||||
#include <plasp/TranslatorException.h>
|
||||
|
||||
#include <plasp/pddl/translation/Predicate.h>
|
||||
#include <plasp/pddl/translation/Primitives.h>
|
||||
@@ -20,18 +21,18 @@ namespace pddl
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline void translateGoal(output::ColorStream &outputStream, const ::pddl::ast::Goal &goal)
|
||||
inline void translateGoal(colorlog::ColorStream &outputStream, const ::pddl::ast::Goal &goal)
|
||||
{
|
||||
const auto handleUnsupported =
|
||||
[](const auto &)
|
||||
{
|
||||
throw output::TranslatorException("only “and” expressions and (negated) predicates supported as goals currently");
|
||||
throw TranslatorException("only “and” expressions and (negated) predicates supported as goals currently");
|
||||
};
|
||||
|
||||
const auto handlePredicate =
|
||||
[&](const ::pddl::ast::PredicatePointer &predicate, bool isPositive = true)
|
||||
{
|
||||
outputStream << std::endl << output::Function("goal") << "(";
|
||||
outputStream << std::endl << colorlog::Function("goal") << "(";
|
||||
// TODO: assert that goal is variable-free
|
||||
translatePredicateToVariable(outputStream, *predicate, isPositive);
|
||||
outputStream << ").";
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATION__PRECONDITION_H
|
||||
#define __PLASP__PDDL__TRANSLATION__PRECONDITION_H
|
||||
|
||||
#include <colorlog/Formatting.h>
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
|
||||
#include <plasp/output/Formatting.h>
|
||||
#include <plasp/output/TranslatorException.h>
|
||||
#include <plasp/TranslatorException.h>
|
||||
|
||||
#include <plasp/pddl/translation/Predicate.h>
|
||||
#include <plasp/pddl/translation/Primitives.h>
|
||||
@@ -21,22 +22,22 @@ namespace pddl
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<typename PrintObjectName>
|
||||
inline void translatePrecondition(output::ColorStream &outputStream, const ::pddl::ast::Precondition &precondition, const std::string &objectType, PrintObjectName printObjectName)
|
||||
inline void translatePrecondition(colorlog::ColorStream &outputStream, const ::pddl::ast::Precondition &precondition, const std::string &objectType, PrintObjectName printObjectName)
|
||||
{
|
||||
const auto handleUnsupported =
|
||||
[](const auto &)
|
||||
{
|
||||
throw output::TranslatorException("only “and” expressions and (negated) predicates supported as action preconditions currently");
|
||||
throw TranslatorException("only “and” expressions and (negated) predicates supported as action preconditions currently");
|
||||
};
|
||||
|
||||
const auto handlePredicate =
|
||||
[&](const ::pddl::ast::PredicatePointer &predicate, bool isPositive = true)
|
||||
{
|
||||
outputStream << std::endl << output::Function("precondition") << "(";
|
||||
outputStream << std::endl << colorlog::Function("precondition") << "(";
|
||||
printObjectName();
|
||||
outputStream << ", ";
|
||||
translatePredicateToVariable(outputStream, *predicate, isPositive);
|
||||
outputStream << ") :- " << output::Function(objectType.c_str()) << "(";
|
||||
outputStream << ") :- " << colorlog::Function(objectType.c_str()) << "(";
|
||||
printObjectName();
|
||||
outputStream << ").";
|
||||
};
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATION__PREDICATE_H
|
||||
#define __PLASP__PDDL__TRANSLATION__PREDICATE_H
|
||||
|
||||
#include <colorlog/Formatting.h>
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
#include <pddlparse/Parse.h>
|
||||
|
||||
#include <plasp/output/Formatting.h>
|
||||
|
||||
#include <plasp/pddl/translation/Primitives.h>
|
||||
#include <plasp/pddl/translation/Variables.h>
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace pddl
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void translatePredicate(output::ColorStream &outputStream, const ::pddl::ast::Predicate &predicate);
|
||||
void translatePredicateDeclaration(output::ColorStream &outputStream, const ::pddl::ast::PredicateDeclaration &predicateDeclaration);
|
||||
void translatePredicate(colorlog::ColorStream &outputStream, const ::pddl::ast::Predicate &predicate);
|
||||
void translatePredicateDeclaration(colorlog::ColorStream &outputStream, const ::pddl::ast::PredicateDeclaration &predicateDeclaration);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline void translatePredicate(output::ColorStream &outputStream, const ::pddl::ast::Predicate &predicate)
|
||||
inline void translatePredicate(colorlog::ColorStream &outputStream, const ::pddl::ast::Predicate &predicate)
|
||||
{
|
||||
const auto &arguments = predicate.arguments;
|
||||
|
||||
@@ -44,7 +44,7 @@ inline void translatePredicate(output::ColorStream &outputStream, const ::pddl::
|
||||
const auto handleConstant =
|
||||
[&](const ::pddl::ast::ConstantPointer &constant)
|
||||
{
|
||||
outputStream << output::Keyword("constant") << "(" << *constant << ")";
|
||||
outputStream << colorlog::Keyword("constant") << "(" << *constant << ")";
|
||||
};
|
||||
|
||||
const auto handleVariable =
|
||||
@@ -56,7 +56,7 @@ inline void translatePredicate(output::ColorStream &outputStream, const ::pddl::
|
||||
const auto handleUnsupported =
|
||||
[&](const auto &)
|
||||
{
|
||||
throw output::TranslatorException("only variables and constants supported in predicates currently");
|
||||
throw TranslatorException("only variables and constants supported in predicates currently");
|
||||
};
|
||||
|
||||
argument.match(handleConstant, handleVariable, handleUnsupported);
|
||||
@@ -67,9 +67,9 @@ inline void translatePredicate(output::ColorStream &outputStream, const ::pddl::
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline void translatePredicateDeclaration(output::ColorStream &outputStream, const ::pddl::ast::PredicateDeclaration &predicateDeclaration)
|
||||
inline void translatePredicateDeclaration(colorlog::ColorStream &outputStream, const ::pddl::ast::PredicateDeclaration &predicateDeclaration)
|
||||
{
|
||||
outputStream << output::Keyword("variable") << "(";
|
||||
outputStream << colorlog::Keyword("variable") << "(";
|
||||
|
||||
if (predicateDeclaration.parameters.empty())
|
||||
{
|
||||
@@ -84,18 +84,18 @@ inline void translatePredicateDeclaration(output::ColorStream &outputStream, con
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void translatePredicateToVariable(output::ColorStream &outputStream, const ::pddl::ast::Predicate &predicate, bool isPositive = true)
|
||||
void translatePredicateToVariable(colorlog::ColorStream &outputStream, const ::pddl::ast::Predicate &predicate, bool isPositive = true)
|
||||
{
|
||||
outputStream << output::Keyword("variable") << "(";
|
||||
outputStream << colorlog::Keyword("variable") << "(";
|
||||
translatePredicate(outputStream, predicate);
|
||||
outputStream << "), " << output::Keyword("value") << "(";
|
||||
outputStream << "), " << colorlog::Keyword("value") << "(";
|
||||
translatePredicate(outputStream, predicate);
|
||||
outputStream << ", ";
|
||||
|
||||
if (isPositive)
|
||||
outputStream << output::Boolean("true");
|
||||
outputStream << colorlog::Boolean("true");
|
||||
else
|
||||
outputStream << output::Boolean("false");
|
||||
outputStream << colorlog::Boolean("false");
|
||||
|
||||
outputStream << ")";
|
||||
}
|
||||
|
@@ -1,10 +1,11 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATION__PRIMITIVES_H
|
||||
#define __PLASP__PDDL__TRANSLATION__PRIMITIVES_H
|
||||
|
||||
#include <colorlog/Formatting.h>
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
|
||||
#include <plasp/output/Formatting.h>
|
||||
#include <plasp/output/TranslatorException.h>
|
||||
#include <plasp/TranslatorException.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
@@ -17,16 +18,16 @@ namespace pddl
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::ConstantDeclaration &constantDeclaration)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::ConstantDeclaration &constantDeclaration)
|
||||
{
|
||||
assert(!constantDeclaration.name.empty());
|
||||
|
||||
return (stream << output::String(constantDeclaration.name.c_str()));
|
||||
return (stream << colorlog::String(constantDeclaration.name.c_str()));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::Constant &constant)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::Constant &constant)
|
||||
{
|
||||
assert(constant.declaration != nullptr);
|
||||
|
||||
@@ -35,16 +36,16 @@ inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::PrimitiveTypeDeclaration &primitiveTypeDeclaration)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::PrimitiveTypeDeclaration &primitiveTypeDeclaration)
|
||||
{
|
||||
assert(!primitiveTypeDeclaration.name.empty());
|
||||
|
||||
return (stream << output::String(primitiveTypeDeclaration.name.c_str()));
|
||||
return (stream << colorlog::String(primitiveTypeDeclaration.name.c_str()));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::PrimitiveType &primitiveType)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::PrimitiveType &primitiveType)
|
||||
{
|
||||
assert(primitiveType.declaration != nullptr);
|
||||
|
||||
@@ -53,7 +54,7 @@ inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, ::pddl::ast::VariableDeclaration &variableDeclaration)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, ::pddl::ast::VariableDeclaration &variableDeclaration)
|
||||
{
|
||||
assert(!variableDeclaration.name.empty());
|
||||
assert(std::isalpha(variableDeclaration.name[0]));
|
||||
@@ -62,14 +63,14 @@ inline output::ColorStream &operator<<(output::ColorStream &stream, ::pddl::ast:
|
||||
variableDeclaration.name[0] = std::toupper(variableDeclaration.name[0]);
|
||||
|
||||
return (stream
|
||||
<< output::Format({output::Color::Green, output::FontWeight::Bold})
|
||||
<< colorlog::Format({colorlog::Color::Green, colorlog::FontWeight::Bold})
|
||||
<< variableDeclaration.name
|
||||
<< output::ResetFormat());
|
||||
<< colorlog::ResetFormat());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, ::pddl::ast::Variable &variable)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, ::pddl::ast::Variable &variable)
|
||||
{
|
||||
assert(variable.declaration != nullptr);
|
||||
|
||||
@@ -79,23 +80,23 @@ inline output::ColorStream &operator<<(output::ColorStream &stream, ::pddl::ast:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO: move to appropriate header
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::Action &action)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::Action &action)
|
||||
{
|
||||
return (stream << output::String(action.name.c_str()));
|
||||
return (stream << colorlog::String(action.name.c_str()));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO: move to appropriate header
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::PredicateDeclaration &predicateDeclaration)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::PredicateDeclaration &predicateDeclaration)
|
||||
{
|
||||
return (stream << output::String(predicateDeclaration.name.c_str()));
|
||||
return (stream << colorlog::String(predicateDeclaration.name.c_str()));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TODO: move to appropriate header
|
||||
inline output::ColorStream &operator<<(output::ColorStream &stream, const ::pddl::ast::Predicate &predicate)
|
||||
inline colorlog::ColorStream &operator<<(colorlog::ColorStream &stream, const ::pddl::ast::Predicate &predicate)
|
||||
{
|
||||
return (stream << *predicate.declaration);
|
||||
}
|
||||
|
@@ -1,11 +1,12 @@
|
||||
#ifndef __PLASP__PDDL__TRANSLATION__VARIABLES_H
|
||||
#define __PLASP__PDDL__TRANSLATION__VARIABLES_H
|
||||
|
||||
#include <colorlog/Formatting.h>
|
||||
|
||||
#include <pddlparse/AST.h>
|
||||
#include <pddlparse/Parse.h>
|
||||
|
||||
#include <plasp/output/Formatting.h>
|
||||
#include <plasp/output/TranslatorException.h>
|
||||
#include <plasp/TranslatorException.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
@@ -19,14 +20,14 @@ namespace pddl
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class T>
|
||||
void translateVariablesForRuleHead(output::ColorStream &outputStream, const T &variables);
|
||||
void translateVariablesForRuleHead(colorlog::ColorStream &outputStream, const T &variables);
|
||||
template<class T>
|
||||
void translateVariablesForRuleBody(output::ColorStream &outputStream, const T &variables);
|
||||
void translateVariablesForRuleBody(colorlog::ColorStream &outputStream, const T &variables);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class T>
|
||||
inline void translateVariablesForRuleHead(output::ColorStream &outputStream, const T &variables)
|
||||
inline void translateVariablesForRuleHead(colorlog::ColorStream &outputStream, const T &variables)
|
||||
{
|
||||
if (variables.empty())
|
||||
return;
|
||||
@@ -38,7 +39,7 @@ inline void translateVariablesForRuleHead(output::ColorStream &outputStream, con
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class T>
|
||||
inline void translateVariablesForRuleBody(output::ColorStream &outputStream, const T &variables)
|
||||
inline void translateVariablesForRuleBody(colorlog::ColorStream &outputStream, const T &variables)
|
||||
{
|
||||
if (variables.empty())
|
||||
return;
|
||||
@@ -53,18 +54,18 @@ inline void translateVariablesForRuleBody(output::ColorStream &outputStream, con
|
||||
if (variable->type)
|
||||
{
|
||||
if (!variable->type.value().template is<::pddl::ast::PrimitiveTypePointer>())
|
||||
throw output::TranslatorException("only primitive types supported currently");
|
||||
throw TranslatorException("only primitive types supported currently");
|
||||
|
||||
const auto &type = variable->type.value().template get<::pddl::ast::PrimitiveTypePointer>();
|
||||
|
||||
outputStream << output::Function("has") << "("
|
||||
<< *variable << ", " << output::Keyword("type") << "(" << *type << "))";
|
||||
outputStream << colorlog::Function("has") << "("
|
||||
<< *variable << ", " << colorlog::Keyword("type") << "(" << *type << "))";
|
||||
}
|
||||
else
|
||||
{
|
||||
outputStream << output::Function("has") << "("
|
||||
outputStream << colorlog::Function("has") << "("
|
||||
<< *variable << ", "
|
||||
<< output::Keyword("type") << "(" << output::String("object") << "))";
|
||||
<< colorlog::Keyword("type") << "(" << colorlog::String("object") << "))";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,11 +4,11 @@
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/Value.h>
|
||||
#include <plasp/sas/Variable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
#include <plasp/sas/Variable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
#include <plasp/sas/Description.h>
|
||||
|
||||
namespace plasp
|
||||
@@ -16,7 +18,7 @@ namespace sas
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
output::ColorStream &operator<<(output::ColorStream &ostream, const Description &description);
|
||||
colorlog::ColorStream &operator<<(colorlog::ColorStream &ostream, const Description &description);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@@ -6,6 +6,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/AxiomRule.h>
|
||||
#include <plasp/sas/Goal.h>
|
||||
#include <plasp/sas/InitialState.h>
|
||||
@@ -13,8 +15,6 @@
|
||||
#include <plasp/sas/Operator.h>
|
||||
#include <plasp/sas/Variable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
#include <plasp/sas/Variable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#ifndef __PLASP__SAS__GOAL_H
|
||||
#define __PLASP__SAS__GOAL_H
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#ifndef __PLASP__SAS__INITIAL_STATE_H
|
||||
#define __PLASP__SAS__INITIAL_STATE_H
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -3,10 +3,10 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
@@ -4,13 +4,15 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
#include <plasp/sas/AssignedVariable.h>
|
||||
#include <plasp/sas/Effect.h>
|
||||
#include <plasp/sas/Predicate.h>
|
||||
#include <plasp/sas/Variable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
@@ -37,7 +39,7 @@ class Operator
|
||||
static Operator fromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
|
||||
|
||||
public:
|
||||
void printPredicateAsASP(output::ColorStream &stream) const;
|
||||
void printPredicateAsASP(colorlog::ColorStream &stream) const;
|
||||
|
||||
const Predicate &predicate() const;
|
||||
const Conditions &preconditions() const;
|
||||
|
@@ -5,10 +5,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
@@ -28,8 +28,8 @@ class Predicate
|
||||
using Arguments = std::vector<std::string>;
|
||||
|
||||
public:
|
||||
void printAsSAS(output::ColorStream &stream) const;
|
||||
void printAsASP(output::ColorStream &stream) const;
|
||||
void printAsSAS(colorlog::ColorStream &stream) const;
|
||||
void printAsASP(colorlog::ColorStream &stream) const;
|
||||
|
||||
const std::string &name() const;
|
||||
const Arguments &arguments() const;
|
||||
|
@@ -3,7 +3,8 @@
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
#include <plasp/sas/Description.h>
|
||||
|
||||
namespace plasp
|
||||
@@ -20,7 +21,7 @@ namespace sas
|
||||
class TranslatorASP
|
||||
{
|
||||
public:
|
||||
explicit TranslatorASP(const Description &description, output::ColorStream &outputStream);
|
||||
explicit TranslatorASP(const Description &description, colorlog::ColorStream &outputStream);
|
||||
|
||||
void translate() const;
|
||||
|
||||
@@ -34,7 +35,7 @@ class TranslatorASP
|
||||
void translateAxiomRules() const;
|
||||
|
||||
const Description &m_description;
|
||||
output::ColorStream &m_outputStream;
|
||||
colorlog::ColorStream &m_outputStream;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -5,10 +5,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
@@ -46,8 +46,8 @@ struct Value
|
||||
public:
|
||||
Value negated() const;
|
||||
|
||||
void printAsSAS(output::ColorStream &stream) const;
|
||||
void printAsASPPredicate(output::ColorStream &stream) const;
|
||||
void printAsSAS(colorlog::ColorStream &stream) const;
|
||||
void printAsASPPredicate(colorlog::ColorStream &stream) const;
|
||||
|
||||
Sign sign() const;
|
||||
const std::string &name() const;
|
||||
|
@@ -5,11 +5,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <plasp/output/ColorStream.h>
|
||||
#include <plasp/sas/Value.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <colorlog/ColorStream.h>
|
||||
|
||||
#include <plasp/sas/Value.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
@@ -33,7 +34,7 @@ class Variable
|
||||
static const Variable &referenceFromSAS(tokenize::Tokenizer<> &tokenizer, const Variables &variables);
|
||||
|
||||
public:
|
||||
void printNameAsASPPredicate(output::ColorStream &outputStream) const;
|
||||
void printNameAsASPPredicate(colorlog::ColorStream &outputStream) const;
|
||||
|
||||
const std::string &name() const;
|
||||
int axiomLayer() const;
|
||||
|
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
#include <plasp/sas/Value.h>
|
||||
#include <plasp/sas/Variable.h>
|
||||
|
||||
#include <tokenize/Tokenizer.h>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
|
Reference in New Issue
Block a user