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

333 lines
3.9 KiB
Scheme
Raw Normal View History

2023-03-26 18:28:54 -04:00
; Includes
2024-01-06 15:05:50 +09:00
"use" @keyword.import
2023-03-26 18:28:54 -04:00
; Keywords
[
"primitive"
"embed"
"let"
"var"
(compile_intrinsic)
"as"
"consume"
"recover"
"object"
"where"
] @keyword
2024-04-23 12:23:15 -07:00
[
"class"
"struct"
"type"
"interface"
"trait"
"actor"
] @keyword.type
2024-01-06 15:05:50 +09:00
"fun" @keyword.function
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
"be" @keyword.coroutine
2023-03-26 18:28:54 -04:00
[
"in"
"is"
] @keyword.operator
2024-01-06 15:05:50 +09:00
"return" @keyword.return
2023-03-26 18:28:54 -04:00
; Qualifiers
[
"iso"
"trn"
"ref"
"val"
"box"
"tag"
"#read"
"#send"
"#share"
"#alias"
"#any"
] @keyword.modifier
2023-03-26 18:28:54 -04:00
; Conditionals
[
"if"
"ifdef"
"iftype"
"then"
"else"
"elseif"
"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-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(if_statement
"end" @keyword.conditional)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(iftype_statement
"end" @keyword.conditional)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(match_statement
"end" @keyword.conditional)
2023-03-26 18:28:54 -04:00
; Repeats
[
"repeat"
"until"
"while"
"for"
"continue"
"do"
"break"
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.repeat
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(do_block
"end" @keyword.repeat)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(repeat_statement
"end" @keyword.repeat)
2023-03-26 18:28:54 -04:00
; Exceptions
[
"try"
(error)
"compile_error"
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-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(try_statement
"end" @keyword.exception)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(recover_statement
"end" @keyword.exception)
2023-03-26 18:28:54 -04:00
; Attributes
(annotation) @attribute
; Variables
(identifier) @variable
(this) @variable.builtin
; Fields
2024-01-06 15:05:50 +09:00
(field
name: (identifier) @variable.member)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(member_expression
"."
(identifier) @variable.member)
2023-03-26 18:28:54 -04:00
; Constructors
2024-01-06 15:05:50 +09:00
(constructor
"new" @keyword.operator
(identifier) @constructor)
2023-03-26 18:28:54 -04:00
; Methods
2024-01-06 15:05:50 +09:00
(method
(identifier) @function.method)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(behavior
(identifier) @function.method)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(ffi_method
(identifier) @function.method)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
((ffi_method
(string) @string.special)
(#set! priority 105))
2023-03-26 18:28:54 -04:00
(call_expression
callee: [
(identifier) @function.method.call
(ffi_identifier
(identifier) @function.method.call)
(member_expression
"."
(identifier) @function.method.call)
])
2023-03-26 18:28:54 -04:00
; Parameters
2024-01-06 15:05:50 +09:00
(parameter
name: (identifier) @variable.parameter)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(lambda_parameter
name: (identifier) @variable.parameter)
2023-03-26 18:28:54 -04:00
; Types
2024-01-06 15:05:50 +09:00
(type_alias
(identifier) @type.definition)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(base_type
name: (identifier) @type)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(generic_parameter
(identifier) @type)
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
(lambda_type
(identifier)? @function.method)
2023-03-26 18:28:54 -04:00
((identifier) @type
(#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]*$"))
; Operators
(unary_expression
operator: [
"not"
"addressof"
"digestof"
] @keyword.operator)
2023-03-26 18:28:54 -04:00
(binary_expression
operator: [
"and"
"or"
"xor"
"is"
"isnt"
] @keyword.operator)
2023-03-26 18:28:54 -04:00
[
"="
"?"
"|"
"&"
"-~"
"+"
"-"
"*"
"/"
"%"
"%%"
"<<"
">>"
"=="
"!="
">"
">="
"<="
"<"
"+~"
"*~"
"/~"
"%~"
"%%~"
"<<~"
">>~"
"==~"
"!=~"
">~"
">=~"
"<=~"
"<~"
"+?"
"-?"
"*?"
"/?"
"%?"
"%%?"
"<:"
] @operator
; Literals
(string) @string
2024-01-06 15:05:50 +09:00
(source_file
(string) @string.documentation)
(actor_definition
(string) @string.documentation)
(class_definition
(string) @string.documentation)
(primitive_definition
(string) @string.documentation)
(interface_definition
(string) @string.documentation)
(trait_definition
(string) @string.documentation)
(struct_definition
(string) @string.documentation)
(type_alias
(string) @string.documentation)
(field
(string) @string.documentation)
2023-03-26 18:28:54 -04:00
(constructor
[
2024-01-06 15:05:50 +09:00
(string) @string.documentation
(block
.
(string) @string.documentation)
2023-03-26 18:28:54 -04:00
])
(method
[
2024-01-06 15:05:50 +09:00
(string) @string.documentation
(block
.
(string) @string.documentation)
2023-03-26 18:28:54 -04:00
])
(behavior
[
2024-01-06 15:05:50 +09:00
(string) @string.documentation
(block
.
(string) @string.documentation)
2023-03-26 18:28:54 -04:00
])
(character) @character
(escape_sequence) @string.escape
(number) @number
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
(float) @number.float
2023-03-26 18:28:54 -04:00
(boolean) @boolean
; Punctuation
2024-01-06 15:05:50 +09:00
[
"{"
"}"
] @punctuation.bracket
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
[
"["
"]"
] @punctuation.bracket
2023-03-26 18:28:54 -04:00
2024-01-06 15:05:50 +09:00
[
"("
")"
] @punctuation.bracket
2023-03-26 18:28:54 -04:00
[
"."
","
";"
":"
"~"
".>"
"->"
"=>"
] @punctuation.delimiter
[
"@"
"!"
"^"
"..."
] @punctuation.special
; Comments
[
(line_comment)
(block_comment)
] @comment @spell