[poincare/parser] Parser::IsReservedName

This commit is contained in:
Léa Saviot
2018-11-12 10:20:13 +01:00
committed by Émilie Feral
parent 42c372b4b4
commit 2d20aacc89
2 changed files with 10 additions and 1 deletions

View File

@@ -13,6 +13,13 @@ Expression Parser::parse() {
return Expression();
}
bool Parser::IsReservedName(const char * name, size_t nameLength, const Expression::FunctionHelper * const * * functionHelper) {
return IsReservedFunctionName(name, nameLength, functionHelper)
|| IsSpecialIdentifierName(name, nameLength);
}
// Private
bool Parser::IsReservedFunctionName(const char * name, size_t nameLength, const Expression::FunctionHelper * const * * functionHelper) {
const Expression::FunctionHelper * const * reservedFunction = &s_reservedFunctions[0];
assert(reservedFunction < s_reservedFunctionsUpperBound);

View File

@@ -30,10 +30,12 @@ public:
Expression parse();
Status getStatus() const { return m_status; }
static bool IsReservedName(const char * name, size_t nameLength, const Expression::FunctionHelper * const * * functionHelper = nullptr);
private:
static bool IsReservedFunctionName(const char * name, size_t nameLength, const Expression::FunctionHelper * const * * functionHelper = nullptr);
static bool IsSpecialIdentifierName(const char * name, size_t nameLength);
private:
Expression parseUntil(Token::Type stoppingType);
// Methods on Tokens