docs: clarify that only the whitespace character class is simplfied

This commit is contained in:
Amaan Qureshi 2025-09-14 15:47:23 -04:00 committed by Amaan Qureshi
parent 4dbfb5b49a
commit 2ae677162f

View file

@ -471,9 +471,8 @@ module.exports = grammar({
```
```admonish note
Tree-sitter intentionally simplifies some common regex patterns, both as a performance optimization and for simplicity,
typically in ways that don't affect the meaning of the pattern. For example, `\w` is simplified to `[a-zA-Z0-9_]`, `\s`
to `[ \t\n\r]`, and `\d` to `[0-9]`. If you need more complex behavior, you can always use a more explicit regex.
Tree-sitter intentionally simplifies the whitespace character class, `\s`, to `[ \t\n\r]` as a performance
optimization. This is because typically users do not require the full Unicode definition of whitespace.
```
## Using Supertypes