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)`. |
||
|---|---|---|
| .cargo | ||
| .github | ||
| .zed | ||
| crates | ||
| docs | ||
| lib | ||
| test/fixtures | ||
| .dockerignore | ||
| .editorconfig | ||
| .envrc | ||
| .gitattributes | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CMakeLists.txt | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| flake.lock | ||
| flake.nix | ||
| FUNDING.json | ||
| LICENSE | ||
| Makefile | ||
| Package.swift | ||
| README.md | ||
tree-sitter
Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited. Tree-sitter aims to be:
- General enough to parse any programming language
- Fast enough to parse on every keystroke in a text editor
- Robust enough to provide useful results even in the presence of syntax errors
- Dependency-free so that the runtime library (which is written in pure C) can be embedded in any application