- Added a new date parse method that indicates the length of the parsed item,
  and does not require Nibbler::depletion.
This commit is contained in:
Paul Beckingham
2014-06-29 22:16:44 -04:00
parent 17ffe3d222
commit 0c0e36993d
3 changed files with 59 additions and 16 deletions

View File

@@ -660,17 +660,10 @@ bool Lexer::is_date (std::string& result)
{
try
{
// TODO Why stop at the space? This seems wrong.
std::string::size_type legacy_i = _input.find (' ', _i);
if (legacy_i == std::string::npos)
legacy_i = _input.length ();
std::string legacy_result = _input.substr (_shift_counter, legacy_i - _shift_counter);
Date legacyDate (legacy_result, Lexer::dateFormat, false, false, false);
legacy_i -= _shift_counter;
std::string::size_type legacy_i = 0;
Date legacyDate (_input.substr (_shift_counter), legacy_i, Lexer::dateFormat, false, false);
result = _input.substr (_shift_counter, legacy_i);
while (legacy_i--) shift ();
result = legacy_result;
return true;
}