From 305ede38cc3b24f04cd6901b34479dc609d40e1d Mon Sep 17 00:00:00 2001 From: Jaime Humberto Macias Bustamante Date: Thu, 26 Jun 2025 16:56:10 -0700 Subject: [PATCH] Update Parser.hx --- hscript/Parser.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 31aa847..4b1b273 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -134,13 +134,21 @@ class Parser { ]; opPriority = new Map(); opRightAssoc = new Map(); + #if (haxe >= "4.0.0") + for(i => p in priorities) + for(x in p) { + opPriority.set(x, i); + if( i == 9 ) opRightAssoc.set(x, true); + } + #else for( i in 0...priorities.length ) for( x in priorities[i] ) { opPriority.set(x, i); if( i == 9 ) opRightAssoc.set(x, true); } + #end for( x in ["!", "++", "--", "~"] ) // unary "-" handled in parser directly! - opPriority.set(x, x == "++" || x == "--" ? -1 : -2); + opPriority.set(x, (x == "++" || x == "--") ? -1 : -2); } public inline function error( err:#if hscriptPos ErrorDef #else Error #end, pmin:Int, pmax:Int ) {