mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplify expectIdentifierToken by using expectToken
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user