How to use backrefs with stateful lexer? #272
-
I would like to parse blocks starting and ending with the same string, eg.
The XXX should match. And I do want to capture XXX once. It's the name of the block. |
Beta Was this translation helpful? Give feedback.
Answered by
alecthomas
Oct 9, 2022
Replies: 1 comment 2 replies
-
Use |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ssquirrel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
\1
in a pushed state to refer to the capture groups from the rule that did the push. There's an example in the tests.