Skip to content

Specify LuaVersion when parsing with full_moon #262

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

Open
jiwonz opened this issue Mar 13, 2025 · 1 comment · May be fixed by #263
Open

Specify LuaVersion when parsing with full_moon #262

jiwonz opened this issue Mar 13, 2025 · 1 comment · May be fixed by #263

Comments

@jiwonz
Copy link
Contributor

jiwonz commented Mar 13, 2025

If you are depending on darklua and full_moon in a root project, and you add features that are incompatible with luau, such as lua53, to full_moon's features, the features will be combined due to the cargo's characteristics of deduplicating shared dependencies (perhaps full_moon is now shared and reused in the relationship between darklua's dependencies and the root project's dependencies). This can cause several incompatibilities and parsing problems, such as this issue.

Therefore, I think this problem can be solved by specifying the specific LuaVersion parameter of full_moon::parse_fallible, which has been available since full_moon v1.0.0, and explicitly parsing it as LuaVersion::Luau in darklua.

@jiwonz jiwonz changed the title Use full_moon::parse_fallible function when parsing with full_moon in parser Specify LuaVersion when parsing with full_moon Mar 13, 2025
@jiwonz
Copy link
Contributor Author

jiwonz commented Mar 13, 2025

Just found full_moon::parse(code) is just equivalent to full_moon::parse_fallible(code, LuaVersion::new()).into_result()
Image
https://docs.rs/full_moon/latest/src/full_moon/lib.rs.html#92-94

And I think this is what causes the issue:
Image
https://docs.rs/full_moon/latest/full_moon/ast/struct.LuaVersion.html#method.new

It seems it's simple to migrate full_moon::parse into full_moon::parse_fallible for Lua version specifying

@jiwonz jiwonz linked a pull request Mar 13, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant