From 307a83e1dea95cd144a955aa0891476e7dd159de Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 12 Jan 2015 12:46:52 +0100 Subject: More convenient function type construction. --- Scanner.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'Scanner.cpp') diff --git a/Scanner.cpp b/Scanner.cpp index 6e3d04bc..b283ca10 100644 --- a/Scanner.cpp +++ b/Scanner.cpp @@ -700,24 +700,6 @@ Token::Value Scanner::scanNumber(char _charSeen) return Token::NUMBER; } - -// ---------------------------------------------------------------------------- -// Keyword Matcher - - -static Token::Value keywordOrIdentifierToken(string const& _input) -{ - // The following macros are used inside TOKEN_LIST and cause non-keyword tokens to be ignored - // and keywords to be put inside the keywords variable. -#define KEYWORD(name, string, precedence) {string, Token::name}, -#define TOKEN(name, string, precedence) - static const map keywords({TOKEN_LIST(TOKEN, KEYWORD)}); -#undef KEYWORD -#undef TOKEN - auto it = keywords.find(_input); - return it == keywords.end() ? Token::IDENTIFIER : it->second; -} - Token::Value Scanner::scanIdentifierOrKeyword() { solAssert(isIdentifierStart(m_char), ""); @@ -727,7 +709,7 @@ Token::Value Scanner::scanIdentifierOrKeyword() while (isIdentifierPart(m_char)) addLiteralCharAndAdvance(); literal.complete(); - return keywordOrIdentifierToken(m_nextToken.literal); + return Token::fromIdentifierOrKeyword(m_nextToken.literal); } char CharStream::advanceAndGet(size_t _chars) -- cgit v1.2.3