Parsing <none of those> values in SAS files.
This commit is contained in:
@@ -16,18 +16,19 @@ namespace sas
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const Value Value::any()
|
||||
const Value Value::reserved(const std::string &name)
|
||||
{
|
||||
Value any;
|
||||
|
||||
any.m_name = "(any)";
|
||||
any.m_name = name;
|
||||
|
||||
return any;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const Value Value::Any = Value::any();
|
||||
const Value Value::Any = Value::reserved("(any)");
|
||||
const Value Value::None = Value::reserved("(none)");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -54,10 +55,19 @@ Value Value::negated() const
|
||||
|
||||
Value Value::fromSAS(std::istream &istream)
|
||||
{
|
||||
Value value;
|
||||
|
||||
const auto sasSign = utils::parse<std::string>(istream);
|
||||
|
||||
if (sasSign == "<none")
|
||||
{
|
||||
utils::parseExpected<std::string>(istream, "of");
|
||||
utils::parseExpected<std::string>(istream, "those>");
|
||||
|
||||
// TODO: do not return a copy of Value::None
|
||||
return Value::None;
|
||||
}
|
||||
|
||||
Value value;
|
||||
|
||||
if (sasSign == "Atom")
|
||||
value.m_sign = Value::Sign::Positive;
|
||||
else if (sasSign == "NegatedAtom")
|
||||
@@ -148,5 +158,18 @@ void Value::printAsSAS(std::ostream &ostream) const
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool operator ==(const Value &value1, const Value &value2)
|
||||
{
|
||||
if (value1.sign() != value2.sign())
|
||||
return false;
|
||||
|
||||
if (value1.name() != value2.name())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user