mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
Lexer
- Implemented an overload of ::token_split that preserveѕ types.
This commit is contained in:
parent
a892abf366
commit
7d4e166277
2 changed files with 14 additions and 0 deletions
|
@ -662,6 +662,19 @@ void Lexer::token_split (std::vector <std::string>& words, const std::string& in
|
|||
words.push_back (word);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Split 'input' into 'tokens', preserving type.
|
||||
void Lexer::token_split (std::vector <std::pair <std::string, Lexer::Type> >& lexemes, const std::string& input)
|
||||
{
|
||||
lexemes.clear ();
|
||||
|
||||
std::string word;
|
||||
Lexer::Type type;
|
||||
Lexer lex (input);
|
||||
while (lex.token (word, type))
|
||||
lexemes.push_back (std::pair <std::string, Lexer::Type>(word, type));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_punct (int c) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue