aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/ParserBase.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-09-06 21:52:44 +0800
committerGitHub <noreply@github.com>2016-09-06 21:52:44 +0800
commit462fc84e530a6e740dfc8bb92bbd5ba82862cbb2 (patch)
treef55c4e97d89427aaecb0b77898a3e808342da215 /libsolidity/parsing/ParserBase.cpp
parent358812569287976001ee1f6cec077038d3fcc937 (diff)
parenta13c5b315705dffde48ef46b8ed1208e3aa32989 (diff)
downloaddexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.tar
dexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.tar.gz
dexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.tar.bz2
dexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.tar.lz
dexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.tar.xz
dexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.tar.zst
dexon-solidity-462fc84e530a6e740dfc8bb92bbd5ba82862cbb2.zip
Merge pull request #1016 from ethereum/reserved
Report the usage of reserved keywords more nicely
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(