Open ckp95 opened 10 months ago
Your parser would match an arbitrary start tag (which gives it the tag name), followed by the contents (some more text
) followed by an end tag with the same name as the start tag. Since it's all one parser, it knows the start tag.
Conceptual question, I wasn't able to figure this out from reading the docs. Let's say I have some XML-like language where you can have tags with arbitrary alphanumeric text in them, and they have to be symmetric, like this:
The possible tags aren't hardcoded ahead of time, they can be anything so long as the tags balance. So this is invalid:
The parser for the second tag would have to look for the exact string matched by the parser for the first tag (kinda like regex capture groups), but I don't know how to express that in this library.