mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Rules: Added ::tokenizeLine
This commit is contained in:
parent
321bddba74
commit
9403fa4974
2 changed files with 15 additions and 0 deletions
|
@ -343,3 +343,17 @@ unsigned int Rules::getIndentation (const std::string& line)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Tokenize the line. This loses whitespace information and token types.
|
||||
std::vector <std::string> Rules::tokenizeLine (const std::string& line)
|
||||
{
|
||||
std::vector <std::string> tokens;
|
||||
std::string token;
|
||||
Lexer::Type type;
|
||||
Lexer lexer (line);
|
||||
while (lexer.token (token, type))
|
||||
tokens.push_back (token);
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -62,6 +62,7 @@ private:
|
|||
void parseRuleTag (const std::vector <std::string>&);
|
||||
|
||||
unsigned int getIndentation (const std::string&);
|
||||
std::vector <std::string> tokenizeLine (const std::string&);
|
||||
|
||||
private:
|
||||
std::string _original_file {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue