Zulip Chat Archive
Stream: lean4
Topic: Naming a subexpression of a Syntax match
Eric Wieser (Apr 17 2023 at 13:29):
I have a macro of the form
macro_rules
| `(!![$[$[$rows],*];*]) => do
which matches things like !![a, b; c d].
How can I obtain a Syntax object corresponding to the entire a, b row, so that I can use it with docs4#Macro.throwErrorAt ?
Sebastian Ullrich (Apr 17 2023 at 14:06):
If it's just about the error range, we often stick the beginning and end into mkNullNode for that purpose
Eric Wieser (Apr 17 2023 at 14:17):
Is there any way to obtain the Syntax nodes corresponding to the , and ; tokens?
Eric Wieser (Apr 17 2023 at 14:17):
Or in general, to capture position information in a syntax match, in order to pass it to mkNullNode later
Mario Carneiro (Apr 17 2023 at 14:31):
not using the fancy syntax
Mario Carneiro (Apr 17 2023 at 14:32):
I would love to have some kind of $tk@ syntax for capturing tokens
Eric Wieser (Apr 17 2023 at 14:32):
mkNullNode was good enough in the end
Eric Wieser (Apr 17 2023 at 14:32):
(context is !4#3427)
Last updated: May 02 2025 at 03:31 UTC