You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository tries to cover the tree-sitter implementation for the OPA Rego language
You can use NVM in order to load the Node version used to develop the grammar by issuing nvm use
Available scripts
yarn generate # initializes parsing for the grammar.js file
yarn build # compiles the tree-sitter grammar
Please, verify that your editor supports EditorConfig plugin, which is necessary to keep the development consistent.
This repository uses Github Actions, which help verify that the changes submitted can be unit-tested, built and deployed to a Github Pages
List of TODO items:
Introduce more unit tests covering the internal functions
This will open locally https://127.0.0.1:8000/, where you can check your rules
directly in the browser
Local testing in NeoVim
To be able to locally verify the changes - you should modify your init.lua file
to point to your locally installed tree-sitter grammar
localparser_config=require"nvim-treesitter.parsers".get_parser_configs()
parser_config.rego= {
install_info= {
url="/home/user/Documents/tree-sitter-rego", -- local path or git repofiles= {"src/parser.c"},
-- optional entries:branch="master", -- default branch in case of git repo if different from mastergenerate_requires_npm=false, -- if stand-alone parser without npm dependenciesrequires_generate_from_grammar=false, -- if folder contains pre-generated src/parser.c
},
filetype="rego", -- if filetype does not match the parser name
}