From 5725085e3be9ee005c9b9cc4623d5ad5f90418f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 24 Mar 2022 21:53:58 +0300 Subject: Fix closing tags eating tokens --- src/parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.c b/src/parser.c index 4ccba1b..0e331d9 100644 --- a/src/parser.c +++ b/src/parser.c @@ -449,10 +449,10 @@ parser_parse_tblock(struct parser *parser, struct block *blk) return false; } vector_push(blk->tag.tblock.subblocks, subblk); + parser_next_token(parser); if (subblk->type == BLOCK_TAG && subblk->tag.type == TAG_CLOSE) { break; } - parser_next_token(parser); } hmap_sets(parser->tblocks, blk->tag.tblock.name.token.literal, blk); @@ -519,7 +519,7 @@ closing: blk->tag.type = TAG_CLOSE; onetoken: if (!parser_expect_peek(parser, TOKEN_PERCENT)) goto fail; - if (!parser_expect_peek(parser, TOKEN_RBRACE)) goto fail; + if (!parser_peek_token_is(parser, TOKEN_RBRACE)) goto fail; return blk; noopening:; parser_error(parser, parser->cur_token, "unexpected closing tag %s", -- cgit v1.2.3