Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua floor division operator not recognised #114

Closed
brynne8 opened this issue Dec 27, 2021 · 1 comment
Closed

Lua floor division operator not recognised #114

brynne8 opened this issue Dec 27, 2021 · 1 comment
Labels
invalid Insufficient detail, issue does not reproduce, or is irrelevant

Comments

@brynne8
Copy link

brynne8 commented Dec 27, 2021

See for example this code:

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

Related Ace Editor issue: ajaxorg/ace#4571

[2:42] <expression> expected near '/'
@fstirlitz fstirlitz added the invalid Insufficient detail, issue does not reproduce, or is irrelevant label Dec 27, 2021
@fstirlitz
Copy link
Owner

This is already supported and tested:

luaparse/luaparse.js

Lines 775 to 779 in d61c6fe

case 47: // /
// Check for integer division op (//)
if (features.integerDivision)
if (47 === next) return scanPunctuator('//');
return scanPunctuator('/');

// { "luaVersion": "5.2" }
a = 1 // 0 -- FAIL
a = p ~ q -- FAIL
a = p & q -- FAIL
// { "luaVersion": "5.3" }
a = 1 // 0

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

@fstirlitz fstirlitz closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Insufficient detail, issue does not reproduce, or is irrelevant
Projects
None yet
Development

No branches or pull requests

2 participants