on master help sign in
Check the closing tag has the right name
commit107a5dd0eff918057439244e1a35b5ee606b92f4 authorNeil Mitchell <ndmitchell@gmail.com> dateThu 4 Jan 2018, 22:48 (9 years ago) parentfed359c
1 file changed+3
gen/test.c+3
gen/test.c+3
@@ -339,6 +339,9 @@ static inline str gap(const char* ref, const char* start, const char* end)
339339 str nodes = node_commit(&d->nodes); \
340340 me = &d->nodes.nodes[d->nodes.size - d->nodes.used_back]; \
341341 me->nodes = nodes; \
342+ if (me->name.length != gap(d->body, name_start, name_end).length || \
343+ memcmp(&d->body[me->name.start], name_start, me->name.length) != 0) \
344+ return "Mismatch in closing tag"; \
342345 me->inner = gap(d->body, &d->body[me->inner.start], tag_start); \
343346 me->outer = gap(d->body, &d->body[me->outer.start], p);
344347#define P_TagOpenClose \