MCPcopy Index your code
hub / github.com/python/cpython / parse_comment

Method parse_comment

Lib/html/parser.py:387–398  ·  view source on GitHub ↗
(self, i, report=True)

Source from the content-addressed store, hash-verified

385 # Internal -- parse comment, return length or -1 if not terminated
386 # see https://html.spec.whatwg.org/multipage/parsing.html#comment-start-state
387 def parse_comment(self, i, report=True):
388 rawdata = self.rawdata
389 assert rawdata.startswith('<!--', i), 'unexpected call to parse_comment()'
390 match = commentclose.search(rawdata, i+4)
391 if not match:
392 match = commentabruptclose.match(rawdata, i+4)
393 if not match:
394 return -1
395 if report:
396 j = match.start()
397 self.handle_comment(rawdata[i+4: j])
398 return match.end()
399
400 # Internal -- parse bogus comment, return length or -1 if not terminated
401 # see https://html.spec.whatwg.org/multipage/parsing.html#bogus-comment-state

Callers 2

goaheadMethod · 0.95

Calls 6

handle_commentMethod · 0.95
startswithMethod · 0.45
searchMethod · 0.45
matchMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected