diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2016-09-06 09:22:02 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2016-09-06 19:03:05 +0800 |
commit | a13c5b315705dffde48ef46b8ed1208e3aa32989 (patch) | |
tree | 881b8950466e60507a27aa2446b8ccc3ea70f6ca /libsolidity | |
parent | cfb6dfc35ecc52b6e9f93db6b4b4b1ef40a2ba03 (diff) | |
download | dexon-solidity-a13c5b315705dffde48ef46b8ed1208e3aa32989.tar.gz dexon-solidity-a13c5b315705dffde48ef46b8ed1208e3aa32989.tar.zst dexon-solidity-a13c5b315705dffde48ef46b8ed1208e3aa32989.zip |
Raise proper error on reserved keywords
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/parsing/ParserBase.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 71085a4d..2abf58cc 100644 --- a/libsolidity/parsing/ParserBase.cpp +++ b/libsolidity/parsing/ParserBase.cpp @@ -47,7 +47,17 @@ void ParserBase::expectToken(Token::Value _value) Token::Value tok = m_scanner->currentToken(); 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(); fatalParserError( |