MCPcopy Create free account
hub / github.com/Kitware/VTK / htmlParseLookupCommentEnd

Function htmlParseLookupCommentEnd

ThirdParty/libxml2/vtklibxml2/HTMLparser.c:5197–5220  ·  view source on GitHub ↗

* htmlParseLookupCommentEnd: * @ctxt: an HTML parser context * * Try to find a comment end tag in the input stream * The search includes "-->" as well as WHATWG-recommended incorrectly-closed tags. * (See https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment) * This function has a side effect of (possibly) incrementing ctxt->checkIndex * to avoid rescann

Source from the content-addressed store, hash-verified

5195 * Returns the index to the current parsing point if the full sequence is available, -1 otherwise.
5196 */
5197static int
5198htmlParseLookupCommentEnd(htmlParserCtxtPtr ctxt)
5199{
5200 int mark = 0;
5201 int offset;
5202
5203 while (1) {
5204 mark = htmlParseLookupSequence(ctxt, '-', '-', 0, 0);
5205 if (mark < 0)
5206 break;
5207 if ((NXT(mark+2) == '>') ||
5208 ((NXT(mark+2) == '!') && (NXT(mark+3) == '>'))) {
5209 ctxt->checkIndex = 0;
5210 break;
5211 }
5212 offset = (NXT(mark+2) == '!') ? 3 : 2;
5213 if (mark + offset >= ctxt->input->end - ctxt->input->cur) {
5214 ctxt->checkIndex = mark;
5215 return(-1);
5216 }
5217 ctxt->checkIndex = mark + 1;
5218 }
5219 return mark;
5220}
5221
5222
5223/**

Callers 1

htmlParseTryOrFinishFunction · 0.85

Calls 1

htmlParseLookupSequenceFunction · 0.85

Tested by

no test coverage detected