(src: str, pos: Pos, hex_len: int)
| 499 | |
| 500 | |
| 501 | def parse_hex_char(src: str, pos: Pos, hex_len: int) -> tuple[Pos, str]: |
| 502 | hex_str = src[pos : pos + hex_len] |
| 503 | if len(hex_str) != hex_len or not HEXDIGIT_CHARS.issuperset(hex_str): |
| 504 | raise suffixed_err(src, pos, "Invalid hex value") |
| 505 | pos += hex_len |
| 506 | hex_int = int(hex_str, 16) |
| 507 | if not is_unicode_scalar_value(hex_int): |
| 508 | raise suffixed_err(src, pos, "Escaped character is not a Unicode scalar value") |
| 509 | return pos, chr(hex_int) |
| 510 | |
| 511 | |
| 512 | def parse_literal_str(src: str, pos: Pos) -> tuple[Pos, str]: |
no test coverage detected