mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Lexer: Added standalone token support
- Added default ctor. - Added ::token method for classifying whole tokens. - Stubbed token classifier methods.
This commit is contained in:
parent
4141215d4b
commit
3b99559216
2 changed files with 203 additions and 0 deletions
27
src/Lexer.h
27
src/Lexer.h
|
@ -51,9 +51,11 @@ public:
|
|||
dom, identifier, word,
|
||||
date, duration };
|
||||
|
||||
Lexer ();
|
||||
Lexer (const std::string&);
|
||||
~Lexer ();
|
||||
bool token (std::string&, Lexer::Type&);
|
||||
Lexer::Type token (const std::string&);
|
||||
static std::vector <std::pair <std::string, Lexer::Type>> tokens (const std::string&);
|
||||
static std::vector <std::string> split (const std::string&);
|
||||
static std::string typeToString (Lexer::Type);
|
||||
|
@ -103,6 +105,31 @@ public:
|
|||
bool isWord (std::string&, Lexer::Type&);
|
||||
bool isContiguous (std::string&, Lexer::Type&);
|
||||
|
||||
// Token Classifiers.
|
||||
/*
|
||||
bool isString (const std::string&);
|
||||
bool isDate (const std::string&);
|
||||
bool isDuration (const std::string&);
|
||||
bool isUUID (const std::string&);
|
||||
bool isNumber (const std::string&);
|
||||
bool isHexNumber (const std::string&);
|
||||
bool isSeparator (const std::string&);
|
||||
bool isURL (const std::string&);
|
||||
bool isPair (const std::string&);
|
||||
bool isSet (const std::string&);
|
||||
*/
|
||||
bool isTag (const std::string&);
|
||||
/*
|
||||
bool isPath (const std::string&);
|
||||
bool isSubstitution (const std::string&);
|
||||
bool isPattern (const std::string&);
|
||||
bool isOperator (const std::string&);
|
||||
bool isDOM (const std::string&);
|
||||
bool isIdentifier (const std::string&);
|
||||
bool isWord (const std::string&);
|
||||
bool isContiguous (const std::string&);
|
||||
*/
|
||||
|
||||
private:
|
||||
std::string _text;
|
||||
std::size_t _cursor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue