2016-05-24 16:03:08 +02:00
|
|
|
#ifndef __PLASP__SAS__VALUE_H
|
|
|
|
#define __PLASP__SAS__VALUE_H
|
2016-05-20 15:29:24 +02:00
|
|
|
|
2016-05-21 01:17:17 +02:00
|
|
|
#include <iosfwd>
|
2016-05-20 15:29:24 +02:00
|
|
|
#include <string>
|
2016-05-21 15:54:03 +02:00
|
|
|
#include <vector>
|
2016-05-20 15:29:24 +02:00
|
|
|
|
2017-05-12 14:17:57 +02:00
|
|
|
#include <tokenize/Tokenizer.h>
|
2017-05-09 15:05:59 +02:00
|
|
|
|
2017-06-22 20:58:31 +02:00
|
|
|
#include <colorlog/ColorStream.h>
|
|
|
|
|
2016-05-20 15:29:24 +02:00
|
|
|
namespace plasp
|
|
|
|
{
|
|
|
|
namespace sas
|
|
|
|
{
|
|
|
|
|
2016-05-21 17:09:55 +02:00
|
|
|
// Forward declarations
|
|
|
|
class Variable;
|
|
|
|
|
2016-05-20 15:29:24 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Value
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-05-22 14:24:38 +02:00
|
|
|
struct Value;
|
|
|
|
using Values = std::vector<Value>;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-05-20 15:29:24 +02:00
|
|
|
struct Value
|
|
|
|
{
|
2016-05-21 16:22:40 +02:00
|
|
|
public:
|
|
|
|
enum class Sign
|
|
|
|
{
|
|
|
|
Positive,
|
|
|
|
Negative
|
|
|
|
};
|
2016-05-21 01:17:17 +02:00
|
|
|
|
2016-05-21 16:22:40 +02:00
|
|
|
static const Value Any;
|
2016-05-23 01:27:28 +02:00
|
|
|
static const Value None;
|
2016-05-20 15:29:24 +02:00
|
|
|
|
2017-05-12 14:17:57 +02:00
|
|
|
static Value fromSAS(tokenize::Tokenizer<> &tokenizer);
|
|
|
|
static const Value &referenceFromSAS(tokenize::Tokenizer<> &tokenizer, const Variable &variable);
|
2016-05-20 15:29:24 +02:00
|
|
|
|
2016-05-21 16:22:40 +02:00
|
|
|
public:
|
2016-05-23 01:02:45 +02:00
|
|
|
Value negated() const;
|
|
|
|
|
2017-06-22 20:58:31 +02:00
|
|
|
void printAsSAS(colorlog::ColorStream &stream) const;
|
|
|
|
void printAsASPPredicate(colorlog::ColorStream &stream) const;
|
2016-05-20 15:29:24 +02:00
|
|
|
|
2016-05-21 16:22:40 +02:00
|
|
|
Sign sign() const;
|
|
|
|
const std::string &name() const;
|
|
|
|
|
|
|
|
private:
|
2016-05-23 01:27:28 +02:00
|
|
|
static const Value reserved(const std::string &name);
|
2016-05-21 16:22:40 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Value();
|
|
|
|
|
|
|
|
Sign m_sign;
|
|
|
|
std::string m_name;
|
2016-05-21 16:27:30 +02:00
|
|
|
bool m_hasArguments;
|
2016-05-21 16:22:40 +02:00
|
|
|
};
|
2016-05-21 15:54:03 +02:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-05-23 01:27:28 +02:00
|
|
|
bool operator ==(const Value &value1, const Value &value2);
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-05-20 15:29:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|