aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/hare
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/hare')
-rw-r--r--runtime/queries/hare/highlights.scm158
-rw-r--r--runtime/queries/hare/indents.scm21
-rw-r--r--runtime/queries/hare/locals.scm20
3 files changed, 199 insertions, 0 deletions
diff --git a/runtime/queries/hare/highlights.scm b/runtime/queries/hare/highlights.scm
new file mode 100644
index 00000000..cd3c1d0a
--- /dev/null
+++ b/runtime/queries/hare/highlights.scm
@@ -0,0 +1,158 @@
+[
+ "f32"
+ "f64"
+ "i16"
+ "i32"
+ "i64"
+ "i8"
+ "int"
+ "rune"
+ "str"
+ "u16"
+ "u32"
+ "u64"
+ "u8"
+ "uint"
+ "uintptr"
+ "void"
+] @type
+
+
+[
+ "else"
+ "if"
+ "match"
+ "switch"
+] @keyword.control.conditional
+
+[
+ "export"
+ "use"
+] @keyword.control.import
+
+[
+ "continue"
+ "for"
+ "break"
+] @keyword.control.repeat
+
+"return" @keyword.control.return
+
+[
+ "abort"
+ "assert"
+] @keyword.control.exception
+
+[
+ "def"
+ "fn"
+] @keyword.function
+
+[
+ "alloc"
+ "append"
+ "as"
+ "bool"
+ "char"
+ "const"
+ "defer"
+ "delete"
+ "enum"
+ "free"
+ "is"
+ "len"
+ "let"
+ "match"
+ "nullable"
+ "offset"
+ "size"
+ "static"
+ "struct"
+ "type"
+ "union"
+] @keyword
+
+[
+ "."
+ "!"
+ "~"
+ "?"
+ "*"
+ "/"
+ "%"
+ "+"
+ "-"
+ "<<"
+ ">>"
+ "::"
+ "<"
+ "<="
+ ">"
+ ">="
+ "=="
+ "!="
+ "&"
+ "|"
+ "^"
+ "&&"
+ "||"
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "&="
+ "|="
+ "<<="
+ ">>="
+ "^="
+ "=>"
+] @operator
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ ")"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ ":"
+ ";"
+] @punctuation.delimiter
+
+"..." @special
+
+(comment) @comment
+
+[
+ "false"
+ "null"
+ "true"
+] @constant.builtin
+
+(string_constant) @string
+(escape_sequence) @constant.character.escape
+(rune_constant) @string
+(integer_constant) @constant.numeric.integer
+(floating_constant) @constant.numeric.float
+
+(call_expression
+ (postfix_expression) @function)
+
+(function_declaration
+ name: (identifier) @function)
+
+(parameter (name) @variable.parameter)
+
+(field_access_expression
+ selector: (name) @variable.other.member)
+(decl_attr) @special
+(fndec_attrs) @special
+
+(identifier) @variable
+
diff --git a/runtime/queries/hare/indents.scm b/runtime/queries/hare/indents.scm
new file mode 100644
index 00000000..a2e83c00
--- /dev/null
+++ b/runtime/queries/hare/indents.scm
@@ -0,0 +1,21 @@
+[
+ (struct_union_fields)
+ (expression_list)
+] @indent
+
+[
+ "case"
+ "}"
+ "]"
+ ")"
+] @outdent
+
+; [
+; "{"
+; "}"
+; ] @branch
+
+; [
+; (comment)
+; ] @ignore
+
diff --git a/runtime/queries/hare/locals.scm b/runtime/queries/hare/locals.scm
new file mode 100644
index 00000000..b8b9b9f7
--- /dev/null
+++ b/runtime/queries/hare/locals.scm
@@ -0,0 +1,20 @@
+(unit) @local.scope
+
+(function_declaration) @local.scope
+
+(global_binding
+ (identifier) @local.definition)
+(constant_binding
+ (identifier) @local.definition)
+(type_bindings
+ (identifier) @local.definition)
+
+(function_declaration
+ (prototype
+ (parameter_list
+ (parameters
+ (parameter
+ (name) @local.definition)))))
+
+(identifier) @local.reference
+