From 606a554d85373ffb24f72fc45eece05456010b4a Mon Sep 17 00:00:00 2001 From: Nicolas Cannasse Date: Mon, 21 Jun 2010 16:38:30 +0000 Subject: [PATCH] allow comma at end of last array element --- hscript/Parser.hx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 9b521ea..43a82f0 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -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); }