Tolk grammar for tree-sitter.
You should update grammar.js and/or grammar/ folder (required from js).
Folders src, bindings, build, and files binding.gyp, Cargo.toml are auto-generated by tree-sitter.
After updating grammar, run:
tree-sitter generate(will change src/).
To play with parser, you can run interactive playground:
yarn playTo manually test, create tmp.tolk with some content, and run:
tree-sitter parse tmp.tolkTo see all parsing steps run:
tree-sitter parse -D --open-log tmp.tolkIf you introduce new keywords, also modify queries/highlights.scm.
This file is not needed for VS Code, but:
tree-sitter highlight tmp.tolkproduces colored output, just a pleasant feature, so keep this file up to date also.
Finally, to build wasm, run in the project folder:
yarn grammar:wasmOn finish, tree-sitter-tolk.wasm will be saved into the server/ folder.
Don't forget to run/update JS tests after modifying grammar!