From 085f4ec37e3122ee7f9af7175207642d2f3271db Mon Sep 17 00:00:00 2001 From: Nicolas Cannasse Date: Mon, 27 Apr 2020 11:19:46 +0200 Subject: [PATCH] fixed comments parsing was broken by previous fix --- hscript/Parser.hx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 424f0ef..e7b2c6b 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -125,6 +125,7 @@ class Parser { ["&&"], ["||"], ["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"], + ["->"] ]; #if haxe3 opPriority = new Map(); @@ -1514,20 +1515,18 @@ class Parser { default: if( ops[char] ) { var op = String.fromCharCode(char); - var prev = -1; while( true ) { char = readChar(); if( StringTools.isEof(char) ) char = 0; - if( !ops[char] || prev == '='.code ) { - if( op.charCodeAt(0) == '/'.code ) - return tokenComment(op,char); + if( !ops[char] ) { this.char = char; return TOp(op); } - prev = char; var pop = op; op += String.fromCharCode(char); if( !opPriority.exists(op) && opPriority.exists(pop) ) { + if( op == "//" || op == "/*" ) + return tokenComment(op,char); this.char = char; return TOp(pop); }