mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer
- Added downgrade from typeNumber to typeIdentifer if a number is followed by a letter, thus supporting "9th" as an identifier. This causes much breakage.
This commit is contained in:
parent
f316413139
commit
4041639e36
1 changed files with 20 additions and 11 deletions
|
@ -124,19 +124,22 @@ bool Lexer::token (std::string& result, Type& type)
|
||||||
// Try a legacy rc.dateformat parse here.
|
// Try a legacy rc.dateformat parse here.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::string::size_type start = _i < 4 ? 0 : _i - 4;
|
if (Lexer::dateFormat != "")
|
||||||
std::string::size_type space = _input.find (' ', _i);
|
{
|
||||||
if (space == std::string::npos)
|
std::string::size_type start = _i < 4 ? 0 : _i - 4;
|
||||||
space = _input.length ();
|
std::string::size_type space = _input.find (' ', _i);
|
||||||
|
if (space == std::string::npos)
|
||||||
|
space = _input.length ();
|
||||||
|
|
||||||
std::string legacy = _input.substr (start, space - start);
|
std::string legacy = _input.substr (start, space - start);
|
||||||
Date legacyDate (legacy, Lexer::dateFormat, true, false);
|
Date legacyDate (legacy, Lexer::dateFormat, true, false);
|
||||||
|
|
||||||
space -= start;
|
space -= start;
|
||||||
while (space--) shift ();
|
while (space--) shift ();
|
||||||
result = legacy;
|
result = legacy;
|
||||||
type = typeDate;
|
type = typeDate;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (...) { /* Never mind. */ }
|
catch (...) { /* Never mind. */ }
|
||||||
|
@ -345,6 +348,12 @@ bool Lexer::token (std::string& result, Type& type)
|
||||||
result += utf8_character (_n0);
|
result += utf8_character (_n0);
|
||||||
shift ();
|
shift ();
|
||||||
}
|
}
|
||||||
|
else if (is_ident_start (_n0))
|
||||||
|
{
|
||||||
|
type = typeIdentifier;
|
||||||
|
result += utf8_character (_n0);
|
||||||
|
shift ();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue