diff --git a/src/IntervalFactory.cpp b/src/IntervalFactory.cpp index f69f3960..1fce8fb8 100644 --- a/src/IntervalFactory.cpp +++ b/src/IntervalFactory.cpp @@ -29,21 +29,40 @@ #include #include -//////////////////////////////////////////////////////////////////////////////// -// Syntax: -// 'inc' [ [ '-' ]] [ '#' [ ... ]] -Interval IntervalFactory::fromSerialization (const std::string& line) +static std::vector tokenizeSerialization (const std::string& line) { - Lexer lexer (line); std::vector tokens; + + Lexer lexer (line); std::string token; Lexer::Type type; + + // When parsing the serialization, we only need the lexer to look for strings + // and words since we're not using the provided type information + lexer.noDate (); + lexer.noDuration (); + lexer.noUUID (); + lexer.noHexNumber (); + lexer.noURL (); + lexer.noPath (); + lexer.noPattern (); + lexer.noOperator (); while (lexer.token (token, type)) { tokens.push_back (Lexer::dequote (token)); } + return tokens; +} + +//////////////////////////////////////////////////////////////////////////////// +// Syntax: +// 'inc' [ [ '-' ]] [ '#' [ ... ]] +Interval IntervalFactory::fromSerialization (const std::string& line) +{ + std::vector tokens = tokenizeSerialization (line); + // Minimal requirement 'inc'. if (!tokens.empty () && tokens[0] == "inc") {