mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer: Fix "task calc now+3days" error
- Fix isDuration() consuming operators, leading to evaluation errors. Previously only "task calc now + 3days" worked, now the spaces are entirely optional.
This commit is contained in:
parent
5487414003
commit
2eea7805c6
2 changed files with 12 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
|||
amount of changes that is considered dangerous (thanks to Tomas Babej).
|
||||
- Disable hooks in bash completion script. Hooks were previously able to
|
||||
abort processing or output interfering data, breaking completion.
|
||||
- Fix "task add due:tomorrow+3days" failing to work without spaces.
|
||||
|
||||
------ current release ---------------------------
|
||||
|
||||
|
|
|
@ -465,9 +465,18 @@ bool Lexer::isDate (std::string& token, Lexer::Type& type)
|
|||
// <ISO8106p> | <Duration>
|
||||
bool Lexer::isDuration (std::string& token, Lexer::Type& type)
|
||||
{
|
||||
std::size_t marker = 0;
|
||||
|
||||
std::size_t marker = _cursor;
|
||||
ISO8601p iso;
|
||||
|
||||
std::string extractedToken;
|
||||
Lexer::Type extractedType;
|
||||
if (isOperator(extractedToken, extractedType))
|
||||
{
|
||||
_cursor = marker;
|
||||
return false;
|
||||
}
|
||||
|
||||
marker = 0;
|
||||
if (iso.parse (_text.substr (_cursor), marker))
|
||||
{
|
||||
type = Lexer::Type::duration;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue