tree-sitter-yarn-spinner
v0.0.7
Published
Tree-sitter grammar for Yarn Spinner
Maintainers
Readme
tree-sitter-yarn-spinner
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.
Bindings
This parser can be used with various programming languages that support tree-sitter. Here are some examples:
Rust:
cargo add tree-sitter-yarn-spinnerJavaScript / TypeScript / Node.js:
pnpm install tree-sitter-yarn-spinnerPython:
uv add tree-sitter-yarn-spinnerBuild
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 generateTo test the parser, you can run:
tree-sitter parse YOUR_FILE.yarnDetails can be found in the tree-sitter documentation.
License
This project is licensed under the MIT License.
