Kampfkarren / full-moon

A lossless Lua 5.1 parser
Mozilla Public License 2.0
374 stars 47 forks source link

Does not support leading & #311

Open iamawatermelo opened 1 month ago

iamawatermelo commented 1 month ago

From https://github.com/JohnnyMorganz/StyLua/issues/877:

local f: & number & string = "hi"

This is valid Luau code:

image

StyLua cannot format it, though:

sarah@localhost ~/project (main) [2]> StyLua example.luau
error: could not format file example.luau: error parsing: error occurred while creating ast: unexpected token `&`. (starting from line 1, character 10 and ending on line 1, character 11)
additional information: expected type after colon
sarah@localhost ~/project (main) [2]> StyLua --version
stylua 0.20.0
sarah@localhost ~/project (main)>

StyLua was installed from aftman.

The issue appears to be that full-moon cannot parse it, so StyLua fails.

Kampfkarren commented 1 month ago

Fixed by #306