diff --git a/Test.hx b/Test.hx index 49fdb4b..9ab6238 100644 --- a/Test.hx +++ b/Test.hx @@ -90,6 +90,7 @@ class Test { test("var x=-3; x", -3); test("var a:Array=[1,2,4]; a[2]", 4, null, true); test("/**/0", 0); + test("x=1;x*=-2", -2); trace("Done"); } diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 6d55306..607e8ba 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -1063,14 +1063,16 @@ class Parser { default: if( ops[char] ) { var op = String.fromCharCode(char); + var prev = -1; while( true ) { char = readChar(); - if( !ops[char] ) { + if( !ops[char] || prev == '='.code ) { if( op.charCodeAt(0) == '/'.code ) return tokenComment(op,char); this.char = char; return TOp(op); } + prev = char; op += String.fromCharCode(char); } }