Lexer: Added 'endBoundary' requirement to ::isUUID

This commit is contained in:
Paul Beckingham
2015-07-25 17:59:40 -04:00
parent f910ce39de
commit 3e74aa51e2
2 changed files with 8 additions and 7 deletions

View File

@@ -79,7 +79,7 @@ bool Lexer::token (std::string& token, Lexer::Type& type)
isDuration (token, type) || isDuration (token, type) ||
isURL (token, type) || isURL (token, type) ||
isPair (token, type) || isPair (token, type) ||
isUUID (token, type) || isUUID (token, type, true) ||
isSet (token, type) || isSet (token, type) ||
isDOM (token, type) || isDOM (token, type) ||
isHexNumber (token, type) || isHexNumber (token, type) ||
@@ -471,7 +471,7 @@ bool Lexer::isDuration (std::string& token, Lexer::Type& type)
// XXXXXXXX- // XXXXXXXX-
// XXXXXXXX // XXXXXXXX
// Followed only by EOS, whitespace, or single character operator. // Followed only by EOS, whitespace, or single character operator.
bool Lexer::isUUID (std::string& token, Lexer::Type& type) bool Lexer::isUUID (std::string& token, Lexer::Type& type, bool endBoundary)
{ {
std::size_t marker = _cursor; std::size_t marker = _cursor;
@@ -487,10 +487,11 @@ bool Lexer::isUUID (std::string& token, Lexer::Type& type)
break; break;
} }
if (i >= uuid_min_length && if (! endBoundary ||
(_text[marker + i] == 0 || (i >= uuid_min_length &&
isWhitespace (_text[marker + i]) || (_text[marker + i] == 0 ||
isSingleCharOperator (_text[marker + i]))) isWhitespace (_text[marker + i]) ||
isSingleCharOperator (_text[marker + i]))))
{ {
token = _text.substr (_cursor, i); token = _text.substr (_cursor, i);
if (! isAllDigits (token)) if (! isAllDigits (token))

View File

@@ -89,7 +89,7 @@ public:
bool isString (std::string&, Lexer::Type&, const std::string&); bool isString (std::string&, Lexer::Type&, const std::string&);
bool isDate (std::string&, Lexer::Type&); bool isDate (std::string&, Lexer::Type&);
bool isDuration (std::string&, Lexer::Type&); bool isDuration (std::string&, Lexer::Type&);
bool isUUID (std::string&, Lexer::Type&); bool isUUID (std::string&, Lexer::Type&, bool);
bool isNumber (std::string&, Lexer::Type&); bool isNumber (std::string&, Lexer::Type&);
bool isInteger (std::string&, Lexer::Type&); bool isInteger (std::string&, Lexer::Type&);
bool isHexNumber (std::string&, Lexer::Type&); bool isHexNumber (std::string&, Lexer::Type&);