#tree-sitter #incremental #parser #rigz

tree-sitter-rigz

Rigz grammar for tree-sitter

5 releases (3 breaking)

0.3.0 Oct 29, 2024
0.2.0 Oct 25, 2024
0.1.1 Sep 6, 2024
0.1.0 Aug 13, 2024
0.0.1 May 14, 2024

#293 in Parser tooling

Download history 6/week @ 2024-07-29 122/week @ 2024-08-12 108/week @ 2024-09-02 4/week @ 2024-09-09 25/week @ 2024-09-16 30/week @ 2024-09-23 21/week @ 2024-09-30 133/week @ 2024-10-21 144/week @ 2024-10-28 4/week @ 2024-11-04

281 downloads per month
Used in rigz

MIT license

530KB
18K SLoC

C 18K SLoC JavaScript 142 SLoC // 0.1% comments Scheme 56 SLoC Rust 31 SLoC // 0.2% comments

tree-sitter-rigz

Setup for Neovim

  1. Add the following to init.lua
vim.filetype.add({
  extension = {
    rigz = "rigz",
  },
})

local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.rigz = {
  install_info = {
    url = "~/parsers/tree-sitter-rigz", -- local path or git repo
    files = {"src/parser.c"},
    generate_requires_npm = false, -- if stand-alone parser without npm dependencies
    requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
    branch = "main", -- default branch is not master
    filetype = 'rigz',
  },
}
  1. curl "https://gitlab.com/magicfoodhand/tree-sitter-rigz/-/raw/main/queries/highlights.scm?ref_type=heads" -o ~/.local/share/nvim/lazy/nvim-treesitter/queries/rigz/highlights.scm

Rust Derive Macro Highlighting

(macro_invocation
  (scoped_identifier
    name: (identifier) @name (#eq? @name derive_module!))

  (token_tree (raw_string_literal) @rigz_string)
)

(macro_invocation
  (scoped_identifier
    path: (identifier) @path (#eq? @path rigz_ast_derive)
    name: (identifier) @name (#eq? @name derive_module!))

  (token_tree (raw_string_literal) @rigz_string)
)

Dependencies

~2–285KB