You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a general principle, the Lua API should subsume all other features:
bind and meta subsume normal metavariables
${{true}} subsumes $_
match and rec subsume sub-patterns
rx and negation replace explicit/special support for these features
However, Lua can't replace $... What would such an API look like? Perhaps ${{lua}}.., where lua would have access to a sequence of nodes' text ts and a sequence of kinds ks? An even more general API would be something like ${{cond||lua}}.. that functions like a take-while, where cond is repeatedly evaluated (in the same context, so it can use state) and siblings are repeatedly consumed until it returns false, and then the lua code gets executed with all the consumed siblings.
The text was updated successfully, but these errors were encountered:
Yet another alternative would be to expose a notion of "focus" or "current node" to the Lua code, which it could manipulate (get and set) freely. This, combined with an optionality construct (perhaps ${{lua}}?) would be enough to implement take-while or ellipses. Indeed, it would be more general. This would require #4.
As a general principle, the Lua API should subsume all other features:
bind
andmeta
subsume normal metavariables${{true}}
subsumes$_
match
andrec
subsume sub-patternsrx
and negation replace explicit/special support for these featuresHowever, Lua can't replace
$..
. What would such an API look like? Perhaps${{lua}}..
, wherelua
would have access to a sequence of nodes' textts
and a sequence of kindsks
? An even more general API would be something like${{cond||lua}}..
that functions like a take-while, wherecond
is repeatedly evaluated (in the same context, so it can use state) and siblings are repeatedly consumed until it returnsfalse
, and then thelua
code gets executed with all the consumed siblings.The text was updated successfully, but these errors were encountered: