Commit 6a92674
committed
Reject malformed/out-of-range \u and \x escapes in strings
A string escape must be well-formed: \u{cp} with cp <= 0x10FFFF, a 4-hex
\uXXXX, or a 2-hex \xXX; any other \<char> (\n, \\, \q non-escape, line
continuation) stays valid. A \u/\x that doesn't match its strict form makes the
string match no token, so the lexer throws — TS's exact rejection. The in-range
code point is encoded directly in the regex: 0* leading zeros then 1-5 hex
(0-0xFFFFF) or 10+4 hex (0x100000-0x10FFFF).
Rejects \u{110000}, \u{FFFFFFFF}, \u{-DDDD}, \u{r}, \u{}, \u{, \u{67 in
string literals. FP 116->108 (8 unicodeExtendedEscapesInStrings cases), FN stays
0 (3376/3376), TP unchanged, highlighter 99.3% unchanged. Artifacts regenerated.
Templates share the same escape fragment but tokenize via the engine — next.1 parent 42ed333 commit 6a92674
4 files changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
| |||
0 commit comments