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

The "break" keyword is incorrectly parsed as valid outside of a loop body #107

Open
JohnnyMorganz opened this issue Dec 17, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@JohnnyMorganz
Copy link
Collaborator

In full_moon, the following code snippet is parsed as valid:

if foo then
    break
end

function foo(bar)
    break
end

break

However, in all these situations, the break keyword cannot be used like this - it can only be used inside of a Loop body

@Kampfkarren Kampfkarren added the bug Something isn't working label Dec 17, 2020
@JohnnyMorganz
Copy link
Collaborator Author

Was looking at this - this is more of a semantic issue rather than a syntactic one. Is this more suited to be handled by a downstream consumer, such as a tool like selene?

That said, luaparse does handle something like this - https://github.com/fstirlitz/luaparse/blob/d61c6fe1cd2757bc210898bc9b263ffe4adbd060/luaparse.js#L1818 but thats because it holds more state such as control flow information (because it provides info such as scope etc.)
Luau (roblox studio) raises this as a syntax error

@Kampfkarren
Copy link
Owner

I believe Lua raises a syntax error as well, which we want to match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants