Commit graph

487 commits

Author SHA1 Message Date
Amaan Qureshi ea9ddbe190 docs: replace mdbook-admonish with mdBook admonitions 2026-08-30 17:33:12 -04:00
Will Lillis 3ac04a64f7 docs: add taplo instructions 2026-08-29 11:10:37 +02:00
Will Lillis d9cb739430 fix(toml): drop align_entries = true from .taplo.toml
This key was being applied inconsistently depending on nesting level.
2026-08-29 11:10:37 +02:00
Will Lillis 82639170a7 docs: specify Emscripten version constraints for web binding builds 2026-08-25 17:34:37 -04:00
Amaan Qureshi 74b7d0c951 feat!: add an eof function
This commit adds an `eof()` function for grammars, which is easier to
use than the NUL byte directly. It compiles down to a constraint that
the enclosing production can only reduce at end of input, not to a
shiftable token.

BREAKING CHANGE: Public error types for `tree-sitter-generate` were modified.

Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2026-08-21 20:02:58 -04:00
Max Brunsfeld 0e2af0d8d1
Allow using Tree-sitter rust lib in multi-threaded web apps compiled to wasm32-unknown-unknown (#5851)
* feat(wasm): make syntax trees sendable

* test(wasm): transfer trees across workers

* test(wasm): use JSON grammar for tree transfer

* test(wasm): edit trees across workers

* test(wasm): share dlmalloc with tree-sitter

* test(wasm): simplify worker tree exchange

* test(wasm): drive tree exchange from Rust

* test(wasm): split sendable-tree xtask

* test(wasm): generalize Rust web fixture

* test(wasm): exercise parallel Rust tree access

* fix(wasm): use Rust global allocator for C core

* test(wasm): use default Rust allocator

* feat(wasm): support external scanners in Rust web apps

* Simplify example further, add a readme

* Regenerate wasm-stdlib

* Fix wasm_stdlib check script

* Vendor the Wasm standard library subset

* Test Unicode Ruby scanner behavior in Wasm

* Make Wasm tree languages instance-aware

* Test multi-threaded use of queries in wasm32-unknown

* Refactor reference-counted language storage

* Check ABI version compat before loading rest of language

* 🎨 Remove redundant #ifdef block

* Reject unsupported Rust Wasm builds on 0.26
2026-08-14 17:05:42 -07:00
Will Lillis 3a76a8c8ca feat(cli)!: rework HTML output modes in highlight
- `--layout <document|line-numbers|fragment>` (default `document`): the
  document structure. `document` is a self-contained page wrapping a plain
  `<div class="highlight"><pre><code>` block, `line-numbers` adds a line-number
  `<table>`, and `fragment` emits only the code markup with no surrounding
  `<head>`/`<style>`/`<body>` so it can be embedded in an existing page.

- `--style <classes|inline|minimal>` (default `classes`): how token colors
  are applied. `classes` uses `class="..."` spans plus a generated `<style>`,
  `inline` bakes colors onto each span so the markup is self-contained, and
  `minimal` emits bare classes with no colors (bring your own stylesheet).

Deprecates the `--css-classes` flag.
2026-07-24 20:56:56 -04:00
Will Lillis f45a488dea feat(cli)!: make parent flags a hard requirements via clap
Also correct a parameter name in `print_tree_graph`
2026-07-18 17:00:53 -04:00
Will Lillis dfcf73921c fix(query): keep the trailing anchor when a zero-matched quantifier is anchored
on both sides

In `A . Q* . B`, a zero-matched `Q` made both anchors vacuous, so `A` and `B`
were no longer required to be immediate siblings. Only relax the following
anchor on a `?`/`*` zero-skip when the skipped step has no leading anchor of
its own; otherwise the adjacency transfers through the empty run.
2026-07-17 17:53:45 -04:00
Kamal Chandra Upreti 49dd7b4079
docs(init): fix broken link 2026-07-15 12:13:07 +00:00
Will Lillis cce7768b27 docs: specify valid children of supertype nodes 2026-07-08 10:36:50 +02:00
Will Lillis 9fc2f486a8 docs(queries): clarify behavior of first child anchor example
Some checks failed
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
CI / sanitize (push) Has been cancelled
CI / build (push) Has been cancelled
CI / check-wasm-stdlib (push) Has been cancelled
Deploy Docs / deploy-docs (push) Has been cancelled
Check Wasm Exports / check-wasm-exports (push) Has been cancelled
2026-07-01 19:31:05 -04:00
Will Lillis ec872bca82 docs(queries): specify anchor behavior with quantifiers and groups
- An anchor between two patterns is vacuous when an adjacent quantifier
matches zero

- A leading or trailing anchor on a node applies to the nearest matched node
when an adjacent optional is skipped

- An anchor at the edge of a group or alternation is not allowed.
2026-07-01 19:31:05 -04:00
ALancki1 b360d655cc Clarify behavior of advance(..., skip) in external scanner docs
Clarifies the behavior of `TSLexer::advance` when `skip=true`.

The previous documentation didn't make it clear that `skip=true` should only be used before a token starts. Using it after `mark_end` can affect the token’s starting position and lead to incorrect or zero-length ranges.

Fixes #2315
2026-06-25 22:54:18 -04:00
buckynbrocko 49f5027158 Added tree-sitter test option --show-diff-markers to force use of + & - while still coloring output
Also cleanup the trailing newline special casing in the `TestDiff`
`Display` impl.

Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2026-06-13 10:29:37 -04:00
Will Lillis 4154ff23c0 fix(docs): explicitly warn against aliasing supertypes 2026-06-05 17:31:26 -04:00
Will Lillis cd338a7a43 fix(loader): skip --no-undefined for sanitizer grammar builds
Compiling a grammar with `-fsanitize=address` (or any other sanitizer)
emits a module constructor in the parser object file that references
runtime symbols like `__asan_init`. These runtime-resolved symbols are
incompatible with `-Wl,--no-undefined`, which breaking sanitized test
runs on clang. (gcc happens to paper over this by auto-linking libasan
into the .so)

To fix, detect `-fsanitize=` in the compile flags and omit `--no-undefined`
in that case.
2026-05-31 10:56:40 -04:00
Will Lillis 8d737aa238 docs: note zero point unbounded behavior in query functions 2026-04-30 04:28:59 -04:00
Amaan Qureshi 475c48d1e3 docs: add AI policy
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
2026-04-26 02:58:56 -04:00
Will Lillis 3294a64027 perf(cli): replace regex with manual parsing in test file parser
This started as a simple one to one rewrite, just removing the regexes,
and quickly devolved into a rewrite of the test parsing logic. In
addition to the memory enhancements, the general flow should be much
clearer now. A few data points:

- JS:   walltime -1.3%, peak rss -10.2%
- C:    walltime -5.7%, peak rss -4.5%
- Rust: walltime -3.8%, peak rss -2.2%
2026-03-31 04:00:43 -04:00
futsuuu 0d4f5cb13f fix(loader): don't discard CC wrapper command specified in CC variable 2026-03-31 01:43:43 -04:00
Will Lillis 9a48405a87 fix(docs): correct various typos 2026-03-28 05:23:10 -04:00
Will Lillis 30d9c675a4 docs: indicate that dashes are not permitted in parser names 2026-03-13 15:35:14 -04:00
Will Lillis 30ed8da439 Revert "feat: allow - in grammar names"
This reverts commit 7d3c321253.
2026-03-13 15:35:14 -04:00
Riley Bruins cf302b07d1 fix(query): don't add copies for quantifier steps outside alternations 2026-03-04 10:32:50 +01:00
John Eismeier 1f9b274dfb
chore: fix typos in messages and documentation
Signed-off-by: John E <jeis4wpi@outlook.com>
2026-03-01 11:40:15 +01:00
Will Lillis d0714e0828 docs: add basic information about creating releases 2026-02-21 15:59:32 +01:00
Amaan Qureshi ebd2a56b5d treewide: add taplo config and reformat toml files 2026-02-18 00:59:34 -05:00
Jeremy Fleischman 7d3c321253 feat: allow - in grammar names
A number of grammars in the wild have this character in their name:

- https://github.com/sogaiu/tree-sitter-janet-simple/pull/7
- https://github.com/tree-sitter/tree-sitter-c-sharp/pull/408
- https://github.com/tree-sitter/tree-sitter-embedded-template/pull/45
- https://github.com/tree-sitter/tree-sitter-ql-dbscheme/pull/7

I read through https://github.com/tree-sitter/tree-sitter/pull/3700 and
https://github.com/tree-sitter/tree-sitter/issues/3637, and it doesn't
look like there was much discussion about this name regex, so hopefully
this is an acceptable change?
2026-02-09 21:28:04 -05:00
Will Lillis 7e1d8add13 feat(cli): add --verbose flag to build command
This displays the working directory of the command (if present),
compiler used, all of its arguments, any environment variables set,
and anything written to stdout/stderr by the compilation tool.
2026-02-01 13:00:02 -05:00
Will Lillis 7100767f64 docs: include info on environment variables for fuzz command 2026-02-01 12:31:13 -05:00
Will Lillis 8816d4494f docs: document parser library symbol checks for build command 2026-01-25 18:19:32 -05:00
Will Lillis aea4ef2338 feat(xtask): give wasm-opt the wasi-sdk treatment 2026-01-21 21:30:13 -05:00
Will Lillis e64e74d5ed docs: adhere to 120 new word column limit for docs 2026-01-14 18:11:42 -05:00
Will Lillis 1a88b26a10 docs: note requirement to rebuild wasm stdlib 2026-01-14 18:11:42 -05:00
skewb1k 999e041d49 docs: add tip about using test --update flag 2025-12-31 01:43:48 -05:00
Christian Clason ba7350c7ee docs(cli): better description of files generated by init 2025-12-25 13:16:57 +01:00
kevin-hua-kraken a7d8c0cbb2
fix(playground): update query API 2025-12-23 10:36:40 +02:00
skewb1k 642b56d9af fix(docs): remove conflicting --release cargo flag in contributing.md
The argument '--release' cannot be used with '--profile <PROFILE-NAME>'
2025-12-14 20:35:13 +01:00
Christian Clason 0574fcf256 docs(cli): include information on generated files 2025-12-14 14:26:49 +01:00
Christian Clason cd4b6e2ef9 0.26.3 2025-12-13 13:41:03 +01:00
Marcono1234 3bd44afcaa docs(cli): fix wrong file path for Java bindings test
The test is currently generated in the default (= unnamed) package.
2025-12-10 20:54:07 +02:00
Will Lillis 8b8199775f 0.26.x
Also bump the tree-sitter-language crate to 0.1.6
2025-12-09 17:19:25 -05:00
Will Lillis 8a3dcc6155 release 0.26.1 2025-12-08 17:05:03 -05:00
ObserverOfTime d861e2bcd9 docs(cli): list Java & Zig binding files 2025-12-08 15:47:15 -05:00
Piotr Osiewicz c0b1710f8a Add containing range APIs to query cursor
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: John Tur <john-tur@outlook.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-12-03 18:06:16 -05:00
skewb1k 882aa867eb docs: remove manual bindings update steps for scanner
Since 66dab20462, bindings automatically
detect external scanner, making the instructions for manual updating
outdated. Avoids confusion about missing commented lines in Rust
bindings.
2025-11-24 23:00:40 +01:00
Will Lillis e92a7803eb fix(docs): final updates before 0.26.1
- Indicate where xtask looks for wasi-sdk
- Indicate where `build --wasm` looks for and downloads wasi-sdk binary
  to
- Mark native runtime as experimental, describe limitations
- Note ABI 13 support limitations
- Mention that `test --wasm` and `parse --wasm` require
  `--features=wasm` build
2025-11-24 15:18:12 +01:00
Will Lillis d592b16ac0 fix(docs): list dependencies on external tooling for version command 2025-11-21 19:40:14 -05:00
Antonin Delpeuch 120f74723e docs: fix typo in the page about ABI version
Of course I only catch that once they are already published…
2025-11-20 09:58:07 +01:00