aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/ParserBase.cpp
diff options
context:
space:
mode:
authorChristian Parpart <christian@parpart.family>2018-10-23 07:50:15 +0800
committerGitHub <noreply@github.com>2018-10-23 07:50:15 +0800
commita2f5087d13274d6832669a39694ee5a3bf68f878 (patch)
tree4b6b8b3816a0a1620e73a30de687ff3557a10098 /libsolidity/parsing/ParserBase.cpp
parentc13b5280c1b44f18a2a1fb61ef5556e91c5678e7 (diff)
parentf112377dd44e8281bff092639bb546ec8a6a39ac (diff)
downloaddexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar
dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.gz
dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.bz2
dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.lz
dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.xz
dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.zst
dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.zip
Merge pull request #5286 from ethereum/refactor-token-as-enum-class
refactor `libsolidity::Token` into a strongly typed enum
Diffstat (limited to 'libsolidity/parsing/ParserBase.cpp')
-rw-r--r--libsolidity/parsing/ParserBase.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp
index 71133746..1d4cb1e2 100644
--- a/libsolidity/parsing/ParserBase.cpp
+++ b/libsolidity/parsing/ParserBase.cpp
@@ -43,12 +43,12 @@ int ParserBase::endPosition() const
return m_scanner->currentLocation().end;
}
-Token::Value ParserBase::currentToken() const
+Token ParserBase::currentToken() const
{
return m_scanner->currentToken();
}
-Token::Value ParserBase::peekNextToken() const
+Token ParserBase::peekNextToken() const
{
return m_scanner->peekNextToken();
}
@@ -58,31 +58,31 @@ std::string ParserBase::currentLiteral() const
return m_scanner->currentLiteral();
}
-Token::Value ParserBase::advance()
+Token ParserBase::advance()
{
return m_scanner->next();
}
-void ParserBase::expectToken(Token::Value _value, bool _advance)
+void ParserBase::expectToken(Token _value, bool _advance)
{
- Token::Value tok = m_scanner->currentToken();
+ Token tok = m_scanner->currentToken();
if (tok != _value)
{
- auto tokenName = [this](Token::Value _token)
+ auto tokenName = [this](Token _token)
{
if (_token == Token::Identifier)
return string("identifier");
else if (_token == Token::EOS)
return string("end of source");
- else if (Token::isReservedKeyword(_token))
- return string("reserved keyword '") + Token::friendlyName(_token) + "'";
- else if (Token::isElementaryTypeName(_token)) //for the sake of accuracy in reporting
+ else if (TokenTraits::isReservedKeyword(_token))
+ return string("reserved keyword '") + TokenTraits::friendlyName(_token) + "'";
+ else if (TokenTraits::isElementaryTypeName(_token)) //for the sake of accuracy in reporting
{
ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken();
return string("'") + elemTypeName.toString() + "'";
}
else
- return string("'") + Token::friendlyName(_token) + "'";
+ return string("'") + TokenTraits::friendlyName(_token) + "'";
};
fatalParserError(string("Expected ") + tokenName(_value) + string(" but got ") + tokenName(tok));