/nix/store/dlwqlnbaj5vfm9aw20r1yxk8y56lmgif-repo/header.tmpl
tree-sitter-oat-v1/queries/oat-v1/highlights.scm

116 lines
2 KiB
Scheme
Raw Permalink Normal View History

2025-10-31 21:10:15 +01:00
;; highlights.scm for Oat language
;; Matches grammar.js (Oat v1)
;; -------------------------------------------------------------------
;; Basic keywords
;; -------------------------------------------------------------------
[
"if"
"else"
"for"
"while"
"return"
"var"
"global"
"new"
"null"
"true"
"false"
] @keyword
[
"void"
] @type
2025-11-01 00:37:45 +01:00
(primitive_type) @type
(ref_type) @type
2025-10-31 21:10:15 +01:00
[
"+"
"-"
"*"
"=="
"!="
"<"
"<="
">"
">="
"<<"
">>"
">>>"
"&"
"|"
"[&]"
"[|]"
"!"
"~"
"="
] @operator
;; -------------------------------------------------------------------
;; Identifiers & function declarations
;; -------------------------------------------------------------------
(identifier) @variable
(fdecl
name: (identifier) @function)
2025-11-01 00:37:45 +01:00
(call_exp
2025-10-31 21:10:15 +01:00
(identifier) @function.call)
(params
(arg
(identifier) @variable.parameter))
;; -------------------------------------------------------------------
;; Literals
;; -------------------------------------------------------------------
(int_literal) @number
(string_literal) @string
;; -------------------------------------------------------------------
;; Comments
;; -------------------------------------------------------------------
(comment) @comment
2025-11-01 00:41:37 +01:00
;; -------------------------------------------------------------------
;; Declarations
;; -------------------------------------------------------------------
(gdecl name: (identifier) @variable.global)
(vdecl
(identifier) @variable)
(assign_stmt lhs: (lhs) @variable)
;; -------------------------------------------------------------------
;; Misc
;; -------------------------------------------------------------------
(array_index) @variable
2025-10-31 21:10:15 +01:00
;; -------------------------------------------------------------------
;; Brackets & punctuation
;; -------------------------------------------------------------------
2025-11-01 00:37:45 +01:00
[
","
";"
] @punctuation.delimiter
2025-10-31 21:10:15 +01:00
[
"("
")"
"{"
"}"
"["
"]"
2025-11-01 00:41:37 +01:00
"[]"
2025-11-01 00:37:45 +01:00
] @punctuation.bracket
2025-10-31 21:10:15 +01:00
(call_stmt) @function.call
(block) @scope