mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-07 14:00:00 -04:00
feat!: drop modules, general refactor and cleanup
This commit is contained in:
parent
310f0925ec
commit
692b051b09
1247 changed files with 6096 additions and 9074 deletions
13
runtime/queries/ada/folds.scm
Normal file
13
runtime/queries/ada/folds.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
; Support for folding in Ada
|
||||
; za toggles folding a package, subprogram, if statement or loop
|
||||
[
|
||||
(package_declaration)
|
||||
(generic_package_declaration)
|
||||
(package_body)
|
||||
(subprogram_body)
|
||||
(block_statement)
|
||||
(if_statement)
|
||||
(loop_statement)
|
||||
(gnatprep_declarative_if_statement)
|
||||
(gnatprep_if_statement)
|
||||
] @fold
|
||||
286
runtime/queries/ada/highlights.scm
Normal file
286
runtime/queries/ada/highlights.scm
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
; highlight queries.
|
||||
; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
|
||||
; for a list of recommended @ tags, though not all of them have matching
|
||||
; highlights in neovim.
|
||||
[
|
||||
"abort"
|
||||
"abs"
|
||||
"abstract"
|
||||
"accept"
|
||||
"access"
|
||||
"all"
|
||||
"array"
|
||||
"at"
|
||||
"begin"
|
||||
"body"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
"digits"
|
||||
"do"
|
||||
"end"
|
||||
"entry"
|
||||
"exit"
|
||||
"generic"
|
||||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"mod"
|
||||
"new"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"overriding"
|
||||
"package"
|
||||
"pragma"
|
||||
"private"
|
||||
"protected"
|
||||
"range"
|
||||
"separate"
|
||||
"subtype"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"type"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
|
||||
"record" @keyword.type
|
||||
|
||||
[
|
||||
"aliased"
|
||||
"constant"
|
||||
"renames"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"with"
|
||||
"use"
|
||||
] @keyword.import
|
||||
|
||||
[
|
||||
"function"
|
||||
"procedure"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"not"
|
||||
"or"
|
||||
"xor"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"while"
|
||||
"loop"
|
||||
"for"
|
||||
"parallel"
|
||||
"reverse"
|
||||
"some"
|
||||
] @keyword.repeat
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"then"
|
||||
"elsif"
|
||||
"select"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"exception"
|
||||
"raise"
|
||||
] @keyword.exception
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(character_literal) @string
|
||||
|
||||
(numeric_literal) @number
|
||||
|
||||
; Highlight the name of subprograms
|
||||
(procedure_specification
|
||||
name: (_) @function)
|
||||
|
||||
(function_specification
|
||||
name: (_) @function)
|
||||
|
||||
(package_declaration
|
||||
name: (_) @function)
|
||||
|
||||
(package_body
|
||||
name: (_) @function)
|
||||
|
||||
(generic_instantiation
|
||||
name: (_) @function)
|
||||
|
||||
(entry_declaration
|
||||
.
|
||||
(identifier) @function)
|
||||
|
||||
; Some keywords should take different categories depending on the context
|
||||
(use_clause
|
||||
"use" @keyword.import
|
||||
"type" @keyword.import)
|
||||
|
||||
(with_clause
|
||||
"private" @keyword.import)
|
||||
|
||||
(with_clause
|
||||
"limited" @keyword.import)
|
||||
|
||||
(use_clause
|
||||
(_) @module)
|
||||
|
||||
(with_clause
|
||||
(_) @module)
|
||||
|
||||
(loop_statement
|
||||
"end" @keyword.repeat)
|
||||
|
||||
(if_statement
|
||||
"end" @keyword.conditional)
|
||||
|
||||
(loop_parameter_specification
|
||||
"in" @keyword.repeat)
|
||||
|
||||
(loop_parameter_specification
|
||||
"in" @keyword.repeat)
|
||||
|
||||
(iterator_specification
|
||||
[
|
||||
"in"
|
||||
"of"
|
||||
] @keyword.repeat)
|
||||
|
||||
(range_attribute_designator
|
||||
"range" @keyword.repeat)
|
||||
|
||||
(raise_statement
|
||||
"with" @keyword.exception)
|
||||
|
||||
(gnatprep_declarative_if_statement) @keyword.directive
|
||||
|
||||
(gnatprep_if_statement) @keyword.directive
|
||||
|
||||
(gnatprep_identifier) @keyword.directive
|
||||
|
||||
(subprogram_declaration
|
||||
"is" @keyword.function
|
||||
"abstract" @keyword.function)
|
||||
|
||||
(aspect_specification
|
||||
"with" @keyword.function)
|
||||
|
||||
(full_type_declaration
|
||||
"is" @keyword.type)
|
||||
|
||||
(subtype_declaration
|
||||
"is" @keyword.type)
|
||||
|
||||
(record_definition
|
||||
"end" @keyword.type)
|
||||
|
||||
(full_type_declaration
|
||||
(_
|
||||
"access" @keyword.type))
|
||||
|
||||
(array_type_definition
|
||||
"array" @keyword.type
|
||||
"of" @keyword.type)
|
||||
|
||||
(access_to_object_definition
|
||||
"access" @keyword.type)
|
||||
|
||||
(access_to_object_definition
|
||||
"access" @keyword.type
|
||||
[
|
||||
(general_access_modifier
|
||||
"constant" @keyword.type)
|
||||
(general_access_modifier
|
||||
"all" @keyword.type)
|
||||
])
|
||||
|
||||
(range_constraint
|
||||
"range" @keyword.type)
|
||||
|
||||
(signed_integer_type_definition
|
||||
"range" @keyword.type)
|
||||
|
||||
(index_subtype_definition
|
||||
"range" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
"abstract" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
"tagged" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
"limited" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
"null" @keyword.type))
|
||||
|
||||
(private_type_declaration
|
||||
"is" @keyword.type
|
||||
"private" @keyword.type)
|
||||
|
||||
(private_type_declaration
|
||||
"tagged" @keyword.type)
|
||||
|
||||
(private_type_declaration
|
||||
"limited" @keyword.type)
|
||||
|
||||
(task_type_declaration
|
||||
"task" @keyword.type
|
||||
"is" @keyword.type)
|
||||
|
||||
; Gray the body of expression functions
|
||||
(expression_function_declaration
|
||||
(function_specification)
|
||||
"is"
|
||||
(_) @attribute)
|
||||
|
||||
(subprogram_declaration
|
||||
(aspect_specification) @attribute)
|
||||
|
||||
; Highlight full subprogram specifications
|
||||
;(subprogram_body
|
||||
; [
|
||||
; (procedure_specification)
|
||||
; (function_specification)
|
||||
; ] @function.spec
|
||||
;)
|
||||
((comment) @comment.documentation
|
||||
.
|
||||
[
|
||||
(entry_declaration)
|
||||
(subprogram_declaration)
|
||||
(parameter_specification)
|
||||
])
|
||||
|
||||
(compilation_unit
|
||||
.
|
||||
(comment) @comment.documentation)
|
||||
|
||||
(component_list
|
||||
(component_declaration)
|
||||
.
|
||||
(comment) @comment.documentation)
|
||||
|
||||
(enumeration_type_definition
|
||||
(identifier)
|
||||
.
|
||||
(comment) @comment.documentation)
|
||||
5
runtime/queries/ada/injections.scm
Normal file
5
runtime/queries/ada/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((doc_block) @injection.content
|
||||
(#set! injection.language "markdown"))
|
||||
91
runtime/queries/ada/locals.scm
Normal file
91
runtime/queries/ada/locals.scm
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
; Better highlighting by referencing to the definition, for variable
|
||||
; references. However, this is not yet supported by neovim
|
||||
; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||
(compilation) @local.scope
|
||||
|
||||
(package_declaration) @local.scope
|
||||
|
||||
(package_body) @local.scope
|
||||
|
||||
(subprogram_declaration) @local.scope
|
||||
|
||||
(subprogram_body) @local.scope
|
||||
|
||||
(block_statement) @local.scope
|
||||
|
||||
(with_clause
|
||||
(identifier) @local.definition.import)
|
||||
|
||||
(procedure_specification
|
||||
name: (_) @local.definition.function)
|
||||
|
||||
(function_specification
|
||||
name: (_) @local.definition.function)
|
||||
|
||||
(package_declaration
|
||||
name: (_) @local.definition.var)
|
||||
|
||||
(package_body
|
||||
name: (_) @local.definition.var)
|
||||
|
||||
(generic_instantiation
|
||||
.
|
||||
name: (_) @local.definition.var)
|
||||
|
||||
(component_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(exception_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(formal_object_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(object_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(parameter_specification
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(full_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(private_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(private_extension_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(incomplete_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(protected_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(formal_complete_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(formal_incomplete_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(task_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(subtype_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(identifier) @local.reference
|
||||
4
runtime/queries/agda/folds.scm
Normal file
4
runtime/queries/agda/folds.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(record)
|
||||
(module)
|
||||
] @fold
|
||||
87
runtime/queries/agda/highlights.scm
Normal file
87
runtime/queries/agda/highlights.scm
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
; Constants
|
||||
(integer) @number
|
||||
|
||||
; Variables and Symbols
|
||||
(typed_binding
|
||||
(atom
|
||||
(qid) @variable))
|
||||
|
||||
(untyped_binding) @variable
|
||||
|
||||
(typed_binding
|
||||
(expr) @type)
|
||||
|
||||
(id) @function
|
||||
|
||||
(bid) @function
|
||||
|
||||
(function_name
|
||||
(atom
|
||||
(qid) @function))
|
||||
|
||||
(field_name) @function
|
||||
|
||||
[
|
||||
(data_name)
|
||||
(record_name)
|
||||
] @constructor
|
||||
|
||||
; Set
|
||||
(SetN) @type.builtin
|
||||
|
||||
(expr
|
||||
.
|
||||
(atom) @function)
|
||||
|
||||
((atom) @boolean
|
||||
(#any-of? @boolean "true" "false" "True" "False"))
|
||||
|
||||
; Imports and Module Declarations
|
||||
"import" @keyword.import
|
||||
|
||||
(module_name) @module
|
||||
|
||||
; Pragmas and comments
|
||||
(pragma) @keyword.directive
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"where"
|
||||
"data"
|
||||
"rewrite"
|
||||
"postulate"
|
||||
"public"
|
||||
"private"
|
||||
"tactic"
|
||||
"Prop"
|
||||
"quote"
|
||||
"renaming"
|
||||
"open"
|
||||
"in"
|
||||
"hiding"
|
||||
"constructor"
|
||||
"abstract"
|
||||
"let"
|
||||
"field"
|
||||
"mutual"
|
||||
"module"
|
||||
"infix"
|
||||
"infixl"
|
||||
"infixr"
|
||||
] @keyword
|
||||
|
||||
"record" @keyword.type
|
||||
|
||||
;(expr
|
||||
; f_name: (atom) @function)
|
||||
; Brackets
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
"=" @operator
|
||||
14
runtime/queries/agda/injections.scm
Normal file
14
runtime/queries/agda/injections.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "^///[^/]")
|
||||
(#set! injection.language "doxygen"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "^///$")
|
||||
(#set! injection.language "doxygen"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "^/[*][*][^*].*[*]/$")
|
||||
(#set! injection.language "doxygen"))
|
||||
1
runtime/queries/angular/folds.scm
Normal file
1
runtime/queries/angular/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
154
runtime/queries/angular/highlights.scm
Normal file
154
runtime/queries/angular/highlights.scm
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(pipe_operator) @operator
|
||||
|
||||
[
|
||||
(string)
|
||||
(static_member_expression)
|
||||
] @string
|
||||
|
||||
(number) @number
|
||||
|
||||
(pipe_call
|
||||
name: (identifier) @function)
|
||||
|
||||
(pipe_call
|
||||
arguments: (pipe_arguments
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(structural_directive
|
||||
"*" @keyword
|
||||
(identifier) @keyword)
|
||||
|
||||
(attribute
|
||||
(attribute_name) @variable.member
|
||||
(#lua-match? @variable.member "#.*"))
|
||||
|
||||
(binding_name
|
||||
(identifier) @keyword)
|
||||
|
||||
(event_binding
|
||||
(binding_name
|
||||
(identifier) @keyword))
|
||||
|
||||
(event_binding
|
||||
"\"" @punctuation.delimiter)
|
||||
|
||||
(property_binding
|
||||
"\"" @punctuation.delimiter)
|
||||
|
||||
(structural_assignment
|
||||
operator: (identifier) @keyword)
|
||||
|
||||
(member_expression
|
||||
property: (identifier) @property)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: ((identifier) @function.builtin
|
||||
(#eq? @function.builtin "$any")))
|
||||
|
||||
(pair
|
||||
key: ((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "$implicit")))
|
||||
|
||||
[
|
||||
(control_keyword)
|
||||
(special_keyword)
|
||||
] @keyword
|
||||
|
||||
((control_keyword) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "for" "empty"))
|
||||
|
||||
((control_keyword) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "if" "else" "switch" "case" "default"))
|
||||
|
||||
((control_keyword) @keyword.coroutine
|
||||
(#any-of? @keyword.coroutine "defer" "placeholder" "loading"))
|
||||
|
||||
((control_keyword) @keyword.exception
|
||||
(#eq? @keyword.exception "error"))
|
||||
|
||||
((identifier) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "this" "$event"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#eq? @constant.builtin "null"))
|
||||
|
||||
[
|
||||
(ternary_operator)
|
||||
(conditional_operator)
|
||||
] @keyword.conditional.ternary
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"@"
|
||||
] @punctuation.bracket
|
||||
|
||||
(two_way_binding
|
||||
[
|
||||
"[("
|
||||
")]"
|
||||
] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"{{"
|
||||
"}}"
|
||||
] @punctuation.special
|
||||
|
||||
(template_substitution
|
||||
[
|
||||
"${"
|
||||
"}"
|
||||
] @punctuation.special)
|
||||
|
||||
(template_chars) @string
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
"?."
|
||||
] @punctuation.delimiter
|
||||
|
||||
(nullish_coalescing_expression
|
||||
(coalescing_operator) @operator)
|
||||
|
||||
(concatenation_expression
|
||||
"+" @operator)
|
||||
|
||||
(icu_clause) @keyword.operator
|
||||
|
||||
(icu_category) @keyword.conditional
|
||||
|
||||
(binary_expression
|
||||
[
|
||||
"-"
|
||||
"&&"
|
||||
"+"
|
||||
"<"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"==="
|
||||
"!="
|
||||
"!=="
|
||||
">"
|
||||
">="
|
||||
"*"
|
||||
"/"
|
||||
"||"
|
||||
"%"
|
||||
] @operator)
|
||||
16
runtime/queries/angular/indents.scm
Normal file
16
runtime/queries/angular/indents.scm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
; inherits: html_tags
|
||||
|
||||
[
|
||||
(statement_block)
|
||||
(switch_statement)
|
||||
] @indent.begin
|
||||
|
||||
(statement_block
|
||||
"{" @indent.branch)
|
||||
|
||||
(statement_block
|
||||
"}" @indent.end)
|
||||
|
||||
"}" @indent.branch
|
||||
|
||||
"}" @indent.end
|
||||
1
runtime/queries/angular/injections.scm
Normal file
1
runtime/queries/angular/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html_tags
|
||||
1
runtime/queries/angular/locals.scm
Normal file
1
runtime/queries/angular/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
6
runtime/queries/apex/folds.scm
Normal file
6
runtime/queries/apex/folds.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
(class_body)
|
||||
(constructor_declaration)
|
||||
(argument_list)
|
||||
(annotation_argument_list)
|
||||
] @fold
|
||||
257
runtime/queries/apex/highlights.scm
Normal file
257
runtime/queries/apex/highlights.scm
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
; inherits: soql
|
||||
|
||||
; Apex + SOQL
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
"."
|
||||
":"
|
||||
"?"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Default general color definition
|
||||
(identifier) @variable
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
; Methods
|
||||
(method_declaration
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(method_invocation
|
||||
name: (identifier) @function.method.call)
|
||||
|
||||
(super) @function.builtin
|
||||
|
||||
; Annotations
|
||||
(annotation
|
||||
name: (identifier) @attribute)
|
||||
|
||||
; Types
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_declaration
|
||||
(superclass) @type)
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(enum_constant
|
||||
name: (identifier) @constant)
|
||||
|
||||
(type_arguments
|
||||
"<" @punctuation.delimiter)
|
||||
|
||||
(type_arguments
|
||||
">" @punctuation.delimiter)
|
||||
|
||||
(field_access
|
||||
object: (identifier) @type)
|
||||
|
||||
(field_access
|
||||
field: (identifier) @property)
|
||||
|
||||
((scoped_identifier
|
||||
scope: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
((method_invocation
|
||||
object: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(method_declaration
|
||||
(formal_parameters
|
||||
(formal_parameter
|
||||
name: (identifier) @variable.parameter)))
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
|
||||
(dml_type) @function.builtin
|
||||
|
||||
(assignment_operator) @operator
|
||||
|
||||
(update_operator) @operator
|
||||
|
||||
(trigger_declaration
|
||||
name: (identifier) @type
|
||||
object: (identifier) @type
|
||||
(trigger_event) @keyword
|
||||
(","
|
||||
(trigger_event) @keyword)*)
|
||||
|
||||
[
|
||||
"@"
|
||||
"="
|
||||
"!="
|
||||
"<="
|
||||
">="
|
||||
] @operator
|
||||
|
||||
(binary_expression
|
||||
operator: [
|
||||
">"
|
||||
"<"
|
||||
"=="
|
||||
"==="
|
||||
"!=="
|
||||
"&&"
|
||||
"||"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
"%"
|
||||
"<<"
|
||||
">>"
|
||||
">>>"
|
||||
] @operator)
|
||||
|
||||
(unary_expression
|
||||
operator: [
|
||||
"+"
|
||||
"-"
|
||||
"!"
|
||||
"~"
|
||||
]) @operator
|
||||
|
||||
"=>" @operator
|
||||
|
||||
[
|
||||
(boolean_type)
|
||||
(void_type)
|
||||
] @type.builtin
|
||||
|
||||
; Fields
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @variable.member))
|
||||
|
||||
(field_access
|
||||
field: (identifier) @variable.member)
|
||||
|
||||
; Variables
|
||||
(variable_declarator
|
||||
(identifier) @property)
|
||||
|
||||
(field_declaration
|
||||
(modifiers
|
||||
(modifier
|
||||
[
|
||||
(final)
|
||||
(static)
|
||||
])
|
||||
(modifier
|
||||
[
|
||||
(final)
|
||||
(static)
|
||||
]))
|
||||
(variable_declarator
|
||||
name: (identifier) @constant))
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) ; SCREAM SNAKE CASE
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Literals
|
||||
[
|
||||
(int)
|
||||
(decimal)
|
||||
(currency_literal)
|
||||
] @number
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
; ;; Keywords
|
||||
[
|
||||
"abstract"
|
||||
"final"
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"static"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"do"
|
||||
"break"
|
||||
] @keyword.repeat
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"throw"
|
||||
"finally"
|
||||
"try"
|
||||
"catch"
|
||||
] @keyword.exception
|
||||
|
||||
"new" @keyword.operator
|
||||
|
||||
[
|
||||
(abstract)
|
||||
(all_rows_clause)
|
||||
"continue"
|
||||
"extends"
|
||||
(final)
|
||||
"get"
|
||||
(global)
|
||||
"implements"
|
||||
"instanceof"
|
||||
"on"
|
||||
(override)
|
||||
(private)
|
||||
(protected)
|
||||
(public)
|
||||
"set"
|
||||
(static)
|
||||
(testMethod)
|
||||
(webservice)
|
||||
(transient)
|
||||
"trigger"
|
||||
(virtual)
|
||||
"when"
|
||||
(with_sharing)
|
||||
(without_sharing)
|
||||
(inherited_sharing)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"interface"
|
||||
"class"
|
||||
"enum"
|
||||
] @keyword.type
|
||||
|
||||
"System.runAs" @function.builtin
|
||||
5
runtime/queries/apex/injections.scm
Normal file
5
runtime/queries/apex/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
([
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
67
runtime/queries/apex/locals.scm
Normal file
67
runtime/queries/apex/locals.scm
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
; declarations
|
||||
(class_declaration) @local.scope
|
||||
|
||||
(method_declaration) @local.scope
|
||||
|
||||
(constructor_declaration) @local.scope
|
||||
|
||||
(enum_declaration) @local.scope
|
||||
|
||||
(enhanced_for_statement) @local.scope
|
||||
|
||||
; if/else
|
||||
(if_statement) @local.scope
|
||||
|
||||
(if_statement
|
||||
consequence: (_) @local.scope) ; if body in case there are no braces
|
||||
|
||||
(if_statement
|
||||
alternative: (_) @local.scope) ; else body in case there are no braces
|
||||
|
||||
; try/catch
|
||||
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
|
||||
(catch_clause) @local.scope ; needed because `Exception` variable
|
||||
|
||||
; loops
|
||||
(for_statement) @local.scope
|
||||
|
||||
(for_statement ; "for" body in case there are no braces
|
||||
body: (_) @local.scope)
|
||||
|
||||
(do_statement
|
||||
body: (_) @local.scope)
|
||||
|
||||
(while_statement
|
||||
body: (_) @local.scope)
|
||||
|
||||
; Functions
|
||||
(constructor_declaration) @local.scope
|
||||
|
||||
(method_declaration) @local.scope
|
||||
|
||||
; definitions
|
||||
(enum_declaration
|
||||
name: (identifier) @local.definition.enum)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_variable_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @local.definition.var))
|
||||
|
||||
(enhanced_for_statement
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(formal_parameter
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @local.definition.field))
|
||||
|
||||
; REFERENCES
|
||||
(identifier) @local.reference
|
||||
|
||||
(type_identifier) @local.reference
|
||||
1
runtime/queries/arduino/folds.scm
Normal file
1
runtime/queries/arduino/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
53
runtime/queries/arduino/highlights.scm
Normal file
53
runtime/queries/arduino/highlights.scm
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
; inherits: cpp
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
; Digital I/O
|
||||
"digitalRead" "digitalWrite" "pinMode"
|
||||
; Analog I/O
|
||||
"analogRead" "analogReference" "analogWrite"
|
||||
; Zero, Due & MKR Family
|
||||
"analogReadResolution" "analogWriteResolution"
|
||||
; Advanced I/O
|
||||
"noTone" "pulseIn" "pulseInLong" "shiftIn" "shiftOut" "tone"
|
||||
; Time
|
||||
"delay" "delayMicroseconds" "micros" "millis"
|
||||
; Math
|
||||
"abs" "constrain" "map" "max" "min" "pow" "sq" "sqrt"
|
||||
; Trigonometry
|
||||
"cos" "sin" "tan"
|
||||
; Characters
|
||||
"isAlpha" "isAlphaNumeric" "isAscii" "isControl" "isDigit" "isGraph" "isHexadecimalDigit"
|
||||
"isLowerCase" "isPrintable" "isPunct" "isSpace" "isUpperCase" "isWhitespace"
|
||||
; Random Numbers
|
||||
"random" "randomSeed"
|
||||
; Bits and Bytes
|
||||
"bit" "bitClear" "bitRead" "bitSet" "bitWrite" "highByte" "lowByte"
|
||||
; External Interrupts
|
||||
"attachInterrupt" "detachInterrupt"
|
||||
; Interrupts
|
||||
"interrupts" "noInterrupts"))
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin "Serial" "SPI" "Stream" "Wire" "Keyboard" "Mouse" "String"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "HIGH" "LOW" "INPUT" "OUTPUT" "INPUT_PULLUP" "LED_BUILTIN"))
|
||||
|
||||
(function_definition
|
||||
(function_declarator
|
||||
declarator: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin "loop" "setup"))
|
||||
|
||||
(call_expression
|
||||
function: (primitive_type) @function.builtin)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @constructor
|
||||
(#any-of? @constructor "SPISettings" "String"))
|
||||
|
||||
(declaration
|
||||
(type_identifier) @type.builtin
|
||||
(function_declarator
|
||||
declarator: (identifier) @constructor)
|
||||
(#eq? @type.builtin "SPISettings"))
|
||||
1
runtime/queries/arduino/indents.scm
Normal file
1
runtime/queries/arduino/indents.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
1
runtime/queries/arduino/injections.scm
Normal file
1
runtime/queries/arduino/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
1
runtime/queries/arduino/locals.scm
Normal file
1
runtime/queries/arduino/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: cpp
|
||||
66
runtime/queries/asm/highlights.scm
Normal file
66
runtime/queries/asm/highlights.scm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
; General
|
||||
(label
|
||||
[
|
||||
(ident)
|
||||
(word)
|
||||
] @label)
|
||||
|
||||
(reg) @variable.builtin
|
||||
|
||||
(meta
|
||||
kind: (_) @function.builtin)
|
||||
|
||||
(instruction
|
||||
kind: (_) @function.builtin)
|
||||
|
||||
(const
|
||||
name: (word) @constant)
|
||||
|
||||
; Comments
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment @spell
|
||||
|
||||
; Literals
|
||||
(int) @number
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(string) @string
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"byte"
|
||||
"word"
|
||||
"dword"
|
||||
"qword"
|
||||
"ptr"
|
||||
"rel"
|
||||
"label"
|
||||
"const"
|
||||
] @keyword
|
||||
|
||||
; Operators & Punctuation
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"|"
|
||||
"^"
|
||||
"&"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
5
runtime/queries/asm/injections.scm
Normal file
5
runtime/queries/asm/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
([
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
1
runtime/queries/astro/folds.scm
Normal file
1
runtime/queries/astro/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
29
runtime/queries/astro/highlights.scm
Normal file
29
runtime/queries/astro/highlights.scm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(doctype) @constant
|
||||
|
||||
"<!" @tag.delimiter
|
||||
|
||||
"---" @punctuation.delimiter
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.special
|
||||
|
||||
; custom components get `@type` highlighting
|
||||
((start_tag
|
||||
(tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((end_tag
|
||||
(tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((self_closing_tag
|
||||
(tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((erroneous_end_tag
|
||||
(erroneous_end_tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
1
runtime/queries/astro/indents.scm
Normal file
1
runtime/queries/astro/indents.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
32
runtime/queries/astro/injections.scm
Normal file
32
runtime/queries/astro/injections.scm
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
; inherits: html_tags
|
||||
|
||||
(frontmatter
|
||||
(frontmatter_js_block) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(attribute_interpolation
|
||||
(attribute_js_expr) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(attribute
|
||||
(attribute_backtick_string) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(html_interpolation
|
||||
(permissible_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(script_element
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(style_element
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_lang_attr
|
||||
(quoted_attribute_value
|
||||
(attribute_value) @_lang_value)))
|
||||
(raw_text) @injection.content
|
||||
(#eq? @_lang_attr "lang")
|
||||
(#eq? @_lang_value "scss")
|
||||
(#set! injection.language "scss"))
|
||||
1
runtime/queries/astro/locals.scm
Normal file
1
runtime/queries/astro/locals.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
; inherits: html
|
||||
60
runtime/queries/authzed/highlights.scm
Normal file
60
runtime/queries/authzed/highlights.scm
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
(identifier) @function
|
||||
|
||||
(block
|
||||
(relation
|
||||
(relation_literal) @function.builtin
|
||||
(identifier) @constant))
|
||||
|
||||
(block
|
||||
(permission
|
||||
(permission_literal) @variable.builtin
|
||||
(identifier) @type))
|
||||
|
||||
; relations
|
||||
(rel_expression
|
||||
(identifier) @property)
|
||||
|
||||
(relation
|
||||
(rel_expression
|
||||
(hash_literal)
|
||||
.
|
||||
(identifier) @constant))
|
||||
|
||||
; permissions
|
||||
(perm_expression
|
||||
(identifier) @property)
|
||||
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
operand: (identifier) @constant
|
||||
field: (field_identifier) @function.method))
|
||||
|
||||
(perm_expression
|
||||
(stabby) @operator
|
||||
.
|
||||
(identifier) @function)
|
||||
|
||||
; misc
|
||||
[
|
||||
(plus_literal)
|
||||
(minus_literal)
|
||||
(amp_literal)
|
||||
(pipe_literal)
|
||||
] @operator
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
(nil) @constant.builtin
|
||||
|
||||
[
|
||||
(caveat_literal)
|
||||
(definition_literal)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
(hash_literal)
|
||||
(comment)
|
||||
] @comment
|
||||
26
runtime/queries/authzed/injections.scm
Normal file
26
runtime/queries/authzed/injections.scm
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((function_call
|
||||
name: (ident) @_name
|
||||
.
|
||||
(simplexpr)
|
||||
.
|
||||
(simplexpr
|
||||
(string
|
||||
(string_fragment) @injection.content)+))
|
||||
(#any-of? @_name "replace" "search" "matches" "captures")
|
||||
(#set! injection.language "regex")
|
||||
(#set! injection.combined))
|
||||
|
||||
((function_call
|
||||
name: (ident) @_name
|
||||
.
|
||||
(simplexpr)
|
||||
.
|
||||
(simplexpr
|
||||
(string
|
||||
(string_fragment) @injection.content)+))
|
||||
(#eq? @_name "jq")
|
||||
(#set! injection.language "jq")
|
||||
(#set! injection.combined))
|
||||
233
runtime/queries/awk/highlights.scm
Normal file
233
runtime/queries/awk/highlights.scm
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
||||
[
|
||||
(identifier)
|
||||
(field_ref)
|
||||
] @variable
|
||||
|
||||
(field_ref
|
||||
(_) @variable)
|
||||
|
||||
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO"
|
||||
"RLENGTH" "RSTART" "RT" "SYMTAB"))
|
||||
|
||||
; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC"
|
||||
"ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN"))
|
||||
|
||||
(number) @number
|
||||
|
||||
(string) @string
|
||||
|
||||
(regex) @string.regexp
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((program
|
||||
.
|
||||
(comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
||||
|
||||
(ns_qualified_name
|
||||
(namespace) @module)
|
||||
|
||||
(ns_qualified_name
|
||||
"::" @punctuation.delimiter)
|
||||
|
||||
(func_def
|
||||
name: (_
|
||||
(identifier) @function) @function)
|
||||
|
||||
(func_call
|
||||
name: (_
|
||||
(identifier) @function) @function)
|
||||
|
||||
(func_def
|
||||
(param_list
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
[
|
||||
"asort"
|
||||
"asorti"
|
||||
"bindtextdomain"
|
||||
"compl"
|
||||
"cos"
|
||||
"dcgettext"
|
||||
"dcngettext"
|
||||
"exp"
|
||||
"gensub"
|
||||
"gsub"
|
||||
"index"
|
||||
"int"
|
||||
"isarray"
|
||||
"length"
|
||||
"log"
|
||||
"lshift"
|
||||
"match"
|
||||
"mktime"
|
||||
"patsplit"
|
||||
"rand"
|
||||
"rshift"
|
||||
"sin"
|
||||
"split"
|
||||
"sprintf"
|
||||
"sqrt"
|
||||
"srand"
|
||||
"strftime"
|
||||
"strtonum"
|
||||
"sub"
|
||||
"substr"
|
||||
"systime"
|
||||
"tolower"
|
||||
"toupper"
|
||||
"typeof"
|
||||
"print"
|
||||
"printf"
|
||||
"getline"
|
||||
] @function.builtin
|
||||
|
||||
[
|
||||
(delete_statement)
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
(next_statement)
|
||||
(nextfile_statement)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"func"
|
||||
"function"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"return"
|
||||
"exit"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
"do"
|
||||
"while"
|
||||
"for"
|
||||
"in"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"case"
|
||||
"default"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"@include"
|
||||
"@load"
|
||||
] @keyword.import
|
||||
|
||||
"@namespace" @keyword.directive
|
||||
|
||||
[
|
||||
"BEGIN"
|
||||
"END"
|
||||
"BEGINFILE"
|
||||
"ENDFILE"
|
||||
] @label
|
||||
|
||||
(binary_exp
|
||||
[
|
||||
"^"
|
||||
"**"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+"
|
||||
"-"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"~"
|
||||
"!~"
|
||||
"in"
|
||||
"&&"
|
||||
"||"
|
||||
] @operator)
|
||||
|
||||
(unary_exp
|
||||
[
|
||||
"!"
|
||||
"+"
|
||||
"-"
|
||||
] @operator)
|
||||
|
||||
(assignment_exp
|
||||
[
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^="
|
||||
] @operator)
|
||||
|
||||
(ternary_exp
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(update_exp
|
||||
[
|
||||
"++"
|
||||
"--"
|
||||
] @operator)
|
||||
|
||||
(redirected_io_statement
|
||||
[
|
||||
">"
|
||||
">>"
|
||||
] @operator)
|
||||
|
||||
(piped_io_statement
|
||||
[
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(piped_io_exp
|
||||
[
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(field_ref
|
||||
"$" @punctuation.delimiter)
|
||||
|
||||
(regex
|
||||
"/" @punctuation.delimiter)
|
||||
|
||||
(regex_constant
|
||||
"@" @punctuation.delimiter)
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
17
runtime/queries/awk/injections.scm
Normal file
17
runtime/queries/awk/injections.scm
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((regex) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((print_statement
|
||||
(exp_list
|
||||
.
|
||||
(string) @injection.content))
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((printf_statement
|
||||
(exp_list
|
||||
.
|
||||
(string) @injection.content))
|
||||
(#set! injection.language "printf"))
|
||||
9
runtime/queries/bash/folds.scm
Normal file
9
runtime/queries/bash/folds.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
(function_definition)
|
||||
(if_statement)
|
||||
(case_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(c_style_for_statement)
|
||||
(heredoc_redirect)
|
||||
] @fold
|
||||
261
runtime/queries/bash/highlights.scm
Normal file
261
runtime/queries/bash/highlights.scm
Normal file
|
|
@ -0,0 +1,261 @@
|
|||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"[["
|
||||
"]]"
|
||||
"(("
|
||||
"))"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
";;"
|
||||
";&"
|
||||
";;&"
|
||||
"&"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
">"
|
||||
">>"
|
||||
"<"
|
||||
"<<"
|
||||
"&&"
|
||||
"|"
|
||||
"|&"
|
||||
"||"
|
||||
"="
|
||||
"+="
|
||||
"=~"
|
||||
"=="
|
||||
"!="
|
||||
"&>"
|
||||
"&>>"
|
||||
"<&"
|
||||
">&"
|
||||
">|"
|
||||
"<&-"
|
||||
">&-"
|
||||
"<<-"
|
||||
"<<<"
|
||||
".."
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
; Do *not* spell check strings since they typically have some sort of
|
||||
; interpolation in them, or, are typically used for things like filenames, URLs,
|
||||
; flags and file content.
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
(ansi_c_string)
|
||||
(heredoc_body)
|
||||
] @string
|
||||
|
||||
[
|
||||
(heredoc_start)
|
||||
(heredoc_end)
|
||||
] @label
|
||||
|
||||
(variable_assignment
|
||||
(word) @string)
|
||||
|
||||
(command
|
||||
argument: "$" @string) ; bare dollar
|
||||
|
||||
(concatenation
|
||||
(word) @string)
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"elif"
|
||||
"fi"
|
||||
"case"
|
||||
"in"
|
||||
"esac"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
"done"
|
||||
"select"
|
||||
"until"
|
||||
"while"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"declare"
|
||||
"typeset"
|
||||
"readonly"
|
||||
"local"
|
||||
"unset"
|
||||
"unsetenv"
|
||||
] @keyword
|
||||
|
||||
"export" @keyword.import
|
||||
|
||||
"function" @keyword.function
|
||||
|
||||
(special_variable_name) @constant
|
||||
|
||||
; trap -l
|
||||
((word) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
|
||||
"SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
|
||||
"SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
|
||||
"SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
|
||||
"SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
|
||||
"SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
|
||||
"SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
|
||||
"SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
|
||||
|
||||
((word) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(test_operator) @operator
|
||||
|
||||
(command_substitution
|
||||
"$(" @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(process_substitution
|
||||
[
|
||||
"<("
|
||||
">("
|
||||
] @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion
|
||||
[
|
||||
"$(("
|
||||
"(("
|
||||
] @punctuation.special
|
||||
"))" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion
|
||||
"," @punctuation.delimiter)
|
||||
|
||||
(ternary_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(binary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(unary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(postfix_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(function_definition
|
||||
name: (word) @function)
|
||||
|
||||
(command_name
|
||||
(word) @function.call)
|
||||
|
||||
(command_name
|
||||
(word) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"." ":" "alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete"
|
||||
"compopt" "continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "false" "fc"
|
||||
"fg" "getopts" "hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf"
|
||||
"pushd" "pwd" "read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time"
|
||||
"times" "trap" "true" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
|
||||
|
||||
(command
|
||||
argument: [
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
|
||||
(declaration_command
|
||||
(word) @variable.parameter)
|
||||
|
||||
(unset_command
|
||||
(word) @variable.parameter)
|
||||
|
||||
(number) @number
|
||||
|
||||
((word) @number
|
||||
(#lua-match? @number "^[0-9]+$"))
|
||||
|
||||
(file_redirect
|
||||
(word) @string.special.path)
|
||||
|
||||
(herestring_redirect
|
||||
(word) @string)
|
||||
|
||||
(file_descriptor) @operator
|
||||
|
||||
(simple_expansion
|
||||
"$" @punctuation.special) @none
|
||||
|
||||
(expansion
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @none
|
||||
|
||||
(expansion
|
||||
operator: _ @punctuation.special)
|
||||
|
||||
(expansion
|
||||
"@"
|
||||
.
|
||||
operator: _ @character.special)
|
||||
|
||||
((expansion
|
||||
(subscript
|
||||
index: (word) @character.special))
|
||||
(#any-of? @character.special "@" "*"))
|
||||
|
||||
"``" @punctuation.special
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
((variable_name) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
((variable_name) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
; https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Variables.html
|
||||
"CDPATH" "HOME" "IFS" "MAIL" "MAILPATH" "OPTARG" "OPTIND" "PATH" "PS1" "PS2"
|
||||
; https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html
|
||||
"_" "BASH" "BASHOPTS" "BASHPID" "BASH_ALIASES" "BASH_ARGC" "BASH_ARGV" "BASH_ARGV0" "BASH_CMDS"
|
||||
"BASH_COMMAND" "BASH_COMPAT" "BASH_ENV" "BASH_EXECUTION_STRING" "BASH_LINENO"
|
||||
"BASH_LOADABLES_PATH" "BASH_REMATCH" "BASH_SOURCE" "BASH_SUBSHELL" "BASH_VERSINFO"
|
||||
"BASH_VERSION" "BASH_XTRACEFD" "CHILD_MAX" "COLUMNS" "COMP_CWORD" "COMP_LINE" "COMP_POINT"
|
||||
"COMP_TYPE" "COMP_KEY" "COMP_WORDBREAKS" "COMP_WORDS" "COMPREPLY" "COPROC" "DIRSTACK" "EMACS"
|
||||
"ENV" "EPOCHREALTIME" "EPOCHSECONDS" "EUID" "EXECIGNORE" "FCEDIT" "FIGNORE" "FUNCNAME"
|
||||
"FUNCNEST" "GLOBIGNORE" "GROUPS" "histchars" "HISTCMD" "HISTCONTROL" "HISTFILE" "HISTFILESIZE"
|
||||
"HISTIGNORE" "HISTSIZE" "HISTTIMEFORMAT" "HOSTFILE" "HOSTNAME" "HOSTTYPE" "IGNOREEOF" "INPUTRC"
|
||||
"INSIDE_EMACS" "LANG" "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES" "LC_NUMERIC" "LC_TIME"
|
||||
"LINENO" "LINES" "MACHTYPE" "MAILCHECK" "MAPFILE" "OLDPWD" "OPTERR" "OSTYPE" "PIPESTATUS"
|
||||
"POSIXLY_CORRECT" "PPID" "PROMPT_COMMAND" "PROMPT_DIRTRIM" "PS0" "PS3" "PS4" "PWD" "RANDOM"
|
||||
"READLINE_ARGUMENT" "READLINE_LINE" "READLINE_MARK" "READLINE_POINT" "REPLY" "SECONDS" "SHELL"
|
||||
"SHELLOPTS" "SHLVL" "SRANDOM" "TIMEFORMAT" "TMOUT" "TMPDIR" "UID"))
|
||||
|
||||
(case_item
|
||||
value: (word) @variable.parameter)
|
||||
|
||||
[
|
||||
(regex)
|
||||
(extglob_pattern)
|
||||
] @string.regexp
|
||||
|
||||
((program
|
||||
.
|
||||
(comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
||||
79
runtime/queries/bash/injections.scm
Normal file
79
runtime/queries/bash/injections.scm
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((regex) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((heredoc_redirect
|
||||
(heredoc_body) @injection.content
|
||||
(heredoc_end) @injection.language)
|
||||
(#downcase! @injection.language))
|
||||
|
||||
; printf 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
.
|
||||
argument: [
|
||||
(string) @injection.content
|
||||
(concatenation
|
||||
(string) @injection.content)
|
||||
(raw_string) @injection.content
|
||||
(concatenation
|
||||
(raw_string) @injection.content)
|
||||
])
|
||||
(#eq? @_command "printf")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; printf -v var 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
.
|
||||
(_)
|
||||
.
|
||||
argument: [
|
||||
(string) @injection.content
|
||||
(concatenation
|
||||
(string) @injection.content)
|
||||
(raw_string) @injection.content
|
||||
(concatenation
|
||||
(raw_string) @injection.content)
|
||||
])
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "-v")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; printf -- 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
.
|
||||
argument: [
|
||||
(string) @injection.content
|
||||
(concatenation
|
||||
(string) @injection.content)
|
||||
(raw_string) @injection.content
|
||||
(concatenation
|
||||
(raw_string) @injection.content)
|
||||
])
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "--")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
.
|
||||
argument: [
|
||||
(string)
|
||||
(raw_string)
|
||||
] @injection.content)
|
||||
(#eq? @_command "bind")
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.include-children)
|
||||
(#set! injection.language "readline"))
|
||||
14
runtime/queries/bash/locals.scm
Normal file
14
runtime/queries/bash/locals.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
; Scopes
|
||||
(function_definition) @local.scope
|
||||
|
||||
; Definitions
|
||||
(variable_assignment
|
||||
name: (variable_name) @local.definition.var)
|
||||
|
||||
(function_definition
|
||||
name: (word) @local.definition.function)
|
||||
|
||||
; References
|
||||
(variable_name) @local.reference
|
||||
|
||||
(word) @local.reference
|
||||
5
runtime/queries/bass/folds.scm
Normal file
5
runtime/queries/bass/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @fold
|
||||
126
runtime/queries/bass/highlights.scm
Normal file
126
runtime/queries/bass/highlights.scm
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
; Variables
|
||||
(list
|
||||
(symbol) @variable)
|
||||
|
||||
(cons
|
||||
(symbol) @variable)
|
||||
|
||||
(scope
|
||||
(symbol) @variable)
|
||||
|
||||
(symbind
|
||||
(symbol) @variable)
|
||||
|
||||
; Constants
|
||||
((symbol) @constant
|
||||
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
|
||||
|
||||
; Functions
|
||||
(list
|
||||
.
|
||||
(symbol) @function)
|
||||
|
||||
; Namespaces
|
||||
(symbind
|
||||
(symbol) @module
|
||||
.
|
||||
(keyword))
|
||||
|
||||
; Includes
|
||||
((symbol) @keyword.import
|
||||
(#any-of? @keyword.import "use" "import" "load"))
|
||||
|
||||
; Keywords
|
||||
((symbol) @keyword
|
||||
(#any-of? @keyword "do" "doc"))
|
||||
|
||||
; Special Functions
|
||||
; Keywords construct a symbol
|
||||
(keyword) @constructor
|
||||
|
||||
((list
|
||||
.
|
||||
(symbol) @keyword.function
|
||||
.
|
||||
(symbol) @function
|
||||
(symbol)? @variable.parameter)
|
||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
.
|
||||
(symbol) @keyword.function
|
||||
.
|
||||
(symbol) @function
|
||||
(symbol)? @variable.parameter)
|
||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||
|
||||
((symbol) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"dump" "mkfs" "json" "log" "error" "now" "cons" "wrap" "unwrap" "eval" "make-scope" "bind"
|
||||
"meta" "with-meta" "null?" "ignore?" "boolean?" "number?" "string?" "symbol?" "scope?" "sink?"
|
||||
"source?" "list?" "pair?" "applicative?" "operative?" "combiner?" "path?" "empty?" "thunk?" "+"
|
||||
"*" "quot" "-" "max" "min" "=" ">" ">=" "<" "<=" "list->source" "across" "emit" "next"
|
||||
"reduce-kv" "assoc" "symbol->string" "string->symbol" "str" "substring" "trim" "scope->list"
|
||||
"string->fs-path" "string->cmd-path" "string->dir" "subpath" "path-name" "path-stem"
|
||||
"with-image" "with-dir" "with-args" "with-cmd" "with-stdin" "with-env" "with-insecure"
|
||||
"with-label" "with-port" "with-tls" "with-mount" "thunk-cmd" "thunk-args" "resolve" "start"
|
||||
"addr" "wait" "read" "cache-dir" "binds?" "recall-memo" "store-memo" "mask" "list" "list*"
|
||||
"first" "rest" "length" "second" "third" "map" "map-pairs" "foldr" "foldl" "append" "filter"
|
||||
"conj" "list->scope" "merge" "apply" "id" "always" "vals" "keys" "memo" "succeeds?" "run" "last"
|
||||
"take" "take-all" "insecure!" "from" "cd" "wrap-cmd" "mkfile" "path-base" "not"))
|
||||
|
||||
((symbol) @function.macro
|
||||
(#any-of? @function.macro
|
||||
"op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
|
||||
|
||||
; Conditionals
|
||||
((symbol) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "if" "case" "cond" "when"))
|
||||
|
||||
; Repeats
|
||||
((symbol) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "each"))
|
||||
|
||||
; Operators
|
||||
((symbol) @operator
|
||||
(#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
((symbol) @punctuation.delimiter
|
||||
(#eq? @punctuation.delimiter "->"))
|
||||
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(path) @string.special.url
|
||||
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
[
|
||||
(ignore)
|
||||
(null)
|
||||
] @constant.builtin
|
||||
|
||||
"^" @character.special
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
31
runtime/queries/bass/indents.scm
Normal file
31
runtime/queries/bass/indents.scm
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent.end
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
5
runtime/queries/bass/injections.scm
Normal file
5
runtime/queries/bass/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((block_comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
26
runtime/queries/bass/locals.scm
Normal file
26
runtime/queries/bass/locals.scm
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
; Scopes
|
||||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
(symbol) @local.reference
|
||||
|
||||
; Definitions
|
||||
((list
|
||||
.
|
||||
(symbol) @_fnkw
|
||||
.
|
||||
(symbol) @local.definition.function
|
||||
(symbol)? @local.definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
.
|
||||
(symbol) @_fnkw
|
||||
.
|
||||
(symbol) @local.definition.function
|
||||
(symbol)? @local.definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
4
runtime/queries/beancount/folds.scm
Normal file
4
runtime/queries/beancount/folds.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(transaction)
|
||||
(section)
|
||||
] @fold
|
||||
57
runtime/queries/beancount/highlights.scm
Normal file
57
runtime/queries/beancount/highlights.scm
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
(date) @variable.member
|
||||
|
||||
(txn) @attribute
|
||||
|
||||
(account) @type
|
||||
|
||||
(amount) @number
|
||||
|
||||
(incomplete_amount) @number
|
||||
|
||||
(compound_amount) @number
|
||||
|
||||
(amount_tolerance) @number
|
||||
|
||||
(currency) @property
|
||||
|
||||
(key) @label
|
||||
|
||||
(string) @string
|
||||
|
||||
(narration) @string @spell
|
||||
|
||||
(payee) @string @spell
|
||||
|
||||
(tag) @constant
|
||||
|
||||
(link) @constant
|
||||
|
||||
[
|
||||
(minus)
|
||||
(plus)
|
||||
(slash)
|
||||
(asterisk)
|
||||
] @operator
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
[
|
||||
(balance)
|
||||
(open)
|
||||
(close)
|
||||
(commodity)
|
||||
(pad)
|
||||
(event)
|
||||
(price)
|
||||
(note)
|
||||
(document)
|
||||
(query)
|
||||
(custom)
|
||||
(pushtag)
|
||||
(poptag)
|
||||
(pushmeta)
|
||||
(popmeta)
|
||||
(option)
|
||||
(include)
|
||||
(plugin)
|
||||
] @keyword
|
||||
5
runtime/queries/beancount/injections.scm
Normal file
5
runtime/queries/beancount/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((macro_text) @injection.content
|
||||
(#set! injection.language "verilog"))
|
||||
1
runtime/queries/bibtex/folds.scm
Normal file
1
runtime/queries/bibtex/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(entry) @fold
|
||||
57
runtime/queries/bibtex/highlights.scm
Normal file
57
runtime/queries/bibtex/highlights.scm
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex)
|
||||
[
|
||||
(string_type)
|
||||
(preamble_type)
|
||||
(entry_type)
|
||||
] @keyword
|
||||
|
||||
[
|
||||
(junk)
|
||||
(comment)
|
||||
] @comment
|
||||
|
||||
(comment) @spell
|
||||
|
||||
[
|
||||
"="
|
||||
"#"
|
||||
] @operator
|
||||
|
||||
(command) @function.builtin
|
||||
|
||||
(number) @number
|
||||
|
||||
(field
|
||||
name: (identifier) @property)
|
||||
|
||||
(token
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
[
|
||||
(brace_word)
|
||||
(quote_word)
|
||||
] @string
|
||||
|
||||
((field
|
||||
name: (identifier) @_url
|
||||
value: (value
|
||||
(token
|
||||
(brace_word) @string.special.url)))
|
||||
(#any-of? @_url "url" "doi"))
|
||||
|
||||
[
|
||||
(key_brace)
|
||||
(key_paren)
|
||||
] @markup.link.label
|
||||
|
||||
(string
|
||||
name: (identifier) @constant)
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
"," @punctuation.delimiter
|
||||
8
runtime/queries/bibtex/indents.scm
Normal file
8
runtime/queries/bibtex/indents.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(entry) @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
(comment) @indent.ignore
|
||||
2
runtime/queries/bibtex/injections.scm
Normal file
2
runtime/queries/bibtex/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((junk) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
19
runtime/queries/bicep/folds.scm
Normal file
19
runtime/queries/bicep/folds.scm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
(module_declaration)
|
||||
(metadata_declaration)
|
||||
(output_declaration)
|
||||
(parameter_declaration)
|
||||
(resource_declaration)
|
||||
(type_declaration)
|
||||
(variable_declaration)
|
||||
(parenthesized_expression)
|
||||
(decorators)
|
||||
(array)
|
||||
(object)
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
(subscript_expression)
|
||||
(ternary_expression)
|
||||
(string)
|
||||
(comment)
|
||||
] @fold
|
||||
234
runtime/queries/bicep/highlights.scm
Normal file
234
runtime/queries/bicep/highlights.scm
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
; Includes
|
||||
[
|
||||
"import"
|
||||
"provider"
|
||||
"with"
|
||||
"as"
|
||||
"from"
|
||||
] @keyword.import
|
||||
|
||||
; Namespaces
|
||||
(module_declaration
|
||||
(identifier) @module)
|
||||
|
||||
; Builtins
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
((member_expression
|
||||
object: (identifier) @type.builtin)
|
||||
(#eq? @type.builtin "sys"))
|
||||
|
||||
; Functions
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(user_defined_function
|
||||
name: (identifier) @function)
|
||||
|
||||
; Properties
|
||||
(object_property
|
||||
(identifier) @property
|
||||
":" @punctuation.delimiter
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @property
|
||||
":" @punctuation.delimiter
|
||||
(_))
|
||||
|
||||
(property_identifier) @property
|
||||
|
||||
; Attributes
|
||||
(decorator
|
||||
"@" @attribute)
|
||||
|
||||
(decorator
|
||||
(call_expression
|
||||
(identifier) @attribute))
|
||||
|
||||
(decorator
|
||||
(call_expression
|
||||
(member_expression
|
||||
object: (identifier) @attribute
|
||||
property: (property_identifier) @attribute)))
|
||||
|
||||
; Types
|
||||
(type_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(type_declaration
|
||||
(identifier)
|
||||
"="
|
||||
(identifier) @type)
|
||||
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
(resource_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Parameters
|
||||
(parameter_declaration
|
||||
(identifier) @variable.parameter
|
||||
(_))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments
|
||||
(member_expression
|
||||
object: (identifier) @variable.parameter)))
|
||||
|
||||
(parameter
|
||||
.
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Variables
|
||||
(variable_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @variable)
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @variable
|
||||
(loop_enumerator) @variable))
|
||||
|
||||
; Conditionals
|
||||
"if" @keyword.conditional
|
||||
|
||||
(ternary_expression
|
||||
"?" @keyword.conditional.ternary
|
||||
":" @keyword.conditional.ternary)
|
||||
|
||||
; Loops
|
||||
(for_statement
|
||||
"for" @keyword.repeat
|
||||
"in"
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"module"
|
||||
"metadata"
|
||||
"output"
|
||||
"param"
|
||||
"resource"
|
||||
"existing"
|
||||
"targetScope"
|
||||
"type"
|
||||
"var"
|
||||
"using"
|
||||
"test"
|
||||
] @keyword
|
||||
|
||||
"func" @keyword.function
|
||||
|
||||
"assert" @keyword.exception
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"||"
|
||||
"&&"
|
||||
"|"
|
||||
"=="
|
||||
"!="
|
||||
"=~"
|
||||
"!~"
|
||||
">"
|
||||
">="
|
||||
"<="
|
||||
"<"
|
||||
"??"
|
||||
"="
|
||||
"!"
|
||||
".?"
|
||||
] @operator
|
||||
|
||||
(subscript_expression
|
||||
"?" @operator)
|
||||
|
||||
(nullable_type
|
||||
"?" @operator)
|
||||
|
||||
"in" @keyword.operator
|
||||
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
; Misc
|
||||
(compatible_identifier
|
||||
"?" @punctuation.special)
|
||||
|
||||
(nullable_return_type) @punctuation.special
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
":"
|
||||
"::"
|
||||
"=>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Interpolation
|
||||
(interpolation) @none
|
||||
|
||||
(interpolation
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(interpolation
|
||||
(identifier) @variable)
|
||||
|
||||
; Comments
|
||||
[
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @comment @spell
|
||||
27
runtime/queries/bicep/indents.scm
Normal file
27
runtime/queries/bicep/indents.scm
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[
|
||||
(array)
|
||||
(object)
|
||||
] @indent.begin
|
||||
|
||||
"}" @indent.end
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @indent.auto
|
||||
5
runtime/queries/bicep/injections.scm
Normal file
5
runtime/queries/bicep/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
([
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
73
runtime/queries/bicep/locals.scm
Normal file
73
runtime/queries/bicep/locals.scm
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
; Scopes
|
||||
[
|
||||
(infrastructure)
|
||||
(call_expression)
|
||||
(lambda_expression)
|
||||
(subscript_expression)
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
(array)
|
||||
(object)
|
||||
(interpolation)
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
(property_identifier) @local.reference
|
||||
|
||||
(call_expression
|
||||
(identifier) @local.reference)
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @local.reference)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @local.reference)
|
||||
|
||||
; Definitions
|
||||
(type) @local.definition.associated
|
||||
|
||||
(object_property
|
||||
(identifier) @local.definition.field
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @local.definition.field
|
||||
(_))
|
||||
|
||||
(user_defined_function
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(module_declaration
|
||||
(identifier) @local.definition.namespace)
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @local.definition.parameter
|
||||
(_))
|
||||
|
||||
(parameter
|
||||
.
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(type_declaration
|
||||
(identifier) @local.definition.type
|
||||
(_))
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @local.definition.var
|
||||
(loop_enumerator) @local.definition.var))
|
||||
24
runtime/queries/bitbake/folds.scm
Normal file
24
runtime/queries/bitbake/folds.scm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[
|
||||
(function_definition)
|
||||
(anonymous_python_function)
|
||||
(python_function_definition)
|
||||
(while_statement)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(with_statement)
|
||||
(try_statement)
|
||||
(import_from_statement)
|
||||
(parameters)
|
||||
(argument_list)
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
(tuple)
|
||||
(list)
|
||||
(set)
|
||||
(dictionary)
|
||||
(string)
|
||||
(python_string)
|
||||
] @fold
|
||||
406
runtime/queries/bitbake/highlights.scm
Normal file
406
runtime/queries/bitbake/highlights.scm
Normal file
|
|
@ -0,0 +1,406 @@
|
|||
; Includes
|
||||
[
|
||||
"inherit"
|
||||
"include"
|
||||
"require"
|
||||
"export"
|
||||
"import"
|
||||
] @keyword.import
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"unset"
|
||||
"EXPORT_FUNCTIONS"
|
||||
"python"
|
||||
"assert"
|
||||
"exec"
|
||||
"global"
|
||||
"nonlocal"
|
||||
"pass"
|
||||
"print"
|
||||
"with"
|
||||
"as"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
|
||||
(yield
|
||||
"from" @keyword.return)
|
||||
|
||||
(future_import_statement
|
||||
"from" @keyword.import
|
||||
"__future__" @constant.builtin)
|
||||
|
||||
(import_from_statement
|
||||
"from" @keyword.import)
|
||||
|
||||
"import" @keyword.import
|
||||
|
||||
(aliased_import
|
||||
"as" @keyword.import)
|
||||
|
||||
[
|
||||
"if"
|
||||
"elif"
|
||||
"else"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"break"
|
||||
"continue"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"try"
|
||||
"except"
|
||||
"except*"
|
||||
"raise"
|
||||
"finally"
|
||||
] @keyword.exception
|
||||
|
||||
(raise_statement
|
||||
"from" @keyword.exception)
|
||||
|
||||
(try_statement
|
||||
(else_clause
|
||||
"else" @keyword.exception))
|
||||
|
||||
[
|
||||
"addtask"
|
||||
"deltask"
|
||||
"addhandler"
|
||||
"def"
|
||||
"lambda"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"before"
|
||||
"after"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"append"
|
||||
"prepend"
|
||||
"remove"
|
||||
] @keyword.modifier
|
||||
|
||||
; Variables
|
||||
[
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
] @variable
|
||||
|
||||
[
|
||||
"noexec"
|
||||
"OVERRIDES"
|
||||
"$BB_ENV_PASSTHROUGH"
|
||||
"$BB_ENV_PASSTHROUGH_ADDITIONS"
|
||||
] @variable.builtin
|
||||
|
||||
; Reset highlighting in f-string interpolations
|
||||
(interpolation) @none
|
||||
|
||||
; Identifier naming conventions
|
||||
((python_identifier) @type
|
||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||
|
||||
([
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
] @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
((python_identifier) @constant.builtin
|
||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
|
||||
((python_identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
; https://docs.python.org/3/library/constants.html
|
||||
"NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license"))
|
||||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
(type
|
||||
(python_identifier) @_annotation))
|
||||
(#eq? @_annotation "TypeAlias"))
|
||||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
right: (call
|
||||
function: (python_identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Fields
|
||||
(flag) @variable.member
|
||||
|
||||
((attribute
|
||||
attribute: (python_identifier) @variable.member)
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
; Functions
|
||||
(call
|
||||
function: (python_identifier) @function.call)
|
||||
|
||||
(call
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
|
||||
"classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
|
||||
"filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
|
||||
"input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
|
||||
"min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
|
||||
"round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
|
||||
"vars" "zip" "__import__"))
|
||||
|
||||
(python_function_definition
|
||||
name: (python_identifier) @function)
|
||||
|
||||
(type
|
||||
(python_identifier) @type)
|
||||
|
||||
(type
|
||||
(subscript
|
||||
(python_identifier) @type)) ; type subscript: Tuple[int]
|
||||
|
||||
((call
|
||||
function: (python_identifier) @_isinstance
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(python_identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
(anonymous_python_function
|
||||
(identifier) @function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @function)
|
||||
|
||||
(addtask_statement
|
||||
(identifier) @function)
|
||||
|
||||
(deltask_statement
|
||||
(identifier) @function)
|
||||
|
||||
(export_functions_statement
|
||||
(identifier) @function)
|
||||
|
||||
(addhandler_statement
|
||||
(identifier) @function)
|
||||
|
||||
(python_function_definition
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(python_string) @string.documentation @spell)))
|
||||
|
||||
; Namespace
|
||||
(inherit_path) @module
|
||||
|
||||
; Normal parameters
|
||||
(parameters
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
; Lambda parameters
|
||||
(lambda_parameters
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
(lambda_parameters
|
||||
(tuple_pattern
|
||||
(python_identifier) @variable.parameter))
|
||||
|
||||
; Default parameters
|
||||
(keyword_argument
|
||||
name: (python_identifier) @variable.parameter)
|
||||
|
||||
; Naming parameters on call-site
|
||||
(default_parameter
|
||||
name: (python_identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
; Variadic parameters *args, **kwargs
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
; *args
|
||||
(python_identifier) @variable.parameter))
|
||||
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
; **kwargs
|
||||
(python_identifier) @variable.parameter))
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
((python_identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "self" "cls"))
|
||||
|
||||
(integer) @number
|
||||
|
||||
(float) @number.float
|
||||
|
||||
; Operators
|
||||
[
|
||||
"?="
|
||||
"??="
|
||||
":="
|
||||
"=+"
|
||||
".="
|
||||
"=."
|
||||
"-"
|
||||
"-="
|
||||
":="
|
||||
"!="
|
||||
"*"
|
||||
"**"
|
||||
"**="
|
||||
"*="
|
||||
"/"
|
||||
"//"
|
||||
"//="
|
||||
"/="
|
||||
"&"
|
||||
"&="
|
||||
"%"
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"+"
|
||||
"+="
|
||||
"<"
|
||||
"<<"
|
||||
"<<="
|
||||
"<="
|
||||
"<>"
|
||||
"="
|
||||
"=="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"@"
|
||||
"@="
|
||||
"|"
|
||||
"|="
|
||||
"~"
|
||||
"->"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"is"
|
||||
"not"
|
||||
"or"
|
||||
"is not"
|
||||
"not in"
|
||||
"del"
|
||||
] @keyword.operator
|
||||
|
||||
; Literals
|
||||
[
|
||||
(string)
|
||||
(python_string)
|
||||
"\""
|
||||
] @string
|
||||
|
||||
(include_path) @string.special.path
|
||||
|
||||
[
|
||||
(escape_sequence)
|
||||
(escape_interpolation)
|
||||
] @string.escape
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
":"
|
||||
"->"
|
||||
";"
|
||||
"."
|
||||
","
|
||||
(ellipsis)
|
||||
] @punctuation.delimiter
|
||||
|
||||
(variable_expansion
|
||||
[
|
||||
"${"
|
||||
"}"
|
||||
] @punctuation.special)
|
||||
|
||||
(inline_python
|
||||
[
|
||||
"${@"
|
||||
"}"
|
||||
] @punctuation.special)
|
||||
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(type_conversion) @function.macro
|
||||
|
||||
([
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
] @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
; https://docs.python.org/3/library/exceptions.html
|
||||
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
|
||||
"AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
|
||||
"ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
|
||||
"NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
|
||||
"StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
|
||||
"SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
|
||||
"UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
|
||||
"IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
|
||||
"BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
|
||||
"FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
|
||||
"NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||
; https://docs.python.org/3/library/stdtypes.html
|
||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview"
|
||||
"set" "frozenset" "dict" "type" "object"))
|
||||
|
||||
(comment) @comment @spell
|
||||
172
runtime/queries/bitbake/indents.scm
Normal file
172
runtime/queries/bitbake/indents.scm
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
[
|
||||
(import_from_statement)
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
(tuple_pattern)
|
||||
(list_pattern)
|
||||
(binary_operator)
|
||||
(lambda)
|
||||
(concatenated_string)
|
||||
] @indent.begin
|
||||
|
||||
((list) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
|
||||
((dictionary) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}"))
|
||||
|
||||
((set) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}"))
|
||||
|
||||
((for_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((if_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((while_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((try_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(ERROR
|
||||
"try"
|
||||
":" @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((python_function_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(function_definition) @indent.begin
|
||||
|
||||
(anonymous_python_function) @indent.begin
|
||||
|
||||
((with_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
(while_statement
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
(ERROR
|
||||
"(" @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
.
|
||||
(_))
|
||||
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(ERROR
|
||||
"[" @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]")
|
||||
.
|
||||
(_))
|
||||
|
||||
(ERROR
|
||||
"{" @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
.
|
||||
(_))
|
||||
|
||||
[
|
||||
(break_statement)
|
||||
(continue_statement)
|
||||
] @indent.dedent
|
||||
|
||||
(ERROR
|
||||
(_) @indent.branch
|
||||
":"
|
||||
.
|
||||
(#lua-match? @indent.branch "^else"))
|
||||
|
||||
(ERROR
|
||||
(_) @indent.branch @indent.dedent
|
||||
":"
|
||||
.
|
||||
(#lua-match? @indent.branch "^elif"))
|
||||
|
||||
(parenthesized_expression
|
||||
")" @indent.end)
|
||||
|
||||
(generator_expression
|
||||
")" @indent.end)
|
||||
|
||||
(list_comprehension
|
||||
"]" @indent.end)
|
||||
|
||||
(set_comprehension
|
||||
"}" @indent.end)
|
||||
|
||||
(dictionary_comprehension
|
||||
"}" @indent.end)
|
||||
|
||||
(tuple_pattern
|
||||
")" @indent.end)
|
||||
|
||||
(list_pattern
|
||||
"]" @indent.end)
|
||||
|
||||
(function_definition
|
||||
"}" @indent.end)
|
||||
|
||||
(anonymous_python_function
|
||||
"}" @indent.end)
|
||||
|
||||
(return_statement
|
||||
[
|
||||
(_) @indent.end
|
||||
(_
|
||||
[
|
||||
(_)
|
||||
")"
|
||||
"}"
|
||||
"]"
|
||||
] @indent.end .)
|
||||
(attribute
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments: (_
|
||||
")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
[
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
(elif_clause)
|
||||
(else_clause)
|
||||
(except_clause)
|
||||
(finally_clause)
|
||||
] @indent.branch
|
||||
|
||||
(string) @indent.auto
|
||||
15
runtime/queries/bitbake/injections.scm
Normal file
15
runtime/queries/bitbake/injections.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(call
|
||||
function: (attribute
|
||||
object: (python_identifier) @_re)
|
||||
arguments: (argument_list
|
||||
(python_string
|
||||
(string_content) @injection.content) @_string)
|
||||
(#eq? @_re "re")
|
||||
(#lua-match? @_string "^r.*")
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((shell_content) @injection.content
|
||||
(#set! injection.language "bash"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
117
runtime/queries/bitbake/locals.scm
Normal file
117
runtime/queries/bitbake/locals.scm
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
; References
|
||||
[
|
||||
(python_identifier)
|
||||
(identifier)
|
||||
] @local.reference
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (python_identifier) @local.definition.import)
|
||||
|
||||
(import_statement
|
||||
name: (dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
|
||||
(import_from_statement
|
||||
name: (dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(default_parameter
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
; *args parameter
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
(python_identifier) @local.definition.parameter))
|
||||
|
||||
; **kwargs parameter
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
(python_identifier) @local.definition.parameter))
|
||||
|
||||
; Function defines function and scope
|
||||
((python_function_definition
|
||||
name: (python_identifier) @local.definition.function) @local.scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(function_definition
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
(anonymous_python_function
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
; not a scope!
|
||||
;(while_statement) @local.scope
|
||||
; for in list comprehension
|
||||
(for_in_clause
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(for_in_clause
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_in_clause
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @local.scope
|
||||
|
||||
(list_comprehension) @local.scope
|
||||
|
||||
(set_comprehension) @local.scope
|
||||
|
||||
; Assignments
|
||||
(assignment
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @local.definition.field))
|
||||
|
||||
(variable_assignment
|
||||
(identifier)
|
||||
operator: [
|
||||
"="
|
||||
"?="
|
||||
"??="
|
||||
":="
|
||||
] @local.definition.var)
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
(python_identifier) @local.definition.var)
|
||||
|
||||
(as_pattern
|
||||
alias: (as_pattern_target) @local.definition.var)
|
||||
14
runtime/queries/blade/folds.scm
Normal file
14
runtime/queries/blade/folds.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
(authorization)
|
||||
(conditional)
|
||||
(envoy)
|
||||
(fragment)
|
||||
(livewire)
|
||||
(loop)
|
||||
(once)
|
||||
(php_statement)
|
||||
(section)
|
||||
(stack)
|
||||
(switch)
|
||||
(verbatim)
|
||||
] @fold
|
||||
15
runtime/queries/blade/highlights.scm
Normal file
15
runtime/queries/blade/highlights.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
([
|
||||
(directive)
|
||||
(directive_start)
|
||||
(directive_end)
|
||||
] @tag
|
||||
(#set! priority 101))
|
||||
|
||||
([
|
||||
(bracket_start)
|
||||
(bracket_end)
|
||||
] @tag.delimiter
|
||||
(#set! priority 101))
|
||||
|
||||
((comment) @comment @spell
|
||||
(#set! priority 101))
|
||||
3
runtime/queries/blade/indents.scm
Normal file
3
runtime/queries/blade/indents.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(directive_start) @indent.begin
|
||||
|
||||
(directive_end) @indent.end
|
||||
15
runtime/queries/blade/injections.scm
Normal file
15
runtime/queries/blade/injections.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
((text) @injection.content
|
||||
(#set! injection.combined)
|
||||
(#set! injection.language html))
|
||||
|
||||
((text) @injection.content
|
||||
(#has-ancestor? @injection.content "envoy")
|
||||
(#set! injection.combined)
|
||||
(#set! injection.language bash))
|
||||
|
||||
((php_only) @injection.content
|
||||
(#set! injection.combined)
|
||||
(#set! injection.language php_only))
|
||||
|
||||
((parameter) @injection.content
|
||||
(#set! injection.language php_only))
|
||||
75
runtime/queries/blueprint/highlights.scm
Normal file
75
runtime/queries/blueprint/highlights.scm
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
(object_id) @variable
|
||||
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(constant) @constant.builtin
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(using) @keyword.import
|
||||
|
||||
(template) @keyword
|
||||
|
||||
(decorator) @attribute
|
||||
|
||||
(property_definition
|
||||
(property_name) @property)
|
||||
|
||||
(object) @type
|
||||
|
||||
(signal_binding
|
||||
(signal_name) @function.builtin)
|
||||
|
||||
(signal_binding
|
||||
(function
|
||||
(identifier)) @function)
|
||||
|
||||
(signal_binding
|
||||
"swapped" @keyword)
|
||||
|
||||
(styles_list
|
||||
"styles" @function.macro)
|
||||
|
||||
(layout_definition
|
||||
"layout" @function.macro)
|
||||
|
||||
(gettext_string
|
||||
"_" @function.builtin)
|
||||
|
||||
(menu_definition
|
||||
"menu" @keyword)
|
||||
|
||||
(menu_section
|
||||
"section" @keyword)
|
||||
|
||||
(menu_item
|
||||
"item" @function.macro)
|
||||
|
||||
(import_statement
|
||||
(gobject_library) @module)
|
||||
|
||||
(import_statement
|
||||
(version_number) @number.float)
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(number) @number
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
2
runtime/queries/blueprint/injections.scm
Normal file
2
runtime/queries/blueprint/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
6
runtime/queries/bp/folds.scm
Normal file
6
runtime/queries/bp/folds.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
(list_expression)
|
||||
(map_expression)
|
||||
(module)
|
||||
(select_expression)
|
||||
] @fold
|
||||
56
runtime/queries/bp/highlights.scm
Normal file
56
runtime/queries/bp/highlights.scm
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
(comment) @comment @spell
|
||||
|
||||
(operator) @operator
|
||||
|
||||
(integer_literal
|
||||
"-" @operator)
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(boolean_literal) @boolean
|
||||
|
||||
(integer_literal) @number
|
||||
|
||||
[
|
||||
(raw_string_literal)
|
||||
(interpreted_string_literal)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(module
|
||||
type: (identifier) @function.call)
|
||||
|
||||
(module
|
||||
(property
|
||||
field: (identifier) @variable.parameter))
|
||||
|
||||
[
|
||||
(unset)
|
||||
(default)
|
||||
(any)
|
||||
] @variable.builtin
|
||||
|
||||
(condition
|
||||
name: (identifier) @function.builtin)
|
||||
|
||||
(map_expression
|
||||
(property
|
||||
field: (identifier) @property))
|
||||
|
||||
(select_expression
|
||||
"select" @keyword.conditional)
|
||||
38
runtime/queries/bp/indents.scm
Normal file
38
runtime/queries/bp/indents.scm
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
(list_expression) @indent.begin
|
||||
|
||||
(list_expression
|
||||
"]" @indent.branch)
|
||||
|
||||
(map_expression) @indent.begin
|
||||
|
||||
(map_expression
|
||||
"}" @indent.branch)
|
||||
|
||||
(select_expression) @indent.begin
|
||||
|
||||
(select_expression
|
||||
")" @indent.branch)
|
||||
|
||||
(select_value) @indent.begin
|
||||
|
||||
(select_value
|
||||
")" @indent.branch)
|
||||
|
||||
(select_pattern
|
||||
"(" @indent.begin)
|
||||
|
||||
(select_pattern
|
||||
")" @indent.branch)
|
||||
|
||||
(select_cases) @indent.begin
|
||||
|
||||
(select_cases
|
||||
"}" @indent.branch)
|
||||
|
||||
(module) @indent.begin
|
||||
|
||||
(module
|
||||
")" @indent.branch)
|
||||
|
||||
(module
|
||||
"}" @indent.branch)
|
||||
2
runtime/queries/bp/injections.scm
Normal file
2
runtime/queries/bp/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
15
runtime/queries/bp/locals.scm
Normal file
15
runtime/queries/bp/locals.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(module
|
||||
(property
|
||||
field: (identifier) @local.definition.parameter))
|
||||
|
||||
(map_expression
|
||||
(property
|
||||
field: (identifier) @local.definition.field))
|
||||
|
||||
(assignment
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(pattern_binding
|
||||
binding: (identifier) @local.definition.var)
|
||||
|
||||
(identifier) @local.reference
|
||||
8
runtime/queries/brightscript/folds.scm
Normal file
8
runtime/queries/brightscript/folds.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
(function_statement)
|
||||
(sub_statement)
|
||||
(while_statement)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(try_statement)
|
||||
] @fold
|
||||
177
runtime/queries/brightscript/highlights.scm
Normal file
177
runtime/queries/brightscript/highlights.scm
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
; Identifiers
|
||||
(identifier) @variable
|
||||
|
||||
; Function declaration
|
||||
(function_statement
|
||||
name: (identifier) @function)
|
||||
|
||||
; Sub declaration
|
||||
(sub_statement
|
||||
name: (identifier) @function)
|
||||
|
||||
[
|
||||
(sub_start)
|
||||
(function_start)
|
||||
(end_sub)
|
||||
(end_function)
|
||||
] @keyword.function
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Types
|
||||
(type_specifier) @type
|
||||
|
||||
; Variables
|
||||
; Base variable in variable declarator (immediate child of prefix_exp)
|
||||
(variable_declarator
|
||||
(prefix_exp
|
||||
(identifier) @variable
|
||||
(#not-has-ancestor? @variable prefix_exp)))
|
||||
|
||||
; Properties in variable declarator
|
||||
(variable_declarator
|
||||
(prefix_exp)
|
||||
(identifier) @property)
|
||||
|
||||
(multiplicative_expression
|
||||
operator: (_) @keyword.operator)
|
||||
|
||||
(logical_not_expression
|
||||
operator: (_) @keyword.operator)
|
||||
|
||||
(logical_expression
|
||||
operator: (_) @keyword.operator)
|
||||
|
||||
; Property access
|
||||
; First identifier in a chain (base variable)
|
||||
(prefix_exp
|
||||
.
|
||||
(identifier) @variable
|
||||
(#not-has-ancestor? @variable prefix_exp))
|
||||
|
||||
; All other identifiers in a chain (properties)
|
||||
(prefix_exp
|
||||
(prefix_exp)
|
||||
(identifier) @property)
|
||||
|
||||
; Function calls
|
||||
(function_call
|
||||
function: (prefix_exp
|
||||
(identifier) @function.call))
|
||||
|
||||
; Statements
|
||||
[
|
||||
(if_start)
|
||||
(else)
|
||||
(else_if)
|
||||
(end_if)
|
||||
(then)
|
||||
(conditional_compl_end_if)
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
(for_start)
|
||||
(while_start)
|
||||
(for_each)
|
||||
(for_in)
|
||||
(for_to)
|
||||
(for_step)
|
||||
(end_for)
|
||||
(end_while)
|
||||
(exit_while_statement)
|
||||
(exit_for_statement)
|
||||
] @keyword.repeat
|
||||
|
||||
; Statements
|
||||
[
|
||||
(try_start)
|
||||
(try_catch)
|
||||
(throw)
|
||||
(end_try)
|
||||
] @keyword.exception
|
||||
|
||||
(return) @keyword.return
|
||||
|
||||
(print) @function.builtin
|
||||
|
||||
(constant) @constant
|
||||
|
||||
; Operators
|
||||
[
|
||||
"="
|
||||
"<>"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
] @operator
|
||||
|
||||
; Literals
|
||||
(boolean) @boolean
|
||||
|
||||
(number) @number
|
||||
|
||||
(string) @string
|
||||
|
||||
(invalid) @constant.builtin
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"?["
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
"?."
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Special highlights for library statements
|
||||
(library_statement) @keyword.import
|
||||
|
||||
(library_statement
|
||||
path: (string) @module)
|
||||
|
||||
; Array and associative array literals
|
||||
(array) @constructor
|
||||
|
||||
(assoc_array) @constructor
|
||||
|
||||
(assoc_array_element
|
||||
key: (identifier) @property)
|
||||
|
||||
; Increment/decrement operators
|
||||
[
|
||||
(prefix_increment_expression)
|
||||
(prefix_decrement_expression)
|
||||
(postfix_increment_expression)
|
||||
(postfix_decrement_expression)
|
||||
] @operator
|
||||
|
||||
; Comparison operators
|
||||
(comparison_expression
|
||||
[
|
||||
"="
|
||||
"<>"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
] @operator)
|
||||
|
||||
(as) @keyword.operator
|
||||
39
runtime/queries/brightscript/indents.scm
Normal file
39
runtime/queries/brightscript/indents.scm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
; Start indentation for block-level constructs
|
||||
[
|
||||
(sub_statement)
|
||||
(function_statement)
|
||||
(annonymous_sub)
|
||||
(annonymous_function)
|
||||
(conditional_compl)
|
||||
(multi_line_if)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(try_statement)
|
||||
(array)
|
||||
(assoc_array)
|
||||
] @indent.begin
|
||||
|
||||
; End indentation for all end statements
|
||||
[
|
||||
(end_sub)
|
||||
(end_function)
|
||||
(end_if)
|
||||
(end_for)
|
||||
(end_while)
|
||||
(end_try)
|
||||
(conditional_compl_end_if)
|
||||
"]"
|
||||
"}"
|
||||
] @indent.branch @indent.end
|
||||
|
||||
; Handle branching constructs
|
||||
[
|
||||
(else_if_clause)
|
||||
(else_clause)
|
||||
(conditional_compl_else_if_clause)
|
||||
(conditional_compl_else_clause)
|
||||
(catch_clause)
|
||||
] @indent.branch
|
||||
|
||||
; Ignore comments for indentation
|
||||
(comment) @indent.ignore
|
||||
2
runtime/queries/brightscript/injections.scm
Normal file
2
runtime/queries/brightscript/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
23
runtime/queries/c/folds.scm
Normal file
23
runtime/queries/c/folds.scm
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(do_statement)
|
||||
(switch_statement)
|
||||
(case_statement)
|
||||
(function_definition)
|
||||
(struct_specifier)
|
||||
(enum_specifier)
|
||||
(comment)
|
||||
(preproc_if)
|
||||
(preproc_elif)
|
||||
(preproc_else)
|
||||
(preproc_ifdef)
|
||||
(preproc_function_def)
|
||||
(initializer_list)
|
||||
(gnu_asm_expression)
|
||||
(preproc_include)+
|
||||
] @fold
|
||||
|
||||
(compound_statement
|
||||
(compound_statement) @fold)
|
||||
341
runtime/queries/c/highlights.scm
Normal file
341
runtime/queries/c/highlights.scm
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
|
||||
((identifier) @variable
|
||||
(#set! priority 95))
|
||||
|
||||
(preproc_def
|
||||
(preproc_arg) @variable)
|
||||
|
||||
[
|
||||
"default"
|
||||
"goto"
|
||||
"asm"
|
||||
"__asm__"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"enum"
|
||||
"struct"
|
||||
"union"
|
||||
"typedef"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"sizeof"
|
||||
"offsetof"
|
||||
] @keyword.operator
|
||||
|
||||
(alignof_expression
|
||||
.
|
||||
_ @keyword.operator)
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"break"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"#if"
|
||||
"#ifdef"
|
||||
"#ifndef"
|
||||
"#else"
|
||||
"#elif"
|
||||
"#endif"
|
||||
"#elifdef"
|
||||
"#elifndef"
|
||||
(preproc_directive)
|
||||
] @keyword.directive
|
||||
|
||||
"#define" @keyword.directive.define
|
||||
|
||||
"#include" @keyword.import
|
||||
|
||||
[
|
||||
";"
|
||||
":"
|
||||
","
|
||||
"."
|
||||
"::"
|
||||
] @punctuation.delimiter
|
||||
|
||||
"..." @punctuation.special
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"="
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"+"
|
||||
"%"
|
||||
"~"
|
||||
"|"
|
||||
"&"
|
||||
"^"
|
||||
"<<"
|
||||
">>"
|
||||
"->"
|
||||
"<"
|
||||
"<="
|
||||
">="
|
||||
">"
|
||||
"=="
|
||||
"!="
|
||||
"!"
|
||||
"&&"
|
||||
"||"
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"|="
|
||||
"&="
|
||||
"^="
|
||||
">>="
|
||||
"<<="
|
||||
"--"
|
||||
"++"
|
||||
] @operator
|
||||
|
||||
; Make sure the comma operator is given a highlight group after the comma
|
||||
; punctuator so the operator is highlighted properly.
|
||||
(comma_expression
|
||||
"," @operator)
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
(conditional_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(system_lib_string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
(number_literal) @number
|
||||
|
||||
(char_literal) @character
|
||||
|
||||
(preproc_defined) @function.macro
|
||||
|
||||
((field_expression
|
||||
(field_identifier) @property) @_parent
|
||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||
|
||||
(field_designator) @property
|
||||
|
||||
((field_identifier) @property
|
||||
(#has-ancestor? @property field_declaration)
|
||||
(#not-has-ancestor? @property function_declarator))
|
||||
|
||||
(statement_identifier) @label
|
||||
|
||||
(declaration
|
||||
type: (type_identifier) @_type
|
||||
declarator: (identifier) @label
|
||||
(#eq? @_type "__label__"))
|
||||
|
||||
[
|
||||
(type_identifier)
|
||||
(type_descriptor)
|
||||
] @type
|
||||
|
||||
(storage_class_specifier) @keyword.modifier
|
||||
|
||||
[
|
||||
(type_qualifier)
|
||||
(gnu_asm_qualifier)
|
||||
"__extension__"
|
||||
] @keyword.modifier
|
||||
|
||||
(linkage_specification
|
||||
"extern" @keyword.modifier)
|
||||
|
||||
(type_definition
|
||||
declarator: (type_identifier) @type.definition)
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(sized_type_specifier
|
||||
_ @type.builtin
|
||||
type: _?)
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
|
||||
(preproc_def
|
||||
(preproc_arg) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
|
||||
(enumerator
|
||||
name: (identifier) @constant)
|
||||
|
||||
(case_statement
|
||||
value: (identifier) @constant)
|
||||
|
||||
((identifier) @constant.builtin
|
||||
; format-ignore
|
||||
(#any-of? @constant.builtin
|
||||
"stderr" "stdin" "stdout"
|
||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||
"__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
|
||||
"__cplusplus" "__OBJC__" "__ASSEMBLER__"
|
||||
"__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__"
|
||||
"__TIMESTAMP__" "__clang__" "__clang_major__"
|
||||
"__clang_minor__" "__clang_patchlevel__"
|
||||
"__clang_version__" "__clang_literal_encoding__"
|
||||
"__clang_wide_literal_encoding__"
|
||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||
"__VA_ARGS__" "__VA_OPT__"))
|
||||
|
||||
(preproc_def
|
||||
(preproc_arg) @constant.builtin
|
||||
; format-ignore
|
||||
(#any-of? @constant.builtin
|
||||
"stderr" "stdin" "stdout"
|
||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||
"__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
|
||||
"__cplusplus" "__OBJC__" "__ASSEMBLER__"
|
||||
"__BASE_FILE__" "__FILE_NAME__" "__INCLUDE_LEVEL__"
|
||||
"__TIMESTAMP__" "__clang__" "__clang_major__"
|
||||
"__clang_minor__" "__clang_patchlevel__"
|
||||
"__clang_version__" "__clang_literal_encoding__"
|
||||
"__clang_wide_literal_encoding__"
|
||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||
"__VA_ARGS__" "__VA_OPT__"))
|
||||
|
||||
(attribute_specifier
|
||||
(argument_list
|
||||
(identifier) @variable.builtin))
|
||||
|
||||
(attribute_specifier
|
||||
(argument_list
|
||||
(call_expression
|
||||
function: (identifier) @variable.builtin)))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
(#lua-match? @function.builtin "^__builtin_"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
(#has-ancestor? @function.builtin attribute_specifier))
|
||||
|
||||
; Preproc def / undef
|
||||
(preproc_def
|
||||
name: (_) @constant.macro)
|
||||
|
||||
(preproc_call
|
||||
directive: (preproc_directive) @_u
|
||||
argument: (_) @constant.macro
|
||||
(#eq? @_u "#undef"))
|
||||
|
||||
(preproc_ifdef
|
||||
name: (identifier) @constant.macro)
|
||||
|
||||
(preproc_elifdef
|
||||
name: (identifier) @constant.macro)
|
||||
|
||||
(preproc_defined
|
||||
(identifier) @constant.macro)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
|
||||
(function_declarator
|
||||
declarator: (parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
|
||||
; Parameters
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @variable.parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (array_declarator) @variable.parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (pointer_declarator) @variable.parameter)
|
||||
|
||||
; K&R functions
|
||||
; To enable support for K&R functions,
|
||||
; add the following lines to your own query config and uncomment them.
|
||||
; They are commented out as they'll conflict with C++
|
||||
; Note that you'll need to have `; extends` at the top of your query file.
|
||||
;
|
||||
; (parameter_list (identifier) @variable.parameter)
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (identifier) @variable.parameter))
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (array_declarator) @variable.parameter))
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (pointer_declarator) @variable.parameter))
|
||||
(preproc_params
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
[
|
||||
"__attribute__"
|
||||
"__declspec"
|
||||
"__based"
|
||||
"__cdecl"
|
||||
"__clrcall"
|
||||
"__stdcall"
|
||||
"__fastcall"
|
||||
"__thiscall"
|
||||
"__vectorcall"
|
||||
(ms_pointer_modifier)
|
||||
(attribute_declaration)
|
||||
] @attribute
|
||||
99
runtime/queries/c/indents.scm
Normal file
99
runtime/queries/c/indents.scm
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
[
|
||||
(compound_statement)
|
||||
(field_declaration_list)
|
||||
(case_statement)
|
||||
(enumerator_list)
|
||||
(compound_literal_expression)
|
||||
(initializer_list)
|
||||
(init_declarator)
|
||||
] @indent.begin
|
||||
|
||||
; With current indent logic, if we capture expression_statement with @indent.begin
|
||||
; It will be affected by _parent_ node with error subnodes deep down the tree
|
||||
; So narrow indent capture to check for error inside expression statement only,
|
||||
(expression_statement
|
||||
(_) @indent.begin
|
||||
";" @indent.end)
|
||||
|
||||
(ERROR
|
||||
"for"
|
||||
"(" @indent.begin
|
||||
";"
|
||||
";"
|
||||
")" @indent.end)
|
||||
|
||||
((for_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-kind-eq? @_body "compound_statement"))
|
||||
|
||||
(while_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
((while_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-kind-eq? @_body "compound_statement"))
|
||||
|
||||
((if_statement)
|
||||
.
|
||||
(ERROR
|
||||
"else" @indent.begin))
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
; Supports if without braces (but not both if-else without braces)
|
||||
(if_statement
|
||||
consequence: (_
|
||||
";" @indent.end) @_consequence
|
||||
(#not-kind-eq? @_consequence "compound_statement")
|
||||
alternative: (else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement
|
||||
(compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
])?) @indent.begin
|
||||
|
||||
(else_clause
|
||||
(_
|
||||
.
|
||||
"{" @indent.branch))
|
||||
|
||||
(compound_statement
|
||||
"}" @indent.end)
|
||||
|
||||
[
|
||||
")"
|
||||
"}"
|
||||
(statement_identifier)
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"#define"
|
||||
"#ifdef"
|
||||
"#ifndef"
|
||||
"#elif"
|
||||
"#if"
|
||||
"#else"
|
||||
"#endif"
|
||||
] @indent.zero
|
||||
|
||||
[
|
||||
(preproc_arg)
|
||||
(string_literal)
|
||||
] @indent.ignore
|
||||
|
||||
((ERROR
|
||||
(parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
([
|
||||
(argument_list)
|
||||
(parameter_list)
|
||||
] @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
128
runtime/queries/c/injections.scm
Normal file
128
runtime/queries/c/injections.scm
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
((preproc_arg) @injection.content
|
||||
(#set! injection.self))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
|
||||
(#set! injection.language "re2c"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "/[*\/][!*\/]<?[^a-zA-Z]")
|
||||
(#set! injection.language "doxygen"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"printf" "printf_s"
|
||||
"vprintf" "vprintf_s"
|
||||
"scanf" "scanf_s"
|
||||
"vscanf" "vscanf_s"
|
||||
"wprintf" "wprintf_s"
|
||||
"vwprintf" "vwprintf_s"
|
||||
"wscanf" "wscanf_s"
|
||||
"vwscanf" "vwscanf_s"
|
||||
"cscanf" "_cscanf"
|
||||
"printw"
|
||||
"scanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"fprintf" "fprintf_s"
|
||||
"sprintf"
|
||||
"dprintf"
|
||||
"fscanf" "fscanf_s"
|
||||
"sscanf" "sscanf_s"
|
||||
"vsscanf" "vsscanf_s"
|
||||
"vfprintf" "vfprintf_s"
|
||||
"vsprintf"
|
||||
"vdprintf"
|
||||
"fwprintf" "fwprintf_s"
|
||||
"vfwprintf" "vfwprintf_s"
|
||||
"fwscanf" "fwscanf_s"
|
||||
"swscanf" "swscanf_s"
|
||||
"vswscanf" "vswscanf_s"
|
||||
"vfscanf" "vfscanf_s"
|
||||
"vfwscanf" "vfwscanf_s"
|
||||
"wprintw"
|
||||
"vw_printw" "vwprintw"
|
||||
"wscanw"
|
||||
"vw_scanw" "vwscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"sprintf_s"
|
||||
"snprintf" "snprintf_s"
|
||||
"vsprintf_s"
|
||||
"vsnprintf" "vsnprintf_s"
|
||||
"swprintf" "swprintf_s"
|
||||
"snwprintf_s"
|
||||
"vswprintf" "vswprintf_s"
|
||||
"vsnwprintf_s"
|
||||
"mvprintw"
|
||||
"mvscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
(#any-of? @_function "mvwprintw" "mvwscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; TODO: add when asm is added
|
||||
; (gnu_asm_expression assembly_code: (string_literal) @injection.content
|
||||
; (#set! injection.language "asm"))
|
||||
; (gnu_asm_expression assembly_code: (concatenated_string (string_literal) @injection.content)
|
||||
; (#set! injection.language "asm"))
|
||||
67
runtime/queries/c/locals.scm
Normal file
67
runtime/queries/c/locals.scm
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
; Functions definitions
|
||||
(function_declarator
|
||||
declarator: (identifier) @local.definition.function)
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @local.definition.macro) @local.scope
|
||||
|
||||
(preproc_def
|
||||
name: (identifier) @local.definition.macro)
|
||||
|
||||
(pointer_declarator
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @local.definition.parameter)
|
||||
|
||||
(init_declarator
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(array_declarator
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(declaration
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(enum_specifier
|
||||
name: (_) @local.definition.type
|
||||
(enumerator_list
|
||||
(enumerator
|
||||
name: (identifier) @local.definition.var)))
|
||||
|
||||
; Type / Struct / Enum
|
||||
(field_declaration
|
||||
declarator: (field_identifier) @local.definition.field)
|
||||
|
||||
(type_definition
|
||||
declarator: (type_identifier) @local.definition.type)
|
||||
|
||||
(struct_specifier
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
; goto
|
||||
(labeled_statement
|
||||
(statement_identifier) @local.definition)
|
||||
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(goto_statement
|
||||
(statement_identifier) @local.reference)
|
||||
|
||||
; Scope
|
||||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(translation_unit)
|
||||
(function_definition)
|
||||
(compound_statement) ; a block in curly braces
|
||||
(struct_specifier)
|
||||
] @local.scope
|
||||
17
runtime/queries/c_sharp/folds.scm
Normal file
17
runtime/queries/c_sharp/folds.scm
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
body: [
|
||||
(declaration_list)
|
||||
(switch_body)
|
||||
(enum_member_declaration_list)
|
||||
] @fold
|
||||
|
||||
accessors: (accessor_list) @fold
|
||||
|
||||
initializer: (initializer_expression) @fold
|
||||
|
||||
[
|
||||
(block)
|
||||
(preproc_if)
|
||||
(preproc_elif)
|
||||
(preproc_else)
|
||||
(using_directive)+
|
||||
] @fold
|
||||
577
runtime/queries/c_sharp/highlights.scm
Normal file
577
runtime/queries/c_sharp/highlights.scm
Normal file
|
|
@ -0,0 +1,577 @@
|
|||
[
|
||||
(identifier)
|
||||
(preproc_arg)
|
||||
] @variable
|
||||
|
||||
((preproc_arg) @constant.macro
|
||||
(#lua-match? @constant.macro "^[_A-Z][_A-Z0-9]*$"))
|
||||
|
||||
((identifier) @keyword
|
||||
(#eq? @keyword "value")
|
||||
(#has-ancestor? @keyword accessor_declaration))
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(method_declaration
|
||||
returns: [
|
||||
(identifier) @type
|
||||
(generic_name
|
||||
(identifier) @type)
|
||||
])
|
||||
|
||||
(event_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(event_declaration
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(event_field_declaration
|
||||
(variable_declaration
|
||||
(variable_declarator
|
||||
name: (identifier) @variable.member)))
|
||||
|
||||
(declaration_pattern
|
||||
type: (identifier) @type)
|
||||
|
||||
(local_function_statement
|
||||
type: (identifier) @type)
|
||||
|
||||
(interpolation) @none
|
||||
|
||||
(member_access_expression
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
name: (identifier) @function.method.call))
|
||||
|
||||
(invocation_expression
|
||||
function: (conditional_access_expression
|
||||
(member_binding_expression
|
||||
name: (identifier) @function.method.call)))
|
||||
|
||||
(namespace_declaration
|
||||
name: [
|
||||
(qualified_name)
|
||||
(identifier)
|
||||
] @module)
|
||||
|
||||
(qualified_name
|
||||
(identifier) @type)
|
||||
|
||||
(namespace_declaration
|
||||
name: (identifier) @module)
|
||||
|
||||
(file_scoped_namespace_declaration
|
||||
name: (identifier) @module)
|
||||
|
||||
(qualified_name
|
||||
(identifier) @module
|
||||
(#not-has-ancestor? @module method_declaration)
|
||||
(#not-has-ancestor? @module record_declaration)
|
||||
(#has-ancestor? @module namespace_declaration file_scoped_namespace_declaration))
|
||||
|
||||
(invocation_expression
|
||||
(identifier) @function.method.call)
|
||||
|
||||
(field_declaration
|
||||
(variable_declaration
|
||||
(variable_declarator
|
||||
(identifier) @variable.member)))
|
||||
|
||||
(initializer_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.member))
|
||||
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(parameter_list
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(bracketed_parameter_list
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(implicit_parameter) @variable.parameter
|
||||
|
||||
(parameter_list
|
||||
(parameter
|
||||
type: (identifier) @type))
|
||||
|
||||
(integer_literal) @number
|
||||
|
||||
(real_literal) @number.float
|
||||
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
(calling_convention
|
||||
[
|
||||
(identifier)
|
||||
"Cdecl"
|
||||
"Stdcall"
|
||||
"Thiscall"
|
||||
"Fastcall"
|
||||
] @attribute.builtin)
|
||||
|
||||
(character_literal) @character
|
||||
|
||||
[
|
||||
(string_literal)
|
||||
(raw_string_literal)
|
||||
(verbatim_string_literal)
|
||||
(interpolated_string_expression)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
[
|
||||
"true"
|
||||
"false"
|
||||
] @boolean
|
||||
|
||||
(predefined_type) @type.builtin
|
||||
|
||||
(implicit_type) @keyword
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///[^/]"))
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///$"))
|
||||
|
||||
(using_directive
|
||||
(identifier) @type)
|
||||
|
||||
(using_directive
|
||||
(type) @type.definition)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @property)
|
||||
|
||||
(property_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(nullable_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(array_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(ref_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(pointer_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(catch_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(record_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(enum_member_declaration
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(operator_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(conversion_operator_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(explicit_interface_specifier
|
||||
[
|
||||
(identifier) @type
|
||||
(generic_name
|
||||
(identifier) @type)
|
||||
])
|
||||
|
||||
(explicit_interface_specifier
|
||||
(identifier) @type)
|
||||
|
||||
(primary_constructor_base_type
|
||||
type: (identifier) @type)
|
||||
|
||||
[
|
||||
"assembly"
|
||||
"module"
|
||||
"this"
|
||||
"base"
|
||||
] @variable.builtin
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
|
||||
(destructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
|
||||
(constructor_initializer
|
||||
"base" @constructor)
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(object_creation_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Generic Types.
|
||||
(typeof_expression
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(type_argument_list
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(base_list
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(type_parameter_constraint
|
||||
[
|
||||
(identifier) @type
|
||||
(type
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
])
|
||||
|
||||
(object_creation_expression
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(property_declaration
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(_
|
||||
type: (generic_name
|
||||
(identifier) @type))
|
||||
|
||||
; Generic Method invocation with generic type
|
||||
(invocation_expression
|
||||
function: (generic_name
|
||||
.
|
||||
(identifier) @function.method.call))
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
(generic_name
|
||||
(identifier) @function.method)))
|
||||
|
||||
(base_list
|
||||
(identifier) @type)
|
||||
|
||||
(type_argument_list
|
||||
(identifier) @type)
|
||||
|
||||
(type_parameter_list
|
||||
(type_parameter) @type)
|
||||
|
||||
(type_parameter
|
||||
name: (identifier) @type)
|
||||
|
||||
(type_parameter_constraints_clause
|
||||
"where"
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
(attribute
|
||||
name: (identifier) @attribute)
|
||||
|
||||
(foreach_statement
|
||||
type: (identifier) @type)
|
||||
|
||||
(goto_statement
|
||||
(identifier) @label)
|
||||
|
||||
(labeled_statement
|
||||
(identifier) @label)
|
||||
|
||||
(tuple_element
|
||||
type: (identifier) @type)
|
||||
|
||||
(tuple_expression
|
||||
(argument
|
||||
(declaration_expression
|
||||
type: (identifier) @type)))
|
||||
|
||||
(cast_expression
|
||||
type: (identifier) @type)
|
||||
|
||||
(lambda_expression
|
||||
type: (identifier) @type)
|
||||
|
||||
(as_expression
|
||||
right: (identifier) @type)
|
||||
|
||||
(typeof_expression
|
||||
(identifier) @type)
|
||||
|
||||
(preproc_error) @keyword.exception
|
||||
|
||||
[
|
||||
"#define"
|
||||
"#undef"
|
||||
] @keyword.directive.define
|
||||
|
||||
[
|
||||
"#if"
|
||||
"#elif"
|
||||
"#else"
|
||||
"#endif"
|
||||
"#region"
|
||||
"#endregion"
|
||||
"#line"
|
||||
"#pragma"
|
||||
"#nullable"
|
||||
"#error"
|
||||
(shebang_directive)
|
||||
] @keyword.directive
|
||||
|
||||
[
|
||||
(preproc_line)
|
||||
(preproc_pragma)
|
||||
(preproc_nullable)
|
||||
] @constant.macro
|
||||
|
||||
(preproc_pragma
|
||||
(identifier) @constant)
|
||||
|
||||
(preproc_if
|
||||
(identifier) @constant)
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"break"
|
||||
"case"
|
||||
"when"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"goto"
|
||||
"foreach"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
"throw"
|
||||
"finally"
|
||||
] @keyword.exception
|
||||
|
||||
[
|
||||
"+"
|
||||
"?"
|
||||
":"
|
||||
"++"
|
||||
"-"
|
||||
"--"
|
||||
"&"
|
||||
"&&"
|
||||
"|"
|
||||
"||"
|
||||
"!"
|
||||
"!="
|
||||
"=="
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"="
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"&="
|
||||
"|="
|
||||
"~"
|
||||
">>"
|
||||
">>>"
|
||||
"<<"
|
||||
"<<="
|
||||
">>="
|
||||
">>>="
|
||||
"=>"
|
||||
"??"
|
||||
"??="
|
||||
".."
|
||||
] @operator
|
||||
|
||||
(list_pattern
|
||||
".." @character.special)
|
||||
|
||||
(discard) @character.special
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(conditional_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
(interpolation_brace) @punctuation.special
|
||||
|
||||
(type_argument_list
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"using"
|
||||
"as"
|
||||
] @keyword.import
|
||||
|
||||
(alias_qualified_name
|
||||
(identifier
|
||||
"global") @keyword.import)
|
||||
|
||||
[
|
||||
"with"
|
||||
"new"
|
||||
"typeof"
|
||||
"sizeof"
|
||||
"is"
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
"stackalloc"
|
||||
"__makeref"
|
||||
"__reftype"
|
||||
"__refvalue"
|
||||
"in"
|
||||
"out"
|
||||
"ref"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"lock"
|
||||
"params"
|
||||
"operator"
|
||||
"default"
|
||||
"implicit"
|
||||
"explicit"
|
||||
"override"
|
||||
"get"
|
||||
"set"
|
||||
"init"
|
||||
"where"
|
||||
"add"
|
||||
"remove"
|
||||
"checked"
|
||||
"unchecked"
|
||||
"fixed"
|
||||
"alias"
|
||||
"file"
|
||||
"unsafe"
|
||||
] @keyword
|
||||
|
||||
(attribute_target_specifier
|
||||
.
|
||||
_ @keyword)
|
||||
|
||||
[
|
||||
"enum"
|
||||
"record"
|
||||
"class"
|
||||
"struct"
|
||||
"interface"
|
||||
"namespace"
|
||||
"event"
|
||||
"delegate"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"const"
|
||||
"extern"
|
||||
"readonly"
|
||||
"static"
|
||||
"volatile"
|
||||
"required"
|
||||
"managed"
|
||||
"unmanaged"
|
||||
"notnull"
|
||||
"abstract"
|
||||
"private"
|
||||
"protected"
|
||||
"internal"
|
||||
"public"
|
||||
"partial"
|
||||
"sealed"
|
||||
"virtual"
|
||||
"global"
|
||||
] @keyword.modifier
|
||||
|
||||
(scoped_type
|
||||
"scoped" @keyword.modifier)
|
||||
|
||||
(query_expression
|
||||
(_
|
||||
[
|
||||
"from"
|
||||
"orderby"
|
||||
"select"
|
||||
"group"
|
||||
"by"
|
||||
"ascending"
|
||||
"descending"
|
||||
"equals"
|
||||
"let"
|
||||
] @keyword))
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
2
runtime/queries/c_sharp/injections.scm
Normal file
2
runtime/queries/c_sharp/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
42
runtime/queries/c_sharp/locals.scm
Normal file
42
runtime/queries/c_sharp/locals.scm
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
; Definitions
|
||||
(variable_declarator
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(variable_declarator
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(declaration_expression
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(foreach_statement
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(foreach_statement
|
||||
left: (tuple_pattern
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(parameter
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(type_parameter
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
|
||||
; Scope
|
||||
(block) @local.scope
|
||||
1
runtime/queries/caddy/folds.scm
Normal file
1
runtime/queries/caddy/folds.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(block) @fold
|
||||
55
runtime/queries/caddy/highlights.scm
Normal file
55
runtime/queries/caddy/highlights.scm
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
(comment) @comment @spell
|
||||
|
||||
[
|
||||
(env)
|
||||
(argv)
|
||||
(block_variable)
|
||||
(placeholder)
|
||||
] @constant
|
||||
|
||||
(value) @variable
|
||||
|
||||
(directive
|
||||
(keyword) @attribute)
|
||||
|
||||
(global_options
|
||||
(option
|
||||
(keyword) @attribute))
|
||||
|
||||
(keyword) @keyword
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(placeholder
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.special)
|
||||
|
||||
(auto) @variable.builtin
|
||||
|
||||
[
|
||||
(string_literal)
|
||||
(quoted_string_literal)
|
||||
(address)
|
||||
] @string
|
||||
|
||||
[
|
||||
(matcher)
|
||||
(route)
|
||||
(snippet_name)
|
||||
] @string.special
|
||||
|
||||
[
|
||||
(numeric_literal)
|
||||
(time)
|
||||
(size)
|
||||
(ip_literal)
|
||||
] @number
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
"," @punctuation.delimiter
|
||||
8
runtime/queries/caddy/indents.scm
Normal file
8
runtime/queries/caddy/indents.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(block) @indent.begin
|
||||
|
||||
(block
|
||||
"}" @indent.branch)
|
||||
|
||||
(comment) @indent.auto
|
||||
|
||||
(ERROR) @indent.auto
|
||||
2
runtime/queries/caddy/injections.scm
Normal file
2
runtime/queries/caddy/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
26
runtime/queries/cairo/folds.scm
Normal file
26
runtime/queries/cairo/folds.scm
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[
|
||||
(mod_item)
|
||||
(struct_item)
|
||||
(trait_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
(type_item)
|
||||
(use_declaration)
|
||||
(let_declaration)
|
||||
(namespace_definition)
|
||||
(arguments)
|
||||
(implicit_arguments)
|
||||
(tuple_type)
|
||||
(import_statement)
|
||||
(attribute_statement)
|
||||
(with_statement)
|
||||
(if_statement)
|
||||
(function_definition)
|
||||
(struct_definition)
|
||||
(loop_expression)
|
||||
(if_expression)
|
||||
(match_expression)
|
||||
(call_expression)
|
||||
(tuple_expression)
|
||||
(attribute_item)
|
||||
] @fold
|
||||
414
runtime/queries/cairo/highlights.scm
Normal file
414
runtime/queries/cairo/highlights.scm
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
; Preproc
|
||||
[
|
||||
"%builtins"
|
||||
"%lang"
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
(import_statement
|
||||
[
|
||||
"from"
|
||||
"import"
|
||||
] @keyword.import
|
||||
module_name: (dotted_name
|
||||
(identifier) @module .))
|
||||
|
||||
[
|
||||
"as"
|
||||
"use"
|
||||
"mod"
|
||||
] @keyword.import
|
||||
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
; Namespaces
|
||||
(namespace_definition
|
||||
(identifier) @module)
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @module)
|
||||
|
||||
(use_list
|
||||
(self) @module)
|
||||
|
||||
(scoped_use_list
|
||||
(self) @module)
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier) @module)
|
||||
|
||||
(scoped_identifier
|
||||
(scoped_identifier
|
||||
name: (identifier) @module))
|
||||
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @module)
|
||||
|
||||
((scoped_identifier
|
||||
path: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
||||
|
||||
((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
|
||||
path: (identifier) @module)
|
||||
|
||||
(scoped_use_list
|
||||
path: (scoped_identifier
|
||||
(identifier) @module))
|
||||
|
||||
(use_list
|
||||
(scoped_identifier
|
||||
(identifier) @module
|
||||
.
|
||||
(_)))
|
||||
|
||||
(use_list
|
||||
(identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
; 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
|
||||
|
||||
[
|
||||
"struct"
|
||||
"enum"
|
||||
"namespace"
|
||||
"type"
|
||||
"trait"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"func"
|
||||
"fn"
|
||||
"end"
|
||||
] @keyword.function
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"cast"
|
||||
"new"
|
||||
"and"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"tempvar"
|
||||
"extern"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"match"
|
||||
] @keyword.conditional
|
||||
|
||||
"loop" @keyword.repeat
|
||||
|
||||
[
|
||||
"assert"
|
||||
"static_assert"
|
||||
"nopanic"
|
||||
] @keyword.exception
|
||||
|
||||
; Fields
|
||||
(implicit_arguments
|
||||
(typed_identifier
|
||||
(identifier) @variable.member))
|
||||
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @variable.member)
|
||||
|
||||
(call_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.member))
|
||||
|
||||
(tuple_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.member))
|
||||
|
||||
(field_identifier) @variable.member
|
||||
|
||||
(shorthand_field_initializer
|
||||
(identifier) @variable.member)
|
||||
|
||||
; Parameters
|
||||
(arguments
|
||||
(typed_identifier
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(call_expression
|
||||
(tuple_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.parameter)))
|
||||
|
||||
(return_type
|
||||
(tuple_type
|
||||
(named_type
|
||||
.
|
||||
(identifier) @variable.parameter)))
|
||||
|
||||
(parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Builtins
|
||||
(builtin_directive
|
||||
(identifier) @variable.builtin)
|
||||
|
||||
(lang_directive
|
||||
(identifier) @variable.builtin)
|
||||
|
||||
[
|
||||
"ap"
|
||||
"fp"
|
||||
(self)
|
||||
] @variable.builtin
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
"func"
|
||||
(identifier) @function)
|
||||
|
||||
(function_definition
|
||||
"fn"
|
||||
(identifier) @function)
|
||||
|
||||
(function_signature
|
||||
"fn"
|
||||
(identifier) @function)
|
||||
|
||||
(extern_function_statement
|
||||
(identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
"jmp" @function.builtin
|
||||
|
||||
; Types
|
||||
(struct_definition
|
||||
.
|
||||
(identifier) @type
|
||||
(typed_identifier
|
||||
(identifier) @variable.member)?)
|
||||
|
||||
(named_type
|
||||
(identifier) @type .)
|
||||
|
||||
[
|
||||
(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)
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern
|
||||
(identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
||||
|
||||
; Constructors
|
||||
(unary_expression
|
||||
"new"
|
||||
(call_expression
|
||||
.
|
||||
(identifier) @constructor))
|
||||
|
||||
((call_expression
|
||||
.
|
||||
(identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Attributes
|
||||
(decorator
|
||||
"@" @attribute
|
||||
(identifier) @attribute)
|
||||
|
||||
(attribute_item
|
||||
(identifier) @function.macro)
|
||||
|
||||
(attribute_item
|
||||
(scoped_identifier
|
||||
(identifier) @function.macro .))
|
||||
|
||||
; Labels
|
||||
(label
|
||||
.
|
||||
(identifier) @label)
|
||||
|
||||
(inst_jmp_to_label
|
||||
"jmp"
|
||||
.
|
||||
(identifier) @label)
|
||||
|
||||
(inst_jnz_to_label
|
||||
"jmp"
|
||||
.
|
||||
(identifier) @label)
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"**"
|
||||
"=="
|
||||
"!="
|
||||
"&"
|
||||
"="
|
||||
"++"
|
||||
"+="
|
||||
"@"
|
||||
"!"
|
||||
"~"
|
||||
".."
|
||||
"&&"
|
||||
"||"
|
||||
"^"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"<<"
|
||||
">>"
|
||||
"%"
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"&="
|
||||
"|="
|
||||
"^="
|
||||
"<<="
|
||||
">>="
|
||||
"?"
|
||||
] @operator
|
||||
|
||||
; Literals
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
[
|
||||
(string)
|
||||
(short_string)
|
||||
] @string
|
||||
|
||||
; Punctuation
|
||||
(attribute_item
|
||||
"#" @punctuation.special)
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
":"
|
||||
";"
|
||||
"->"
|
||||
"=>"
|
||||
"::"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"%{"
|
||||
"%}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(type_parameters
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
(type_arguments
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
; Comment
|
||||
(comment) @comment @spell
|
||||
57
runtime/queries/cairo/indents.scm
Normal file
57
runtime/queries/cairo/indents.scm
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
[
|
||||
(mod_item)
|
||||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
(struct_expression)
|
||||
(match_expression)
|
||||
(tuple_expression)
|
||||
(match_arm)
|
||||
(match_block)
|
||||
(call_expression)
|
||||
(assignment_expression)
|
||||
(arguments)
|
||||
(block)
|
||||
(use_list)
|
||||
(field_declaration_list)
|
||||
(enum_variant_list)
|
||||
(tuple_pattern)
|
||||
] @indent.begin
|
||||
|
||||
(import_statement
|
||||
"(") @indent.begin
|
||||
|
||||
(block
|
||||
"}" @indent.end)
|
||||
|
||||
(enum_item
|
||||
body: (enum_variant_list
|
||||
"}" @indent.end))
|
||||
|
||||
(match_expression
|
||||
body: (match_block
|
||||
"}" @indent.end))
|
||||
|
||||
(mod_item
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(struct_item
|
||||
body: (field_declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(trait_item
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
[
|
||||
")"
|
||||
"]"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(comment)
|
||||
(string)
|
||||
(short_string)
|
||||
] @indent.ignore
|
||||
5
runtime/queries/cairo/injections.scm
Normal file
5
runtime/queries/cairo/injections.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
((python_code) @injection.content
|
||||
(#set! injection.language "python"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
66
runtime/queries/cairo/locals.scm
Normal file
66
runtime/queries/cairo/locals.scm
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
; References
|
||||
(identifier) @local.reference
|
||||
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
; Scopes
|
||||
[
|
||||
(program)
|
||||
(block)
|
||||
(function_definition)
|
||||
(loop_expression)
|
||||
(if_expression)
|
||||
(match_expression)
|
||||
(match_arm)
|
||||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
] @local.scope
|
||||
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @local.definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
||||
(use_list
|
||||
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @local.definition.method
|
||||
(parameter
|
||||
(self)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameter
|
||||
[
|
||||
(identifier)
|
||||
(self)
|
||||
] @local.definition.parameter)
|
||||
|
||||
; Types
|
||||
(struct_item
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
; Module
|
||||
(mod_item
|
||||
name: (identifier) @local.definition.namespace)
|
||||
|
||||
; Variables
|
||||
(assignment_expression
|
||||
left: (identifier) @local.definition.var)
|
||||
14
runtime/queries/capnp/folds.scm
Normal file
14
runtime/queries/capnp/folds.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
(annotation_targets)
|
||||
(const_list)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @fold
|
||||
141
runtime/queries/capnp/highlights.scm
Normal file
141
runtime/queries/capnp/highlights.scm
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
; Preproc
|
||||
[
|
||||
(unique_id)
|
||||
(top_level_annotation_body)
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
[
|
||||
"import"
|
||||
"$import"
|
||||
"embed"
|
||||
"using"
|
||||
] @keyword.import
|
||||
|
||||
(import_path) @string.special.path
|
||||
|
||||
; Keywords
|
||||
"extends" @keyword
|
||||
|
||||
[
|
||||
"struct"
|
||||
"interface"
|
||||
"union"
|
||||
"enum"
|
||||
"annotation"
|
||||
"group"
|
||||
"namespace"
|
||||
] @keyword.type
|
||||
|
||||
; Builtins
|
||||
"const" @keyword.modifier
|
||||
|
||||
[
|
||||
(primitive_type)
|
||||
"List"
|
||||
] @type.builtin
|
||||
|
||||
; Typedefs
|
||||
(type_definition) @type.definition
|
||||
|
||||
; Labels (@number, @number!)
|
||||
(field_version) @label
|
||||
|
||||
; Methods
|
||||
[
|
||||
(annotation_definition_identifier)
|
||||
(method_identifier)
|
||||
] @function.method
|
||||
|
||||
; Fields
|
||||
(field_identifier) @variable.member
|
||||
|
||||
; Properties
|
||||
(property) @property
|
||||
|
||||
; Parameters
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @variable.parameter
|
||||
|
||||
(annotation_target) @variable.parameter.builtin
|
||||
|
||||
; Constants
|
||||
[
|
||||
(const_identifier)
|
||||
(local_const)
|
||||
(enum_member)
|
||||
] @constant
|
||||
|
||||
(void) @constant.builtin
|
||||
|
||||
; Types
|
||||
[
|
||||
(enum_identifier)
|
||||
(extend_type)
|
||||
(type_identifier)
|
||||
] @type
|
||||
|
||||
; Attributes
|
||||
[
|
||||
(annotation_identifier)
|
||||
(attribute)
|
||||
] @attribute
|
||||
|
||||
; Operators
|
||||
"=" @operator
|
||||
|
||||
; Literals
|
||||
[
|
||||
(string)
|
||||
(concatenated_string)
|
||||
(block_text)
|
||||
(namespace)
|
||||
] @string
|
||||
|
||||
(namespace) @string.special
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(data_string) @string.special
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(data_hex) @string.special.symbol
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"*"
|
||||
"$"
|
||||
":"
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
";"
|
||||
"->"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
40
runtime/queries/capnp/indents.scm
Normal file
40
runtime/queries/capnp/indents.scm
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
[
|
||||
(annotation_targets)
|
||||
(const)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(union)
|
||||
(field)
|
||||
] @indent.begin
|
||||
|
||||
((struct_shorthand
|
||||
(property)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((method
|
||||
(field_version)) @indent.align
|
||||
(#set! indent.open_delimiter field_version))
|
||||
|
||||
((const_list
|
||||
(const_value)) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
|
||||
(concatenated_string) @indent.align
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent.end @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
2
runtime/queries/capnp/injections.scm
Normal file
2
runtime/queries/capnp/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
97
runtime/queries/capnp/locals.scm
Normal file
97
runtime/queries/capnp/locals.scm
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
[
|
||||
(message)
|
||||
(annotation_targets)
|
||||
(const_list)
|
||||
(enum)
|
||||
(interface)
|
||||
(implicit_generics)
|
||||
(generics)
|
||||
(group)
|
||||
(method_parameters)
|
||||
(named_return_types)
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @local.scope
|
||||
|
||||
[
|
||||
(extend_type)
|
||||
(field_type)
|
||||
] @local.reference
|
||||
|
||||
(custom_type
|
||||
(type_identifier) @local.reference)
|
||||
|
||||
(custom_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.reference)))
|
||||
|
||||
(annotation_definition_identifier) @local.definition
|
||||
|
||||
(const_identifier) @local.definition.constant
|
||||
|
||||
(enum
|
||||
(enum_identifier) @local.definition.enum)
|
||||
|
||||
[
|
||||
(enum_member)
|
||||
(field_identifier)
|
||||
] @local.definition.field
|
||||
|
||||
(method_identifier) @local.definition.method
|
||||
|
||||
(namespace) @local.definition.namespace
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @local.definition.parameter
|
||||
|
||||
(group
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(struct
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(union
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(interface
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
; Generics Related (don't know how to combine these)
|
||||
(struct
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(interface
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(method
|
||||
(implicit_generics
|
||||
(implicit_generic_parameters
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(method
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(annotation
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
(replace_using
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
(return_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.definition.type)))
|
||||
5
runtime/queries/chatito/folds.scm
Normal file
5
runtime/queries/chatito/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @fold
|
||||
54
runtime/queries/chatito/highlights.scm
Normal file
54
runtime/queries/chatito/highlights.scm
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
; Punctuation
|
||||
[
|
||||
"%["
|
||||
"@["
|
||||
"~["
|
||||
"*["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
"," @punctuation.delimiter
|
||||
|
||||
(eq) @operator
|
||||
|
||||
([
|
||||
"\""
|
||||
"'"
|
||||
] @punctuation.special
|
||||
(#set! conceal ""))
|
||||
|
||||
[
|
||||
"%"
|
||||
"?"
|
||||
"#"
|
||||
] @character.special
|
||||
|
||||
; Entities
|
||||
(intent) @module
|
||||
|
||||
(slot) @type
|
||||
|
||||
(variation) @attribute
|
||||
|
||||
(alias) @keyword.directive
|
||||
|
||||
(number) @number
|
||||
|
||||
(argument
|
||||
key: (string) @property
|
||||
value: (string) @string)
|
||||
|
||||
(escape) @string.escape
|
||||
|
||||
; Import
|
||||
"import" @keyword.import
|
||||
|
||||
(file) @string.special.path
|
||||
|
||||
; Text
|
||||
(word) @spell
|
||||
|
||||
; Comment
|
||||
(comment) @comment @spell
|
||||
8
runtime/queries/chatito/indents.scm
Normal file
8
runtime/queries/chatito/indents.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @indent.begin
|
||||
|
||||
(ERROR
|
||||
"]") @indent.begin
|
||||
2
runtime/queries/chatito/injections.scm
Normal file
2
runtime/queries/chatito/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue