mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Raise proper error on reserved keywords
This commit is contained in:
parent
cfb6dfc35e
commit
a13c5b3157
@ -47,7 +47,17 @@ void ParserBase::expectToken(Token::Value _value)
|
|||||||
Token::Value tok = m_scanner->currentToken();
|
Token::Value tok = m_scanner->currentToken();
|
||||||
if (tok != _value)
|
if (tok != _value)
|
||||||
{
|
{
|
||||||
if (Token::isElementaryTypeName(tok)) //for the sake of accuracy in reporting
|
if (Token::isReservedKeyword(tok))
|
||||||
|
{
|
||||||
|
fatalParserError(
|
||||||
|
string("Expected token ") +
|
||||||
|
string(Token::name(_value)) +
|
||||||
|
string(" got reserved keyword '") +
|
||||||
|
string(Token::name(tok)) +
|
||||||
|
string("'")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (Token::isElementaryTypeName(tok)) //for the sake of accuracy in reporting
|
||||||
{
|
{
|
||||||
ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken();
|
ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken();
|
||||||
fatalParserError(
|
fatalParserError(
|
||||||
|
Loading…
Reference in New Issue
Block a user