Lexer: Removed ::isoEnabled, which belongs in ISO8601{d,p}

This commit is contained in:
Paul Beckingham
2015-10-04 11:11:48 -04:00
parent 61e494195a
commit d4abae0f70
3 changed files with 8 additions and 13 deletions

View File

@@ -632,8 +632,8 @@ void Context::staticInitialization ()
Task::searchCaseSensitive = Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive"); Task::searchCaseSensitive = Variant::searchCaseSensitive = config.getBoolean ("search.case.sensitive");
Task::regex = Variant::searchUsingRegex = config.getBoolean ("regex"); Task::regex = Variant::searchUsingRegex = config.getBoolean ("regex");
Lexer::dateFormat = Variant::dateFormat = config.get ("dateformat"); Lexer::dateFormat = Variant::dateFormat = config.get ("dateformat");
Lexer::isoEnabled = Variant::isoEnabled = config.getBoolean ("date.iso");
ISO8601p::isoEnabled = ISO8601d::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"); TDB2::debug_mode = config.getBoolean ("debug");

View File

@@ -34,7 +34,6 @@ static const std::string uuid_pattern = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
static const unsigned int uuid_min_length = 8; static const unsigned int uuid_min_length = 8;
std::string Lexer::dateFormat = ""; std::string Lexer::dateFormat = "";
bool Lexer::isoEnabled = true;
std::string::size_type Lexer::minimumMatchLength = 3; std::string::size_type Lexer::minimumMatchLength = 3;
std::map <std::string, std::string> Lexer::attributes; std::map <std::string, std::string> 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) bool Lexer::isDate (std::string& token, Lexer::Type& type)
{ {
// Try an ISO date parse. // 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; type = Lexer::Type::date;
ISO8601d iso; token = _text.substr (_cursor, iso_i);
if (iso.parse (_text.substr (_cursor), iso_i, Lexer::dateFormat)) _cursor += iso_i;
{ return true;
type = Lexer::Type::date;
token = _text.substr (_cursor, iso_i);
_cursor += iso_i;
return true;
}
} }
return false; return false;

View File

@@ -40,7 +40,6 @@ class Lexer
public: public:
// These are overridable. // These are overridable.
static std::string dateFormat; static std::string dateFormat;
static bool isoEnabled;
static std::string::size_type minimumMatchLength; static std::string::size_type minimumMatchLength;
static std::map <std::string, std::string> attributes; static std::map <std::string, std::string> attributes;