aboutsummaryrefslogtreecommitdiffstats
path: root/Scanner.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-12 19:46:52 +0800
committerChristian <c@ethdev.com>2015-01-12 19:46:52 +0800
commit307a83e1dea95cd144a955aa0891476e7dd159de (patch)
tree5adca427a0debe24ba729bd3cd917c821c92ebca /Scanner.cpp
parent94cff9684f8b1d4a5e2eeba58444a99e32e8a7ae (diff)
downloaddexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.gz
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.bz2
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.lz
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.xz
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.tar.zst
dexon-solidity-307a83e1dea95cd144a955aa0891476e7dd159de.zip
More convenient function type construction.
Diffstat (limited to 'Scanner.cpp')
-rw-r--r--Scanner.cpp20
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)