From d4abae0f70baa764e33bbd2da16d4029a7495667 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 4 Oct 2015 11:11:48 -0400 Subject: [PATCH] Lexer: Removed ::isoEnabled, which belongs in ISO8601{d,p} --- src/Context.cpp | 2 +- src/Lexer.cpp | 18 +++++++----------- src/Lexer.h | 1 - 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 703ff8407..8b4abc7cf 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -632,8 +632,8 @@ void Context::staticInitialization () Task::searchCaseSensitive = Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive"); Task::regex = Variant::searchUsingRegex = config.getBoolean ("regex"); Lexer::dateFormat = Variant::dateFormat = config.get ("dateformat"); - Lexer::isoEnabled = Variant::isoEnabled = config.getBoolean ("date.iso"); ISO8601p::isoEnabled = ISO8601d::isoEnabled = config.getBoolean ("date.iso"); + Variant::isoEnabled = config.getBoolean ("date.iso"); TDB2::debug_mode = config.getBoolean ("debug"); diff --git a/src/Lexer.cpp b/src/Lexer.cpp index b0e210ce2..2c7f04df3 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -34,7 +34,6 @@ static const std::string uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; static const unsigned int uuid_min_length = 8; std::string Lexer::dateFormat = ""; -bool Lexer::isoEnabled = true; std::string::size_type Lexer::minimumMatchLength = 3; std::map Lexer::attributes; @@ -435,17 +434,14 @@ bool Lexer::isString (std::string& token, Lexer::Type& type, const std::string& bool Lexer::isDate (std::string& token, Lexer::Type& type) { // Try an ISO date parse. - if (Lexer::isoEnabled) + std::size_t iso_i = 0; + ISO8601d iso; + if (iso.parse (_text.substr (_cursor), iso_i, Lexer::dateFormat)) { - std::size_t iso_i = 0; - ISO8601d iso; - if (iso.parse (_text.substr (_cursor), iso_i, Lexer::dateFormat)) - { - type = Lexer::Type::date; - token = _text.substr (_cursor, iso_i); - _cursor += iso_i; - return true; - } + type = Lexer::Type::date; + token = _text.substr (_cursor, iso_i); + _cursor += iso_i; + return true; } return false; diff --git a/src/Lexer.h b/src/Lexer.h index 1cb7aab0c..9aa510596 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -40,7 +40,6 @@ class Lexer public: // These are overridable. static std::string dateFormat; - static bool isoEnabled; static std::string::size_type minimumMatchLength; static std::map attributes;