From 3e74aa51e2e7bffc4778c6d8f1fdfc7a3fa6d727 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 25 Jul 2015 17:59:40 -0400 Subject: [PATCH] Lexer: Added 'endBoundary' requirement to ::isUUID --- src/Lexer.cpp | 13 +++++++------ src/Lexer.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 3aebd314f..5e6b8e400 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -79,7 +79,7 @@ bool Lexer::token (std::string& token, Lexer::Type& type) isDuration (token, type) || isURL (token, type) || isPair (token, type) || - isUUID (token, type) || + isUUID (token, type, true) || isSet (token, type) || isDOM (token, type) || isHexNumber (token, type) || @@ -471,7 +471,7 @@ bool Lexer::isDuration (std::string& token, Lexer::Type& type) // XXXXXXXX- // XXXXXXXX // 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; @@ -487,10 +487,11 @@ bool Lexer::isUUID (std::string& token, Lexer::Type& type) break; } - if (i >= uuid_min_length && - (_text[marker + i] == 0 || - isWhitespace (_text[marker + i]) || - isSingleCharOperator (_text[marker + i]))) + if (! endBoundary || + (i >= uuid_min_length && + (_text[marker + i] == 0 || + isWhitespace (_text[marker + i]) || + isSingleCharOperator (_text[marker + i])))) { token = _text.substr (_cursor, i); if (! isAllDigits (token)) diff --git a/src/Lexer.h b/src/Lexer.h index 3caad292a..b6b806dc3 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -89,7 +89,7 @@ public: bool isString (std::string&, Lexer::Type&, const std::string&); bool isDate (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 isInteger (std::string&, Lexer::Type&); bool isHexNumber (std::string&, Lexer::Type&);