mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 00:57:19 +02:00
Lexer: Dead code removal
This commit is contained in:
parent
a89c996334
commit
fed3b815a0
3 changed files with 5 additions and 59 deletions
|
@ -97,22 +97,6 @@ bool Lexer::token (std::string& token, Lexer::Type& type)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This static method tokenizes the input and provides a vector of token/type
|
||||
// results from a high-level lex.
|
||||
std::vector <std::pair <std::string, Lexer::Type>> Lexer::tokens (
|
||||
const std::string& text)
|
||||
{
|
||||
std::vector <std::pair <std::string, Lexer::Type>> all;
|
||||
std::string token;
|
||||
Lexer::Type type;
|
||||
Lexer l (text);
|
||||
while (l.token (token, type))
|
||||
all.push_back (std::pair <std::string, Lexer::Type> (token, type));
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This static method tokenizes the input, but discards the type information.
|
||||
std::vector <std::string> Lexer::split (const std::string& text)
|
||||
|
@ -1093,30 +1077,6 @@ bool Lexer::isWord (std::string& token, Lexer::Type& type)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Lexer::Type::word
|
||||
// [^\s]+
|
||||
bool Lexer::isContiguous (std::string& token, Lexer::Type& type)
|
||||
{
|
||||
std::size_t marker = _cursor;
|
||||
|
||||
while (_text[marker] &&
|
||||
! isWhitespace (_text[marker]) &&
|
||||
_text[marker] != '(' &&
|
||||
_text[marker] != ')')
|
||||
utf8_next_char (_text, marker);
|
||||
|
||||
if (marker > _cursor)
|
||||
{
|
||||
token = _text.substr (_cursor, marker - _cursor);
|
||||
type = Lexer::Type::word;
|
||||
_cursor = marker;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
std::string Lexer::typeToString (Lexer::Type type)
|
||||
|
@ -1148,19 +1108,6 @@ bool Lexer::isAllDigits (const std::string& text)
|
|||
return text.find_first_not_of ("0123456789") == std::string::npos;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Not escape-proof.
|
||||
bool Lexer::isOneWord (const std::string& text)
|
||||
{
|
||||
std::string::size_type i = 0;
|
||||
int character;
|
||||
while ((character = utf8_next_char (text, i)))
|
||||
if (Lexer::isWhitespace (character))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Full implementation of a quoted word. Includes:
|
||||
// '\''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue