aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Parser.cpp
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2017-06-16 00:10:08 +0800
committerFederico Bond <federicobond@gmail.com>2017-06-16 00:10:08 +0800
commit60bfae75e51c4f5213c82d17d32e10d939ebf0bf (patch)
treee3eaebad6160942a6c1c1ac3dc3c3267c3507a71 /libsolidity/parsing/Parser.cpp
parent54e97d1c34d7c291673e695a991db8df627c503e (diff)
downloaddexon-solidity-60bfae75e51c4f5213c82d17d32e10d939ebf0bf.tar.gz
dexon-solidity-60bfae75e51c4f5213c82d17d32e10d939ebf0bf.tar.zst
dexon-solidity-60bfae75e51c4f5213c82d17d32e10d939ebf0bf.zip
Improve error reporting of trailing commas
Diffstat (limited to 'libsolidity/parsing/Parser.cpp')
-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 7c439211..a49f60e2 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -1335,13 +1335,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);