mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer
- Implemented ::token_split, which performs a full lex, and doesn't require white space like ::word_split does. - Added unit tests.
This commit is contained in:
parent
0af9bbdc03
commit
7598997e70
3 changed files with 32 additions and 1 deletions
|
@ -630,6 +630,19 @@ void Lexer::word_split (std::vector <std::string>& words, const std::string& inp
|
|||
words.push_back (word);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Split 'input' into 'tokens'.
|
||||
void Lexer::token_split (std::vector <std::string>& words, const std::string& input)
|
||||
{
|
||||
words.clear ();
|
||||
|
||||
std::string word;
|
||||
Lexer::Type type;
|
||||
Lexer lex (input);
|
||||
while (lex.token (word, type))
|
||||
words.push_back (word);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_punct (int c) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue