aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/odin
diff options
context:
space:
mode:
authorRobert Walter2022-05-05 17:09:09 +0000
committerGitHub2022-05-05 17:09:09 +0000
commit495ba40eafe84f048e56b3d958a7727751f3aa99 (patch)
treed09b71d081e34a1f9e2d72d1d64ad2a3ac09f251 /runtime/queries/odin
parent2f240b018eb95457441a0cad9b7af47b0e55a54c (diff)
feat(languages): add odin language (#2399)
Diffstat (limited to 'runtime/queries/odin')
-rw-r--r--runtime/queries/odin/highlights.scm141
1 files changed, 141 insertions, 0 deletions
diff --git a/runtime/queries/odin/highlights.scm b/runtime/queries/odin/highlights.scm
new file mode 100644
index 00000000..1d801ff1
--- /dev/null
+++ b/runtime/queries/odin/highlights.scm
@@ -0,0 +1,141 @@
+; Function calls
+
+(call_expression
+ function: (identifier) @function)
+
+(call_expression
+ function: (selector_expression
+ field: (field_identifier) @function))
+
+
+; ; Function definitions
+
+(function_declaration
+ name: (identifier) @function)
+
+(proc_group
+ (identifier) @function)
+
+; ; Identifiers
+
+(type_identifier) @type
+(field_identifier) @variable.other.member
+(identifier) @variable
+
+(const_declaration
+ (identifier) @constant)
+(const_declaration_with_type
+ (identifier) @constant)
+
+"any" @type
+
+(directive_identifier) @constant
+
+; ; Operators
+
+[
+ "?"
+ "-"
+ "-="
+ ":="
+ "!"
+ "!="
+ "*"
+ "*"
+ "*="
+ "/"
+ "/="
+ "&"
+ "&&"
+ "&="
+ "%"
+ "%="
+ "^"
+ "+"
+ "+="
+ "<-"
+ "<"
+ "<<"
+ "<<="
+ "<="
+ "="
+ "=="
+ ">"
+ ">="
+ ">>"
+ ">>="
+ "|"
+ "|="
+ "||"
+ "~"
+ ".."
+ "..<"
+ "..="
+ "::"
+] @operator
+
+; ; Keywords
+
+[
+ ; "asm"
+ "auto_cast"
+ ; "bit_set"
+ "cast"
+ ; "context"
+ ; "or_else"
+ ; "or_return"
+ "in"
+ ; "not_in"
+ "distinct"
+ "foreign"
+ "transmute"
+ ; "typeid"
+
+ "break"
+ "case"
+ "continue"
+ "defer"
+ "else"
+ "using"
+ "when"
+ "where"
+ "fallthrough"
+ "for"
+ "proc"
+ "if"
+ "import"
+ "map"
+ "package"
+ "return"
+ "struct"
+ "union"
+ "enum"
+ "switch"
+ "dynamic"
+] @keyword
+
+; ; Literals
+
+[
+ (interpreted_string_literal)
+ (raw_string_literal)
+ (rune_literal)
+] @string
+
+(escape_sequence) @constant.character.escape
+
+(int_literal) @constant.numeric.integer
+(float_literal) @constant.numeric.float
+(imaginary_literal) @constant.numeric
+
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
+
+[
+ (nil)
+ (undefined)
+] @constant.builtin
+
+(comment) @comment.line