tree-sitter-tiger/queries/highlights.scm

128 lines
1.7 KiB
Scheme
Raw Normal View History

; Built-ins {{{
((function_call
function: (identifier) @function.builtin)
(#match? @function.builtin "^(chr|concat|exit|flush|getchar|not|ord|print|print_err|print_int|size|strcmp|streq|substring)$")
(#is-not? local))
((type_identifier) @type.builtin
2022-06-04 21:31:43 +02:00
(#match? @type.builtin "^(int|string|Object)$")
(#is-not? local))
((identifier) @variable.builtin
(#match? @variable.builtin "^self$")
(#is-not? local))
; }}}
2022-06-02 22:27:42 +02:00
; Keywords {{{
[
"function"
"primitive"
] @keyword.function
[
"do"
"for"
"to"
"while"
] @keyword.repeat
2022-06-04 21:35:14 +02:00
[
"new"
] @keyword.constructor
2022-06-04 21:35:31 +02:00
[
"method"
] @keyword.method
2022-06-02 22:27:42 +02:00
[
"array"
(break_expression)
"do"
"else"
"end"
"for"
"function"
"if"
"import"
"in"
"let"
"of"
"primitive"
"then"
"to"
"type"
"var"
"while"
"class"
"extends"
"method"
"new"
"_cast"
"_chunks"
"_exp"
"_lvalue"
"_namety"
2022-06-02 22:27:42 +02:00
] @keyword
; }}}
2022-06-03 10:08:58 +02:00
; Operators {{{
(operator) @operator
[
","
";"
2022-06-03 11:43:43 +02:00
":"
2022-06-03 10:08:58 +02:00
"."
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; }}}
2022-06-04 21:29:27 +02:00
; Functions and methods {{{
2022-06-03 19:59:56 +02:00
(function_call
function: (identifier) @function)
(function_declaration
name: (identifier) @function)
(primitive_declaration
name: (identifier) @function)
2022-06-04 21:29:27 +02:00
(method_call
method: (identifier) @method)
(method_declaration
name: (identifier) @method)
2022-06-03 19:59:56 +02:00
(parameters
name: (identifier) @variable.parameter)
; }}}
; Declarations {{{
(import_declaration
file: (string_literal) @string.special.path)
; }}}
; Literals {{{
(nil_literal) @constant.builtin
(integer_literal) @number
(string_literal) @string
(escape_sequence) @string.escape
; }}}
; Misc {{{
(comment) @comment
(type_identifier) @type
(field_identifier) @property
(identifier) @variable
; }}}
2022-06-02 17:25:31 +02:00
; vim: sw=2 foldmethod=marker