mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer: Added comments
This commit is contained in:
parent
11dab68fce
commit
289780c8cc
2 changed files with 5 additions and 5 deletions
|
@ -713,7 +713,7 @@ void CLI::addArg (const std::string& arg, Lexer::Type type /* = Lexer::Type::wor
|
||||||
}
|
}
|
||||||
|
|
||||||
// The argument may require lexing. Lex anyway, and analyze before comitting
|
// The argument may require lexing. Lex anyway, and analyze before comitting
|
||||||
// that.
|
// to that.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Lex each remaining argument. The apply a series of disqualifying tests
|
// Lex each remaining argument. The apply a series of disqualifying tests
|
||||||
|
|
|
@ -608,6 +608,7 @@ bool Lexer::isNumber (std::string& token, Lexer::Type& type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lookahread: !<isWhitespace> | !<isSingleCharOperator>
|
||||||
// If there is an immediately consecutive character, that is not an operator, fail.
|
// If there is an immediately consecutive character, that is not an operator, fail.
|
||||||
if (_eos > marker &&
|
if (_eos > marker &&
|
||||||
! isWhitespace (_text[marker]) &&
|
! isWhitespace (_text[marker]) &&
|
||||||
|
@ -753,9 +754,7 @@ bool Lexer::isTag (std::string& token, Lexer::Type& type)
|
||||||
{
|
{
|
||||||
std::size_t marker = _cursor;
|
std::size_t marker = _cursor;
|
||||||
|
|
||||||
// This test requires a tag to have a preceding space or start a string.
|
// Lookbehind: ^ | <isWhiteSpace>
|
||||||
// bad: 'a+b' --> identifier tag
|
|
||||||
// good: 'a+b' --> identifier op identifier
|
|
||||||
if (marker > 0 &&
|
if (marker > 0 &&
|
||||||
! isWhitespace (_text[marker - 1]))
|
! isWhitespace (_text[marker - 1]))
|
||||||
return false;
|
return false;
|
||||||
|
@ -844,6 +843,7 @@ bool Lexer::isSubstitution (std::string& token, Lexer::Type& type)
|
||||||
if (_text[_cursor] == 'g')
|
if (_text[_cursor] == 'g')
|
||||||
++_cursor;
|
++_cursor;
|
||||||
|
|
||||||
|
// Lookahread: <isWhitespace>
|
||||||
if (isWhitespace (_text[_cursor]))
|
if (isWhitespace (_text[_cursor]))
|
||||||
{
|
{
|
||||||
token = _text.substr (marker, _cursor - marker);
|
token = _text.substr (marker, _cursor - marker);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue