aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-19 18:01:19 +0800
committerGitHub <noreply@github.com>2017-06-19 18:01:19 +0800
commit622703c0c0a4b215f759c509569c9df6dcc9ce3a (patch)
tree00ea273f45a64ebd407fff030e21797c73f9aacb /libsolidity
parentb3a7b5a145ba66e5ce99c04cc99418e995543355 (diff)
parent60bfae75e51c4f5213c82d17d32e10d939ebf0bf (diff)
downloaddexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.tar
dexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.tar.gz
dexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.tar.bz2
dexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.tar.lz
dexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.tar.xz
dexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.tar.zst
dexon-solidity-622703c0c0a4b215f759c509569c9df6dcc9ce3a.zip
Merge pull request #2409 from federicobond/trailing-commas-2
Improve error reporting of trailing commas
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/parsing/Parser.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index ec6d11f4..b0cf364e 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -1350,13 +1350,19 @@ pair<vector<ASTPointer<Expression>>, vector<ASTPointer<ASTString>>> Parser::pars
if (!first)
expectToken(Token::Comma);
- if (m_scanner->currentToken() == Token::RBrace)
- fatalParserError("Unexpected trailing comma.");
-
ret.second.push_back(expectIdentifierToken());
expectToken(Token::Colon);
ret.first.push_back(parseExpression());
+ if (
+ m_scanner->currentToken() == Token::Comma &&
+ m_scanner->peekNextToken() == Token::RBrace
+ )
+ {
+ parserError("Unexpected trailing comma.");
+ m_scanner->next();
+ }
+
first = false;
}
expectToken(Token::RBrace);