Kampfkarren/selene

Support `goto` statements.

howmanysmall opened this issue · 16 comments

Currently Selene doesn't really like my usage of goto labels, as shown below. It'd be nice if it was supported.
image

Relies on a full-moon update.

#229 makes this possible, though a separate PR will need to turn on lua52 feature flag.

@Kampfkarren I'm still getting this error on 0.24.0 w/ lua52 as a base.
Is there something special that needs to be done to enable this support?

You need specifically a selene built with the lua52 feature flag. I'm not sure if that's available, or if that would even work.

It's more viable today than when this issue was first posted though

I'd have to build one my self? do you have an example build command for this?

You would need to edit Cargo.toml in selene to include lua52 for full-moon

ok. that seems to have worked. I'm not sure its entirely right.

# Cargo.toml

[workspace.dependencies]
full_moon = { version = "0.17.0", features = ["lua52"] }
#selene/Cargo.toml

[features]
default = [ "roblox", "lua52" ]
lua52 = []
tracy-profiling = ["profiling/profile-with-tracy","tracy-client"]
roblox = ["selene-lib/roblox", "full_moon/roblox", "ureq"]

That looks right to me, though we'd need a bit more work ourselves if we wanted to ship that.

Is there any reason not to?

@JohnnyMorganz would be able to answer if the backwards incompatibilities with Lua 5.2 and Luau are problematic. There are more than zero. Ideally we want full-moon to be able to dynamically switch capabilities.

any updates on this?

or any way to work with goto without having to build on your own, e.g. an ignore rule I may have missed in the docs?

Work is being done in the parser (https://github.com/Kampfkarren/full-moon) to be able to support swapping out languages easier, we can't really move forward on it until that's done. No ETA but it recently picked up more steam.

Anyone have found a way to ignore goto parse_error?

I have tried to use this in my selene.toml without success.

std="lua52+vim"

This still needs a full-moon update, but everything is already merged into full-moon that makes this possible thankfully. ETA could be a week or so with dedicated effort.