From 7293de75b02954997a2d3e311f10ad705e064292 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 9 May 2015 21:27:48 -0400 Subject: [PATCH] TW-1608: The recur/recurring report shows tasks without a recur interval - Lexer needed additional lookbehind criteria for ::isTag (thanks to Brad Collette). --- ChangeLog | 2 ++ src/Lexer.cpp | 11 +++++++---- test/lexer.t.cpp | 5 ++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ddcfa6c7..b460b5806 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ again (thanks to Jens Erat). - TW-1605 Japanese translation for Taskwarrior (thanks to Oota Toshiya). - TW-1606 scheduled.any filter (thanks to Peter Rochen). +- TW-1608 The recur/recurring report shows tasks without a recur interval + (thanks to Brad Collette). - TW-1610 Disabling GC can lead to editing the wrong task (thanks to Scott M). - The 'obfuscate' setting, if set to '1' will replace all text with 'xxx'. - POSIX file locking mechanism, eliminating platform-specific code. diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 41fb6ef9f..7cd21bdae 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -778,14 +778,17 @@ bool Lexer::isPair (std::string& token, Lexer::Type& type) //////////////////////////////////////////////////////////////////////////////// // Lexer::Type::tag -// ^ | [ +|- ] [ ]* +// ^ | '(' | ')' | +// [ +|- ] [ ]* bool Lexer::isTag (std::string& token, Lexer::Type& type) { std::size_t marker = _cursor; - // Lookbehind: ^ | - if (marker > 0 && - ! isWhitespace (_text[marker - 1])) + // Lookbehind: ^ | '(' | ')' | + if (marker > 0 && + ! isWhitespace (_text[marker - 1]) && + _text[marker - 1] != '(' && + _text[marker - 1] != ')') return false; if (_text[marker] == '+' || diff --git a/test/lexer.t.cpp b/test/lexer.t.cpp index d29b82997..890c980bc 100644 --- a/test/lexer.t.cpp +++ b/test/lexer.t.cpp @@ -36,7 +36,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (771); + UnitTest t (789); std::vector > tokens; std::string token; @@ -374,6 +374,9 @@ int main (int argc, char** argv) { "desc~pattern", { { "desc", Lexer::Type::dom }, { "~", Lexer::Type::op }, { "pattern", Lexer::Type::dom }, NO, NO }, }, + { "(+tag)", { { "(", Lexer::Type::op }, + { "+tag", Lexer::Type::tag }, + { ")", Lexer::Type::op }, NO, NO }, }, }; #define NUM_TESTS (sizeof (lexerTests) / sizeof (lexerTests[0]))