Skip to content

Non matching end tag in example xml parser not taken into account #1709

Answered by NaridaL
medihack asked this question in Q&A
Discussion options

You must be logged in to vote

@medihack The XML Parser extends CSTParser, so it includes all the parsed tokens in the output and a check whether start and end tags match could be implemented as a second pass.

If you want to check immediately, you could assign the two consumed Name tokens to variables and then check if they match.

if (openName.image !== closeName.image) throw new Error("unexpected closing tag")

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@medihack
Comment options

Answer selected by medihack
Comment options

You must be logged in to vote
1 reply
@medihack
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants