Skip to content

simonvic/tree-sitter-enforce

Repository files navigation

tree-sitter-enforce

CI

Enforce grammar for tree-sitter.

This grammar intends to be a close approximation of the Enforce script "specification".

Note

We don't have official specification; some opinionated choices may have been taken (e.g. mandatory semicolon terminated statements)

Read more about it here

Getting started

neovim

Neovim doesn't recognize the Enforce filetype, and since it uses .c file extension, you need to add a custom language filetype; add the following somewhere in your init.lua

vim.filetype.add({
	pattern = {
		[".*/scripts/.*/.*%.c"] = "enforce",
	},
})

The pattern will match all .c files in a scripts/some_module/ directory. You may have to modify the pattern to suit your needs.

To install the parser, you can use nvim-treesitter plugin and run :TSInstall enforce

VSCode

Note

This has not been tested. Use at your own discretion

You can use tree-sitter-vscode plugin. You'll likely need tree-sitter-enforce.wasm, which you can find in the releases or you can clone this repository and build it with tree-sitter

About

Enforce script grammar for treesitter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •