Skip to content

Latest commit

 

History

History

tree-sitter-tolk

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

tree-sitter-tolk

Tolk grammar for tree-sitter.

Based on https://github.com/akifoq/tree-sitter-func, but actually almost rewritten.

How to update and test grammar

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 manually test, create tmp.tolk with some content, and run

tree-sitter parse tmp.tolk

and manually inspect the output.

If you introduce new keywords, also modify queries/highlights.scm.
This file is not needed for VS Code, but

tree-sitter highlight tmp.tolk

produces colored output, just a pleasant feature, so keep this file up to date also.

Note, that for VS Code highlighting, besides grammar, you will probably have to touch .tmLanguage.json.

Finally, to build wasm, run in the project folder

yarn grammar:wasm

This is executed in Docker and may take a long time for first run. On finish, tree-sitter-tolk.wasm will be saved into the server/ folder.

Don't forget to run/update JS tests after modifying grammar!