#parser #cooklang #incremental

tree-sitter-cooklang

cooklang grammar for the tree-sitter parsing library

2 releases

0.0.2 Nov 12, 2023
0.0.1 Nov 11, 2023

#200 in Text editors

50 downloads per month

MIT license

45KB
1.5K SLoC

C 1.5K SLoC JavaScript 46 SLoC Rust 31 SLoC // 0.5% comments Scheme 14 SLoC

Tree-sitter-cooklang

This is an unofficial tree-sitter grammar for Cooklang.

Testing the grammar

  • tree-sitter generate to compile the grammar and generate the different bindings.
  • tree-sitter test to run the tests (in corpus folder)
  • make clean to remove all generated files

Using the syntax highlight

With tree-sitter

To use the syntax highlight with tree-sitter, follow the indication in the doc. Then you can run tree-sitter highlight {your_file}.cook. You should see something like

screenshot

With Helix

Follow the indication in the adding languages page, or:

  • Edit your language.toml file to add

    [[language]]
    name = "cooklang"
    scope = "source.cook"
    file-types = ["cook"]
    roots = []
    
    [[grammar]]
    name = "cooklang"
    source = { path = "/local/path/to/tree-sitter-cooklang"}
    
  • In your helix configuration folder, be sure that the folders runtime/grammars and runtime/queries/cooklang exists.

  • Copy the content of the queries folder to your personal runtime/queries/cooklang

  • build the grammar by doing hx --grammar build cooklang

helix screenshot

Reference

Dependencies

~2.7–4MB
~71K SLoC