From a13c5b315705dffde48ef46b8ed1208e3aa32989 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 6 Sep 2016 02:22:02 +0100 Subject: [PATCH] Raise proper error on reserved keywords --- libsolidity/parsing/ParserBase.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libsolidity/parsing/ParserBase.cpp b/libsolidity/parsing/ParserBase.cpp index 71085a4d0..2abf58ccb 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(