(self, i, report=True)
| 359 | # Internal -- parse comment, return length or -1 if not terminated |
| 360 | # see https://html.spec.whatwg.org/multipage/parsing.html#comment-start-state |
| 361 | def parse_comment(self, i, report=True): |
| 362 | rawdata = self.rawdata |
| 363 | assert rawdata.startswith('<!--', i), 'unexpected call to parse_comment()' |
| 364 | # If no close was found after an earlier position in the same `rawdata`, there |
| 365 | # is none after this one either. Don't rescan the rest of the document again. |
| 366 | searched, pos = self._no_commentclose |
| 367 | if searched is rawdata and i + 4 >= pos: |
| 368 | match = None |
| 369 | else: |
| 370 | match = commentclose.search(rawdata, i+4) |
| 371 | if not match: |
| 372 | self._no_commentclose = (rawdata, i + 4) |
| 373 | self.handle_data('<') |
| 374 | return i + 1 |
| 375 | if report: |
| 376 | j = match.start() |
| 377 | self.handle_comment(rawdata[i+4: j]) |
| 378 | return match.end() |
| 379 | |
| 380 | def parse_html_declaration(self, i: int) -> int: |
| 381 | if self.at_line_start() or self.intail: |
nothing calls this directly
no test coverage detected