Replies: 1 comment 2 replies
-
|
The best solution is to rewrite the parser for your language after you have forked it. I know that MoonSharp is a Lua runtime implemented in C#, so I suggest that you could consider implementing these features on my language server. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am the author of the TTSLua addon, and am wondering the best way to go about adding a configuration option that will support lambda-style functions.
Since my issue (#2515) on the matter received little to no attention, I thought I would take it upon myself to implement this and submit a PR.
A lambda-style function, supported for instance by moonsharp, is an expression that has the form
|paramList| Exprwhere paramList can be empty.It's essentially just adding a new rule to the grammar for exp, like so:
exp ::= ... | ‘|’ [parlist] ‘|’ expThat means that,
|x, y| x+ywould be equivalent tofunction(x, y) return x + y endHooking into the parser inside an addon to support this does not seem to be the right approach. It seems shaky to call into the parser methods defined within
parserwithin the add on logic.I believe I have a handle on how to implement it - adding a rule within the
parseExpUnitmethod ofcompile.lua. However, I am more interested in how users would enable support for the syntax via configuration.Since it isn't really a "symbol", it does not make sense for it to be a
nonStandardSymbollike the others. It also isn't a replacement of an existing keyword, sospecialseems unfit as well.Is there precedent to add a specific configuration option to support this?
Beta Was this translation helpful? Give feedback.
All reactions