(to: number)
| 1470 | // Counting resumes only where parsing stopped, which is never between a CR |
| 1471 | // and an LF. |
| 1472 | private count(to: number): void { |
| 1473 | const s = this.buf |
| 1474 | const base = this.base |
| 1475 | const i = this.counted - base |
| 1476 | if (i >= to) return |
| 1477 | let cr = this.nextCR === -1 ? indexOrEnd(s, "\r", i) : this.nextCR |
| 1478 | let lf = this.nextLF === -1 ? indexOrEnd(s, "\n", i) : this.nextLF |
| 1479 | while (true) { |
| 1480 | if (cr < to && cr < lf) { |
| 1481 | this.line++ |
| 1482 | this.lineStart = base + cr + 1 |
| 1483 | cr = indexOrEnd(s, "\r", cr + 1) |
| 1484 | } else if (lf < to) { |
| 1485 | // The LF of a CRLF does not start a new line |
| 1486 | if (!(lf > 0 && s.charCodeAt(lf - 1) === CR)) this.line++ |
| 1487 | this.lineStart = base + lf + 1 |
| 1488 | lf = indexOrEnd(s, "\n", lf + 1) |
| 1489 | } else { |
| 1490 | break |
| 1491 | } |
| 1492 | } |
| 1493 | this.nextCR = cr |
| 1494 | this.nextLF = lf |
| 1495 | this.counted = base + to |
| 1496 | } |
| 1497 | |
| 1498 | private syntax(message: string, i: number): XmlError { |
| 1499 | return this.error("Syntax", message, this.base + i) |
no test coverage detected