diff options
author | Christian <c@ethdev.com> | 2015-01-12 19:46:52 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-12 19:46:52 +0800 |
commit | 307a83e1dea95cd144a955aa0891476e7dd159de (patch) | |
tree | 5adca427a0debe24ba729bd3cd917c821c92ebca /Scanner.cpp | |
parent | 94cff9684f8b1d4a5e2eeba58444a99e32e8a7ae (diff) | |
download | dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.gz dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.zst dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.zip |
More convenient function type construction.
Diffstat (limited to 'Scanner.cpp')
-rw-r--r-- | Scanner.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
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<string, Token::Value> 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) |