(self, chunk)
| 1274 | if s[start + search_pos:end] == thead: return i # if s_tail == token_head |
| 1275 | |
| 1276 | def _iter_markup(self, chunk): |
| 1277 | if self.stopped: |
| 1278 | raise StopMarkupException() |
| 1279 | cur_meth = self.cur_meth |
| 1280 | abs_start_section = self.abs_start_section |
| 1281 | start_next_sec = 0 |
| 1282 | skip_start = 0 |
| 1283 | tlen = self.tlen |
| 1284 | eat_data, eat_headers = self._eat_data, self._eat_headers |
| 1285 | while True: |
| 1286 | try: |
| 1287 | end_section = cur_meth(chunk, start_next_sec) |
| 1288 | except StopMarkupException: |
| 1289 | self.stopped = True |
| 1290 | return |
| 1291 | if end_section is None: break |
| 1292 | if cur_meth == eat_headers: |
| 1293 | sec_name = 'headers' |
| 1294 | start_next_sec = end_section + CRLFx2_LEN |
| 1295 | cur_meth = eat_data |
| 1296 | skip_start = 0 |
| 1297 | elif cur_meth == eat_data: |
| 1298 | sec_name = 'data' |
| 1299 | start_next_sec = end_section + tlen |
| 1300 | skip_start = CRLF_LEN |
| 1301 | cur_meth = eat_headers |
| 1302 | else: |
| 1303 | assert cur_meth == self._eat_start_boundary |
| 1304 | sec_name = 'data' |
| 1305 | start_next_sec = end_section + tlen |
| 1306 | skip_start = CRLF_LEN |
| 1307 | cur_meth = eat_headers |
| 1308 | |
| 1309 | # if the body starts with a hyphen, |
| 1310 | # we will have a negative abs_end_section equal to the length of the CRLF |
| 1311 | abs_end_section = self.abspos + end_section |
| 1312 | if abs_end_section < 0: |
| 1313 | assert abs_end_section == -CRLF_LEN |
| 1314 | end_section = -self.abspos |
| 1315 | yield sec_name, (abs_start_section, self.abspos + end_section) |
| 1316 | abs_start_section = self.abspos + start_next_sec + skip_start |
| 1317 | self.abspos += len(chunk) |
| 1318 | self.cur_meth = cur_meth |
| 1319 | self.abs_start_section = abs_start_section |
| 1320 | |
| 1321 | def _eat_start_boundary(self, chunk, base): |
| 1322 | if self.trest is None: |
no test coverage detected