mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 00:57:19 +02:00
Lexer: Implemented ::isOneOf, to help with parsing
This commit is contained in:
parent
9394b96202
commit
37e31e8e0b
2 changed files with 11 additions and 0 deletions
|
@ -1092,6 +1092,16 @@ bool Lexer::isLiteral (const std::string& literal)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool Lexer::isOneOf (const std::vector <std::string>& options)
|
||||||
|
{
|
||||||
|
for (auto& item : options)
|
||||||
|
if (isLiteral (item))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Static
|
// Static
|
||||||
std::string Lexer::typeToString (Lexer::Type type)
|
std::string Lexer::typeToString (Lexer::Type type)
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
bool isIdentifier (std::string&, Lexer::Type&);
|
bool isIdentifier (std::string&, Lexer::Type&);
|
||||||
bool isWord (std::string&, Lexer::Type&);
|
bool isWord (std::string&, Lexer::Type&);
|
||||||
bool isLiteral (const std::string&);
|
bool isLiteral (const std::string&);
|
||||||
|
bool isOneOf (const std::vector <std::string>&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _text;
|
std::string _text;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue