Kampfkarren / full-moon

A lossless Lua 5.1 parser
Mozilla Public License 2.0
394 stars 52 forks source link

Question- Support optional character ?. in lua #280

Open Gellipapa opened 1 year ago

Gellipapa commented 1 year ago

Hi! I have a question: I'm using the stylua script and the author said to use the full-moon library for parse lua code, so I'm writing here.

My problem would be that we are developing in FiveM which is a framework for GTA 5 online and in FiveM they have included extra characters that are not supported by the base lua. One of these is the optional character ?. and when I start to run the code formatter it exits with an error code because it cannot compile the code. I would like your help on how to make the compiler skip the ?. optional character so that the formatting is successful?

It would be a great help for us FiveM developers because then we would be able to format our code even though it is a bit unique to FiveM.

I'll see how I can implement this if it works out I'll open a pr.

Context thread: Stylua/Question- Support ? and ` characters?

Thanks in advance for your replies.

Kampfkarren commented 1 year ago

It would have to be done after the parser rewrite (which will likely not be done soon) and its own feature, off by default. But yes it is probably fine, the parser rewrite will allow us to more easily have whatever funky Lua distributions there are

Gellipapa commented 10 months ago

@Kampfkarren Hi! I would like to know if you managed to rewrite the parser or if you are still in the process of rewriting it. You mentioned earlier that after rewriting it it will support what is written in issue. Thanks in advance for your reply.

Kampfkarren commented 10 months ago

It's been stalling but I'm going to be looking at it and hopefully merging it today.

Gellipapa commented 10 months ago

It's been stalling but I'm going to be looking at it and hopefully merging it today.

Ohh cool thanks so much in advance. Currently I solved it by replacing the characters with node-js before formatting and then resetting them, but a stable solution would be better. Thanks again.

Gellipapa commented 10 months ago

Thank you very much for your work i saw that you merged , can you give me some guidance on where I can find this new feature to add additional characters so that the parser doesn't throw an error? Thank you very much.