Fixed parsing issue with unexpected whitespaces in SAS files.
This commit is contained in:
parent
9447912fbf
commit
76f8df13fc
@ -5,6 +5,7 @@
|
||||
Bug Fixes:
|
||||
|
||||
* fixes incorrect output format of conditional effects with SAS
|
||||
* fixes parsing issue with unexpected whitespaces in SAS files
|
||||
|
||||
## 3.0.2 (2016-08-18)
|
||||
|
||||
|
@ -27,6 +27,11 @@ class PDDLParserPolicy
|
||||
return std::iswspace(c);
|
||||
}
|
||||
|
||||
static bool isBlankCharacter(char c)
|
||||
{
|
||||
return std::isblank(c);
|
||||
}
|
||||
|
||||
static bool isIdentifierCharacter(char c)
|
||||
{
|
||||
return c != '?'
|
||||
|
@ -72,6 +72,7 @@ class Parser: public Stream, public ParserPolicy
|
||||
std::string parseLine();
|
||||
|
||||
void skipWhiteSpace();
|
||||
void skipBlankSpace();
|
||||
void skipLine();
|
||||
|
||||
private:
|
||||
@ -124,6 +125,17 @@ void Parser<ParserPolicy>::skipWhiteSpace()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class ParserPolicy>
|
||||
void Parser<ParserPolicy>::skipBlankSpace()
|
||||
{
|
||||
check();
|
||||
|
||||
while (!atEnd() && ParserPolicy::isBlankCharacter(currentCharacter()))
|
||||
advance();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<class ParserPolicy>
|
||||
void Parser<ParserPolicy>::skipLine()
|
||||
{
|
||||
|
@ -27,6 +27,11 @@ class CaseSensitiveParserPolicy
|
||||
return std::iswspace(c);
|
||||
}
|
||||
|
||||
static bool isBlankCharacter(char c)
|
||||
{
|
||||
return std::isblank(c);
|
||||
}
|
||||
|
||||
static bool isIdentifierCharacter(char c)
|
||||
{
|
||||
return std::isgraph(c);
|
||||
@ -48,6 +53,11 @@ class CaseInsensitiveParserPolicy
|
||||
return std::iswspace(c);
|
||||
}
|
||||
|
||||
static bool isBlankCharacter(char c)
|
||||
{
|
||||
return std::isblank(c);
|
||||
}
|
||||
|
||||
static bool isIdentifierCharacter(char c)
|
||||
{
|
||||
return std::isgraph(c);
|
||||
|
@ -30,14 +30,10 @@ Predicate Predicate::fromSAS(utils::Parser<> &parser)
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Parse arguments until reaching newline
|
||||
// TODO: reimplement
|
||||
/*parser.skipWhiteSpace(
|
||||
[&](const auto character)
|
||||
{
|
||||
return character != '\n' && std::isspace(character);
|
||||
});*/
|
||||
// Skip whitespace but not newlines
|
||||
parser.skipBlankSpace();
|
||||
|
||||
// TODO: check \r handling
|
||||
if (parser.currentCharacter() == '\n')
|
||||
break;
|
||||
|
||||
|
@ -111,6 +111,8 @@ TEST_F(SASParserTests, ParseValidSASFile)
|
||||
{
|
||||
FAIL() << e.what();
|
||||
}
|
||||
|
||||
// TODO: add whitespace test
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user