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

label declaration after variable assignment/declaration gives error parsing: error occurred while creating ast: unexpected token \end\`` #876

Closed
thunder-coding opened this issue Jul 17, 2024 · 2 comments

Comments

@thunder-coding
Copy link

thunder-coding commented Jul 17, 2024

Lua code to reproduce the error:

while true do
  local x = 3
  ::continue::
end
while true do
  x = 2
  ::continue::
end

Can also be reproduced with if statements instead of while loops

Output:

$ stylua x.lua
error: could not format file x.lua: error parsing: error occurred while creating ast: unexpected token `end`. (starting from line 4, character 1 and ending on line 4, character 4)
additional information: expected identifier after `::`

Workaround

Adding a semicolon to explicitely terminate the variable declaration/assignment makes the error go away

Additional details:

This bug was originally found while working on thunder-coding/zincoxide@0a007af.

Stylua has been installed from Arch Linux's repository

@JohnnyMorganz
Copy link
Owner

See #407, should hopefully be fixed soon with runtime syntax selection

@thunder-coding
Copy link
Author

Thanks for pointing out! Closing this issue as it's a duplicate of the issue you linked

@thunder-coding thunder-coding closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 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