moonwave
moonwave copied to clipboard
Unexpected Token Error When Creating AST with Lua Code Containing the "//" Operator
the error msg is:
error occurred while creating ast: unexpected token `/`
It is worth noting that the "//" operator was only introduced to Lua in version 5.3. In order to reproduce this error, you can use the following code snippet:
p = 3.0
p = p and p // 1
Please note that this error appears to be related to the parser, as it is unable to recognize the "//" operator.
We currently only support Lua 5.1/Luau mode but the underlying parser we use (full_moon) does support Lua 5.2, 5.3, and 5.4.
We would need to add a flag/config option to Moonwave to allow selecting which version of Lua to use to support this.
Hey, 👋🏻
I'm currently affected by this, I was wondering when will the update be released?
Hello @RuizuKun-Dev, I gave a brief answer on Discord but I will also provide an answer here in case anyone else comes across this.
This issue would be fixed by updating full-moon to v0.19.0, which is the version I was originally going to update Moonwave to. Unfortunately, I was experiencing full-moon crashes on that version in large codebases during testing, such as Nevermore. These crashes are fixed in full-moon v1.0.0 which is not out just yet.
Since I do not want to break workflows for projects such as Nevermore, this is currently blocked until the release of full-moon v1.0.0 which, to my knowledge, has no ETA but is currently in pre-release phase and should hopefully be released soon.
In the meantime, you can instead do
-- This
math.floor(a / b)
-- Instead of
a // b
For future tracking, see #147.
ahhh, okay thank you for the answer appreciate it! 🙏🏻 @YetAnotherClown
In the meantime, you can instead do
-- This math.floor(a / b) -- Instead of a // b
yeah, I actually did that for bufferUtil
thanks, i sub to the issue and repo release