| Crates.io | tree-sitter-yarn-spinner |
| lib.rs | tree-sitter-yarn-spinner |
| version | 0.0.7 |
| created_at | 2025-08-07 05:54:42.755673+00 |
| updated_at | 2025-08-08 10:24:31.143486+00 |
| description | Tree-sitter grammar for Yarn Spinner |
| homepage | |
| repository | https://github.com/yuna0x0/tree-sitter-yarn-spinner |
| max_upload_size | |
| id | 1784725 |
| size | 460,417 |
A tree-sitter grammar for Yarn Spinner, a dialogue system for interactive fiction and games.
⚠️ This tree-sitter parser is in early development and might have incomplete or incorrect grammar rules.
The grammar rules are based on the Yarn Spinner ANTLR 4 grammar files YarnSpinnerLexer.g4 and YarnSpinnerParser.g4 from the Yarn Spinner repository.
The grammar file in this repository is grammar.js with the external scanner in src/scanner.c and a generated src/grammar.json file.
This parser can be used with various programming languages that support tree-sitter. Here are some examples:
Rust:
cargo add tree-sitter-yarn-spinner
JavaScript / TypeScript / Node.js:
pnpm install tree-sitter-yarn-spinner
Python:
uv add tree-sitter-yarn-spinner
To build the parser, you need to have a JavaScript runtime like Node.js and a C compiler (like gcc, clang, or MSVC on Windows) installed.
Then, run the following command in the root directory of this repository, to install dependencies and generate the parser:
pnpm install
tree-sitter generate
To test the parser, you can run:
tree-sitter parse YOUR_FILE.yarn
Details can be found in the tree-sitter documentation.
This project is licensed under the MIT License.