diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-05-03 03:42:26 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-05-04 05:10:51 +0800 |
commit | ed9f80690bde53e56c6ef5cb046fb20713f3f780 (patch) | |
tree | ee51257c9b6182dd7996010c36df5725b976e44c /libsolidity/parsing/Parser.cpp | |
parent | 73c99d15cdf5ef0589096d6d42025a21502fc8d9 (diff) | |
download | dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.tar dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.tar.gz dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.tar.bz2 dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.tar.lz dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.tar.xz dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.tar.zst dexon-solidity-ed9f80690bde53e56c6ef5cb046fb20713f3f780.zip |
Simplify expectIdentifierToken by using expectToken
Diffstat (limited to 'libsolidity/parsing/Parser.cpp')
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 411466cd..37732a37 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1602,27 +1602,10 @@ ASTPointer<ParameterList> Parser::createEmptyParameterList() return nodeFactory.createNode<ParameterList>(vector<ASTPointer<VariableDeclaration>>()); } -string Parser::currentTokenName() -{ - Token::Value token = m_scanner->currentToken(); - if (Token::isElementaryTypeName(token)) //for the sake of accuracy in reporting - { - ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); - return elemTypeName.toString(); - } - else - return Token::name(token); -} - ASTPointer<ASTString> Parser::expectIdentifierToken() { - Token::Value id = m_scanner->currentToken(); - if (id != Token::Identifier) - fatalParserError( - string("Expected identifier, got '") + - currentTokenName() + - string("'") - ); + // do not advance on success + expectToken(Token::Identifier, false); return getLiteralAndAdvance(); } |