Support [<no-expr>] in variable declarations (semantic support already exists).
Support [<no-expr>] in variable declarations (semantic support already exists).
1.1 --- a/src/Parser.cpp Mon Jul 30 11:38:32 2012 -0700
1.2 +++ b/src/Parser.cpp Mon Jul 30 11:46:56 2012 -0700
1.3 @@ -658,12 +658,13 @@
1.4 if (scanner_.peek() == TOK_LBRACKET) {
1.5 postDimensions = new (pool_) ExpressionList();
1.6 while (match(TOK_LBRACKET)) {
1.7 - Expression *dim = expression();
1.8 - if (!dim)
1.9 - return NULL;
1.10 -
1.11 - if (!expect(TOK_RBRACKET))
1.12 - return NULL;
1.13 + Expression *dim = NULL;
1.14 + if (!match(TOK_RBRACKET)) {
1.15 + if ((dim = expression()) == NULL)
1.16 + return NULL;
1.17 + if (!expect(TOK_RBRACKET))
1.18 + return NULL;
1.19 + }
1.20
1.21 if (!postDimensions->append(dim))
1.22 return NULL;