Array parse fix

Do not allow arrays without comma between values (https://github.com/HaxeFoundation/hscript/pull/138)
This commit is contained in:
Jaime Humberto Macias Bustamante
2025-04-09 11:57:04 -07:00
parent ca0599b180
commit 6622220415
+8 -2
View File
@@ -481,15 +481,21 @@ class Parser {
case TBkOpen:
var a = [];
tk = token();
var first:Bool = true;
while( tk != TBkClose && (!resumeErrors || tk != TEof) ) {
if(!first) {
if(tk != TComma)
unexpected(tk);
else
tk = token();
}
first = false;
push(tk);
var oldoo = disableOrOp;
disableOrOp = false;
a.push(parseExpr());
disableOrOp = oldoo;
tk = token();
if( tk == TComma )
tk = token();
}
if( a.length == 1 && a[0] != null ) // What is this for???
switch( expr(a[0]) ) {