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

if conditional return "end" bug #14

Open
danielpza opened this issue Dec 8, 2019 · 2 comments
Open

if conditional return "end" bug #14

danielpza opened this issue Dec 8, 2019 · 2 comments

Comments

@danielpza
Copy link

There seems to be a bug when a conditional returns "end" it would break the parser.

if condition then
  return "end"
end

See danielpza@8a4c013

@suchipi
Copy link
Member

suchipi commented Dec 10, 2019

Could you post the error stack? This is likely a bug in luaparse, though it might just be that we're using an old version.

@danielpza
Copy link
Author

danielpza commented Dec 10, 2019

Sure:

$ prettier --write main.lua 
main.lua
[error] main.lua: SyntaxError: [20:0] unexpected keyword 'end' near '<eof>'
[error]     at raise (/home/daniel/var/npm/lib/node_modules/@prettier/plugin-lua/node_modules/luaparse/luaparse.js:492:15)
[error]     at unexpected (/home/daniel/var/npm/lib/node_modules/@prettier/plugin-lua/node_modules/luaparse/luaparse.js:556:14)
[error]     at parseChunk (/home/daniel/var/npm/lib/node_modules/@prettier/plugin-lua/node_modules/luaparse/luaparse.js:1367:29)
[error]     at end (/home/daniel/var/npm/lib/node_modules/@prettier/plugin-lua/node_modules/luaparse/luaparse.js:2266:17)
[error]     at Object.parse (/home/daniel/var/npm/lib/node_modules/@prettier/plugin-lua/node_modules/luaparse/luaparse.js:2236:31)
[error]     at Object.parse (/home/daniel/var/npm/lib/node_modules/@prettier/plugin-lua/src/parser.js:5:19)
[error]     at Object.parse (/home/daniel/var/npm/lib/node_modules/prettier/bin-prettier.js:9743:19)
[error]     at coreFormat (/home/daniel/var/npm/lib/node_modules/prettier/bin-prettier.js:13258:23)
[error]     at format (/home/daniel/var/npm/lib/node_modules/prettier/bin-prettier.js:13516:73)
[error]     at formatWithCursor (/home/daniel/var/npm/lib/node_modules/prettier/bin-prettier.js:13532:12)

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