allow comma at end of last array element

This commit is contained in:
Nicolas Cannasse
2010-06-21 16:38:30 +00:00
parent 8c40c20aae
commit 606a554d85
+10 -1
View File
@@ -211,7 +211,16 @@ class Parser {
return makeUnop(op,parseExpr());
return unexpected(tk);
case TBkOpen:
return parseExprNext(EArrayDecl(parseExprList(TBkClose)));
var a = new Array();
tk = token();
while( tk != TBkClose ) {
tokens.add(tk);
a.push(parseExpr());
tk = token();
if( tk == TComma )
tk = token();
}
return parseExprNext(EArrayDecl(a));
default:
return unexpected(tk);
}