Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua + ellipses #12

Open
langston-barrett opened this issue Mar 27, 2023 · 1 comment
Open

Lua + ellipses #12

langston-barrett opened this issue Mar 27, 2023 · 1 comment
Labels

Comments

@langston-barrett
Copy link
Owner

langston-barrett commented Mar 27, 2023

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.

@langston-barrett
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant