fstirlitz / luaparse

A Lua parser written in JavaScript
https://fstirlitz.github.io/luaparse/
MIT License
459 stars 91 forks source link

Lua floor division operator not recognised #114

Closed brynne8 closed 2 years ago

brynne8 commented 2 years ago

See for example this code:

function round(v, step)
    return math.tointeger((v + step*0.5) // step * step)
end

Related Ace Editor issue: https://github.com/ajaxorg/ace/issues/4571

[2:42] <expression> expected near '/'
fstirlitz commented 2 years ago

This is already supported and tested:

https://github.com/fstirlitz/luaparse/blob/d61c6fe1cd2757bc210898bc9b263ffe4adbd060/luaparse.js#L775-L779

https://github.com/fstirlitz/luaparse/blob/d61c6fe1cd2757bc210898bc9b263ffe4adbd060/test/scaffolding/operators#L35-L40

Ace will have to enable the "luaVersion": "5.3" option.