Skip to content

Commit 99a3509

Browse files
authored
Do not allow arrays without comma between values (#138)
1 parent d676059 commit 99a3509

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hscript/Parser.hx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,18 @@ class Parser {
446446
case TBkOpen:
447447
var a = new Array();
448448
tk = token();
449+
var first = true;
449450
while( tk != TBkClose && (!resumeErrors || tk != TEof) ) {
451+
if (!first) {
452+
if (tk != TComma)
453+
unexpected(tk);
454+
else
455+
tk = token();
456+
}
457+
first = false;
450458
push(tk);
451459
a.push(parseExpr());
452460
tk = token();
453-
if( tk == TComma )
454-
tk = token();
455461
}
456462
if( a.length == 1 && a[0] != null )
457463
switch( expr(a[0]) ) {

0 commit comments

Comments
 (0)