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
-
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| Expr
where paramList can be empty.It's essentially just adding a new rule to the grammar for exp, like so:
exp ::= ... | ‘|’ [parlist] ‘|’ exp
That means that,
|x, y| x+y
would be equivalent tofunction(x, y) return x + y end
Hooking 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
parser
within the add on logic.I believe I have a handle on how to implement it - adding a rule within the
parseExpUnit
method 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
nonStandardSymbol
like the others. It also isn't a replacement of an existing keyword, sospecial
seems unfit as well.Is there precedent to add a specific configuration option to support this?
Beta Was this translation helpful? Give feedback.
All reactions