(input, pos)
| 375 | * @returns {number} position past the escape sequence |
| 376 | */ |
| 377 | const _consumeAnEscapedCodePoint = (input, pos) => { |
| 378 | // Caller has verified the `\` and the next code point form a valid |
| 379 | // escape. Hex digits: consume up to 6 hex digits, then one optional |
| 380 | // whitespace. Non-hex: consume one code point. |
| 381 | // `\` at EOF: nothing to consume; return pos so callers don't overrun. |
| 382 | if (pos >= input.length) return pos; |
| 383 | const cc = input.charCodeAt(pos); |
| 384 | pos++; |
| 385 | if (pos === input.length) return pos; |
| 386 | if (_isHexDigit(cc)) { |
| 387 | for (let i = 0; i < 5; i++) { |
| 388 | if (_isHexDigit(input.charCodeAt(pos))) pos++; |
| 389 | } |
| 390 | const trail = input.charCodeAt(pos); |
| 391 | if (_isWhiteSpace(trail)) { |
| 392 | pos++; |
| 393 | pos = consumeExtraNewline(trail, input, pos); |
| 394 | } |
| 395 | } |
| 396 | return pos; |
| 397 | }; |
| 398 | |
| 399 | /** |
| 400 | * Spec: "two code points are a valid escape" — first is `\`, second is |
no test coverage detected