mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-10 07:36:22 -04:00
A previous fix moved case folding for `/i` patterns out of `regex_syntax` and into `expand_regex`, so folding could drop the two non-ASCII code points Unicode simple folding maps onto ASCII letters: the long s `ſ` (U+017F) onto `s`, and the Kelvin sign `K` (U+212A) onto `k`. Left in, they leak into otherwise-ASCII tokens and stop those tokens from being extracted as keywords. By that point, though, the HIR has already turned a negated class into a complement, so folding it applies the fold on the wrong side of the negation. `(?i)[^a-z]` folds a set that contains `A-Z`, which re-admits `a-z` and leaves a class matching very nearly everything. `regex_syntax` folds each leaf of a class expression before applying that leaf's negation and the set algebra above it. Keep that order and change only the fold: walk the AST, replace each leaf with its fold, and translate with `case_insensitive(false)`. |
||
|---|---|---|
| .. | ||
| cli | ||
| config | ||
| generate | ||
| highlight | ||
| language | ||
| loader | ||
| tags | ||
| xtask | ||