nvim-treesitter/runtime/queries/cairo/highlights.scm

415 lines
5.5 KiB
Scheme
Raw Normal View History

2023-07-06 21:42:51 -04:00
; Preproc
[
"%builtins"
"%lang"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.directive
2023-07-06 21:42:51 -04:00
; Includes
2024-01-06 15:05:50 +09:00
(import_statement
[
"from"
"import"
] @keyword.import
module_name: (dotted_name
(identifier) @module .))
2023-07-06 21:42:51 -04:00
[
"as"
"use"
"mod"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.import
2023-07-06 21:42:51 -04:00
; Variables
(identifier) @variable
; Namespaces
2024-01-06 15:05:50 +09:00
(namespace_definition
(identifier) @module)
2023-07-06 21:42:51 -04:00
(mod_item
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
name: (identifier) @module)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(use_list
(self) @module)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(scoped_use_list
(self) @module)
2023-07-06 21:42:51 -04:00
(scoped_identifier
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
path: (identifier) @module)
2023-07-06 21:42:51 -04:00
(scoped_identifier
2024-01-06 15:05:50 +09:00
(scoped_identifier
name: (identifier) @module))
2023-07-06 21:42:51 -04:00
(scoped_type_identifier
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
path: (identifier) @module)
2023-07-06 21:42:51 -04:00
((scoped_identifier
path: (identifier) @type)
2024-01-06 15:05:50 +09:00
(#lua-match? @type "^[A-Z]"))
2023-07-06 21:42:51 -04:00
((scoped_identifier
2024-01-06 15:05:50 +09:00
name: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
2023-07-06 21:42:51 -04:00
((scoped_identifier
2024-01-06 15:05:50 +09:00
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
2023-07-06 21:42:51 -04:00
((scoped_identifier
path: (identifier) @type
name: (identifier) @constant)
(#lua-match? @type "^[A-Z]")
(#lua-match? @constant "^[A-Z]"))
((scoped_type_identifier
path: (identifier) @type
name: (type_identifier) @constant)
(#lua-match? @type "^[A-Z]")
(#lua-match? @constant "^[A-Z]"))
(scoped_use_list
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
path: (identifier) @module)
2023-07-06 21:42:51 -04:00
(scoped_use_list
path: (scoped_identifier
(identifier) @module))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(use_list
(scoped_identifier
(identifier) @module
.
(_)))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(use_list
(identifier) @type
(#lua-match? @type "^[A-Z]"))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(use_as_clause
alias: (identifier) @type
(#lua-match? @type "^[A-Z]"))
2023-07-06 21:42:51 -04:00
; Keywords
[
; 0.x
"using"
"let"
"const"
"local"
"rel"
"abs"
"dw"
"alloc_locals"
(inst_ret)
"with_attr"
"with"
"call"
"nondet"
; 1.0
"impl"
"implicits"
"of"
"ref"
"mut"
] @keyword
2024-04-23 12:23:15 -07:00
[
"struct"
"enum"
"namespace"
"type"
"trait"
] @keyword.type
2023-07-06 21:42:51 -04:00
[
"func"
"fn"
"end"
] @keyword.function
"return" @keyword.return
[
"cast"
"new"
"and"
] @keyword.operator
[
"tempvar"
"extern"
] @keyword.modifier
2023-07-06 21:42:51 -04:00
[
"if"
"else"
"match"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.conditional
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
"loop" @keyword.repeat
2023-07-06 21:42:51 -04:00
[
"assert"
"static_assert"
"nopanic"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.exception
2023-07-06 21:42:51 -04:00
; Fields
2024-01-06 15:05:50 +09:00
(implicit_arguments
(typed_identifier
(identifier) @variable.member))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(member_expression
"."
(identifier) @variable.member)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(call_expression
(assignment_expression
left: (identifier) @variable.member))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(tuple_expression
(assignment_expression
left: (identifier) @variable.member))
2023-07-06 21:42:51 -04:00
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(field_identifier) @variable.member
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(shorthand_field_initializer
(identifier) @variable.member)
2023-07-06 21:42:51 -04:00
; Parameters
2024-01-06 15:05:50 +09:00
(arguments
(typed_identifier
(identifier) @variable.parameter))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(call_expression
(tuple_expression
(assignment_expression
left: (identifier) @variable.parameter)))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(return_type
(tuple_type
(named_type
.
(identifier) @variable.parameter)))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(parameter
(identifier) @variable.parameter)
2023-07-06 21:42:51 -04:00
; Builtins
2024-01-06 15:05:50 +09:00
(builtin_directive
(identifier) @variable.builtin)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(lang_directive
(identifier) @variable.builtin)
2023-07-06 21:42:51 -04:00
[
"ap"
"fp"
(self)
] @variable.builtin
; Functions
2024-01-06 15:05:50 +09:00
(function_definition
"func"
(identifier) @function)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(function_definition
"fn"
(identifier) @function)
(function_signature
"fn"
(identifier) @function)
(extern_function_statement
(identifier) @function)
2023-07-06 21:42:51 -04:00
(call_expression
function: (identifier) @function.call)
(call_expression
function: (scoped_identifier
(identifier) @function.call .))
2023-07-06 21:42:51 -04:00
(call_expression
function: (field_expression
field: (field_identifier) @function.call))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
"jmp" @function.builtin
2023-07-06 21:42:51 -04:00
; Types
2024-01-06 15:05:50 +09:00
(struct_definition
.
(identifier) @type
(typed_identifier
(identifier) @variable.member)?)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(named_type
(identifier) @type .)
2023-07-06 21:42:51 -04:00
[
(builtin_type)
(primitive_type)
] @type.builtin
((identifier) @type
(#lua-match? @type "^[A-Z][a-zA-Z0-9_]*$"))
(type_identifier) @type
; Constants
((identifier) @constant
(#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
(enum_variant
name: (identifier) @constant)
(call_expression
function: (scoped_identifier
"::"
name: (identifier) @constant)
2023-07-06 21:42:51 -04:00
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern
(identifier) @constant))
2024-01-06 15:05:50 +09:00
(#lua-match? @constant "^[A-Z]"))
2023-07-06 21:42:51 -04:00
((match_arm
pattern: (match_pattern
(scoped_identifier
name: (identifier) @constant)))
2024-01-06 15:05:50 +09:00
(#lua-match? @constant "^[A-Z]"))
2023-07-06 21:42:51 -04:00
((identifier) @constant.builtin
2024-01-06 15:05:50 +09:00
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
2023-07-06 21:42:51 -04:00
; Constructors
2024-01-06 15:05:50 +09:00
(unary_expression
"new"
(call_expression
.
(identifier) @constructor))
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
((call_expression
.
(identifier) @constructor)
2023-07-06 21:42:51 -04:00
(#lua-match? @constructor "^%u"))
; Attributes
2024-01-06 15:05:50 +09:00
(decorator
"@" @attribute
(identifier) @attribute)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(attribute_item
(identifier) @function.macro)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(attribute_item
(scoped_identifier
(identifier) @function.macro .))
2023-07-06 21:42:51 -04:00
; Labels
2024-01-06 15:05:50 +09:00
(label
.
(identifier) @label)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(inst_jmp_to_label
"jmp"
.
(identifier) @label)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
(inst_jnz_to_label
"jmp"
.
(identifier) @label)
2023-07-06 21:42:51 -04:00
; Operators
[
"+"
"-"
"*"
"/"
"**"
"=="
"!="
"&"
"="
"++"
"+="
"@"
"!"
"~"
".."
"&&"
"||"
"^"
"<"
"<="
">"
">="
"<<"
">>"
"%"
"-="
"*="
"/="
"%="
"&="
"|="
"^="
"<<="
">>="
"?"
] @operator
; Literals
(number) @number
(boolean) @boolean
[
(string)
(short_string)
] @string
; Punctuation
2024-01-06 15:05:50 +09:00
(attribute_item
"#" @punctuation.special)
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
[
"."
","
":"
";"
"->"
"=>"
"::"
] @punctuation.delimiter
2023-07-06 21:42:51 -04:00
2024-01-06 15:05:50 +09:00
[
"{"
"}"
"("
")"
"["
"]"
"%{"
"%}"
] @punctuation.bracket
(type_parameters
[
"<"
">"
] @punctuation.bracket)
(type_arguments
[
"<"
">"
] @punctuation.bracket)
2023-07-06 21:42:51 -04:00
; Comment
(comment) @comment @spell