From ed9f80690bde53e56c6ef5cb046fb20713f3f780 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 2 May 2018 20:42:26 +0100 Subject: Simplify expectIdentifierToken by using expectToken --- libsolidity/parsing/Parser.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'libsolidity/parsing/Parser.cpp') 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 Parser::createEmptyParameterList() return nodeFactory.createNode(vector>()); } -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 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(); } -- cgit v1.2.3