1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! In-tree Typst grammar for tree-sitter.
//!
//! Replaces the previous `tree-sitter-typst` path-dependency. The C
//! sources (`parser.c`, `scanner.c`, `unicode.h`, and the internal
//! `tree_sitter/*.h` headers) are compiled into the binary by
//! `build.rs` and exposed here as a single Rust function.
//!
//! Upstream: `github.com/uben0/tree-sitter-typst` — MIT licensed
//! (© 2023 Gerbais-Nief Eddie). See `LICENSES/tree-sitter-typst-LICENSE`
//! for the unmodified license text.
//!
//! ## Refreshing the grammar
//!
//! To pull a newer parser from upstream, copy these files verbatim
//! from `github.com/uben0/tree-sitter-typst` into this directory:
//!
//! - `src/parser.c` → `src/grammar/parser.c`
//! - `src/scanner.c` → `src/grammar/scanner.c`
//! - `src/unicode.h` → `src/grammar/unicode.h`
//! - `src/tree_sitter/{alloc,array,parser}.h`
//! → `src/grammar/tree_sitter/`
//!
//! Update `LICENSES/tree-sitter-typst-LICENSE` if the upstream
//! copyright year or holder changes. Rebuild + verify
//! `tui::highlight::TypstHighlighter::new()` still constructs
//! without error, then re-test syntax colouring in the TUI editor
//! pane.
use Language;
unsafe extern "C"
/// Get the tree-sitter `Language` for Typst. Wraps the in-tree
/// grammar's C entry point.