tree-sitter-mal
MAL grammar for tree-sitter. Used in the MAL-toolbox to parse MAL languages.
References
Usage
Install tree sitter CLI to be able to use this grammar. Then, run tree-sitter generate to generate the parser from the grammar and tree-sitter test to test the parser, as well as the syntax highlighting and code navigation queries.
To see the parse tree the parser generates, use the command tree-sitter parse.
To use the highlight through the command line, make sure you have a config file initialized. Then, you can use your own highlighting colors or copy the ones in the repository, specialized for MAL. Lastly, use tree-sitter highlight to generate an output, see the docs for more information.
For more commands see tree sitter CLI docs and the tree-sitter-mal Wiki.
NeoVim Manual Installation
[!NOTE] Tested for NeoVim v0.11.1.
Using nvim-treesitter
- Install the grammar. Simply add the following Lua snippet to your configuration (
init.luaor respective package config)local parser_config = require . parser_config. = vim.. - Install the queries. Find the query installation folder (it will be in your runtime path,
:h rtp). You can find various locations by using e.g.find ~ -type d -and -iname "queries"(NOTE: This example only looks at files installed in your home directory). An example of the path can be$HOME/.local/share/nvim/lazy/nvim-treesitter/if you are using the Lazy PM. Install the files fromqueriesinto a directory named after the language (cp -r queries $NVIM_TREESITTER_QUERIES/mal/). - Verify that everything is installed by running a healthcheck
:checkhealth nvim-treesitter, the table will list if the grammar and highlighting has been found. - Configure Nvim to start tree-sitter. Here is an example using auto-commands:
vim..