aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/authzed
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/authzed')
-rw-r--r--runtime/queries/authzed/highlights.scm60
-rw-r--r--runtime/queries/authzed/injections.scm26
2 files changed, 86 insertions, 0 deletions
diff --git a/runtime/queries/authzed/highlights.scm b/runtime/queries/authzed/highlights.scm
new file mode 100644
index 000000000..fb946caaf
--- /dev/null
+++ b/runtime/queries/authzed/highlights.scm
@@ -0,0 +1,60 @@
+(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/runtime/queries/authzed/injections.scm b/runtime/queries/authzed/injections.scm
new file mode 100644
index 000000000..298a8d070
--- /dev/null
+++ b/runtime/queries/authzed/injections.scm
@@ -0,0 +1,26 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+((function_call
+ name: (ident) @_name
+ .
+ (simplexpr)
+ .
+ (simplexpr
+ (string
+ (string_fragment) @injection.content)+))
+ (#any-of? @_name "replace" "search" "matches" "captures")
+ (#set! injection.language "regex")
+ (#set! injection.combined))
+
+((function_call
+ name: (ident) @_name
+ .
+ (simplexpr)
+ .
+ (simplexpr
+ (string
+ (string_fragment) @injection.content)+))
+ (#eq? @_name "jq")
+ (#set! injection.language "jq")
+ (#set! injection.combined))