aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/ParserBase.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-09-06 09:22:02 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2016-09-06 19:03:05 +0800
commita13c5b315705dffde48ef46b8ed1208e3aa32989 (patch)
tree881b8950466e60507a27aa2446b8ccc3ea70f6ca /libsolidity/parsing/ParserBase.cpp
parentcfb6dfc35ecc52b6e9f93db6b4b4b1ef40a2ba03 (diff)
downloaddexon-solidity-a13c5b315705dffde48ef46b8ed1208e3aa32989.tar.gz
dexon-solidity-a13c5b315705dffde48ef46b8ed1208e3aa32989.tar.zst
dexon-solidity-a13c5b315705dffde48ef46b8ed1208e3aa32989.zip
Raise proper error on reserved keywords
Diffstat (limited to 'libsolidity/parsing/ParserBase.cpp')
-rw-r--r--libsolidity/parsing/ParserBase.cpp12
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(