summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathew Polzin <matt.polzin@gmail.com>2023-10-06 20:43:35 -0500
committerGitHub <noreply@github.com>2023-10-07 10:43:35 +0900
commit3a2cc3161e01455d619a8076f0aa7fcd3e930090 (patch)
treef79eb3b38e2e4ae44e967e3555fd2ce40924e7d5
parentUpdate parsers: cuda, elm, erlang, glimmer, glsl, hlsl, java, tsx, typescript... (diff)
downloadnvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.tar
nvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.tar.gz
nvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.tar.bz2
nvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.tar.lz
nvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.tar.xz
nvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.tar.zst
nvim-treesitter-3a2cc3161e01455d619a8076f0aa7fcd3e930090.zip
feat(authzed): add parser and highlight queries. (#5426)
* feat(authzed): add parser and highlight queries * Update queries/authzed/highlights.scm use `any-of` for list of alternative words. Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com> * add injections queries file. * Update queries/authzed/highlights.scm * tweak whitespace * fix errors with capture names. * style(authzed): reformat highlights * add self as maintainer * Update lua/nvim-treesitter/parsers.lua Co-authored-by: Christian Clason <c.clason@uni-graz.at> * Add to lockfile and readme * feat(authzed): Updates to queries and lockfile around newest Authzed parser changes. * Update queries/authzed/highlights.scm Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com> * Update queries/authzed/highlights.scm Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com> * unnest here similarly to recommended elsewhere * Update highlights.scm Co-authored-by: ObserverOfTime <chronobserver@disroot.org> --------- Co-authored-by: Pham Huy Hoang <hoangtun0810@gmail.com> Co-authored-by: ObserverOfTime <chronobserver@disroot.org> Co-authored-by: Christian Clason <c.clason@uni-graz.at>
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/authzed/highlights.scm58
-rw-r--r--queries/authzed/injections.scm2
5 files changed, 72 insertions, 0 deletions
diff --git a/README.md b/README.md
index 480e243b3..15b97fb34 100644
--- a/README.md
+++ b/README.md
@@ -178,6 +178,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [apex](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber)
- [x] [arduino](https://github.com/ObserverOfTime/tree-sitter-arduino) (maintained by @ObserverOfTime)
- [x] [astro](https://github.com/virchau13/tree-sitter-astro) (maintained by @virchau13)
+- [x] [authzed](https://github.com/mleonidas/tree-sitter-authzed) (maintained by @mattpolzin)
- [ ] [awk](https://github.com/Beaglefoot/tree-sitter-awk)
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
- [x] [bass](https://github.com/amaanq/tree-sitter-bass) (maintained by @amaanq)
diff --git a/lockfile.json b/lockfile.json
index 72c9a3cfa..b05825591 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -14,6 +14,9 @@
"astro": {
"revision": "e122a8fcd07e808a7b873bfadc2667834067daf1"
},
+ "authzed": {
+ "revision": "1dec7e1af96c56924e3322cd85fdce15d0a31d00"
+ },
"awk": {
"revision": "374da90decaa60fea7a22490a77440ece6d4161d"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 26a2bf8f5..d8dfb7124 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -117,6 +117,14 @@ list.astro = {
maintainers = { "@virchau13" },
}
+list.authzed = {
+ install_info = {
+ url = "https://github.com/mleonidas/tree-sitter-authzed",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@mattpolzin" },
+}
+
list.awk = {
install_info = {
url = "https://github.com/Beaglefoot/tree-sitter-awk",
diff --git a/queries/authzed/highlights.scm b/queries/authzed/highlights.scm
new file mode 100644
index 000000000..7a4b85d1f
--- /dev/null
+++ b/queries/authzed/highlights.scm
@@ -0,0 +1,58 @@
+(identifier) @function
+
+(block
+ (relation
+ (relation_literal) @function.builtin
+ (identifier) @constant))
+
+(block
+ (permission
+ (permission_literal) @variable.builtin
+ (identifier) @type))
+
+; relations
+(rel_expression (identifier) @property)
+
+(relation
+ (rel_expression
+ (hash_literal)
+ .
+ (identifier) @constant))
+
+; permissions
+(perm_expression (identifier) @property)
+
+(call_expression
+ function: (selector_expression
+ operand: (identifier) @constant
+ field: (field_identifier) @function.method))
+
+(perm_expression
+ (stabby) @operator
+ .
+ (identifier) @function)
+
+; misc
+[
+ (plus_literal)
+ (minus_literal)
+ (amp_literal)
+ (pipe_literal)
+] @operator
+
+[
+ (true)
+ (false)
+] @boolean
+
+(nil) @constant.builtin
+
+[
+ (caveat_literal)
+ (definition_literal)
+] @keyword
+
+[
+ (hash_literal)
+ (comment)
+] @comment
diff --git a/queries/authzed/injections.scm b/queries/authzed/injections.scm
new file mode 100644
index 000000000..321c90add
--- /dev/null
+++ b/queries/authzed/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))