Jakt grammar for tree-sitter
Jakt is a memory safe programming language created for SerenityOS that transpiles to C++.
tree-sitter-jakt implements 100% (330/330) of the Jakt Samples as of February 26, 2023
The tree-sitter cli is required to run tests.
tree-sitter generate && tree-sitter test
See the CONTRIBUTING.md.
Note: this step is only temporary. The highlighter will eventually be added to the nvim-tressitter project to be included with neovim.
-
Add the following to the neovim (lua) config:
local parser_config = require "nvim-treesitter.parsers".get_parser_configs() parser_config.jakt = { install_info = { url = "https://github.com/demizer/tree-sitter-jakt.git", -- local path or git repo files = {"src/parser.c", "src/scanner.c"}, -- optional entries: branch = "main", -- default branch in case of git repo if different from master generate_requires_npm = false, -- if stand-alone parser without npm dependencies requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c }, }
-
Manually install the highlighter
See nvim-treesitter instructions
highlights.scm
is contained in the tree-sitter-jakt repository.mkdir -p ~/.config/nvim/queries/jakt cp queries/* ~/.config/nvim/queries/jakt/
-
Install tree-sitter-jakt using neovim
:TSInstall jakt
-
checkhealth in neovim
:checkhealth
-
jakt
should be contained in the tree-sitter parsers and should it should have a check underhighlight
. -
Configure filetype detection
vim.filetype.add { extension = { jakt = "jakt"} }
-
Open a jakt file