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

for loops bug #180

Closed
Srlion opened this issue Apr 20, 2024 · 2 comments
Closed

for loops bug #180

Srlion opened this issue Apr 20, 2024 · 2 comments

Comments

@Srlion
Copy link

Srlion commented Apr 20, 2024

Linter allows this:

fori = 1 , 3do
end

It's kinda weird, but the problem is probably not with the for loop, but with 3do end

EDIT:
yep the problem is with "3do end" as formatter formats it into:

fori = 3
do
end
@FPtje
Copy link
Owner

FPtje commented Apr 21, 2024

Ah, indeed fori = 1, 3 is valid Lua, but the 3do part is not. Lua itself complains about it being a malformed number. glualint is fine lexing it as the number 3 followed by the keyword do.

I think the difference is in that Lua number parsing works like "parse a number followed by a bunch of letters, then check later if those letters make sense". Glualint parses numbers as the very precise set of characters in the order that they are allowed.

@FPtje FPtje closed this as completed in 4e48563 Jul 1, 2024
@FPtje
Copy link
Owner

FPtje commented Jul 3, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants