Better than average syntax highlighting and formatting for emacs.
Go to file
Daniel Jalkut e4ac513afd lexer: pass code-unit length to U16_NEXT in UTF-16 decoders
`ts_decode_utf16_le` and `ts_decode_utf16_be` passed a byte length to
`U16_NEXT_LE` and `U16_NEXT_BE`, but those macros count `uint16_t` code
units. If a lead surrogate was the last code unit in a chunk, the decoder
could peek past the chunk and combine it with adjacent memory.

This commit passes the code-unit length to the UTF-16 macros, and fails
with `TS_DECODE_ERROR` when a chunk is too short to contain even one full
code unit. This lets the lexer retry with a fresh chunk or advance through
the invalid byte as it already does.

Co-authored-by: Will Lillis <will.lillis24@gmail.com>
Co-authored-by: Amaan Qureshi <git@amaanq.com>
(cherry picked from commit 0f6780b9a3)
2026-04-26 03:40:09 -04:00
.cargo chore: remove CARGO_WORKSPACE_DIR var 2025-09-24 16:14:08 -04:00
.github feat(dist): enable install via cargo binstall (#5533) 2026-04-24 09:36:10 +02:00
.zed Add zed config file (enable all cargo features for rust-analyzer) 2025-04-23 16:32:21 -07:00
crates lexer: pass code-unit length to U16_NEXT in UTF-16 decoders 2026-04-26 03:40:09 -04:00
docs docs: indicate that dashes are not permitted in parser names 2026-03-13 20:45:45 +01:00
lib lexer: pass code-unit length to U16_NEXT in UTF-16 decoders 2026-04-26 03:40:09 -04:00
test/fixtures lexer: pass code-unit length to U16_NEXT in UTF-16 decoders 2026-04-26 03:40:09 -04:00
.dockerignore Add a simple dockerfile for testing 2024-03-18 12:35:10 -07:00
.editorconfig style(zig): reformat files 2025-08-28 20:54:25 +03:00
.envrc feat: add nix flake 2025-09-01 22:48:37 -04:00
.gitattributes Reorganize rust crates into a flat crates directory, simplify some CI steps (#4496) 2025-06-06 14:25:37 -07:00
.gitignore refactor: rework nix flake 2025-09-09 03:03:35 -04:00
build.zig fix(build): define _BSD_SOURCE 2026-01-12 23:43:46 -05:00
build.zig.zon build(deps): bump wasmtime-c-api to v36.0.7 2026-04-10 09:46:43 +02:00
Cargo.lock build(deps): bump wasmtime-c-api to v36.0.7 2026-04-10 09:46:43 +02:00
Cargo.toml release v0.26.8 2026-03-31 19:31:10 +02:00
CMakeLists.txt release v0.26.8 2026-03-31 19:31:10 +02:00
CONTRIBUTING.md docs: improve docs for contributing to docs 2025-01-10 22:57:54 -05:00
Dockerfile Add a simple dockerfile for testing 2024-03-18 12:35:10 -07:00
flake.lock refactor: rework nix flake 2025-09-09 03:03:35 -04:00
flake.nix release v0.26.8 2026-03-31 19:31:10 +02:00
FUNDING.json chore: add FUNDING.json 2023-11-08 00:08:07 -05:00
LICENSE chore: copy license to all packages 2025-09-11 03:12:35 -04:00
Makefile release v0.26.8 2026-03-31 19:31:10 +02:00
Package.swift fix(build): define _BSD_SOURCE 2026-01-12 23:43:46 -05:00
README.md docs: change WASM/wasm to Wasm 2025-08-21 09:56:32 +03:00

tree-sitter

DOI discord matrix

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