aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorRJ Catalano <catalanor0220@gmail.com>2015-12-16 00:57:57 +0800
committerRJ Catalano <catalanor0220@gmail.com>2015-12-16 00:57:57 +0800
commit42c43394040e68c3bb32ed1e73992e096e5d10d2 (patch)
tree4aea421f3c0df5823391121704a8b3a824d35994 /libsolidity
parent591a4f1ff44af20fce9bafebf0fa0607e2bdfcc0 (diff)
downloaddexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.tar
dexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.tar.gz
dexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.tar.bz2
dexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.tar.lz
dexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.tar.xz
dexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.tar.zst
dexon-solidity-42c43394040e68c3bb32ed1e73992e096e5d10d2.zip
updated attempt, a couple of more things to sort through and change
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/parsing/Parser.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 2b886121..5a3ed56e 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -1034,26 +1034,28 @@ ASTPointer<Expression> Parser::parsePrimaryExpression()
nodeFactory.markEndPosition();
expression = nodeFactory.createNode<Identifier>(getLiteralAndAdvance());
break;
- case Token::LParen:
+ case Token::LParen || Token::LBrack:
{
// Tuple or parenthesized expression.
// Special cases: () is empty tuple type, (x) is not a real tuple, (x,) is one-dimensional tuple
m_scanner->next();
vector<ASTPointer<Expression>> components;
+ Token::Value oppositeToken = (token == LParen ? Token::RParen : Token::RBrack);
+
if (m_scanner->currentToken() != Token::RParen)
while (true)
{
- if (m_scanner->currentToken() != Token::Comma && m_scanner->currentToken() != Token::RParen)
+ if (m_scanner->currentToken() != Token::Comma && m_scanner->currentToken() != oppositeToken)
components.push_back(parseExpression());
else
components.push_back(ASTPointer<Expression>());
- if (m_scanner->currentToken() == Token::RParen)
+ if (m_scanner->currentToken() == oppositeToken)
break;
else if (m_scanner->currentToken() == Token::Comma)
m_scanner->next();
}
nodeFactory.markEndPosition();
- expectToken(Token::RParen);
+ expectToken(oppositeToken);
return nodeFactory.createNode<TupleExpression>(components);
}
default: