mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Lexer: Migrated from ISO8601p to Duration
This commit is contained in:
parent
e20fb95a43
commit
1571981b57
1 changed files with 4 additions and 4 deletions
|
@ -29,7 +29,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <Datetime.h>
|
#include <Datetime.h>
|
||||||
#include <ISO8601.h>
|
#include <Duration.h>
|
||||||
#include <utf8.h>
|
#include <utf8.h>
|
||||||
|
|
||||||
static const std::string uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
static const std::string uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
|
||||||
|
@ -573,21 +573,21 @@ bool Lexer::isDate (std::string& token, Lexer::Type& type)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Lexer::Type::duration
|
// Lexer::Type::duration
|
||||||
// <ISO8601p> | <Duration>
|
// <Duration>
|
||||||
bool Lexer::isDuration (std::string& token, Lexer::Type& type)
|
bool Lexer::isDuration (std::string& token, Lexer::Type& type)
|
||||||
{
|
{
|
||||||
std::size_t marker = _cursor;
|
std::size_t marker = _cursor;
|
||||||
|
|
||||||
std::string extractedToken;
|
std::string extractedToken;
|
||||||
Lexer::Type extractedType;
|
Lexer::Type extractedType;
|
||||||
if (isOperator(extractedToken, extractedType))
|
if (isOperator (extractedToken, extractedType))
|
||||||
{
|
{
|
||||||
_cursor = marker;
|
_cursor = marker;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
marker = 0;
|
marker = 0;
|
||||||
ISO8601p iso;
|
Duration iso;
|
||||||
if (iso.parse (_text.substr (_cursor), marker))
|
if (iso.parse (_text.substr (_cursor), marker))
|
||||||
{
|
{
|
||||||
type = Lexer::Type::duration;
|
type = Lexer::Type::duration;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue