Lexer: Implemented ::isLiteral, to help with parsing
This commit is contained in:
@@ -1077,6 +1077,21 @@ bool Lexer::isWord (std::string& token, Lexer::Type& type)
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::isLiteral (const std::string& literal)
|
||||
{
|
||||
if (_text.find (literal, _cursor) == 0 &&
|
||||
(isEOS () ||
|
||||
Lexer::isWhitespace (_text[_cursor + literal.length ()]) ||
|
||||
Lexer::isSingleCharOperator (_text[_cursor + literal.length ()])))
|
||||
{
|
||||
_cursor += literal.length ();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Static
|
||||
std::string Lexer::typeToString (Lexer::Type type)
|
||||
|
||||
Reference in New Issue
Block a user