mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer: Improved termination for UUID types
This commit is contained in:
parent
82802f7f47
commit
76d3efe313
1 changed files with 7 additions and 2 deletions
|
@ -66,6 +66,7 @@ bool Lexer::token (std::string& token, Lexer::Type& type)
|
||||||
|
|
||||||
// The sequence is specific, and must follow these rules:
|
// The sequence is specific, and must follow these rules:
|
||||||
// - date < duration < uuid < identifier
|
// - date < duration < uuid < identifier
|
||||||
|
// - dom < uuid
|
||||||
// - uuid < hex < number
|
// - uuid < hex < number
|
||||||
// - url < pair < identifier
|
// - url < pair < identifier
|
||||||
// - hex < number
|
// - hex < number
|
||||||
|
@ -461,6 +462,7 @@ bool Lexer::isDuration (std::string& token, Lexer::Type& type)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
marker = 0;
|
||||||
Duration dur;
|
Duration dur;
|
||||||
if (dur.parse (_text.substr (_cursor), marker))
|
if (dur.parse (_text.substr (_cursor), marker))
|
||||||
{
|
{
|
||||||
|
@ -484,7 +486,7 @@ bool Lexer::isDuration (std::string& token, Lexer::Type& type)
|
||||||
// XXXXXXXX-X
|
// XXXXXXXX-X
|
||||||
// XXXXXXXX-
|
// XXXXXXXX-
|
||||||
// XXXXXXXX
|
// XXXXXXXX
|
||||||
// Followed only by EOS, whitespace, operator or list.
|
// 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)
|
||||||
{
|
{
|
||||||
std::size_t marker = _cursor;
|
std::size_t marker = _cursor;
|
||||||
|
@ -501,7 +503,10 @@ bool Lexer::isUUID (std::string& token, Lexer::Type& type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= uuid_min_length)
|
if (i >= uuid_min_length &&
|
||||||
|
(_text[marker + i] == 0 ||
|
||||||
|
isWhitespace (_text[marker + i]) ||
|
||||||
|
isSingleCharOperator (_text[marker + i])))
|
||||||
{
|
{
|
||||||
token = _text.substr (_cursor, i);
|
token = _text.substr (_cursor, i);
|
||||||
if (! isAllDigits (token))
|
if (! isAllDigits (token))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue