diff options
author | RJ Catalano <catalanor0220@gmail.com> | 2015-12-17 02:55:52 +0800 |
---|---|---|
committer | RJ Catalano <catalanor0220@gmail.com> | 2015-12-17 02:55:52 +0800 |
commit | 0ba24a5289eaaf1941c1e84e774f938353b9b94c (patch) | |
tree | 8eab9e138065e69a2b5643db9bec61b771b683d2 /libsolidity/parsing | |
parent | caa6202f62749567870e38c3e4d284984349ca75 (diff) | |
download | dexon-solidity-0ba24a5289eaaf1941c1e84e774f938353b9b94c.tar.gz dexon-solidity-0ba24a5289eaaf1941c1e84e774f938353b9b94c.tar.zst dexon-solidity-0ba24a5289eaaf1941c1e84e774f938353b9b94c.zip |
changed a couple of small nuances, made an attempt at fixing the parsing in the inline arrays case (fails), and added test for inline arrays per Chriseth request
Diffstat (limited to 'libsolidity/parsing')
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index cb5968e9..e7391dff 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1043,9 +1043,10 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() m_scanner->next(); vector<ASTPointer<Expression>> components; Token::Value oppositeToken = (token == Token::LParen ? Token::RParen : Token::RBrack); - bool isArray = (token == Token::LParen ? false : true); - - if (m_scanner->currentToken() != Token::RParen) + bool isArray = (token == Token::RBrace ? true : false); + if (isArray && (m_scanner->currentToken() == Token::Comma)) + fatalParserError("Expected value in array cell after '[' ."); + if (m_scanner->currentToken() != oppositeToken) while (true) { if (m_scanner->currentToken() != Token::Comma && m_scanner->currentToken() != oppositeToken) @@ -1055,6 +1056,8 @@ ASTPointer<Expression> Parser::parsePrimaryExpression() if (m_scanner->currentToken() == oppositeToken) break; else if (m_scanner->currentToken() == Token::Comma) + if (isArray && (m_scanner->peekNextToken() == (Token::Comma || oppositeToken))) + fatalParserError("Expected value in array cell after ',' ."); m_scanner->next(); } nodeFactory.markEndPosition(); |