mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
;; Support for folding in Ada
|
; Support for folding in Ada
|
||||||
;; za toggles folding a package, subprogram, if statement or loop
|
; za toggles folding a package, subprogram, if statement or loop
|
||||||
|
|
||||||
[
|
[
|
||||||
(package_declaration)
|
(package_declaration)
|
||||||
(generic_package_declaration)
|
(generic_package_declaration)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
;; highlight queries.
|
; highlight queries.
|
||||||
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-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
|
; 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
|
; for a list of recommended @ tags, though not all of them have matching
|
||||||
;; highlights in neovim.
|
; highlights in neovim.
|
||||||
|
|
||||||
[
|
[
|
||||||
"abort"
|
"abort"
|
||||||
"abs"
|
"abs"
|
||||||
|
|
@ -40,11 +39,13 @@
|
||||||
"until"
|
"until"
|
||||||
"when"
|
"when"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
[
|
[
|
||||||
"aliased"
|
"aliased"
|
||||||
"constant"
|
"constant"
|
||||||
"renames"
|
"renames"
|
||||||
] @keyword.storage
|
] @keyword.storage
|
||||||
|
|
||||||
[
|
[
|
||||||
"mod"
|
"mod"
|
||||||
"new"
|
"new"
|
||||||
|
|
@ -53,10 +54,12 @@
|
||||||
"subtype"
|
"subtype"
|
||||||
"type"
|
"type"
|
||||||
] @keyword.type
|
] @keyword.type
|
||||||
|
|
||||||
[
|
[
|
||||||
"with"
|
"with"
|
||||||
"use"
|
"use"
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
[
|
[
|
||||||
"body"
|
"body"
|
||||||
"function"
|
"function"
|
||||||
|
|
@ -65,6 +68,7 @@
|
||||||
"package"
|
"package"
|
||||||
"separate"
|
"separate"
|
||||||
] @keyword.function
|
] @keyword.function
|
||||||
|
|
||||||
[
|
[
|
||||||
"and"
|
"and"
|
||||||
"in"
|
"in"
|
||||||
|
|
@ -72,6 +76,7 @@
|
||||||
"or"
|
"or"
|
||||||
"xor"
|
"xor"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
[
|
[
|
||||||
"while"
|
"while"
|
||||||
"loop"
|
"loop"
|
||||||
|
|
@ -80,9 +85,9 @@
|
||||||
"reverse"
|
"reverse"
|
||||||
"some"
|
"some"
|
||||||
] @keyword.repeat
|
] @keyword.repeat
|
||||||
[
|
|
||||||
"return"
|
"return" @keyword.return
|
||||||
] @keyword.return
|
|
||||||
[
|
[
|
||||||
"case"
|
"case"
|
||||||
"if"
|
"if"
|
||||||
|
|
@ -91,100 +96,193 @@
|
||||||
"elsif"
|
"elsif"
|
||||||
"select"
|
"select"
|
||||||
] @keyword.conditional
|
] @keyword.conditional
|
||||||
|
|
||||||
[
|
[
|
||||||
"exception"
|
"exception"
|
||||||
"raise"
|
"raise"
|
||||||
] @keyword.exception
|
] @keyword.exception
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
|
|
||||||
(character_literal) @string
|
(character_literal) @string
|
||||||
|
|
||||||
(numeric_literal) @number
|
(numeric_literal) @number
|
||||||
|
|
||||||
;; Highlight the name of subprograms
|
; Highlight the name of subprograms
|
||||||
(procedure_specification name: (_) @function)
|
(procedure_specification
|
||||||
(function_specification name: (_) @function)
|
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
|
(function_specification
|
||||||
(use_clause "use" @keyword.import "type" @keyword.import)
|
name: (_) @function)
|
||||||
(with_clause "private" @keyword.import)
|
|
||||||
(with_clause "limited" @keyword.import)
|
|
||||||
(use_clause (_) @module)
|
|
||||||
(with_clause (_) @module)
|
|
||||||
|
|
||||||
(loop_statement "end" @keyword.repeat)
|
(package_declaration
|
||||||
(if_statement "end" @keyword.conditional)
|
name: (_) @function)
|
||||||
(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)
|
(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_declarative_if_statement) @keyword.directive
|
||||||
|
|
||||||
(gnatprep_if_statement) @keyword.directive
|
(gnatprep_if_statement) @keyword.directive
|
||||||
|
|
||||||
(gnatprep_identifier) @keyword.directive
|
(gnatprep_identifier) @keyword.directive
|
||||||
|
|
||||||
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
|
(subprogram_declaration
|
||||||
(aspect_specification "with" @keyword.function)
|
"is" @keyword.function
|
||||||
|
"abstract" @keyword.function)
|
||||||
|
|
||||||
(full_type_declaration "is" @keyword.type)
|
(aspect_specification
|
||||||
(subtype_declaration "is" @keyword.type)
|
"with" @keyword.function)
|
||||||
(record_definition "end" @keyword.type)
|
|
||||||
(full_type_declaration (_ "access" @keyword.type))
|
(full_type_declaration
|
||||||
(array_type_definition "array" @keyword.type "of" @keyword.type)
|
"is" @keyword.type)
|
||||||
(access_to_object_definition "access" @keyword.type)
|
|
||||||
(access_to_object_definition "access" @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
|
||||||
(general_access_modifier "all" @keyword.type)
|
"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
|
(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
|
(expression_function_declaration
|
||||||
(function_specification)
|
(function_specification)
|
||||||
"is"
|
"is"
|
||||||
(_) @attribute
|
(_) @attribute)
|
||||||
)
|
|
||||||
(subprogram_declaration (aspect_specification) @attribute)
|
|
||||||
|
|
||||||
;; Highlight full subprogram specifications
|
(subprogram_declaration
|
||||||
|
(aspect_specification) @attribute)
|
||||||
|
|
||||||
|
; Highlight full subprogram specifications
|
||||||
;(subprogram_body
|
;(subprogram_body
|
||||||
; [
|
; [
|
||||||
; (procedure_specification)
|
; (procedure_specification)
|
||||||
; (function_specification)
|
; (function_specification)
|
||||||
; ] @function.spec
|
; ] @function.spec
|
||||||
;)
|
;)
|
||||||
|
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
. [
|
.
|
||||||
|
[
|
||||||
(entry_declaration)
|
(entry_declaration)
|
||||||
(subprogram_declaration)
|
(subprogram_declaration)
|
||||||
(parameter_specification)
|
(parameter_specification)
|
||||||
])
|
])
|
||||||
|
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
. (comment) @comment.documentation)
|
.
|
||||||
|
(comment) @comment.documentation)
|
||||||
|
|
||||||
(component_list
|
(component_list
|
||||||
(component_declaration)
|
(component_declaration)
|
||||||
. (comment) @comment.documentation)
|
.
|
||||||
|
(comment) @comment.documentation)
|
||||||
|
|
||||||
(enumeration_type_definition
|
(enumeration_type_definition
|
||||||
(identifier)
|
(identifier)
|
||||||
. (comment) @comment.documentation)
|
.
|
||||||
|
(comment) @comment.documentation)
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,91 @@
|
||||||
;; Better highlighting by referencing to the definition, for variable
|
; Better highlighting by referencing to the definition, for variable
|
||||||
;; references. However, this is not yet supported by neovim
|
; references. However, this is not yet supported by neovim
|
||||||
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||||
|
|
||||||
(compilation) @local.scope
|
(compilation) @local.scope
|
||||||
|
|
||||||
(package_declaration) @local.scope
|
(package_declaration) @local.scope
|
||||||
|
|
||||||
(package_body) @local.scope
|
(package_body) @local.scope
|
||||||
|
|
||||||
(subprogram_declaration) @local.scope
|
(subprogram_declaration) @local.scope
|
||||||
|
|
||||||
(subprogram_body) @local.scope
|
(subprogram_body) @local.scope
|
||||||
|
|
||||||
(block_statement) @local.scope
|
(block_statement) @local.scope
|
||||||
|
|
||||||
(with_clause (identifier) @local.definition.import)
|
(with_clause
|
||||||
(procedure_specification name: (_) @local.definition.function)
|
(identifier) @local.definition.import)
|
||||||
(function_specification name: (_) @local.definition.function)
|
|
||||||
(package_declaration name: (_) @local.definition.var)
|
(procedure_specification
|
||||||
(package_body name: (_) @local.definition.var)
|
name: (_) @local.definition.function)
|
||||||
(generic_instantiation . name: (_) @local.definition.var)
|
|
||||||
(component_declaration . (identifier) @local.definition.var)
|
(function_specification
|
||||||
(exception_declaration . (identifier) @local.definition.var)
|
name: (_) @local.definition.function)
|
||||||
(formal_object_declaration . (identifier) @local.definition.var)
|
|
||||||
(object_declaration . (identifier) @local.definition.var)
|
(package_declaration
|
||||||
(parameter_specification . (identifier) @local.definition.var)
|
name: (_) @local.definition.var)
|
||||||
(full_type_declaration . (identifier) @local.definition.type)
|
|
||||||
(private_type_declaration . (identifier) @local.definition.type)
|
(package_body
|
||||||
(private_extension_declaration . (identifier) @local.definition.type)
|
name: (_) @local.definition.var)
|
||||||
(incomplete_type_declaration . (identifier) @local.definition.type)
|
|
||||||
(protected_type_declaration . (identifier) @local.definition.type)
|
(generic_instantiation
|
||||||
(formal_complete_type_declaration . (identifier) @local.definition.type)
|
.
|
||||||
(formal_incomplete_type_declaration . (identifier) @local.definition.type)
|
name: (_) @local.definition.var)
|
||||||
(task_type_declaration . (identifier) @local.definition.type)
|
|
||||||
(subtype_declaration . (identifier) @local.definition.type)
|
(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
|
(identifier) @local.reference
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,52 @@
|
||||||
|
; Constants
|
||||||
;; Constants
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
|
|
||||||
;; Variables and Symbols
|
; Variables and Symbols
|
||||||
|
(typed_binding
|
||||||
|
(atom
|
||||||
|
(qid) @variable))
|
||||||
|
|
||||||
(typed_binding (atom (qid) @variable))
|
|
||||||
(untyped_binding) @variable
|
(untyped_binding) @variable
|
||||||
(typed_binding (expr) @type)
|
|
||||||
|
(typed_binding
|
||||||
|
(expr) @type)
|
||||||
|
|
||||||
(id) @function
|
(id) @function
|
||||||
|
|
||||||
(bid) @function
|
(bid) @function
|
||||||
|
|
||||||
(function_name (atom (qid) @function))
|
(function_name
|
||||||
|
(atom
|
||||||
|
(qid) @function))
|
||||||
|
|
||||||
(field_name) @function
|
(field_name) @function
|
||||||
|
|
||||||
|
[
|
||||||
[(data_name) (record_name)] @constructor
|
(data_name)
|
||||||
|
(record_name)
|
||||||
|
] @constructor
|
||||||
|
|
||||||
; Set
|
; Set
|
||||||
(SetN) @type.builtin
|
(SetN) @type.builtin
|
||||||
|
|
||||||
(expr . (atom) @function)
|
(expr
|
||||||
|
.
|
||||||
|
(atom) @function)
|
||||||
|
|
||||||
((atom) @boolean
|
((atom) @boolean
|
||||||
(#any-of? @boolean "true" "false" "True" "False"))
|
(#any-of? @boolean "true" "false" "True" "False"))
|
||||||
|
|
||||||
;; Imports and Module Declarations
|
; Imports and Module Declarations
|
||||||
|
|
||||||
"import" @keyword.import
|
"import" @keyword.import
|
||||||
|
|
||||||
(module_name) @module
|
(module_name) @module
|
||||||
|
|
||||||
;; Pragmas and comments
|
; Pragmas and comments
|
||||||
|
|
||||||
(pragma) @keyword.directive
|
(pragma) @keyword.directive
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
;; Keywords
|
; Keywords
|
||||||
[
|
[
|
||||||
"where"
|
"where"
|
||||||
"data"
|
"data"
|
||||||
|
|
@ -62,20 +71,16 @@
|
||||||
"infixl"
|
"infixl"
|
||||||
"infixr"
|
"infixr"
|
||||||
"record"
|
"record"
|
||||||
]
|
] @keyword
|
||||||
@keyword
|
|
||||||
|
|
||||||
;;;(expr
|
|
||||||
;;; f_name: (atom) @function)
|
|
||||||
;; Brackets
|
|
||||||
|
|
||||||
|
;(expr
|
||||||
|
; f_name: (atom) @function)
|
||||||
|
; Brackets
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
"{"
|
"{"
|
||||||
"}"]
|
"}"
|
||||||
@punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
"=" @operator
|
||||||
"="
|
|
||||||
] @operator
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,18 @@
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
(pipe_sequence "|" @operator)
|
|
||||||
|
(pipe_sequence
|
||||||
|
"|" @operator)
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
(pipe_call
|
(pipe_call
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(pipe_call
|
(pipe_call
|
||||||
arguments: (pipe_arguments
|
arguments:
|
||||||
|
(pipe_arguments
|
||||||
(identifier) @variable.parameter))
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
(structural_assignment
|
(structural_assignment
|
||||||
|
|
@ -18,7 +25,8 @@
|
||||||
function: (identifier) @function)
|
function: (identifier) @function)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @function.builtin
|
function:
|
||||||
|
((identifier) @function.builtin
|
||||||
(#eq? @function.builtin "$any")))
|
(#eq? @function.builtin "$any")))
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -44,6 +52,7 @@
|
||||||
|
|
||||||
((identifier) @boolean
|
((identifier) @boolean
|
||||||
(#any-of? @boolean "true" "false"))
|
(#any-of? @boolean "true" "false"))
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#any-of? @variable.builtin "this" "\$event" "null"))
|
(#any-of? @variable.builtin "this" "\$event" "null"))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
; inherits: soql
|
; inherits: soql
|
||||||
|
; Apex + SOQL
|
||||||
;;; Apex + SOQL
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
|
|
@ -19,14 +17,12 @@
|
||||||
";"
|
";"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
;; Default general color defination
|
; Default general color defination
|
||||||
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
|
|
||||||
;; Methods
|
; Methods
|
||||||
|
|
||||||
(method_declaration
|
(method_declaration
|
||||||
name: (identifier) @function.method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
|
|
@ -35,13 +31,11 @@
|
||||||
|
|
||||||
(super) @function.builtin
|
(super) @function.builtin
|
||||||
|
|
||||||
;; Annotations
|
; Annotations
|
||||||
|
|
||||||
(annotation
|
(annotation
|
||||||
name: (identifier) @attribute)
|
name: (identifier) @attribute)
|
||||||
|
|
||||||
;; Types
|
; Types
|
||||||
|
|
||||||
(interface_declaration
|
(interface_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
|
|
@ -57,8 +51,11 @@
|
||||||
(enum_constant
|
(enum_constant
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
|
|
||||||
(type_arguments "<" @punctuation.delimiter)
|
(type_arguments
|
||||||
(type_arguments ">" @punctuation.delimiter)
|
"<" @punctuation.delimiter)
|
||||||
|
|
||||||
|
(type_arguments
|
||||||
|
">" @punctuation.delimiter)
|
||||||
|
|
||||||
((field_access
|
((field_access
|
||||||
object: (identifier) @type))
|
object: (identifier) @type))
|
||||||
|
|
@ -86,13 +83,18 @@
|
||||||
|
|
||||||
(assignment_operator) @operator
|
(assignment_operator) @operator
|
||||||
|
|
||||||
(update_expression ["++" "--"] @operator)
|
(update_expression
|
||||||
|
[
|
||||||
|
"++"
|
||||||
|
"--"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
(trigger_declaration
|
(trigger_declaration
|
||||||
name: (identifier) @type
|
name: (identifier) @type
|
||||||
object: (identifier) @type
|
object: (identifier) @type
|
||||||
(trigger_event) @keyword
|
(trigger_event) @keyword
|
||||||
("," (trigger_event) @keyword)*)
|
(","
|
||||||
|
(trigger_event) @keyword)*)
|
||||||
|
|
||||||
[
|
[
|
||||||
"@"
|
"@"
|
||||||
|
|
@ -103,7 +105,8 @@
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
(binary_expression
|
(binary_expression
|
||||||
operator: [
|
operator:
|
||||||
|
[
|
||||||
">"
|
">"
|
||||||
"<"
|
"<"
|
||||||
"=="
|
"=="
|
||||||
|
|
@ -121,17 +124,20 @@
|
||||||
"%"
|
"%"
|
||||||
"<<"
|
"<<"
|
||||||
">>"
|
">>"
|
||||||
">>>"] @operator)
|
">>>"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
(unary_expression
|
(unary_expression
|
||||||
operator: [
|
operator:
|
||||||
|
[
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
"!"
|
"!"
|
||||||
"~"
|
"~"
|
||||||
]) @operator
|
]) @operator
|
||||||
|
|
||||||
(map_initializer "=>" @operator)
|
(map_initializer
|
||||||
|
"=>" @operator)
|
||||||
|
|
||||||
[
|
[
|
||||||
(boolean_type)
|
(boolean_type)
|
||||||
|
|
@ -139,18 +145,27 @@
|
||||||
] @type.builtin
|
] @type.builtin
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
|
|
||||||
(field_declaration
|
(field_declaration
|
||||||
declarator: (variable_declarator
|
declarator:
|
||||||
|
(variable_declarator
|
||||||
name: (identifier) @variable.member))
|
name: (identifier) @variable.member))
|
||||||
|
|
||||||
(field_access
|
(field_access
|
||||||
field: (identifier) @variable.member)
|
field: (identifier) @variable.member)
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
(field_declaration
|
(field_declaration
|
||||||
(modifiers (modifier ["final" "static"])(modifier ["final" "static"]))
|
(modifiers
|
||||||
|
(modifier
|
||||||
|
[
|
||||||
|
"final"
|
||||||
|
"static"
|
||||||
|
])
|
||||||
|
(modifier
|
||||||
|
[
|
||||||
|
"final"
|
||||||
|
"static"
|
||||||
|
]))
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @constant))
|
name: (identifier) @constant))
|
||||||
|
|
||||||
|
|
@ -163,7 +178,6 @@
|
||||||
(this) @variable.builtin
|
(this) @variable.builtin
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
[
|
[
|
||||||
(int)
|
(int)
|
||||||
(decimal)
|
(decimal)
|
||||||
|
|
@ -179,8 +193,7 @@
|
||||||
|
|
||||||
(null_literal) @constant.builtin
|
(null_literal) @constant.builtin
|
||||||
|
|
||||||
;; ;; Keywords
|
; ;; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"abstract"
|
"abstract"
|
||||||
"final"
|
"final"
|
||||||
|
|
@ -203,9 +216,7 @@
|
||||||
"break"
|
"break"
|
||||||
] @keyword.repeat
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
"return" @keyword.return
|
||||||
"return"
|
|
||||||
] @keyword.return
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"throw"
|
"throw"
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,46 @@
|
||||||
; declarations
|
; declarations
|
||||||
|
|
||||||
(class_declaration) @local.scope
|
(class_declaration) @local.scope
|
||||||
|
|
||||||
(method_declaration) @local.scope
|
(method_declaration) @local.scope
|
||||||
|
|
||||||
(constructor_declaration) @local.scope
|
(constructor_declaration) @local.scope
|
||||||
|
|
||||||
(enum_declaration) @local.scope
|
(enum_declaration) @local.scope
|
||||||
|
|
||||||
(enhanced_for_statement) @local.scope
|
(enhanced_for_statement) @local.scope
|
||||||
|
|
||||||
; if/else
|
; if/else
|
||||||
|
|
||||||
(if_statement) @local.scope
|
(if_statement) @local.scope
|
||||||
|
|
||||||
(if_statement
|
(if_statement
|
||||||
consequence: (_) @local.scope) ; if body in case there are no braces
|
consequence: (_) @local.scope) ; if body in case there are no braces
|
||||||
|
|
||||||
(if_statement
|
(if_statement
|
||||||
alternative: (_) @local.scope) ; else body in case there are no braces
|
alternative: (_) @local.scope) ; else body in case there are no braces
|
||||||
|
|
||||||
; try/catch
|
; try/catch
|
||||||
|
|
||||||
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
|
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
|
||||||
|
|
||||||
(catch_clause) @local.scope ; needed because `Exception` variable
|
(catch_clause) @local.scope ; needed because `Exception` variable
|
||||||
|
|
||||||
; loops
|
; loops
|
||||||
|
|
||||||
(for_statement) @local.scope
|
(for_statement) @local.scope
|
||||||
|
|
||||||
(for_statement ; "for" body in case there are no braces
|
(for_statement ; "for" body in case there are no braces
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
||||||
(do_statement
|
(do_statement
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
||||||
(while_statement
|
(while_statement
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(constructor_declaration) @local.scope
|
(constructor_declaration) @local.scope
|
||||||
|
|
||||||
(method_declaration) @local.scope
|
(method_declaration) @local.scope
|
||||||
|
|
||||||
;; definitions
|
; definitions
|
||||||
|
|
||||||
(enum_declaration
|
(enum_declaration
|
||||||
name: (identifier) @local.definition.enum)
|
name: (identifier) @local.definition.enum)
|
||||||
|
|
||||||
|
|
@ -43,7 +48,8 @@
|
||||||
name: (identifier) @local.definition.method)
|
name: (identifier) @local.definition.method)
|
||||||
|
|
||||||
(local_variable_declaration
|
(local_variable_declaration
|
||||||
declarator: (variable_declarator
|
declarator:
|
||||||
|
(variable_declarator
|
||||||
name: (identifier) @local.definition.var))
|
name: (identifier) @local.definition.var))
|
||||||
|
|
||||||
(enhanced_for_statement
|
(enhanced_for_statement
|
||||||
|
|
@ -56,11 +62,11 @@
|
||||||
name: (identifier) @local.definition.parameter)
|
name: (identifier) @local.definition.parameter)
|
||||||
|
|
||||||
(field_declaration
|
(field_declaration
|
||||||
declarator: (variable_declarator
|
declarator:
|
||||||
|
(variable_declarator
|
||||||
name: (identifier) @local.definition.field))
|
name: (identifier) @local.definition.field))
|
||||||
|
|
||||||
;; REFERENCES
|
; REFERENCES
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
(type_identifier) @local.reference
|
(type_identifier) @local.reference
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; inherits: cpp
|
; inherits: cpp
|
||||||
|
|
||||||
((identifier) @function.builtin
|
((identifier) @function.builtin
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @function.builtin
|
(#any-of? @function.builtin
|
||||||
|
|
@ -72,25 +71,10 @@
|
||||||
"noInterrupts"))
|
"noInterrupts"))
|
||||||
|
|
||||||
((identifier) @type.builtin
|
((identifier) @type.builtin
|
||||||
(#any-of? @type.builtin
|
(#any-of? @type.builtin "Serial" "SPI" "Stream" "Wire" "Keyboard" "Mouse" "String"))
|
||||||
"Serial"
|
|
||||||
"SPI"
|
|
||||||
"Stream"
|
|
||||||
"Wire"
|
|
||||||
"Keyboard"
|
|
||||||
"Mouse"
|
|
||||||
"String"
|
|
||||||
))
|
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin "HIGH" "LOW" "INPUT" "OUTPUT" "INPUT_PULLUP" "LED_BUILTIN"))
|
||||||
"HIGH"
|
|
||||||
"LOW"
|
|
||||||
"INPUT"
|
|
||||||
"OUTPUT"
|
|
||||||
"INPUT_PULLUP"
|
|
||||||
"LED_BUILTIN"
|
|
||||||
))
|
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
(function_declarator
|
(function_declarator
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
; inherits: html
|
; inherits: html
|
||||||
|
"---" @punctuation.delimiter
|
||||||
|
|
||||||
[ "---" ] @punctuation.delimiter
|
[
|
||||||
|
"{"
|
||||||
[ "{" "}" ] @punctuation.special
|
"}"
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
; custom components get `@type` highlighting
|
; custom components get `@type` highlighting
|
||||||
((start_tag (tag_name) @type)
|
((start_tag
|
||||||
|
(tag_name) @type)
|
||||||
(#lua-match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
((end_tag (tag_name) @type)
|
|
||||||
|
((end_tag
|
||||||
|
(tag_name) @type)
|
||||||
(#lua-match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
((erroneous_end_tag (erroneous_end_tag_name) @type)
|
|
||||||
|
((erroneous_end_tag
|
||||||
|
(erroneous_end_tag_name) @type)
|
||||||
(#lua-match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; inherits: html_tags
|
; inherits: html_tags
|
||||||
|
|
||||||
(frontmatter
|
(frontmatter
|
||||||
(raw_text) @injection.content
|
(raw_text) @injection.content
|
||||||
(#set! injection.language "typescript"))
|
(#set! injection.language "typescript"))
|
||||||
|
|
@ -16,7 +15,8 @@
|
||||||
(start_tag
|
(start_tag
|
||||||
(attribute
|
(attribute
|
||||||
(attribute_name) @_lang_attr
|
(attribute_name) @_lang_attr
|
||||||
(quoted_attribute_value (attribute_value) @_lang_value)))
|
(quoted_attribute_value
|
||||||
|
(attribute_value) @_lang_value)))
|
||||||
(raw_text) @injection.content
|
(raw_text) @injection.content
|
||||||
(#eq? @_lang_attr "lang")
|
(#eq? @_lang_attr "lang")
|
||||||
(#eq? @_lang_value "scss")
|
(#eq? @_lang_value "scss")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
|
|
||||||
; relations
|
; relations
|
||||||
(rel_expression (identifier) @property)
|
(rel_expression
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
(relation
|
(relation
|
||||||
(rel_expression
|
(rel_expression
|
||||||
|
|
@ -20,10 +21,12 @@
|
||||||
(identifier) @constant))
|
(identifier) @constant))
|
||||||
|
|
||||||
; permissions
|
; permissions
|
||||||
(perm_expression (identifier) @property)
|
(perm_expression
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (selector_expression
|
function:
|
||||||
|
(selector_expression
|
||||||
operand: (identifier) @constant
|
operand: (identifier) @constant
|
||||||
field: (field_identifier) @function.method))
|
field: (field_identifier) @function.method))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,54 @@
|
||||||
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
||||||
|
|
||||||
[
|
[
|
||||||
(identifier)
|
(identifier)
|
||||||
(field_ref)
|
(field_ref)
|
||||||
] @variable
|
] @variable
|
||||||
(field_ref (_) @variable)
|
|
||||||
|
(field_ref
|
||||||
|
(_) @variable)
|
||||||
|
|
||||||
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
|
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin "ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO" "RLENGTH" "RSTART" "RT" "SYMTAB"))
|
||||||
"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
|
; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#any-of? @variable.builtin
|
(#any-of? @variable.builtin "BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC" "ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN"))
|
||||||
"BINMODE"
|
|
||||||
"CONVFMT"
|
|
||||||
"FIELDWIDTHS"
|
|
||||||
"FPAT"
|
|
||||||
"FS"
|
|
||||||
"IGNORECASE"
|
|
||||||
"LINT"
|
|
||||||
"OFMT"
|
|
||||||
"OFS"
|
|
||||||
"ORS"
|
|
||||||
"PREC"
|
|
||||||
"ROUNDMODE"
|
|
||||||
"RS"
|
|
||||||
"SUBSEP"
|
|
||||||
"TEXTDOMAIN"))
|
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(regex) @string.regexp
|
(regex) @string.regexp
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
((program . (comment) @keyword.directive)
|
((program
|
||||||
|
.
|
||||||
|
(comment) @keyword.directive)
|
||||||
(#lua-match? @keyword.directive "^#!/"))
|
(#lua-match? @keyword.directive "^#!/"))
|
||||||
|
|
||||||
(ns_qualified_name (namespace) @module)
|
(ns_qualified_name
|
||||||
(ns_qualified_name "::" @punctuation.delimiter)
|
(namespace) @module)
|
||||||
|
|
||||||
(func_def name: (_ (identifier) @function) @function)
|
(ns_qualified_name
|
||||||
(func_call name: (_ (identifier) @function) @function)
|
"::" @punctuation.delimiter)
|
||||||
|
|
||||||
(func_def (param_list (identifier) @variable.parameter))
|
(func_def
|
||||||
|
name:
|
||||||
|
(_
|
||||||
|
(identifier) @function) @function)
|
||||||
|
|
||||||
|
(func_call
|
||||||
|
name:
|
||||||
|
(_
|
||||||
|
(identifier) @function) @function)
|
||||||
|
|
||||||
|
(func_def
|
||||||
|
(param_list
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
[
|
[
|
||||||
"print"
|
"print"
|
||||||
|
|
@ -116,7 +103,8 @@
|
||||||
"ENDFILE"
|
"ENDFILE"
|
||||||
] @label
|
] @label
|
||||||
|
|
||||||
(binary_exp [
|
(binary_exp
|
||||||
|
[
|
||||||
"^"
|
"^"
|
||||||
"**"
|
"**"
|
||||||
"*"
|
"*"
|
||||||
|
|
@ -137,13 +125,15 @@
|
||||||
"||"
|
"||"
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(unary_exp [
|
(unary_exp
|
||||||
|
[
|
||||||
"!"
|
"!"
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(assignment_exp [
|
(assignment_exp
|
||||||
|
[
|
||||||
"="
|
"="
|
||||||
"+="
|
"+="
|
||||||
"-="
|
"-="
|
||||||
|
|
@ -153,37 +143,49 @@
|
||||||
"^="
|
"^="
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(ternary_exp [
|
(ternary_exp
|
||||||
|
[
|
||||||
"?"
|
"?"
|
||||||
":"
|
":"
|
||||||
] @keyword.conditional.ternary)
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
(update_exp [
|
(update_exp
|
||||||
|
[
|
||||||
"++"
|
"++"
|
||||||
"--"
|
"--"
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(redirected_io_statement [
|
(redirected_io_statement
|
||||||
|
[
|
||||||
">"
|
">"
|
||||||
">>"
|
">>"
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(piped_io_statement [
|
(piped_io_statement
|
||||||
|
[
|
||||||
"|"
|
"|"
|
||||||
"|&"
|
"|&"
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(piped_io_exp [
|
(piped_io_exp
|
||||||
|
[
|
||||||
"|"
|
"|"
|
||||||
"|&"
|
"|&"
|
||||||
] @operator)
|
] @operator)
|
||||||
|
|
||||||
(field_ref "$" @punctuation.delimiter)
|
(field_ref
|
||||||
|
"$" @punctuation.delimiter)
|
||||||
|
|
||||||
(regex "/" @punctuation.delimiter)
|
(regex
|
||||||
(regex_constant "@" @punctuation.delimiter)
|
"/" @punctuation.delimiter)
|
||||||
|
|
||||||
[ ";" "," ] @punctuation.delimiter
|
(regex_constant
|
||||||
|
"@" @punctuation.delimiter)
|
||||||
|
|
||||||
|
[
|
||||||
|
";"
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,13 @@
|
||||||
(#set! injection.language "regex"))
|
(#set! injection.language "regex"))
|
||||||
|
|
||||||
((print_statement
|
((print_statement
|
||||||
(exp_list . (string) @injection.content))
|
(exp_list
|
||||||
|
.
|
||||||
|
(string) @injection.content))
|
||||||
(#set! injection.language "printf"))
|
(#set! injection.language "printf"))
|
||||||
|
|
||||||
((printf_statement
|
((printf_statement
|
||||||
(exp_list . (string) @injection.content))
|
(exp_list
|
||||||
|
.
|
||||||
|
(string) @injection.content))
|
||||||
(#set! injection.language "printf"))
|
(#set! injection.language "printf"))
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
[
|
[
|
||||||
"(" ")"
|
"("
|
||||||
"{" "}"
|
")"
|
||||||
"[" "]"
|
"{"
|
||||||
"[[" "]]"
|
"}"
|
||||||
"((" "))"
|
"["
|
||||||
|
"]"
|
||||||
|
"[["
|
||||||
|
"]]"
|
||||||
|
"(("
|
||||||
|
"))"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -28,7 +33,6 @@
|
||||||
"=~"
|
"=~"
|
||||||
"=="
|
"=="
|
||||||
"!="
|
"!="
|
||||||
|
|
||||||
"&>"
|
"&>"
|
||||||
"&>>"
|
"&>>"
|
||||||
"<&"
|
"<&"
|
||||||
|
|
@ -36,10 +40,8 @@
|
||||||
">|"
|
">|"
|
||||||
"<&-"
|
"<&-"
|
||||||
">&-"
|
">&-"
|
||||||
|
|
||||||
"<<-"
|
"<<-"
|
||||||
"<<<"
|
"<<<"
|
||||||
|
|
||||||
".."
|
".."
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
|
|
@ -58,8 +60,11 @@
|
||||||
(heredoc_end)
|
(heredoc_end)
|
||||||
] @label
|
] @label
|
||||||
|
|
||||||
(variable_assignment (word) @string)
|
(variable_assignment
|
||||||
(command argument: "$" @string) ; bare dollar
|
(word) @string)
|
||||||
|
|
||||||
|
(command
|
||||||
|
argument: "$" @string) ; bare dollar
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
|
|
@ -106,27 +111,45 @@
|
||||||
|
|
||||||
(test_operator) @operator
|
(test_operator) @operator
|
||||||
|
|
||||||
(command_substitution "$(" @punctuation.bracket)
|
(command_substitution
|
||||||
(process_substitution "<(" @punctuation.bracket)
|
"$(" @punctuation.bracket)
|
||||||
|
|
||||||
|
(process_substitution
|
||||||
|
"<(" @punctuation.bracket)
|
||||||
|
|
||||||
(arithmetic_expansion
|
(arithmetic_expansion
|
||||||
[ "$((" "((" ] @punctuation.special
|
[
|
||||||
|
"$(("
|
||||||
|
"(("
|
||||||
|
] @punctuation.special
|
||||||
"))" @punctuation.special)
|
"))" @punctuation.special)
|
||||||
|
|
||||||
(arithmetic_expansion "," @punctuation.delimiter)
|
(arithmetic_expansion
|
||||||
|
"," @punctuation.delimiter)
|
||||||
|
|
||||||
(ternary_expression [ "?" ":" ] @keyword.conditional.ternary)
|
(ternary_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
(binary_expression operator: _ @operator)
|
(binary_expression
|
||||||
(unary_expression operator: _ @operator)
|
operator: _ @operator)
|
||||||
(postfix_expression operator: _ @operator)
|
|
||||||
|
(unary_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
|
||||||
|
(postfix_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (word) @function)
|
name: (word) @function)
|
||||||
|
|
||||||
(command_name (word) @function.call)
|
(command_name
|
||||||
|
(word) @function.call)
|
||||||
|
|
||||||
((command_name (word) @function.builtin)
|
((command_name
|
||||||
|
(word) @function.builtin)
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @function.builtin
|
(#any-of? @function.builtin
|
||||||
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
|
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
|
||||||
|
|
@ -140,12 +163,15 @@
|
||||||
"ulimit" "umask" "unalias" "wait"))
|
"ulimit" "umask" "unalias" "wait"))
|
||||||
|
|
||||||
(command
|
(command
|
||||||
argument: [
|
argument:
|
||||||
|
[
|
||||||
(word) @variable.parameter
|
(word) @variable.parameter
|
||||||
(concatenation (word) @variable.parameter)
|
(concatenation
|
||||||
|
(word) @variable.parameter)
|
||||||
])
|
])
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
((word) @number
|
((word) @number
|
||||||
(#lua-match? @number "^[0-9]+$"))
|
(#lua-match? @number "^[0-9]+$"))
|
||||||
|
|
||||||
|
|
@ -156,12 +182,18 @@
|
||||||
|
|
||||||
(simple_expansion
|
(simple_expansion
|
||||||
"$" @punctuation.special) @none
|
"$" @punctuation.special) @none
|
||||||
|
|
||||||
(expansion
|
(expansion
|
||||||
"${" @punctuation.special
|
"${" @punctuation.special
|
||||||
"}" @punctuation.special) @none
|
"}" @punctuation.special) @none
|
||||||
|
|
||||||
(expansion operator: _ @punctuation.special)
|
(expansion
|
||||||
(expansion "@" . operator: _ @character.special)
|
operator: _ @punctuation.special)
|
||||||
|
|
||||||
|
(expansion
|
||||||
|
"@"
|
||||||
|
.
|
||||||
|
operator: _ @character.special)
|
||||||
|
|
||||||
((expansion
|
((expansion
|
||||||
(subscript
|
(subscript
|
||||||
|
|
@ -183,5 +215,7 @@
|
||||||
(extglob_pattern)
|
(extglob_pattern)
|
||||||
] @string.regexp
|
] @string.regexp
|
||||||
|
|
||||||
((program . (comment) @keyword.directive)
|
((program
|
||||||
|
.
|
||||||
|
(comment) @keyword.directive)
|
||||||
(#lua-match? @keyword.directive "^#!/"))
|
(#lua-match? @keyword.directive "^#!/"))
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,12 @@
|
||||||
; printf 'format'
|
; printf 'format'
|
||||||
((command
|
((command
|
||||||
name: (command_name) @_command
|
name: (command_name) @_command
|
||||||
. argument: [(string) (raw_string)] @injection.content)
|
.
|
||||||
|
argument:
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(raw_string)
|
||||||
|
] @injection.content)
|
||||||
(#eq? @_command "printf")
|
(#eq? @_command "printf")
|
||||||
(#set! injection.language "printf"))
|
(#set! injection.language "printf"))
|
||||||
|
|
||||||
|
|
@ -20,7 +25,14 @@
|
||||||
((command
|
((command
|
||||||
name: (command_name) @_command
|
name: (command_name) @_command
|
||||||
argument: (word) @_arg
|
argument: (word) @_arg
|
||||||
. (_) . argument: [(string) (raw_string)] @injection.content)
|
.
|
||||||
|
(_)
|
||||||
|
.
|
||||||
|
argument:
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(raw_string)
|
||||||
|
] @injection.content)
|
||||||
(#eq? @_command "printf")
|
(#eq? @_command "printf")
|
||||||
(#eq? @_arg "-v")
|
(#eq? @_arg "-v")
|
||||||
(#set! injection.language "printf"))
|
(#set! injection.language "printf"))
|
||||||
|
|
@ -29,7 +41,12 @@
|
||||||
((command
|
((command
|
||||||
name: (command_name) @_command
|
name: (command_name) @_command
|
||||||
argument: (word) @_arg
|
argument: (word) @_arg
|
||||||
. argument: [(string) (raw_string)] @injection.content)
|
.
|
||||||
|
argument:
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(raw_string)
|
||||||
|
] @injection.content)
|
||||||
(#eq? @_command "printf")
|
(#eq? @_command "printf")
|
||||||
(#eq? @_arg "--")
|
(#eq? @_arg "--")
|
||||||
(#set! injection.language "printf"))
|
(#set! injection.language "printf"))
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,5 @@
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(variable_name) @local.reference
|
(variable_name) @local.reference
|
||||||
|
|
||||||
(word) @local.reference
|
(word) @local.reference
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,56 @@
|
||||||
;; Variables
|
; Variables
|
||||||
|
(list
|
||||||
|
(symbol) @variable)
|
||||||
|
|
||||||
(list (symbol) @variable)
|
(cons
|
||||||
|
(symbol) @variable)
|
||||||
|
|
||||||
(cons (symbol) @variable)
|
(scope
|
||||||
|
(symbol) @variable)
|
||||||
|
|
||||||
(scope (symbol) @variable)
|
(symbind
|
||||||
|
(symbol) @variable)
|
||||||
(symbind (symbol) @variable)
|
|
||||||
|
|
||||||
;; Constants
|
|
||||||
|
|
||||||
|
; Constants
|
||||||
((symbol) @constant
|
((symbol) @constant
|
||||||
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
|
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
|
||||||
|
|
||||||
;; Functions
|
; Functions
|
||||||
|
|
||||||
(list
|
(list
|
||||||
. (symbol) @function)
|
.
|
||||||
|
(symbol) @function)
|
||||||
;; Namespaces
|
|
||||||
|
|
||||||
|
; Namespaces
|
||||||
(symbind
|
(symbind
|
||||||
(symbol) @module
|
(symbol) @module
|
||||||
. (keyword))
|
.
|
||||||
|
(keyword))
|
||||||
;; Includes
|
|
||||||
|
|
||||||
|
; Includes
|
||||||
((symbol) @keyword.import
|
((symbol) @keyword.import
|
||||||
(#any-of? @keyword.import "use" "import" "load"))
|
(#any-of? @keyword.import "use" "import" "load"))
|
||||||
|
|
||||||
;; Keywords
|
; Keywords
|
||||||
|
|
||||||
((symbol) @keyword
|
((symbol) @keyword
|
||||||
(#any-of? @keyword "do" "doc"))
|
(#any-of? @keyword "do" "doc"))
|
||||||
|
|
||||||
;; Special Functions
|
; Special Functions
|
||||||
|
|
||||||
; Keywords construct a symbol
|
; Keywords construct a symbol
|
||||||
|
|
||||||
(keyword) @constructor
|
(keyword) @constructor
|
||||||
|
|
||||||
((list
|
((list
|
||||||
. (symbol) @keyword.function
|
.
|
||||||
. (symbol) @function
|
(symbol) @keyword.function
|
||||||
|
.
|
||||||
|
(symbol) @function
|
||||||
(symbol)? @variable.parameter)
|
(symbol)? @variable.parameter)
|
||||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||||
|
|
||||||
((cons
|
((cons
|
||||||
. (symbol) @keyword.function
|
.
|
||||||
. (symbol) @function
|
(symbol) @keyword.function
|
||||||
|
.
|
||||||
|
(symbol) @function
|
||||||
(symbol)? @variable.parameter)
|
(symbol)? @variable.parameter)
|
||||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||||
|
|
||||||
|
|
@ -58,33 +60,38 @@
|
||||||
((symbol) @function.macro
|
((symbol) @function.macro
|
||||||
(#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
|
(#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
|
||||||
|
|
||||||
;; Conditionals
|
; Conditionals
|
||||||
|
|
||||||
((symbol) @keyword.conditional
|
((symbol) @keyword.conditional
|
||||||
(#any-of? @keyword.conditional "if" "case" "cond" "when"))
|
(#any-of? @keyword.conditional "if" "case" "cond" "when"))
|
||||||
|
|
||||||
;; Repeats
|
; Repeats
|
||||||
|
|
||||||
((symbol) @keyword.repeat
|
((symbol) @keyword.repeat
|
||||||
(#any-of? @keyword.repeat "each"))
|
(#any-of? @keyword.repeat "each"))
|
||||||
|
|
||||||
;; Operators
|
; Operators
|
||||||
|
((symbol) @operator
|
||||||
|
(#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
|
||||||
|
|
||||||
((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
|
; Punctuation
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
;; Punctuation
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "(" ")" ] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
[ "{" "}" ] @punctuation.bracket
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
[ "[" "]" ] @punctuation.bracket
|
|
||||||
|
|
||||||
((symbol) @punctuation.delimiter
|
((symbol) @punctuation.delimiter
|
||||||
(#eq? @punctuation.delimiter "->"))
|
(#eq? @punctuation.delimiter "->"))
|
||||||
|
|
||||||
;; Literals
|
; Literals
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
@ -100,10 +107,7 @@
|
||||||
(null)
|
(null)
|
||||||
] @constant.builtin
|
] @constant.builtin
|
||||||
|
|
||||||
[
|
"^" @character.special
|
||||||
"^"
|
|
||||||
] @character.special
|
|
||||||
|
|
||||||
;; Comments
|
|
||||||
|
|
||||||
|
; Comments
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,20 @@
|
||||||
"]"
|
"]"
|
||||||
] @indent.end
|
] @indent.end
|
||||||
|
|
||||||
[ "(" ")" ] @indent.branch
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[ "{" "}" ] @indent.branch
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[ "[" "]" ] @indent.branch
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[
|
[
|
||||||
(ERROR)
|
(ERROR)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; Scopes
|
; Scopes
|
||||||
|
|
||||||
[
|
[
|
||||||
(list)
|
(list)
|
||||||
(scope)
|
(scope)
|
||||||
|
|
@ -7,19 +6,21 @@
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
; References
|
; References
|
||||||
|
|
||||||
(symbol) @local.reference
|
(symbol) @local.reference
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
((list
|
((list
|
||||||
. (symbol) @_fnkw
|
.
|
||||||
. (symbol) @local.definition.function
|
(symbol) @_fnkw
|
||||||
|
.
|
||||||
|
(symbol) @local.definition.function
|
||||||
(symbol)? @local.definition.parameter)
|
(symbol)? @local.definition.parameter)
|
||||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||||
|
|
||||||
((cons
|
((cons
|
||||||
. (symbol) @_fnkw
|
.
|
||||||
. (symbol) @local.definition.function
|
(symbol) @_fnkw
|
||||||
|
.
|
||||||
|
(symbol) @local.definition.function
|
||||||
(symbol)? @local.definition.parameter)
|
(symbol)? @local.definition.parameter)
|
||||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,57 @@
|
||||||
(date) @variable.member
|
(date) @variable.member
|
||||||
|
|
||||||
(txn) @attribute
|
(txn) @attribute
|
||||||
|
|
||||||
(account) @type
|
(account) @type
|
||||||
|
|
||||||
(amount) @number
|
(amount) @number
|
||||||
|
|
||||||
(incomplete_amount) @number
|
(incomplete_amount) @number
|
||||||
|
|
||||||
(compound_amount) @number
|
(compound_amount) @number
|
||||||
|
|
||||||
(amount_tolerance) @number
|
(amount_tolerance) @number
|
||||||
|
|
||||||
(currency) @property
|
(currency) @property
|
||||||
|
|
||||||
(key) @label
|
(key) @label
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(narration) @string @spell
|
(narration) @string @spell
|
||||||
|
|
||||||
(payee) @string @spell
|
(payee) @string @spell
|
||||||
|
|
||||||
(tag) @constant
|
(tag) @constant
|
||||||
|
|
||||||
(link) @constant
|
(link) @constant
|
||||||
|
|
||||||
[
|
[
|
||||||
(minus) (plus) (slash) (asterisk)
|
(minus)
|
||||||
|
(plus)
|
||||||
|
(slash)
|
||||||
|
(asterisk)
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
[
|
[
|
||||||
(balance) (open) (close) (commodity) (pad)
|
(balance)
|
||||||
(event) (price) (note) (document) (query)
|
(open)
|
||||||
(custom) (pushtag) (poptag) (pushmeta)
|
(close)
|
||||||
(popmeta) (option) (include) (plugin)
|
(commodity)
|
||||||
|
(pad)
|
||||||
|
(event)
|
||||||
|
(price)
|
||||||
|
(note)
|
||||||
|
(document)
|
||||||
|
(query)
|
||||||
|
(custom)
|
||||||
|
(pushtag)
|
||||||
|
(poptag)
|
||||||
|
(pushmeta)
|
||||||
|
(popmeta)
|
||||||
|
(option)
|
||||||
|
(include)
|
||||||
|
(plugin)
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
[
|
(entry) @fold
|
||||||
(entry)
|
|
||||||
] @fold
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex)
|
; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex)
|
||||||
|
|
||||||
[
|
[
|
||||||
(string_type)
|
(string_type)
|
||||||
(preamble_type)
|
(preamble_type)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
[
|
(entry) @indent.begin
|
||||||
(entry)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"{"
|
"{"
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,14 @@
|
||||||
(resource_declaration)
|
(resource_declaration)
|
||||||
(type_declaration)
|
(type_declaration)
|
||||||
(variable_declaration)
|
(variable_declaration)
|
||||||
|
|
||||||
(parenthesized_expression)
|
(parenthesized_expression)
|
||||||
|
|
||||||
(decorators)
|
(decorators)
|
||||||
(array)
|
(array)
|
||||||
(object)
|
(object)
|
||||||
|
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
|
|
||||||
(subscript_expression)
|
(subscript_expression)
|
||||||
(ternary_expression)
|
(ternary_expression)
|
||||||
|
|
||||||
(string)
|
(string)
|
||||||
|
|
||||||
(comment)
|
(comment)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
(import_statement
|
(import_statement
|
||||||
"import" @keyword.import)
|
"import" @keyword.import)
|
||||||
|
|
||||||
|
|
@ -8,12 +7,10 @@
|
||||||
"with" @keyword.import)
|
"with" @keyword.import)
|
||||||
|
|
||||||
; Namespaces
|
; Namespaces
|
||||||
|
|
||||||
(module_declaration
|
(module_declaration
|
||||||
(identifier) @module)
|
(identifier) @module)
|
||||||
|
|
||||||
; Builtins
|
; Builtins
|
||||||
|
|
||||||
(primitive_type) @type.builtin
|
(primitive_type) @type.builtin
|
||||||
|
|
||||||
((member_expression
|
((member_expression
|
||||||
|
|
@ -21,12 +18,10 @@
|
||||||
(#eq? @type.builtin "sys"))
|
(#eq? @type.builtin "sys"))
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
; Properties
|
; Properties
|
||||||
|
|
||||||
(object_property
|
(object_property
|
||||||
(identifier) @property
|
(identifier) @property
|
||||||
":" @punctuation.delimiter
|
":" @punctuation.delimiter
|
||||||
|
|
@ -40,12 +35,12 @@
|
||||||
(property_identifier) @property
|
(property_identifier) @property
|
||||||
|
|
||||||
; Attributes
|
; Attributes
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
"@" @attribute)
|
"@" @attribute)
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
(call_expression (identifier) @attribute))
|
(call_expression
|
||||||
|
(identifier) @attribute))
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
(call_expression
|
(call_expression
|
||||||
|
|
@ -54,7 +49,6 @@
|
||||||
property: (property_identifier) @attribute)))
|
property: (property_identifier) @attribute)))
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
||||||
(type_declaration
|
(type_declaration
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
|
|
@ -66,7 +60,8 @@
|
||||||
(type_declaration
|
(type_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
"="
|
"="
|
||||||
(array_type (identifier) @type))
|
(array_type
|
||||||
|
(identifier) @type))
|
||||||
|
|
||||||
(type
|
(type
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
@ -78,21 +73,22 @@
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
; Parameters
|
; Parameters
|
||||||
|
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
(identifier) @variable.parameter
|
(identifier) @variable.parameter
|
||||||
(_))
|
(_))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (_)
|
function: (_)
|
||||||
(arguments (identifier) @variable.parameter))
|
(arguments
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (_)
|
function: (_)
|
||||||
(arguments (member_expression object: (identifier) @variable.parameter)))
|
(arguments
|
||||||
|
(member_expression
|
||||||
|
object: (identifier) @variable.parameter)))
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
(_))
|
(_))
|
||||||
|
|
@ -117,7 +113,6 @@
|
||||||
(loop_enumerator) @variable))
|
(loop_enumerator) @variable))
|
||||||
|
|
||||||
; Conditionals
|
; Conditionals
|
||||||
|
|
||||||
"if" @keyword.conditional
|
"if" @keyword.conditional
|
||||||
|
|
||||||
(ternary_expression
|
(ternary_expression
|
||||||
|
|
@ -125,14 +120,12 @@
|
||||||
":" @keyword.conditional.ternary)
|
":" @keyword.conditional.ternary)
|
||||||
|
|
||||||
; Loops
|
; Loops
|
||||||
|
|
||||||
(for_statement
|
(for_statement
|
||||||
"for" @keyword.repeat
|
"for" @keyword.repeat
|
||||||
"in"
|
"in"
|
||||||
":" @punctuation.delimiter)
|
":" @punctuation.delimiter)
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"module"
|
"module"
|
||||||
"metadata"
|
"metadata"
|
||||||
|
|
@ -146,7 +139,6 @@
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
|
|
@ -169,14 +161,11 @@
|
||||||
"!"
|
"!"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
[
|
"in" @keyword.operator
|
||||||
"in"
|
|
||||||
] @keyword.operator
|
|
||||||
|
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(import_string
|
(import_string
|
||||||
"'" @string
|
"'" @string
|
||||||
(import_name) @module
|
(import_name) @module
|
||||||
|
|
@ -192,17 +181,25 @@
|
||||||
(null) @constant.builtin
|
(null) @constant.builtin
|
||||||
|
|
||||||
; Misc
|
; Misc
|
||||||
|
|
||||||
(compatible_identifier
|
(compatible_identifier
|
||||||
"?" @punctuation.special)
|
"?" @punctuation.special)
|
||||||
|
|
||||||
(nullable_return_type) @punctuation.special
|
(nullable_return_type) @punctuation.special
|
||||||
|
|
||||||
["{" "}"] @punctuation.bracket
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
["[" "]"] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
["(" ")"] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
"."
|
"."
|
||||||
|
|
@ -210,9 +207,7 @@
|
||||||
"=>"
|
"=>"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
|
||||||
; Interpolation
|
; Interpolation
|
||||||
|
|
||||||
(interpolation) @none
|
(interpolation) @none
|
||||||
|
|
||||||
(interpolation
|
(interpolation
|
||||||
|
|
@ -223,7 +218,6 @@
|
||||||
(identifier) @variable)
|
(identifier) @variable)
|
||||||
|
|
||||||
; Comments
|
; Comments
|
||||||
|
|
||||||
[
|
[
|
||||||
(comment)
|
(comment)
|
||||||
(diagnostic_comment)
|
(diagnostic_comment)
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,20 @@
|
||||||
|
|
||||||
"}" @indent.end
|
"}" @indent.end
|
||||||
|
|
||||||
[ "{" "}" ] @indent.branch
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[ "[" "]" ] @indent.branch
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[ "(" ")" ] @indent.branch
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[
|
[
|
||||||
(ERROR)
|
(ERROR)
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,17 @@
|
||||||
; Scopes
|
; Scopes
|
||||||
|
|
||||||
[
|
[
|
||||||
(infrastructure)
|
(infrastructure)
|
||||||
(call_expression)
|
(call_expression)
|
||||||
|
|
||||||
(lambda_expression)
|
(lambda_expression)
|
||||||
(subscript_expression)
|
(subscript_expression)
|
||||||
|
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
|
|
||||||
(array)
|
(array)
|
||||||
(object)
|
(object)
|
||||||
(interpolation)
|
(interpolation)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
; References
|
; References
|
||||||
|
|
||||||
(property_identifier) @local.reference
|
(property_identifier) @local.reference
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
|
|
@ -31,7 +26,6 @@
|
||||||
(identifier) @local.reference)
|
(identifier) @local.reference)
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(type) @local.definition.associated
|
(type) @local.definition.associated
|
||||||
|
|
||||||
(object_property
|
(object_property
|
||||||
|
|
|
||||||
|
|
@ -2,28 +2,23 @@
|
||||||
(function_definition)
|
(function_definition)
|
||||||
(anonymous_python_function)
|
(anonymous_python_function)
|
||||||
(python_function_definition)
|
(python_function_definition)
|
||||||
|
|
||||||
(while_statement)
|
(while_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(with_statement)
|
(with_statement)
|
||||||
(try_statement)
|
(try_statement)
|
||||||
|
|
||||||
(import_from_statement)
|
(import_from_statement)
|
||||||
(parameters)
|
(parameters)
|
||||||
(argument_list)
|
(argument_list)
|
||||||
|
|
||||||
(parenthesized_expression)
|
(parenthesized_expression)
|
||||||
(generator_expression)
|
(generator_expression)
|
||||||
(list_comprehension)
|
(list_comprehension)
|
||||||
(set_comprehension)
|
(set_comprehension)
|
||||||
(dictionary_comprehension)
|
(dictionary_comprehension)
|
||||||
|
|
||||||
(tuple)
|
(tuple)
|
||||||
(list)
|
(list)
|
||||||
(set)
|
(set)
|
||||||
(dictionary)
|
(dictionary)
|
||||||
|
|
||||||
(string)
|
(string)
|
||||||
(python_string)
|
(python_string)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
[
|
[
|
||||||
"inherit"
|
"inherit"
|
||||||
"include"
|
"include"
|
||||||
|
|
@ -9,12 +8,10 @@
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"unset"
|
"unset"
|
||||||
"EXPORT_FUNCTIONS"
|
"EXPORT_FUNCTIONS"
|
||||||
"python"
|
"python"
|
||||||
|
|
||||||
"assert"
|
"assert"
|
||||||
"exec"
|
"exec"
|
||||||
"global"
|
"global"
|
||||||
|
|
@ -34,19 +31,34 @@
|
||||||
"return"
|
"return"
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword.return
|
] @keyword.return
|
||||||
(yield "from" @keyword.return)
|
|
||||||
|
(yield
|
||||||
|
"from" @keyword.return)
|
||||||
|
|
||||||
(future_import_statement
|
(future_import_statement
|
||||||
"from" @keyword.import
|
"from" @keyword.import
|
||||||
"__future__" @constant.builtin)
|
"__future__" @constant.builtin)
|
||||||
(import_from_statement "from" @keyword.import)
|
|
||||||
|
(import_from_statement
|
||||||
|
"from" @keyword.import)
|
||||||
|
|
||||||
"import" @keyword.import
|
"import" @keyword.import
|
||||||
|
|
||||||
(aliased_import "as" @keyword.import)
|
(aliased_import
|
||||||
|
"as" @keyword.import)
|
||||||
|
|
||||||
["if" "elif" "else"] @keyword.conditional
|
[
|
||||||
|
"if"
|
||||||
|
"elif"
|
||||||
|
"else"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
["for" "while" "break" "continue"] @keyword.repeat
|
[
|
||||||
|
"for"
|
||||||
|
"while"
|
||||||
|
"break"
|
||||||
|
"continue"
|
||||||
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"try"
|
"try"
|
||||||
|
|
@ -56,7 +68,8 @@
|
||||||
"finally"
|
"finally"
|
||||||
] @keyword.exception
|
] @keyword.exception
|
||||||
|
|
||||||
(raise_statement "from" @keyword.exception)
|
(raise_statement
|
||||||
|
"from" @keyword.exception)
|
||||||
|
|
||||||
(try_statement
|
(try_statement
|
||||||
(else_clause
|
(else_clause
|
||||||
|
|
@ -82,7 +95,6 @@
|
||||||
] @type.qualifier
|
] @type.qualifier
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
[
|
[
|
||||||
(identifier)
|
(identifier)
|
||||||
(python_identifier)
|
(python_identifier)
|
||||||
|
|
@ -99,10 +111,14 @@
|
||||||
; Reset highlighting in f-string interpolations
|
; Reset highlighting in f-string interpolations
|
||||||
(interpolation) @none
|
(interpolation) @none
|
||||||
|
|
||||||
;; Identifier naming conventions
|
; Identifier naming conventions
|
||||||
((python_identifier) @type
|
((python_identifier) @type
|
||||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||||
([(identifier) (python_identifier)] @constant
|
|
||||||
|
([
|
||||||
|
(identifier)
|
||||||
|
(python_identifier)
|
||||||
|
] @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
((python_identifier) @constant.builtin
|
((python_identifier) @constant.builtin
|
||||||
|
|
@ -117,17 +133,18 @@
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
left: (python_identifier) @type.definition
|
left: (python_identifier) @type.definition
|
||||||
(type (python_identifier) @_annotation))
|
(type
|
||||||
|
(python_identifier) @_annotation))
|
||||||
(#eq? @_annotation "TypeAlias"))
|
(#eq? @_annotation "TypeAlias"))
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
left: (python_identifier) @type.definition
|
left: (python_identifier) @type.definition
|
||||||
right: (call
|
right:
|
||||||
|
(call
|
||||||
function: (python_identifier) @_func))
|
function: (python_identifier) @_func))
|
||||||
(#any-of? @_func "TypeVar" "NewType"))
|
(#any-of? @_func "TypeVar" "NewType"))
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
|
|
||||||
(flag) @variable.member
|
(flag) @variable.member
|
||||||
|
|
||||||
((attribute
|
((attribute
|
||||||
|
|
@ -135,12 +152,12 @@
|
||||||
(#lua-match? @variable.member "^[%l_].*$"))
|
(#lua-match? @variable.member "^[%l_].*$"))
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(call
|
(call
|
||||||
function: (python_identifier) @function.call)
|
function: (python_identifier) @function.call)
|
||||||
|
|
||||||
(call
|
(call
|
||||||
function: (attribute
|
function:
|
||||||
|
(attribute
|
||||||
attribute: (python_identifier) @function.method.call))
|
attribute: (python_identifier) @function.method.call))
|
||||||
|
|
||||||
((call
|
((call
|
||||||
|
|
@ -148,97 +165,117 @@
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (attribute
|
function:
|
||||||
|
(attribute
|
||||||
attribute: (python_identifier) @constructor))
|
attribute: (python_identifier) @constructor))
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (python_identifier) @function.builtin)
|
function: (python_identifier) @function.builtin)
|
||||||
(#any-of? @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__"))
|
||||||
"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
|
(python_function_definition
|
||||||
name: (python_identifier) @function)
|
name: (python_identifier) @function)
|
||||||
|
|
||||||
(type (python_identifier) @type)
|
(type
|
||||||
|
(python_identifier) @type)
|
||||||
|
|
||||||
(type
|
(type
|
||||||
(subscript
|
(subscript
|
||||||
(python_identifier) @type)) ; type subscript: Tuple[int]
|
(python_identifier) @type)) ; type subscript: Tuple[int]
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (python_identifier) @_isinstance
|
function: (python_identifier) @_isinstance
|
||||||
arguments: (argument_list
|
arguments:
|
||||||
|
(argument_list
|
||||||
(_)
|
(_)
|
||||||
(python_identifier) @type))
|
(python_identifier) @type))
|
||||||
(#eq? @_isinstance "isinstance"))
|
(#eq? @_isinstance "isinstance"))
|
||||||
|
|
||||||
(anonymous_python_function (identifier) @function)
|
(anonymous_python_function
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(function_definition (identifier) @function)
|
(function_definition
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(addtask_statement (identifier) @function)
|
(addtask_statement
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(deltask_statement (identifier) @function)
|
(deltask_statement
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(export_functions_statement (identifier) @function)
|
(export_functions_statement
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(addhandler_statement (identifier) @function)
|
(addhandler_statement
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(python_function_definition
|
(python_function_definition
|
||||||
body:
|
body:
|
||||||
(block
|
(block
|
||||||
. (expression_statement (python_string) @string.documentation @spell)))
|
.
|
||||||
|
(expression_statement
|
||||||
|
(python_string) @string.documentation @spell)))
|
||||||
|
|
||||||
; Namespace
|
; Namespace
|
||||||
|
|
||||||
(inherit_path) @module
|
(inherit_path) @module
|
||||||
|
|
||||||
;; Normal parameters
|
; Normal parameters
|
||||||
(parameters
|
(parameters
|
||||||
(python_identifier) @variable.parameter)
|
(python_identifier) @variable.parameter)
|
||||||
;; Lambda parameters
|
|
||||||
|
; Lambda parameters
|
||||||
(lambda_parameters
|
(lambda_parameters
|
||||||
(python_identifier) @variable.parameter)
|
(python_identifier) @variable.parameter)
|
||||||
|
|
||||||
(lambda_parameters
|
(lambda_parameters
|
||||||
(tuple_pattern
|
(tuple_pattern
|
||||||
(python_identifier) @variable.parameter))
|
(python_identifier) @variable.parameter))
|
||||||
|
|
||||||
; Default parameters
|
; Default parameters
|
||||||
(keyword_argument
|
(keyword_argument
|
||||||
name: (python_identifier) @variable.parameter)
|
name: (python_identifier) @variable.parameter)
|
||||||
|
|
||||||
; Naming parameters on call-site
|
; Naming parameters on call-site
|
||||||
(default_parameter
|
(default_parameter
|
||||||
name: (python_identifier) @variable.parameter)
|
name: (python_identifier) @variable.parameter)
|
||||||
|
|
||||||
(typed_parameter
|
(typed_parameter
|
||||||
(python_identifier) @variable.parameter)
|
(python_identifier) @variable.parameter)
|
||||||
|
|
||||||
(typed_default_parameter
|
(typed_default_parameter
|
||||||
(python_identifier) @variable.parameter)
|
(python_identifier) @variable.parameter)
|
||||||
|
|
||||||
; Variadic parameters *args, **kwargs
|
; Variadic parameters *args, **kwargs
|
||||||
(parameters
|
(parameters
|
||||||
(list_splat_pattern ; *args
|
(list_splat_pattern
|
||||||
|
; *args
|
||||||
(python_identifier) @variable.parameter))
|
(python_identifier) @variable.parameter))
|
||||||
|
|
||||||
(parameters
|
(parameters
|
||||||
(dictionary_splat_pattern ; **kwargs
|
(dictionary_splat_pattern
|
||||||
|
; **kwargs
|
||||||
(python_identifier) @variable.parameter))
|
(python_identifier) @variable.parameter))
|
||||||
|
|
||||||
;; Literals
|
; Literals
|
||||||
|
|
||||||
(none) @constant.builtin
|
(none) @constant.builtin
|
||||||
[(true) (false)] @boolean
|
|
||||||
|
[
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
] @boolean
|
||||||
|
|
||||||
((python_identifier) @variable.builtin
|
((python_identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "self"))
|
(#eq? @variable.builtin "self"))
|
||||||
|
|
||||||
((python_identifier) @variable.builtin
|
((python_identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "cls"))
|
(#eq? @variable.builtin "cls"))
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
|
|
||||||
(float) @number.float
|
(float) @number.float
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
"?="
|
"?="
|
||||||
"??="
|
"??="
|
||||||
|
|
@ -293,12 +330,10 @@
|
||||||
"or"
|
"or"
|
||||||
"is not"
|
"is not"
|
||||||
"not in"
|
"not in"
|
||||||
|
|
||||||
"del"
|
"del"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
[
|
[
|
||||||
(string)
|
(string)
|
||||||
(python_string)
|
(python_string)
|
||||||
|
|
@ -313,8 +348,14 @@
|
||||||
] @string.escape
|
] @string.escape
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
[
|
||||||
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
|
"("
|
||||||
|
")"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
":"
|
":"
|
||||||
|
|
@ -325,15 +366,28 @@
|
||||||
(ellipsis)
|
(ellipsis)
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
(variable_expansion [ "${" "}" ] @punctuation.special)
|
(variable_expansion
|
||||||
(inline_python [ "${@" "}" ] @punctuation.special)
|
[
|
||||||
|
"${"
|
||||||
|
"}"
|
||||||
|
] @punctuation.special)
|
||||||
|
|
||||||
|
(inline_python
|
||||||
|
[
|
||||||
|
"${@"
|
||||||
|
"}"
|
||||||
|
] @punctuation.special)
|
||||||
|
|
||||||
(interpolation
|
(interpolation
|
||||||
"{" @punctuation.special
|
"{" @punctuation.special
|
||||||
"}" @punctuation.special)
|
"}" @punctuation.special)
|
||||||
|
|
||||||
(type_conversion) @function.macro
|
(type_conversion) @function.macro
|
||||||
|
|
||||||
([(identifier) (python_identifier)] @type.builtin
|
([
|
||||||
|
(identifier)
|
||||||
|
(python_identifier)
|
||||||
|
] @type.builtin
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @type.builtin
|
(#any-of? @type.builtin
|
||||||
; https://docs.python.org/3/library/exceptions.html
|
; https://docs.python.org/3/library/exceptions.html
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,53 @@
|
||||||
[
|
[
|
||||||
(import_from_statement)
|
(import_from_statement)
|
||||||
|
|
||||||
(parenthesized_expression)
|
(parenthesized_expression)
|
||||||
(generator_expression)
|
(generator_expression)
|
||||||
(list_comprehension)
|
(list_comprehension)
|
||||||
(set_comprehension)
|
(set_comprehension)
|
||||||
(dictionary_comprehension)
|
(dictionary_comprehension)
|
||||||
|
|
||||||
(tuple_pattern)
|
(tuple_pattern)
|
||||||
(list_pattern)
|
(list_pattern)
|
||||||
(binary_operator)
|
(binary_operator)
|
||||||
|
|
||||||
(lambda)
|
(lambda)
|
||||||
|
|
||||||
(concatenated_string)
|
(concatenated_string)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
((list) @indent.align
|
((list) @indent.align
|
||||||
(#set! indent.open_delimiter "[")
|
(#set! indent.open_delimiter "[")
|
||||||
(#set! indent.close_delimiter "]")
|
(#set! indent.close_delimiter "]"))
|
||||||
)
|
|
||||||
((dictionary) @indent.align
|
((dictionary) @indent.align
|
||||||
(#set! indent.open_delimiter "{")
|
(#set! indent.open_delimiter "{")
|
||||||
(#set! indent.close_delimiter "}")
|
(#set! indent.close_delimiter "}"))
|
||||||
)
|
|
||||||
((set) @indent.align
|
((set) @indent.align
|
||||||
(#set! indent.open_delimiter "{")
|
(#set! indent.open_delimiter "{")
|
||||||
(#set! indent.close_delimiter "}")
|
(#set! indent.close_delimiter "}"))
|
||||||
)
|
|
||||||
|
|
||||||
((for_statement) @indent.begin
|
((for_statement) @indent.begin
|
||||||
(#set! indent.immediate 1))
|
(#set! indent.immediate 1))
|
||||||
|
|
||||||
((if_statement) @indent.begin
|
((if_statement) @indent.begin
|
||||||
(#set! indent.immediate 1))
|
(#set! indent.immediate 1))
|
||||||
|
|
||||||
((while_statement) @indent.begin
|
((while_statement) @indent.begin
|
||||||
(#set! indent.immediate 1))
|
(#set! indent.immediate 1))
|
||||||
|
|
||||||
((try_statement) @indent.begin
|
((try_statement) @indent.begin
|
||||||
(#set! indent.immediate 1))
|
(#set! indent.immediate 1))
|
||||||
(ERROR "try" ":" @indent.begin (#set! indent.immediate 1))
|
|
||||||
|
(ERROR
|
||||||
|
"try"
|
||||||
|
":" @indent.begin
|
||||||
|
(#set! indent.immediate 1))
|
||||||
|
|
||||||
((python_function_definition) @indent.begin
|
((python_function_definition) @indent.begin
|
||||||
(#set! indent.immediate 1))
|
(#set! indent.immediate 1))
|
||||||
|
|
||||||
(function_definition) @indent.begin
|
(function_definition) @indent.begin
|
||||||
|
|
||||||
(anonymous_python_function) @indent.begin
|
(anonymous_python_function) @indent.begin
|
||||||
|
|
||||||
((with_statement) @indent.begin
|
((with_statement) @indent.begin
|
||||||
(#set! indent.immediate 1))
|
(#set! indent.immediate 1))
|
||||||
|
|
||||||
|
|
@ -50,27 +56,46 @@
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")")
|
(#set! indent.close_delimiter ")")
|
||||||
(#set! indent.avoid_last_matching_next 1))
|
(#set! indent.avoid_last_matching_next 1))
|
||||||
|
|
||||||
(while_statement
|
(while_statement
|
||||||
condition: (parenthesized_expression) @indent.align
|
condition: (parenthesized_expression) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")")
|
(#set! indent.close_delimiter ")")
|
||||||
(#set! indent.avoid_last_matching_next 1))
|
(#set! indent.avoid_last_matching_next 1))
|
||||||
|
|
||||||
(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_))
|
(ERROR
|
||||||
|
"(" @indent.align
|
||||||
|
(#set! indent.open_delimiter "(")
|
||||||
|
(#set! indent.close_delimiter ")")
|
||||||
|
.
|
||||||
|
(_))
|
||||||
|
|
||||||
((argument_list) @indent.align
|
((argument_list) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")"))
|
(#set! indent.close_delimiter ")"))
|
||||||
|
|
||||||
((parameters) @indent.align
|
((parameters) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")")
|
(#set! indent.close_delimiter ")")
|
||||||
(#set! indent.avoid_last_matching_next 1))
|
(#set! indent.avoid_last_matching_next 1))
|
||||||
|
|
||||||
((tuple) @indent.align
|
((tuple) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_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 "]")
|
||||||
|
.
|
||||||
|
(_))
|
||||||
|
|
||||||
(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_))
|
(ERROR
|
||||||
|
"{" @indent.align
|
||||||
|
(#set! indent.open_delimiter "{")
|
||||||
|
(#set! indent.close_delimiter "}")
|
||||||
|
.
|
||||||
|
(_))
|
||||||
|
|
||||||
[
|
[
|
||||||
(break_statement)
|
(break_statement)
|
||||||
|
|
@ -78,24 +103,43 @@
|
||||||
] @indent.dedent
|
] @indent.dedent
|
||||||
|
|
||||||
(ERROR
|
(ERROR
|
||||||
(_) @indent.branch ":" .
|
(_) @indent.branch
|
||||||
|
":"
|
||||||
|
.
|
||||||
(#lua-match? @indent.branch "^else"))
|
(#lua-match? @indent.branch "^else"))
|
||||||
|
|
||||||
(ERROR
|
(ERROR
|
||||||
(_) @indent.branch @indent.dedent ":" .
|
(_) @indent.branch @indent.dedent
|
||||||
|
":"
|
||||||
|
.
|
||||||
(#lua-match? @indent.branch "^elif"))
|
(#lua-match? @indent.branch "^elif"))
|
||||||
|
|
||||||
(parenthesized_expression ")" @indent.end)
|
(parenthesized_expression
|
||||||
(generator_expression ")" @indent.end)
|
")" @indent.end)
|
||||||
(list_comprehension "]" @indent.end)
|
|
||||||
(set_comprehension "}" @indent.end)
|
|
||||||
(dictionary_comprehension "}" @indent.end)
|
|
||||||
|
|
||||||
(tuple_pattern ")" @indent.end)
|
(generator_expression
|
||||||
(list_pattern "]" @indent.end)
|
")" @indent.end)
|
||||||
|
|
||||||
(function_definition "}" @indent.end)
|
(list_comprehension
|
||||||
(anonymous_python_function "}" @indent.end)
|
"]" @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
|
(return_statement
|
||||||
[
|
[
|
||||||
|
|
@ -110,7 +154,9 @@
|
||||||
(attribute
|
(attribute
|
||||||
attribute: (_) @indent.end)
|
attribute: (_) @indent.end)
|
||||||
(call
|
(call
|
||||||
arguments: (_ ")" @indent.end))
|
arguments:
|
||||||
|
(_
|
||||||
|
")" @indent.end))
|
||||||
"return" @indent.end
|
"return" @indent.end
|
||||||
] .)
|
] .)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
(call
|
(call
|
||||||
function: (attribute
|
function:
|
||||||
|
(attribute
|
||||||
object: (python_identifier) @_re)
|
object: (python_identifier) @_re)
|
||||||
arguments: (argument_list (python_string
|
arguments:
|
||||||
|
(argument_list
|
||||||
|
(python_string
|
||||||
(string_content) @injection.content) @_string)
|
(string_content) @injection.content) @_string)
|
||||||
(#eq? @_re "re")
|
(#eq? @_re "re")
|
||||||
(#lua-match? @_string "^r.*")
|
(#lua-match? @_string "^r.*")
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,16 @@
|
||||||
; Imports
|
; Imports
|
||||||
(aliased_import
|
(aliased_import
|
||||||
alias: (python_identifier) @local.definition.import)
|
alias: (python_identifier) @local.definition.import)
|
||||||
|
|
||||||
(import_statement
|
(import_statement
|
||||||
name: (dotted_name ((python_identifier) @local.definition.import)))
|
name:
|
||||||
|
(dotted_name
|
||||||
|
((python_identifier) @local.definition.import)))
|
||||||
|
|
||||||
(import_from_statement
|
(import_from_statement
|
||||||
name: (dotted_name ((python_identifier) @local.definition.import)))
|
name:
|
||||||
|
(dotted_name
|
||||||
|
((python_identifier) @local.definition.import)))
|
||||||
|
|
||||||
; Function with parameters, defines parameters
|
; Function with parameters, defines parameters
|
||||||
(parameters
|
(parameters
|
||||||
|
|
@ -40,56 +46,78 @@
|
||||||
name: (python_identifier) @local.definition.function) @local.scope
|
name: (python_identifier) @local.definition.function) @local.scope
|
||||||
(#set! definition.function.scope "parent"))
|
(#set! definition.function.scope "parent"))
|
||||||
|
|
||||||
(function_definition (identifier) @local.definition.function)
|
(function_definition
|
||||||
|
(identifier) @local.definition.function)
|
||||||
|
|
||||||
(anonymous_python_function (identifier) @local.definition.function)
|
(anonymous_python_function
|
||||||
|
(identifier) @local.definition.function)
|
||||||
|
|
||||||
;;; Loops
|
; Loops
|
||||||
; not a scope!
|
; not a scope!
|
||||||
(for_statement
|
(for_statement
|
||||||
left: (pattern_list
|
left:
|
||||||
|
(pattern_list
|
||||||
(python_identifier) @local.definition.var))
|
(python_identifier) @local.definition.var))
|
||||||
|
|
||||||
(for_statement
|
(for_statement
|
||||||
left: (tuple_pattern
|
left:
|
||||||
|
(tuple_pattern
|
||||||
(python_identifier) @local.definition.var))
|
(python_identifier) @local.definition.var))
|
||||||
|
|
||||||
(for_statement
|
(for_statement
|
||||||
left: (python_identifier) @local.definition.var)
|
left: (python_identifier) @local.definition.var)
|
||||||
|
|
||||||
; not a scope!
|
; not a scope!
|
||||||
;(while_statement) @local.scope
|
;(while_statement) @local.scope
|
||||||
|
|
||||||
; for in list comprehension
|
; for in list comprehension
|
||||||
(for_in_clause
|
(for_in_clause
|
||||||
left: (python_identifier) @local.definition.var)
|
left: (python_identifier) @local.definition.var)
|
||||||
|
|
||||||
(for_in_clause
|
(for_in_clause
|
||||||
left: (tuple_pattern
|
left:
|
||||||
|
(tuple_pattern
|
||||||
(python_identifier) @local.definition.var))
|
(python_identifier) @local.definition.var))
|
||||||
|
|
||||||
(for_in_clause
|
(for_in_clause
|
||||||
left: (pattern_list
|
left:
|
||||||
|
(pattern_list
|
||||||
(python_identifier) @local.definition.var))
|
(python_identifier) @local.definition.var))
|
||||||
|
|
||||||
(dictionary_comprehension) @local.scope
|
(dictionary_comprehension) @local.scope
|
||||||
|
|
||||||
(list_comprehension) @local.scope
|
(list_comprehension) @local.scope
|
||||||
|
|
||||||
(set_comprehension) @local.scope
|
(set_comprehension) @local.scope
|
||||||
|
|
||||||
;;; Assignments
|
; Assignments
|
||||||
|
|
||||||
(assignment
|
(assignment
|
||||||
left: (python_identifier) @local.definition.var)
|
left: (python_identifier) @local.definition.var)
|
||||||
|
|
||||||
(assignment
|
(assignment
|
||||||
left: (pattern_list
|
left:
|
||||||
(python_identifier) @local.definition.var))
|
(pattern_list
|
||||||
(assignment
|
|
||||||
left: (tuple_pattern
|
|
||||||
(python_identifier) @local.definition.var))
|
(python_identifier) @local.definition.var))
|
||||||
|
|
||||||
(assignment
|
(assignment
|
||||||
left: (attribute
|
left:
|
||||||
|
(tuple_pattern
|
||||||
|
(python_identifier) @local.definition.var))
|
||||||
|
|
||||||
|
(assignment
|
||||||
|
left:
|
||||||
|
(attribute
|
||||||
(python_identifier)
|
(python_identifier)
|
||||||
(python_identifier) @local.definition.field))
|
(python_identifier) @local.definition.field))
|
||||||
|
|
||||||
(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var)
|
(variable_assignment
|
||||||
|
(identifier)
|
||||||
|
operator:
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"?="
|
||||||
|
"??="
|
||||||
|
":="
|
||||||
|
] @local.definition.var)
|
||||||
|
|
||||||
; Walrus operator x := 1
|
; Walrus operator x := 1
|
||||||
(named_expression
|
(named_expression
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
(object_id) @variable
|
(object_id) @variable
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
@ -15,30 +16,50 @@
|
||||||
|
|
||||||
(decorator) @attribute
|
(decorator) @attribute
|
||||||
|
|
||||||
(property_definition (property_name) @property)
|
(property_definition
|
||||||
|
(property_name) @property)
|
||||||
|
|
||||||
(object) @type
|
(object) @type
|
||||||
|
|
||||||
(signal_binding (signal_name) @function.builtin)
|
(signal_binding
|
||||||
(signal_binding (function (identifier)) @function)
|
(signal_name) @function.builtin)
|
||||||
(signal_binding "swapped" @keyword)
|
|
||||||
|
|
||||||
(styles_list "styles" @function.macro)
|
(signal_binding
|
||||||
(layout_definition "layout" @function.macro)
|
(function
|
||||||
|
(identifier)) @function)
|
||||||
|
|
||||||
(gettext_string "_" @function.builtin)
|
(signal_binding
|
||||||
|
"swapped" @keyword)
|
||||||
|
|
||||||
(menu_definition "menu" @keyword)
|
(styles_list
|
||||||
(menu_section "section" @keyword)
|
"styles" @function.macro)
|
||||||
(menu_item "item" @function.macro)
|
|
||||||
|
|
||||||
(template_definition (template_name_qualifier) @type.qualifier)
|
(layout_definition
|
||||||
|
"layout" @function.macro)
|
||||||
|
|
||||||
(import_statement (gobject_library) @module)
|
(gettext_string
|
||||||
|
"_" @function.builtin)
|
||||||
|
|
||||||
(import_statement (version_number) @number.float)
|
(menu_definition
|
||||||
|
"menu" @keyword)
|
||||||
|
|
||||||
|
(menu_section
|
||||||
|
"section" @keyword)
|
||||||
|
|
||||||
|
(menu_item
|
||||||
|
"item" @function.macro)
|
||||||
|
|
||||||
|
(template_definition
|
||||||
|
(template_name_qualifier) @type.qualifier)
|
||||||
|
|
||||||
|
(import_statement
|
||||||
|
(gobject_library) @module)
|
||||||
|
|
||||||
|
(import_statement
|
||||||
|
(version_number) @number.float)
|
||||||
|
|
||||||
(float) @number.float
|
(float) @number.float
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
|
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
|
||||||
((identifier) @variable (#set! "priority" 95))
|
((identifier) @variable
|
||||||
(preproc_def (preproc_arg) @variable)
|
(#set! "priority" 95))
|
||||||
|
|
||||||
|
(preproc_def
|
||||||
|
(preproc_arg) @variable)
|
||||||
|
|
||||||
[
|
[
|
||||||
"default"
|
"default"
|
||||||
|
|
@ -17,7 +20,10 @@
|
||||||
"sizeof"
|
"sizeof"
|
||||||
"offsetof"
|
"offsetof"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
(alignof_expression . _ @keyword.operator)
|
|
||||||
|
(alignof_expression
|
||||||
|
.
|
||||||
|
_ @keyword.operator)
|
||||||
|
|
||||||
"return" @keyword.return
|
"return" @keyword.return
|
||||||
|
|
||||||
|
|
@ -52,42 +58,48 @@
|
||||||
|
|
||||||
"#include" @keyword.import
|
"#include" @keyword.import
|
||||||
|
|
||||||
[ ";" ":" "," "::" ] @punctuation.delimiter
|
[
|
||||||
|
";"
|
||||||
|
":"
|
||||||
|
","
|
||||||
|
"::"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
"..." @punctuation.special
|
"..." @punctuation.special
|
||||||
|
|
||||||
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
"="
|
"="
|
||||||
|
|
||||||
"-"
|
"-"
|
||||||
"*"
|
"*"
|
||||||
"/"
|
"/"
|
||||||
"+"
|
"+"
|
||||||
"%"
|
"%"
|
||||||
|
|
||||||
"~"
|
"~"
|
||||||
"|"
|
"|"
|
||||||
"&"
|
"&"
|
||||||
"^"
|
"^"
|
||||||
"<<"
|
"<<"
|
||||||
">>"
|
">>"
|
||||||
|
|
||||||
"->"
|
"->"
|
||||||
"."
|
"."
|
||||||
|
|
||||||
"<"
|
"<"
|
||||||
"<="
|
"<="
|
||||||
">="
|
">="
|
||||||
">"
|
">"
|
||||||
"=="
|
"=="
|
||||||
"!="
|
"!="
|
||||||
|
|
||||||
"!"
|
"!"
|
||||||
"&&"
|
"&&"
|
||||||
"||"
|
"||"
|
||||||
|
|
||||||
"-="
|
"-="
|
||||||
"+="
|
"+="
|
||||||
"*="
|
"*="
|
||||||
|
|
@ -102,26 +114,37 @@
|
||||||
"++"
|
"++"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
;; Make sure the comma operator is given a highlight group after the comma
|
; Make sure the comma operator is given a highlight group after the comma
|
||||||
;; punctuator so the operator is highlighted properly.
|
; punctuator so the operator is highlighted properly.
|
||||||
(comma_expression [ "," ] @operator)
|
(comma_expression
|
||||||
|
"," @operator)
|
||||||
|
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
(false)
|
(false)
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
(conditional_expression [ "?" ":" ] @keyword.conditional.ternary)
|
(conditional_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
|
|
||||||
(system_lib_string) @string
|
(system_lib_string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(null) @constant.builtin
|
(null) @constant.builtin
|
||||||
|
|
||||||
(number_literal) @number
|
(number_literal) @number
|
||||||
|
|
||||||
(char_literal) @character
|
(char_literal) @character
|
||||||
|
|
||||||
((preproc_arg) @function.macro (#set! "priority" 90))
|
((preproc_arg) @function.macro
|
||||||
|
(#set! "priority" 90))
|
||||||
|
|
||||||
(preproc_defined) @function.macro
|
(preproc_defined) @function.macro
|
||||||
|
|
||||||
((field_expression
|
((field_expression
|
||||||
|
|
@ -129,6 +152,7 @@
|
||||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||||
|
|
||||||
(field_designator) @property
|
(field_designator) @property
|
||||||
|
|
||||||
((field_identifier) @property
|
((field_identifier) @property
|
||||||
(#has-ancestor? @property field_declaration)
|
(#has-ancestor? @property field_declaration)
|
||||||
(#not-has-ancestor? @property function_declarator))
|
(#not-has-ancestor? @property function_declarator))
|
||||||
|
|
@ -156,14 +180,20 @@
|
||||||
|
|
||||||
(primitive_type) @type.builtin
|
(primitive_type) @type.builtin
|
||||||
|
|
||||||
(sized_type_specifier _ @type.builtin type: _?)
|
(sized_type_specifier
|
||||||
|
_ @type.builtin
|
||||||
|
type: _?)
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||||
(preproc_def (preproc_arg) @constant
|
|
||||||
|
(preproc_def
|
||||||
|
(preproc_arg) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||||
|
|
||||||
(enumerator
|
(enumerator
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
|
|
||||||
(case_statement
|
(case_statement
|
||||||
value: (identifier) @constant)
|
value: (identifier) @constant)
|
||||||
|
|
||||||
|
|
@ -181,7 +211,9 @@
|
||||||
"__clang_wide_literal_encoding__"
|
"__clang_wide_literal_encoding__"
|
||||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||||
"__VA_ARGS__" "__VA_OPT__"))
|
"__VA_ARGS__" "__VA_OPT__"))
|
||||||
(preproc_def (preproc_arg) @constant.builtin
|
|
||||||
|
(preproc_def
|
||||||
|
(preproc_arg) @constant.builtin
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin
|
||||||
"stderr" "stdin" "stdout"
|
"stderr" "stdin" "stdout"
|
||||||
|
|
@ -197,21 +229,26 @@
|
||||||
"__VA_ARGS__" "__VA_OPT__"))
|
"__VA_ARGS__" "__VA_OPT__"))
|
||||||
|
|
||||||
(attribute_specifier
|
(attribute_specifier
|
||||||
(argument_list (identifier) @variable.builtin))
|
(argument_list
|
||||||
|
(identifier) @variable.builtin))
|
||||||
|
|
||||||
((attribute_specifier
|
((attribute_specifier
|
||||||
(argument_list (call_expression
|
(argument_list
|
||||||
|
(call_expression
|
||||||
function: (identifier) @variable.builtin))))
|
function: (identifier) @variable.builtin))))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(#lua-match? @function.builtin "^__builtin_"))
|
(#lua-match? @function.builtin "^__builtin_"))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(#has-ancestor? @function.builtin attribute_specifier))
|
(#has-ancestor? @function.builtin attribute_specifier))
|
||||||
|
|
||||||
;; Preproc def / undef
|
; Preproc def / undef
|
||||||
(preproc_def
|
(preproc_def
|
||||||
name: (_) @constant)
|
name: (_) @constant)
|
||||||
|
|
||||||
(preproc_call
|
(preproc_call
|
||||||
directive: (preproc_directive) @_u
|
directive: (preproc_directive) @_u
|
||||||
argument: (_) @constant
|
argument: (_) @constant
|
||||||
|
|
@ -219,15 +256,21 @@
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (field_expression
|
function:
|
||||||
|
(field_expression
|
||||||
field: (field_identifier) @function.call))
|
field: (field_identifier) @function.call))
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (identifier) @function)
|
declarator: (identifier) @function)
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (parenthesized_declarator
|
declarator:
|
||||||
|
(parenthesized_declarator
|
||||||
(pointer_declarator
|
(pointer_declarator
|
||||||
declarator: (field_identifier) @function)))
|
declarator: (field_identifier) @function)))
|
||||||
|
|
||||||
(preproc_function_def
|
(preproc_function_def
|
||||||
name: (identifier) @function.macro)
|
name: (identifier) @function.macro)
|
||||||
|
|
||||||
|
|
@ -236,7 +279,7 @@
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||||
|
|
||||||
;; Parameters
|
; Parameters
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
declarator: (identifier) @variable.parameter)
|
declarator: (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
|
@ -268,8 +311,8 @@
|
||||||
; declarator: _
|
; declarator: _
|
||||||
; (declaration
|
; (declaration
|
||||||
; declarator: (pointer_declarator) @variable.parameter))
|
; declarator: (pointer_declarator) @variable.parameter))
|
||||||
|
(preproc_params
|
||||||
(preproc_params (identifier) @variable.parameter)
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
[
|
[
|
||||||
"__attribute__"
|
"__attribute__"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
(initializer_list)
|
(initializer_list)
|
||||||
(init_declarator)
|
(init_declarator)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
; With current indent logic, if we capture expression_statement with @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
|
; 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,
|
; So narrow indent capture to check for error inside expression statement only,
|
||||||
|
|
@ -16,7 +15,11 @@
|
||||||
";" @indent.end)
|
";" @indent.end)
|
||||||
|
|
||||||
(ERROR
|
(ERROR
|
||||||
"for" "(" @indent.begin ";" ";" ")" @indent.end)
|
"for"
|
||||||
|
"(" @indent.begin
|
||||||
|
";"
|
||||||
|
";"
|
||||||
|
")" @indent.end)
|
||||||
|
|
||||||
((for_statement
|
((for_statement
|
||||||
body: (_) @_body) @indent.begin
|
body: (_) @_body) @indent.begin
|
||||||
|
|
@ -29,34 +32,37 @@
|
||||||
body: (_) @_body) @indent.begin
|
body: (_) @_body) @indent.begin
|
||||||
(#not-has-type? @_body compound_statement))
|
(#not-has-type? @_body compound_statement))
|
||||||
|
|
||||||
(
|
((if_statement)
|
||||||
(if_statement)
|
|
||||||
.
|
.
|
||||||
(ERROR "else" @indent.begin))
|
(ERROR
|
||||||
|
"else" @indent.begin))
|
||||||
|
|
||||||
(if_statement
|
(if_statement
|
||||||
condition: (_) @indent.begin)
|
condition: (_) @indent.begin)
|
||||||
|
|
||||||
;; Supports if without braces (but not both if-else without braces)
|
; Supports if without braces (but not both if-else without braces)
|
||||||
((if_statement
|
((if_statement
|
||||||
consequence:
|
consequence:
|
||||||
(_ ";" @indent.end) @_consequence
|
(_
|
||||||
|
";" @indent.end) @_consequence
|
||||||
(#not-has-type? @_consequence compound_statement)
|
(#not-has-type? @_consequence compound_statement)
|
||||||
alternative:
|
alternative:
|
||||||
(else_clause
|
(else_clause
|
||||||
"else" @indent.branch
|
"else" @indent.branch
|
||||||
[
|
[
|
||||||
(if_statement (compound_statement) @indent.dedent)? @indent.dedent
|
(if_statement
|
||||||
|
(compound_statement) @indent.dedent)? @indent.dedent
|
||||||
(compound_statement)? @indent.dedent
|
(compound_statement)? @indent.dedent
|
||||||
(_)? @indent.dedent
|
(_)? @indent.dedent
|
||||||
]
|
])?) @indent.begin)
|
||||||
)?
|
|
||||||
) @indent.begin)
|
|
||||||
|
|
||||||
(else_clause (_ . "{" @indent.branch))
|
(else_clause
|
||||||
|
(_
|
||||||
|
.
|
||||||
|
"{" @indent.branch))
|
||||||
|
|
||||||
|
(compound_statement
|
||||||
(compound_statement "}" @indent.end)
|
"}" @indent.end)
|
||||||
|
|
||||||
[
|
[
|
||||||
")"
|
")"
|
||||||
|
|
@ -79,12 +85,16 @@
|
||||||
(string_literal)
|
(string_literal)
|
||||||
] @indent.ignore
|
] @indent.ignore
|
||||||
|
|
||||||
((ERROR (parameter_declaration)) @indent.align
|
((ERROR
|
||||||
|
(parameter_declaration)) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")"))
|
(#set! indent.close_delimiter ")"))
|
||||||
([(argument_list) (parameter_list)] @indent.align
|
|
||||||
|
([
|
||||||
|
(argument_list)
|
||||||
|
(parameter_list)
|
||||||
|
] @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")"))
|
(#set! indent.close_delimiter ")"))
|
||||||
|
|
||||||
(comment) @indent.auto
|
(comment) @indent.auto
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,11 @@
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @_function
|
function: (identifier) @_function
|
||||||
arguments: (argument_list
|
arguments:
|
||||||
. (string_literal (string_content) @injection.content)))
|
(argument_list
|
||||||
|
.
|
||||||
|
(string_literal
|
||||||
|
(string_content) @injection.content)))
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @_function
|
(#any-of? @_function
|
||||||
"printf" "printf_s"
|
"printf" "printf_s"
|
||||||
|
|
@ -33,8 +36,12 @@
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @_function
|
function: (identifier) @_function
|
||||||
arguments: (argument_list
|
arguments:
|
||||||
(_) . (string_literal (string_content) @injection.content)))
|
(argument_list
|
||||||
|
(_)
|
||||||
|
.
|
||||||
|
(string_literal
|
||||||
|
(string_content) @injection.content)))
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @_function
|
(#any-of? @_function
|
||||||
"fprintf" "fprintf_s"
|
"fprintf" "fprintf_s"
|
||||||
|
|
@ -61,8 +68,14 @@
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @_function
|
function: (identifier) @_function
|
||||||
arguments: (argument_list
|
arguments:
|
||||||
(_) . (_) . (string_literal (string_content) @injection.content)))
|
(argument_list
|
||||||
|
(_)
|
||||||
|
.
|
||||||
|
(_)
|
||||||
|
.
|
||||||
|
(string_literal
|
||||||
|
(string_content) @injection.content)))
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @_function
|
(#any-of? @_function
|
||||||
"sprintf_s"
|
"sprintf_s"
|
||||||
|
|
@ -79,10 +92,17 @@
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @_function
|
function: (identifier) @_function
|
||||||
arguments: (argument_list
|
arguments:
|
||||||
(_) . (_) . (_) . (string_literal (string_content) @injection.content)))
|
(argument_list
|
||||||
(#any-of? @_function "mvwprintw"
|
(_)
|
||||||
"mvwscanw")
|
.
|
||||||
|
(_)
|
||||||
|
.
|
||||||
|
(_)
|
||||||
|
.
|
||||||
|
(string_literal
|
||||||
|
(string_content) @injection.content)))
|
||||||
|
(#any-of? @_function "mvwprintw" "mvwscanw")
|
||||||
(#set! injection.language "printf"))
|
(#set! injection.language "printf"))
|
||||||
|
|
||||||
; TODO: add when asm is added
|
; TODO: add when asm is added
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,61 @@
|
||||||
;; Functions definitions
|
; Functions definitions
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (identifier) @local.definition.function)
|
declarator: (identifier) @local.definition.function)
|
||||||
|
|
||||||
(preproc_function_def
|
(preproc_function_def
|
||||||
name: (identifier) @local.definition.macro) @local.scope
|
name: (identifier) @local.definition.macro) @local.scope
|
||||||
|
|
||||||
(preproc_def
|
(preproc_def
|
||||||
name: (identifier) @local.definition.macro)
|
name: (identifier) @local.definition.macro)
|
||||||
|
|
||||||
(pointer_declarator
|
(pointer_declarator
|
||||||
declarator: (identifier) @local.definition.var)
|
declarator: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
declarator: (identifier) @local.definition.parameter)
|
declarator: (identifier) @local.definition.parameter)
|
||||||
|
|
||||||
(init_declarator
|
(init_declarator
|
||||||
declarator: (identifier) @local.definition.var)
|
declarator: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(array_declarator
|
(array_declarator
|
||||||
declarator: (identifier) @local.definition.var)
|
declarator: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(declaration
|
(declaration
|
||||||
declarator: (identifier) @local.definition.var)
|
declarator: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(enum_specifier
|
(enum_specifier
|
||||||
name: (_) @local.definition.type
|
name: (_) @local.definition.type
|
||||||
(enumerator_list
|
(enumerator_list
|
||||||
(enumerator name: (identifier) @local.definition.var)))
|
(enumerator
|
||||||
|
name: (identifier) @local.definition.var)))
|
||||||
|
|
||||||
;; Type / Struct / Enum
|
; Type / Struct / Enum
|
||||||
(field_declaration
|
(field_declaration
|
||||||
declarator: (field_identifier) @local.definition.field)
|
declarator: (field_identifier) @local.definition.field)
|
||||||
|
|
||||||
(type_definition
|
(type_definition
|
||||||
declarator: (type_identifier) @local.definition.type)
|
declarator: (type_identifier) @local.definition.type)
|
||||||
|
|
||||||
(struct_specifier
|
(struct_specifier
|
||||||
name: (type_identifier) @local.definition.type)
|
name: (type_identifier) @local.definition.type)
|
||||||
|
|
||||||
;; goto
|
; goto
|
||||||
(labeled_statement (statement_identifier) @local.definition)
|
(labeled_statement
|
||||||
|
(statement_identifier) @local.definition)
|
||||||
|
|
||||||
;; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
((field_identifier) @local.reference
|
((field_identifier) @local.reference
|
||||||
(#set! reference.kind "field"))
|
(#set! reference.kind "field"))
|
||||||
|
|
||||||
((type_identifier) @local.reference
|
((type_identifier) @local.reference
|
||||||
(#set! reference.kind "type"))
|
(#set! reference.kind "type"))
|
||||||
|
|
||||||
(goto_statement (statement_identifier) @local.reference)
|
(goto_statement
|
||||||
|
(statement_identifier) @local.reference)
|
||||||
|
|
||||||
;; Scope
|
; Scope
|
||||||
[
|
[
|
||||||
(for_statement)
|
(for_statement)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
body: [
|
body:
|
||||||
|
[
|
||||||
(declaration_list)
|
(declaration_list)
|
||||||
(switch_body)
|
(switch_body)
|
||||||
(enum_member_declaration_list)
|
(enum_member_declaration_list)
|
||||||
] @fold
|
] @fold
|
||||||
|
accessors: (accessor_list) @fold
|
||||||
accessors: [
|
initializer: (initializer_expression) @fold
|
||||||
(accessor_list)
|
|
||||||
] @fold
|
|
||||||
|
|
||||||
initializer: [
|
|
||||||
(initializer_expression)
|
|
||||||
] @fold
|
|
||||||
|
|
||||||
(block) @fold
|
(block) @fold
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,17 @@
|
||||||
name: (identifier) @function.method.call))
|
name: (identifier) @function.method.call))
|
||||||
|
|
||||||
(invocation_expression
|
(invocation_expression
|
||||||
function: (conditional_access_expression
|
function:
|
||||||
|
(conditional_access_expression
|
||||||
(member_binding_expression
|
(member_binding_expression
|
||||||
name: (identifier) @function.method.call)))
|
name: (identifier) @function.method.call)))
|
||||||
|
|
||||||
(namespace_declaration
|
(namespace_declaration
|
||||||
name: [(qualified_name) (identifier)] @module)
|
name:
|
||||||
|
[
|
||||||
|
(qualified_name)
|
||||||
|
(identifier)
|
||||||
|
] @module)
|
||||||
|
|
||||||
(qualified_name
|
(qualified_name
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
@ -57,9 +62,11 @@
|
||||||
type: (identifier) @type))
|
type: (identifier) @type))
|
||||||
|
|
||||||
(integer_literal) @number
|
(integer_literal) @number
|
||||||
|
|
||||||
(real_literal) @number.float
|
(real_literal) @number.float
|
||||||
|
|
||||||
(null_literal) @constant.builtin
|
(null_literal) @constant.builtin
|
||||||
|
|
||||||
(character_literal) @character
|
(character_literal) @character
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -70,9 +77,7 @@
|
||||||
|
|
||||||
(boolean_literal) @boolean
|
(boolean_literal) @boolean
|
||||||
|
|
||||||
[
|
(predefined_type) @type.builtin
|
||||||
(predefined_type)
|
|
||||||
] @type.builtin
|
|
||||||
|
|
||||||
(implicit_type) @keyword
|
(implicit_type) @keyword
|
||||||
|
|
||||||
|
|
@ -83,6 +88,7 @@
|
||||||
|
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^///[^/]"))
|
(#lua-match? @comment.documentation "^///[^/]"))
|
||||||
|
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^///$"))
|
(#lua-match? @comment.documentation "^///$"))
|
||||||
|
|
||||||
|
|
@ -90,7 +96,8 @@
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
(using_directive
|
(using_directive
|
||||||
(name_equals (identifier) @type.definition))
|
(name_equals
|
||||||
|
(identifier) @type.definition))
|
||||||
|
|
||||||
(property_declaration
|
(property_declaration
|
||||||
name: (identifier) @property)
|
name: (identifier) @property)
|
||||||
|
|
@ -106,20 +113,25 @@
|
||||||
|
|
||||||
(interface_declaration
|
(interface_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(class_declaration
|
(class_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(record_declaration
|
(record_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(enum_declaration
|
(enum_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(constructor_declaration
|
(constructor_declaration
|
||||||
name: (identifier) @constructor)
|
name: (identifier) @constructor)
|
||||||
(constructor_initializer [
|
|
||||||
"base" @constructor
|
(constructor_initializer
|
||||||
])
|
"base" @constructor)
|
||||||
|
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
(object_creation_expression
|
(object_creation_expression
|
||||||
(identifier) @type)
|
(identifier) @type)
|
||||||
|
|
||||||
|
|
@ -149,12 +161,16 @@
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
|
|
||||||
(_
|
(_
|
||||||
type: (generic_name
|
type:
|
||||||
|
(generic_name
|
||||||
(identifier) @type))
|
(identifier) @type))
|
||||||
|
|
||||||
; Generic Method invocation with generic type
|
; Generic Method invocation with generic type
|
||||||
(invocation_expression
|
(invocation_expression
|
||||||
function: (generic_name
|
function:
|
||||||
. (identifier) @function.method.call))
|
(generic_name
|
||||||
|
.
|
||||||
|
(identifier) @function.method.call))
|
||||||
|
|
||||||
(invocation_expression
|
(invocation_expression
|
||||||
(member_access_expression
|
(member_access_expression
|
||||||
|
|
@ -197,20 +213,24 @@
|
||||||
(identifier) @variable.parameter)
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
(warning_directive) @comment.warning
|
(warning_directive) @comment.warning
|
||||||
|
|
||||||
(error_directive) @keyword.exception
|
(error_directive) @keyword.exception
|
||||||
|
|
||||||
(define_directive
|
(define_directive
|
||||||
(identifier) @constant) @constant.macro
|
(identifier) @constant) @constant.macro
|
||||||
|
|
||||||
(undef_directive
|
(undef_directive
|
||||||
(identifier) @constant) @constant.macro
|
(identifier) @constant) @constant.macro
|
||||||
|
|
||||||
(line_directive) @constant.macro
|
(line_directive) @constant.macro
|
||||||
|
|
||||||
(line_directive
|
(line_directive
|
||||||
(preproc_integer_literal) @constant
|
(preproc_integer_literal) @constant
|
||||||
(preproc_string_literal)? @string)
|
(preproc_string_literal)? @string)
|
||||||
|
|
||||||
(pragma_directive
|
(pragma_directive
|
||||||
(identifier) @constant) @constant.macro
|
(identifier) @constant) @constant.macro
|
||||||
|
|
||||||
(pragma_directive
|
(pragma_directive
|
||||||
(preproc_string_literal) @string) @constant.macro
|
(preproc_string_literal) @string) @constant.macro
|
||||||
|
|
||||||
|
|
@ -235,6 +255,7 @@
|
||||||
|
|
||||||
(if_directive
|
(if_directive
|
||||||
(identifier) @constant)
|
(identifier) @constant)
|
||||||
|
|
||||||
(elif_directive
|
(elif_directive
|
||||||
(identifier) @constant)
|
(identifier) @constant)
|
||||||
|
|
||||||
|
|
@ -304,7 +325,11 @@
|
||||||
":"
|
":"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
(conditional_expression ["?" ":"] @keyword.conditional.ternary)
|
(conditional_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
[
|
[
|
||||||
"["
|
"["
|
||||||
|
|
@ -315,7 +340,11 @@
|
||||||
")"
|
")"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
(type_argument_list ["<" ">"] @punctuation.bracket)
|
(type_argument_list
|
||||||
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
[
|
[
|
||||||
(this_expression)
|
(this_expression)
|
||||||
|
|
@ -328,7 +357,8 @@
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
(alias_qualified_name
|
(alias_qualified_name
|
||||||
(identifier "global") @keyword.import)
|
(identifier
|
||||||
|
"global") @keyword.import)
|
||||||
|
|
||||||
[
|
[
|
||||||
"with"
|
"with"
|
||||||
|
|
@ -401,7 +431,8 @@
|
||||||
(parameter_modifier) @operator
|
(parameter_modifier) @operator
|
||||||
|
|
||||||
(query_expression
|
(query_expression
|
||||||
(_ [
|
(_
|
||||||
|
[
|
||||||
"from"
|
"from"
|
||||||
"orderby"
|
"orderby"
|
||||||
"select"
|
"select"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
;; Definitions
|
; Definitions
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
. (identifier) @local.definition.var)
|
.
|
||||||
|
(identifier) @local.definition.var)
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
(tuple_pattern
|
(tuple_pattern
|
||||||
|
|
@ -13,7 +14,8 @@
|
||||||
left: (identifier) @local.definition.var)
|
left: (identifier) @local.definition.var)
|
||||||
|
|
||||||
(for_each_statement
|
(for_each_statement
|
||||||
left: (tuple_pattern
|
left:
|
||||||
|
(tuple_pattern
|
||||||
(identifier) @local.definition.var))
|
(identifier) @local.definition.var))
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
|
|
@ -34,8 +36,8 @@
|
||||||
(class_declaration
|
(class_declaration
|
||||||
name: (identifier) @local.definition)
|
name: (identifier) @local.definition)
|
||||||
|
|
||||||
;; References
|
; References
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
;; Scope
|
; Scope
|
||||||
(block) @local.scope
|
(block) @local.scope
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,16 @@
|
||||||
(enum_item)
|
(enum_item)
|
||||||
(impl_item)
|
(impl_item)
|
||||||
(type_item)
|
(type_item)
|
||||||
|
|
||||||
(use_declaration)
|
(use_declaration)
|
||||||
(let_declaration)
|
(let_declaration)
|
||||||
(namespace_definition)
|
(namespace_definition)
|
||||||
|
|
||||||
(arguments)
|
(arguments)
|
||||||
(implicit_arguments)
|
(implicit_arguments)
|
||||||
(tuple_type)
|
(tuple_type)
|
||||||
|
|
||||||
(import_statement)
|
(import_statement)
|
||||||
(attribute_statement)
|
(attribute_statement)
|
||||||
(with_statement)
|
(with_statement)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
|
|
||||||
(function_definition)
|
(function_definition)
|
||||||
(struct_definition)
|
(struct_definition)
|
||||||
(loop_expression)
|
(loop_expression)
|
||||||
|
|
@ -26,6 +22,5 @@
|
||||||
(match_expression)
|
(match_expression)
|
||||||
(call_expression)
|
(call_expression)
|
||||||
(tuple_expression)
|
(tuple_expression)
|
||||||
|
|
||||||
(attribute_item)
|
(attribute_item)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,18 @@
|
||||||
; Preproc
|
; Preproc
|
||||||
|
|
||||||
[
|
[
|
||||||
"%builtins"
|
"%builtins"
|
||||||
"%lang"
|
"%lang"
|
||||||
] @keyword.directive
|
] @keyword.directive
|
||||||
|
|
||||||
; Includes
|
; Includes
|
||||||
|
(import_statement
|
||||||
(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . ))
|
[
|
||||||
|
"from"
|
||||||
|
"import"
|
||||||
|
] @keyword.import
|
||||||
|
module_name:
|
||||||
|
(dotted_name
|
||||||
|
(identifier) @module .))
|
||||||
|
|
||||||
[
|
[
|
||||||
"as"
|
"as"
|
||||||
|
|
@ -16,19 +21,20 @@
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
; Namespaces
|
; Namespaces
|
||||||
|
(namespace_definition
|
||||||
(namespace_definition (identifier) @module)
|
(identifier) @module)
|
||||||
|
|
||||||
(mod_item
|
(mod_item
|
||||||
name: (identifier) @module)
|
name: (identifier) @module)
|
||||||
|
|
||||||
(use_list (self) @module)
|
(use_list
|
||||||
|
(self) @module)
|
||||||
|
|
||||||
(scoped_use_list (self) @module)
|
(scoped_use_list
|
||||||
|
(self) @module)
|
||||||
|
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
path: (identifier) @module)
|
path: (identifier) @module)
|
||||||
|
|
@ -68,17 +74,25 @@
|
||||||
path: (identifier) @module)
|
path: (identifier) @module)
|
||||||
|
|
||||||
(scoped_use_list
|
(scoped_use_list
|
||||||
path: (scoped_identifier
|
path:
|
||||||
|
(scoped_identifier
|
||||||
(identifier) @module))
|
(identifier) @module))
|
||||||
|
|
||||||
(use_list (scoped_identifier (identifier) @module . (_)))
|
(use_list
|
||||||
|
(scoped_identifier
|
||||||
|
(identifier) @module
|
||||||
|
.
|
||||||
|
(_)))
|
||||||
|
|
||||||
(use_list (identifier) @type (#lua-match? @type "^[A-Z]"))
|
(use_list
|
||||||
|
(identifier) @type
|
||||||
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]"))
|
(use_as_clause
|
||||||
|
alias: (identifier) @type
|
||||||
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
; 0.x
|
; 0.x
|
||||||
"using"
|
"using"
|
||||||
|
|
@ -96,7 +110,6 @@
|
||||||
"with"
|
"with"
|
||||||
"call"
|
"call"
|
||||||
"nondet"
|
"nondet"
|
||||||
|
|
||||||
; 1.0
|
; 1.0
|
||||||
"type"
|
"type"
|
||||||
"impl"
|
"impl"
|
||||||
|
|
@ -133,9 +146,7 @@
|
||||||
"match"
|
"match"
|
||||||
] @keyword.conditional
|
] @keyword.conditional
|
||||||
|
|
||||||
[
|
"loop" @keyword.repeat
|
||||||
"loop"
|
|
||||||
] @keyword.repeat
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"assert"
|
"assert"
|
||||||
|
|
@ -144,33 +155,52 @@
|
||||||
] @keyword.exception
|
] @keyword.exception
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
|
(implicit_arguments
|
||||||
|
(typed_identifier
|
||||||
|
(identifier) @variable.member))
|
||||||
|
|
||||||
(implicit_arguments (typed_identifier (identifier) @variable.member))
|
(member_expression
|
||||||
|
"."
|
||||||
|
(identifier) @variable.member)
|
||||||
|
|
||||||
(member_expression "." (identifier) @variable.member)
|
(call_expression
|
||||||
|
(assignment_expression
|
||||||
|
left: (identifier) @variable.member))
|
||||||
|
|
||||||
(call_expression (assignment_expression left: (identifier) @variable.member))
|
(tuple_expression
|
||||||
|
(assignment_expression
|
||||||
(tuple_expression (assignment_expression left: (identifier) @variable.member))
|
left: (identifier) @variable.member))
|
||||||
|
|
||||||
(field_identifier) @variable.member
|
(field_identifier) @variable.member
|
||||||
|
|
||||||
(shorthand_field_initializer (identifier) @variable.member)
|
(shorthand_field_initializer
|
||||||
|
(identifier) @variable.member)
|
||||||
|
|
||||||
; Parameters
|
; Parameters
|
||||||
|
(arguments
|
||||||
|
(typed_identifier
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
(arguments (typed_identifier (identifier) @variable.parameter))
|
(call_expression
|
||||||
|
(tuple_expression
|
||||||
|
(assignment_expression
|
||||||
|
left: (identifier) @variable.parameter)))
|
||||||
|
|
||||||
(call_expression (tuple_expression (assignment_expression left: (identifier) @variable.parameter)))
|
(return_type
|
||||||
|
(tuple_type
|
||||||
|
(named_type
|
||||||
|
.
|
||||||
|
(identifier) @variable.parameter)))
|
||||||
|
|
||||||
(return_type (tuple_type (named_type . (identifier) @variable.parameter)))
|
(parameter
|
||||||
|
(identifier) @variable.parameter)
|
||||||
(parameter (identifier) @variable.parameter)
|
|
||||||
|
|
||||||
; Builtins
|
; Builtins
|
||||||
|
(builtin_directive
|
||||||
|
(identifier) @variable.builtin)
|
||||||
|
|
||||||
(builtin_directive (identifier) @variable.builtin)
|
(lang_directive
|
||||||
(lang_directive (identifier) @variable.builtin)
|
(identifier) @variable.builtin)
|
||||||
|
|
||||||
[
|
[
|
||||||
"ap"
|
"ap"
|
||||||
|
|
@ -179,32 +209,45 @@
|
||||||
] @variable.builtin
|
] @variable.builtin
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
(function_definition
|
||||||
|
"func"
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(function_definition "func" (identifier) @function)
|
(function_definition
|
||||||
(function_definition "fn" (identifier) @function)
|
"fn"
|
||||||
(function_signature "fn" (identifier) @function)
|
(identifier) @function)
|
||||||
(extern_function_statement (identifier) @function)
|
|
||||||
|
(function_signature
|
||||||
|
"fn"
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
|
(extern_function_statement
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (scoped_identifier
|
function:
|
||||||
|
(scoped_identifier
|
||||||
(identifier) @function.call .))
|
(identifier) @function.call .))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (field_expression
|
function:
|
||||||
|
(field_expression
|
||||||
field: (field_identifier) @function.call))
|
field: (field_identifier) @function.call))
|
||||||
|
|
||||||
[
|
"jmp" @function.builtin
|
||||||
"jmp"
|
|
||||||
] @function.builtin
|
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
(struct_definition
|
||||||
|
.
|
||||||
|
(identifier) @type
|
||||||
|
(typed_identifier
|
||||||
|
(identifier) @variable.member)?)
|
||||||
|
|
||||||
(struct_definition . (identifier) @type (typed_identifier (identifier) @variable.member)?)
|
(named_type
|
||||||
|
(identifier) @type .)
|
||||||
(named_type (identifier) @type .)
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(builtin_type)
|
(builtin_type)
|
||||||
|
|
@ -217,7 +260,6 @@
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
|
(#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
|
||||||
|
|
||||||
|
|
@ -225,17 +267,21 @@
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (scoped_identifier
|
function:
|
||||||
|
(scoped_identifier
|
||||||
"::"
|
"::"
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
(#lua-match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
((match_arm
|
((match_arm
|
||||||
pattern: (match_pattern (identifier) @constant))
|
pattern:
|
||||||
|
(match_pattern
|
||||||
|
(identifier) @constant))
|
||||||
(#lua-match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
||||||
((match_arm
|
((match_arm
|
||||||
pattern: (match_pattern
|
pattern:
|
||||||
|
(match_pattern
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
name: (identifier) @constant)))
|
name: (identifier) @constant)))
|
||||||
(#lua-match? @constant "^[A-Z]"))
|
(#lua-match? @constant "^[A-Z]"))
|
||||||
|
|
@ -244,30 +290,45 @@
|
||||||
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
||||||
|
|
||||||
; Constructors
|
; Constructors
|
||||||
|
(unary_expression
|
||||||
|
"new"
|
||||||
|
(call_expression
|
||||||
|
.
|
||||||
|
(identifier) @constructor))
|
||||||
|
|
||||||
(unary_expression "new" (call_expression . (identifier) @constructor))
|
((call_expression
|
||||||
|
.
|
||||||
((call_expression . (identifier) @constructor)
|
(identifier) @constructor)
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
; Attributes
|
; Attributes
|
||||||
|
(decorator
|
||||||
|
"@" @attribute
|
||||||
|
(identifier) @attribute)
|
||||||
|
|
||||||
(decorator "@" @attribute (identifier) @attribute)
|
(attribute_item
|
||||||
|
(identifier) @function.macro)
|
||||||
|
|
||||||
(attribute_item (identifier) @function.macro)
|
(attribute_item
|
||||||
|
(scoped_identifier
|
||||||
(attribute_item (scoped_identifier (identifier) @function.macro .))
|
(identifier) @function.macro .))
|
||||||
|
|
||||||
; Labels
|
; Labels
|
||||||
|
(label
|
||||||
|
.
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
(label . (identifier) @label)
|
(inst_jmp_to_label
|
||||||
|
"jmp"
|
||||||
|
.
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
(inst_jmp_to_label "jmp" . (identifier) @label)
|
(inst_jnz_to_label
|
||||||
|
"jmp"
|
||||||
(inst_jnz_to_label "jmp" . (identifier) @label)
|
.
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
|
|
@ -307,7 +368,6 @@
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
(boolean) @boolean
|
(boolean) @boolean
|
||||||
|
|
@ -318,17 +378,41 @@
|
||||||
] @string
|
] @string
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
(attribute_item
|
||||||
|
"#" @punctuation.special)
|
||||||
|
|
||||||
(attribute_item "#" @punctuation.special)
|
[
|
||||||
|
"."
|
||||||
|
","
|
||||||
|
":"
|
||||||
|
";"
|
||||||
|
"->"
|
||||||
|
"=>"
|
||||||
|
"::"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"%{"
|
||||||
|
"%}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket
|
(type_parameters
|
||||||
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
(type_parameters [ "<" ">" ] @punctuation.bracket)
|
(type_arguments
|
||||||
|
[
|
||||||
(type_arguments [ "<" ">" ] @punctuation.bracket)
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
; Comment
|
; Comment
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,36 @@
|
||||||
(tuple_pattern)
|
(tuple_pattern)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
(import_statement "(") @indent.begin
|
(import_statement
|
||||||
|
"(") @indent.begin
|
||||||
|
|
||||||
|
(block
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
(block "}" @indent.end)
|
|
||||||
(enum_item
|
(enum_item
|
||||||
body: (enum_variant_list "}" @indent.end))
|
body:
|
||||||
|
(enum_variant_list
|
||||||
|
"}" @indent.end))
|
||||||
|
|
||||||
(match_expression
|
(match_expression
|
||||||
body: (match_block "}" @indent.end))
|
body:
|
||||||
|
(match_block
|
||||||
|
"}" @indent.end))
|
||||||
|
|
||||||
(mod_item
|
(mod_item
|
||||||
body: (declaration_list "}" @indent.end))
|
body:
|
||||||
|
(declaration_list
|
||||||
|
"}" @indent.end))
|
||||||
|
|
||||||
(struct_item
|
(struct_item
|
||||||
body: (field_declaration_list "}" @indent.end))
|
body:
|
||||||
|
(field_declaration_list
|
||||||
|
"}" @indent.end))
|
||||||
|
|
||||||
(trait_item
|
(trait_item
|
||||||
body: (declaration_list "}" @indent.end))
|
body:
|
||||||
|
(declaration_list
|
||||||
|
"}" @indent.end))
|
||||||
|
|
||||||
[
|
[
|
||||||
")"
|
")"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
(python_code) @python
|
((python_code) @injection.content
|
||||||
|
(#set! injection.language "python"))
|
||||||
|
|
||||||
(comment) @comment
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
; References
|
; References
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
((type_identifier) @local.reference
|
((type_identifier) @local.reference
|
||||||
(#set! reference.kind "type"))
|
(#set! reference.kind "type"))
|
||||||
|
|
||||||
((field_identifier) @local.reference
|
((field_identifier) @local.reference
|
||||||
(#set! reference.kind "field"))
|
(#set! reference.kind "field"))
|
||||||
|
|
||||||
; Scopes
|
; Scopes
|
||||||
|
|
||||||
[
|
[
|
||||||
(program)
|
(program)
|
||||||
(block)
|
(block)
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
(if_expression)
|
(if_expression)
|
||||||
(match_expression)
|
(match_expression)
|
||||||
(match_arm)
|
(match_arm)
|
||||||
|
|
||||||
(struct_item)
|
(struct_item)
|
||||||
(enum_item)
|
(enum_item)
|
||||||
(impl_item)
|
(impl_item)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
(use_declaration
|
(use_declaration
|
||||||
argument: (scoped_identifier
|
argument:
|
||||||
|
(scoped_identifier
|
||||||
name: (identifier) @local.definition.import))
|
name: (identifier) @local.definition.import))
|
||||||
|
|
||||||
(use_as_clause
|
(use_as_clause
|
||||||
|
|
@ -33,21 +33,22 @@
|
||||||
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
(identifier) @local.definition.function)
|
(identifier) @local.definition.function)
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
(identifier) @local.definition.method
|
(identifier) @local.definition.method
|
||||||
(parameter (self)))
|
(parameter
|
||||||
|
(self)))
|
||||||
|
|
||||||
; Function with parameters, defines parameters
|
; Function with parameters, defines parameters
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
[ (identifier) (self) ] @local.definition.parameter)
|
[
|
||||||
|
(identifier)
|
||||||
|
(self)
|
||||||
|
] @local.definition.parameter)
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
||||||
(struct_item
|
(struct_item
|
||||||
name: (type_identifier) @local.definition.type)
|
name: (type_identifier) @local.definition.type)
|
||||||
|
|
||||||
|
|
@ -58,11 +59,9 @@
|
||||||
name: (type_identifier) @local.definition.type)
|
name: (type_identifier) @local.definition.type)
|
||||||
|
|
||||||
; Module
|
; Module
|
||||||
|
|
||||||
(mod_item
|
(mod_item
|
||||||
name: (identifier) @local.definition.namespace)
|
name: (identifier) @local.definition.namespace)
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (identifier) @local.definition.var)
|
left: (identifier) @local.definition.var)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
; Preproc
|
; Preproc
|
||||||
|
|
||||||
[
|
[
|
||||||
(unique_id)
|
(unique_id)
|
||||||
(top_level_annotation_body)
|
(top_level_annotation_body)
|
||||||
] @keyword.directive
|
] @keyword.directive
|
||||||
|
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
[
|
[
|
||||||
"import"
|
"import"
|
||||||
"$import"
|
"$import"
|
||||||
|
|
@ -17,7 +15,6 @@
|
||||||
(import_path) @string.special.path
|
(import_path) @string.special.path
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"annotation"
|
"annotation"
|
||||||
"enum"
|
"enum"
|
||||||
|
|
@ -30,10 +27,7 @@
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
; Builtins
|
; Builtins
|
||||||
|
"const" @type.qualifier
|
||||||
[
|
|
||||||
"const"
|
|
||||||
] @type.qualifier
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(primitive_type)
|
(primitive_type)
|
||||||
|
|
@ -41,30 +35,24 @@
|
||||||
] @type.builtin
|
] @type.builtin
|
||||||
|
|
||||||
; Typedefs
|
; Typedefs
|
||||||
|
|
||||||
(type_definition) @type.definition
|
(type_definition) @type.definition
|
||||||
|
|
||||||
; Labels (@number, @number!)
|
; Labels (@number, @number!)
|
||||||
|
|
||||||
(field_version) @label
|
(field_version) @label
|
||||||
|
|
||||||
; Methods
|
; Methods
|
||||||
|
|
||||||
[
|
[
|
||||||
(annotation_definition_identifier)
|
(annotation_definition_identifier)
|
||||||
(method_identifier)
|
(method_identifier)
|
||||||
] @function.method
|
] @function.method
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
|
|
||||||
(field_identifier) @variable.member
|
(field_identifier) @variable.member
|
||||||
|
|
||||||
; Properties
|
; Properties
|
||||||
|
|
||||||
(property) @property
|
(property) @property
|
||||||
|
|
||||||
; Parameters
|
; Parameters
|
||||||
|
|
||||||
[
|
[
|
||||||
(param_identifier)
|
(param_identifier)
|
||||||
(return_identifier)
|
(return_identifier)
|
||||||
|
|
@ -73,7 +61,6 @@
|
||||||
(annotation_target) @variable.parameter.builtin
|
(annotation_target) @variable.parameter.builtin
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
|
|
||||||
[
|
[
|
||||||
(const_identifier)
|
(const_identifier)
|
||||||
(local_const)
|
(local_const)
|
||||||
|
|
@ -83,7 +70,6 @@
|
||||||
(void) @constant.builtin
|
(void) @constant.builtin
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
||||||
[
|
[
|
||||||
(enum_identifier)
|
(enum_identifier)
|
||||||
(extend_type)
|
(extend_type)
|
||||||
|
|
@ -91,18 +77,15 @@
|
||||||
] @type
|
] @type
|
||||||
|
|
||||||
; Attributes
|
; Attributes
|
||||||
|
|
||||||
[
|
[
|
||||||
(annotation_identifier)
|
(annotation_identifier)
|
||||||
(attribute)
|
(attribute)
|
||||||
] @attribute
|
] @attribute
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
"=" @operator
|
"=" @operator
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
[
|
[
|
||||||
(string)
|
(string)
|
||||||
(concatenated_string)
|
(concatenated_string)
|
||||||
|
|
@ -125,18 +108,26 @@
|
||||||
(data_hex) @string.special.symbol
|
(data_hex) @string.special.symbol
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
"*"
|
"*"
|
||||||
"$"
|
"$"
|
||||||
":"
|
":"
|
||||||
] @punctuation.special
|
] @punctuation.special
|
||||||
|
|
||||||
["{" "}"] @punctuation.bracket
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
["(" ")"] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
["[" "]"] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
"."
|
"."
|
||||||
|
|
@ -146,5 +137,4 @@
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
; Comments
|
; Comments
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,17 @@
|
||||||
(field)
|
(field)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
((struct_shorthand (property)) @indent.align
|
((struct_shorthand
|
||||||
|
(property)) @indent.align
|
||||||
(#set! indent.open_delimiter "(")
|
(#set! indent.open_delimiter "(")
|
||||||
(#set! indent.close_delimiter ")"))
|
(#set! indent.close_delimiter ")"))
|
||||||
|
|
||||||
((method (field_version)) @indent.align
|
((method
|
||||||
|
(field_version)) @indent.align
|
||||||
(#set! indent.open_delimiter field_version))
|
(#set! indent.open_delimiter field_version))
|
||||||
|
|
||||||
((const_list (const_value)) @indent.align
|
((const_list
|
||||||
|
(const_value)) @indent.align
|
||||||
(#set! indent.open_delimiter "[")
|
(#set! indent.open_delimiter "[")
|
||||||
(#set! indent.close_delimiter "]"))
|
(#set! indent.close_delimiter "]"))
|
||||||
|
|
||||||
|
|
@ -31,7 +34,6 @@
|
||||||
")"
|
")"
|
||||||
] @indent.end @indent.branch
|
] @indent.end @indent.branch
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(ERROR)
|
(ERROR)
|
||||||
(comment)
|
(comment)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@
|
||||||
(extend_type)
|
(extend_type)
|
||||||
(field_type)
|
(field_type)
|
||||||
] @local.reference
|
] @local.reference
|
||||||
(custom_type (type_identifier) @local.reference)
|
|
||||||
|
(custom_type
|
||||||
|
(type_identifier) @local.reference)
|
||||||
|
|
||||||
(custom_type
|
(custom_type
|
||||||
(generics
|
(generics
|
||||||
(generic_parameters
|
(generic_parameters
|
||||||
|
|
@ -28,7 +31,8 @@
|
||||||
|
|
||||||
(const_identifier) @local.definition.constant
|
(const_identifier) @local.definition.constant
|
||||||
|
|
||||||
(enum (enum_identifier) @local.definition.enum)
|
(enum
|
||||||
|
(enum_identifier) @local.definition.enum)
|
||||||
|
|
||||||
[
|
[
|
||||||
(enum_member)
|
(enum_member)
|
||||||
|
|
@ -44,16 +48,19 @@
|
||||||
(return_identifier)
|
(return_identifier)
|
||||||
] @local.definition.parameter
|
] @local.definition.parameter
|
||||||
|
|
||||||
(group (type_identifier) @local.definition.type)
|
(group
|
||||||
|
(type_identifier) @local.definition.type)
|
||||||
|
|
||||||
(struct (type_identifier) @local.definition.type)
|
(struct
|
||||||
|
(type_identifier) @local.definition.type)
|
||||||
|
|
||||||
(union (type_identifier) @local.definition.type)
|
(union
|
||||||
|
(type_identifier) @local.definition.type)
|
||||||
|
|
||||||
(interface (type_identifier) @local.definition.type)
|
(interface
|
||||||
|
(type_identifier) @local.definition.type)
|
||||||
|
|
||||||
; Generics Related (don't know how to combine these)
|
; Generics Related (don't know how to combine these)
|
||||||
|
|
||||||
(struct
|
(struct
|
||||||
(generics
|
(generics
|
||||||
(generic_parameters
|
(generic_parameters
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
;; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
"%["
|
"%["
|
||||||
"@["
|
"@["
|
||||||
|
|
@ -10,15 +9,24 @@
|
||||||
")"
|
")"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[":" ","] @punctuation.delimiter
|
[
|
||||||
|
":"
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
(["\"" "'"] @punctuation.special
|
([
|
||||||
|
"\""
|
||||||
|
"'"
|
||||||
|
] @punctuation.special
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
["%" "?" "#"] @character.special
|
[
|
||||||
|
"%"
|
||||||
;; Entities
|
"?"
|
||||||
|
"#"
|
||||||
|
] @character.special
|
||||||
|
|
||||||
|
; Entities
|
||||||
(intent) @module
|
(intent) @module
|
||||||
|
|
||||||
(slot) @type
|
(slot) @type
|
||||||
|
|
@ -35,16 +43,13 @@
|
||||||
|
|
||||||
(escape) @string.escape
|
(escape) @string.escape
|
||||||
|
|
||||||
;; Import
|
; Import
|
||||||
|
|
||||||
"import" @keyword.import
|
"import" @keyword.import
|
||||||
|
|
||||||
(file) @string.special.path
|
(file) @string.special.path
|
||||||
|
|
||||||
;; Text
|
; Text
|
||||||
|
|
||||||
(word) @spell
|
(word) @spell
|
||||||
|
|
||||||
;; Comment
|
; Comment
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,5 @@
|
||||||
(alias_def)
|
(alias_def)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
(ERROR "]") @indent.begin
|
(ERROR
|
||||||
|
"]") @indent.begin
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,16 @@
|
||||||
;; Definitions
|
; Definitions
|
||||||
|
(intent_def
|
||||||
|
(intent) @local.definition)
|
||||||
|
|
||||||
(intent_def (intent) @local.definition)
|
(slot_def
|
||||||
(slot_def (slot) @local.definition)
|
(slot) @local.definition)
|
||||||
(alias_def (alias) @local.definition)
|
|
||||||
|
|
||||||
;; References
|
(alias_def
|
||||||
|
(alias) @local.definition)
|
||||||
|
|
||||||
(slot_ref (slot) @local.reference)
|
; References
|
||||||
(alias_ref (alias) @local.reference)
|
(slot_ref
|
||||||
|
(slot) @local.reference)
|
||||||
|
|
||||||
|
(alias_ref
|
||||||
|
(alias) @local.reference)
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
(source (list_lit) @fold)
|
(source
|
||||||
|
(list_lit) @fold)
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,57 @@
|
||||||
;; >> Explanation
|
; >> Explanation
|
||||||
;; Parsers for lisps are a bit weird in that they just return the raw forms.
|
; Parsers for lisps are a bit weird in that they just return the raw forms.
|
||||||
;; This means we have to do a bit of extra work in the queries to get things
|
; This means we have to do a bit of extra work in the queries to get things
|
||||||
;; highlighted as they should be.
|
; highlighted as they should be.
|
||||||
;;
|
;
|
||||||
;; For the most part this means that some things have to be assigned multiple
|
; For the most part this means that some things have to be assigned multiple
|
||||||
;; groups.
|
; groups.
|
||||||
;; By doing this we can add a basic capture and then later refine it with more
|
; By doing this we can add a basic capture and then later refine it with more
|
||||||
;; specialized captures.
|
; specialized captures.
|
||||||
;; This can mean that sometimes things are highlighted weirdly because they
|
; This can mean that sometimes things are highlighted weirdly because they
|
||||||
;; have multiple highlight groups applied to them.
|
; have multiple highlight groups applied to them.
|
||||||
|
; >> Literals
|
||||||
|
((dis_expr) @comment
|
||||||
;; >> Literals
|
(#set! "priority" 105)
|
||||||
|
; Higher priority to mark the whole sexpr as a comment
|
||||||
(
|
|
||||||
(dis_expr) @comment
|
|
||||||
(#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(kwd_lit) @string.special.symbol
|
(kwd_lit) @string.special.symbol
|
||||||
|
|
||||||
(str_lit) @string
|
(str_lit) @string
|
||||||
|
|
||||||
(num_lit) @number
|
(num_lit) @number
|
||||||
|
|
||||||
(char_lit) @character
|
(char_lit) @character
|
||||||
|
|
||||||
(bool_lit) @boolean
|
(bool_lit) @boolean
|
||||||
|
|
||||||
(nil_lit) @constant.builtin
|
(nil_lit) @constant.builtin
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
(regex_lit) @string.regexp
|
(regex_lit) @string.regexp
|
||||||
|
|
||||||
["'" "`"] @string.escape
|
[
|
||||||
|
"'"
|
||||||
|
"`"
|
||||||
|
] @string.escape
|
||||||
|
|
||||||
["~" "~@" "#"] @punctuation.special
|
[
|
||||||
|
"~"
|
||||||
|
"~@"
|
||||||
|
"#"
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
;; >> Symbols
|
"]"
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
; >> Symbols
|
||||||
; General symbol highlighting
|
; General symbol highlighting
|
||||||
(sym_lit) @variable
|
(sym_lit) @variable
|
||||||
|
|
||||||
|
|
@ -43,6 +59,7 @@
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @function.call)
|
(sym_lit) @function.call)
|
||||||
|
|
||||||
(anon_fn_lit
|
(anon_fn_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @function.call)
|
(sym_lit) @function.call)
|
||||||
|
|
@ -50,6 +67,7 @@
|
||||||
; Quoted symbols
|
; Quoted symbols
|
||||||
(quoting_lit
|
(quoting_lit
|
||||||
(sym_lit) @string.special.symbol)
|
(sym_lit) @string.special.symbol)
|
||||||
|
|
||||||
(syn_quoting_lit
|
(syn_quoting_lit
|
||||||
(sym_lit) @string.special.symbol)
|
(sym_lit) @string.special.symbol)
|
||||||
|
|
||||||
|
|
@ -84,19 +102,19 @@
|
||||||
|
|
||||||
; Builtin repl variables
|
; Builtin repl variables
|
||||||
((sym_lit) @variable.builtin
|
((sym_lit) @variable.builtin
|
||||||
(#any-of? @variable.builtin
|
(#any-of? @variable.builtin "*1" "*2" "*3" "*e"))
|
||||||
"*1" "*2" "*3" "*e"))
|
|
||||||
|
|
||||||
; Gensym
|
; Gensym
|
||||||
;; Might not be needed
|
; Might not be needed
|
||||||
((sym_lit) @variable
|
((sym_lit) @variable
|
||||||
(#lua-match? @variable "^.*#$"))
|
(#lua-match? @variable "^.*#$"))
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
;; TODO: improve?
|
; TODO: improve?
|
||||||
((sym_lit) @type
|
((sym_lit) @type
|
||||||
(#lua-match? @type "^[%u][^/]*$"))
|
(#lua-match? @type "^[%u][^/]*$"))
|
||||||
;; Symbols with `.` but not `/`
|
|
||||||
|
; Symbols with `.` but not `/`
|
||||||
((sym_lit) @type
|
((sym_lit) @type
|
||||||
(#lua-match? @type "^[^/]+[.][^/]*$"))
|
(#lua-match? @type "^[^/]+[.][^/]*$"))
|
||||||
|
|
||||||
|
|
@ -105,39 +123,39 @@
|
||||||
; (.instanceMember Classname args*)
|
; (.instanceMember Classname args*)
|
||||||
((sym_lit) @function.method
|
((sym_lit) @function.method
|
||||||
(#lua-match? @function.method "^%.[^-]"))
|
(#lua-match? @function.method "^%.[^-]"))
|
||||||
|
|
||||||
; (.-instanceField instance)
|
; (.-instanceField instance)
|
||||||
((sym_lit) @variable.member
|
((sym_lit) @variable.member
|
||||||
(#lua-match? @variable.member "^%.%-.*"))
|
(#lua-match? @variable.member "^%.%-.*"))
|
||||||
|
|
||||||
; Classname/staticField
|
; Classname/staticField
|
||||||
((sym_lit) @variable.member
|
((sym_lit) @variable.member
|
||||||
(#lua-match? @variable.member "^[%u].*/.+"))
|
(#lua-match? @variable.member "^[%u].*/.+"))
|
||||||
|
|
||||||
; (Classname/staticMethod args*)
|
; (Classname/staticMethod args*)
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @function.method
|
(sym_lit) @function.method
|
||||||
(#lua-match? @function.method "^[%u].*/.+"))
|
(#lua-match? @function.method "^[%u].*/.+"))
|
||||||
;; TODO: Special casing for the `.` macro
|
|
||||||
|
|
||||||
|
; TODO: Special casing for the `.` macro
|
||||||
; Operators
|
; Operators
|
||||||
((sym_lit) @operator
|
((sym_lit) @operator
|
||||||
(#any-of? @operator
|
(#any-of? @operator "*" "*'" "+" "+'" "-" "-'" "/" "<" "<=" ">" ">=" "=" "=="))
|
||||||
"*" "*'" "+" "+'" "-" "-'" "/"
|
|
||||||
"<" "<=" ">" ">=" "=" "=="))
|
|
||||||
((sym_lit) @keyword.operator
|
((sym_lit) @keyword.operator
|
||||||
(#any-of? @keyword.operator
|
(#any-of? @keyword.operator "not" "not=" "and" "or"))
|
||||||
"not" "not=" "and" "or"))
|
|
||||||
|
|
||||||
; Definition functions
|
; Definition functions
|
||||||
((sym_lit) @keyword
|
((sym_lit) @keyword
|
||||||
(#any-of? @keyword
|
(#any-of? @keyword "def" "defonce" "defrecord" "defmacro" "definline" "definterface" "defmulti" "defmethod" "defstruct" "defprotocol" "deftype"))
|
||||||
"def" "defonce" "defrecord" "defmacro" "definline" "definterface"
|
|
||||||
"defmulti" "defmethod" "defstruct" "defprotocol"
|
|
||||||
"deftype"))
|
|
||||||
((sym_lit) @keyword
|
((sym_lit) @keyword
|
||||||
(#eq? @keyword "declare"))
|
(#eq? @keyword "declare"))
|
||||||
|
|
||||||
((sym_name) @keyword.coroutine
|
((sym_name) @keyword.coroutine
|
||||||
(#any-of? @keyword.coroutine
|
(#any-of? @keyword.coroutine "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
|
||||||
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
|
|
||||||
((sym_lit) @keyword.function
|
((sym_lit) @keyword.function
|
||||||
(#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
|
(#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
|
||||||
|
|
||||||
|
|
@ -147,31 +165,28 @@
|
||||||
|
|
||||||
; Conditionals
|
; Conditionals
|
||||||
((sym_lit) @keyword.conditional
|
((sym_lit) @keyword.conditional
|
||||||
(#any-of? @keyword.conditional
|
(#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp"))
|
||||||
"case" "cond" "cond->" "cond->>" "condp"))
|
|
||||||
((sym_lit) @keyword.conditional
|
((sym_lit) @keyword.conditional
|
||||||
(#any-of? @keyword.conditional
|
(#any-of? @keyword.conditional "if" "if-let" "if-not" "if-some"))
|
||||||
"if" "if-let" "if-not" "if-some"))
|
|
||||||
((sym_lit) @keyword.conditional
|
((sym_lit) @keyword.conditional
|
||||||
(#any-of? @keyword.conditional
|
(#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some"))
|
||||||
"when" "when-first" "when-let" "when-not" "when-some"))
|
|
||||||
|
|
||||||
; Repeats
|
; Repeats
|
||||||
((sym_lit) @keyword.repeat
|
((sym_lit) @keyword.repeat
|
||||||
(#any-of? @keyword.repeat
|
(#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while"))
|
||||||
"doseq" "dotimes" "for" "loop" "recur" "while"))
|
|
||||||
|
|
||||||
; Exception
|
; Exception
|
||||||
((sym_lit) @keyword.exception
|
((sym_lit) @keyword.exception
|
||||||
(#any-of? @keyword.exception
|
(#any-of? @keyword.exception "throw" "try" "catch" "finally"))
|
||||||
"throw" "try" "catch" "finally"))
|
|
||||||
|
|
||||||
; Includes
|
; Includes
|
||||||
((sym_lit) @keyword.import
|
((sym_lit) @keyword.import
|
||||||
(#any-of? @keyword.import "ns" "import" "require" "use"))
|
(#any-of? @keyword.import "ns" "import" "require" "use"))
|
||||||
|
|
||||||
; Builtin macros
|
; Builtin macros
|
||||||
;; TODO: Do all these items belong here?
|
; TODO: Do all these items belong here?
|
||||||
((sym_lit) @function.macro
|
((sym_lit) @function.macro
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @function.macro
|
(#any-of? @function.macro
|
||||||
|
|
@ -191,7 +206,7 @@
|
||||||
; (keep (fn [[s v]] (when-not (:macro (meta v)) s)))
|
; (keep (fn [[s v]] (when-not (:macro (meta v)) s)))
|
||||||
; sort
|
; sort
|
||||||
; clojure.pprint/pprint))
|
; clojure.pprint/pprint))
|
||||||
;; ...and then lots of manual filtering...
|
; ...and then lots of manual filtering...
|
||||||
((sym_lit) @function.builtin
|
((sym_lit) @function.builtin
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @function.builtin
|
(#any-of? @function.builtin
|
||||||
|
|
@ -316,13 +331,9 @@
|
||||||
"seq-to-map-for-destructuring" "update-keys" "update-vals"
|
"seq-to-map-for-destructuring" "update-keys" "update-vals"
|
||||||
;; 1.12
|
;; 1.12
|
||||||
"partitionv" "partitionv-all" "splitv-at"))
|
"partitionv" "partitionv-all" "splitv-at"))
|
||||||
|
; >> Context based highlighting
|
||||||
|
; def-likes
|
||||||
|
; Correctly highlight docstrings
|
||||||
;; >> Context based highlighting
|
|
||||||
|
|
||||||
;; def-likes
|
|
||||||
;; Correctly highlight docstrings
|
|
||||||
;(list_lit
|
;(list_lit
|
||||||
;.
|
;.
|
||||||
;(sym_lit) @_keyword ; Don't really want to highlight twice
|
;(sym_lit) @_keyword ; Don't really want to highlight twice
|
||||||
|
|
@ -333,11 +344,10 @@
|
||||||
;.
|
;.
|
||||||
;(sym_lit)
|
;(sym_lit)
|
||||||
;.
|
;.
|
||||||
;;; TODO: Add @comment highlight
|
; TODO: Add @comment highlight
|
||||||
;(str_lit)?
|
;(str_lit)?
|
||||||
;.
|
;.
|
||||||
;(_))
|
;(_))
|
||||||
|
|
||||||
; Function definitions
|
; Function definitions
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
|
|
@ -346,18 +356,18 @@
|
||||||
.
|
.
|
||||||
(sym_lit)? @function
|
(sym_lit)? @function
|
||||||
.
|
.
|
||||||
;; TODO: Add @comment highlight
|
; TODO: Add @comment highlight
|
||||||
(str_lit)?)
|
(str_lit)?)
|
||||||
;; TODO: Fix parameter highlighting
|
|
||||||
;; I think there's a bug here in nvim-treesitter
|
; TODO: Fix parameter highlighting
|
||||||
;; TODO: Reproduce bug and file ticket
|
; I think there's a bug here in nvim-treesitter
|
||||||
|
; TODO: Reproduce bug and file ticket
|
||||||
;.
|
;.
|
||||||
;[(vec_lit
|
;[(vec_lit
|
||||||
; (sym_lit)* @variable.parameter)
|
; (sym_lit)* @variable.parameter)
|
||||||
; (list_lit
|
; (list_lit
|
||||||
; (vec_lit
|
; (vec_lit
|
||||||
; (sym_lit)* @variable.parameter))])
|
; (sym_lit)* @variable.parameter))])
|
||||||
|
|
||||||
;[((list_lit
|
;[((list_lit
|
||||||
; (vec_lit
|
; (vec_lit
|
||||||
; (sym_lit) @variable.parameter)
|
; (sym_lit) @variable.parameter)
|
||||||
|
|
@ -366,16 +376,14 @@
|
||||||
; ((vec_lit
|
; ((vec_lit
|
||||||
; (sym_lit) @variable.parameter)
|
; (sym_lit) @variable.parameter)
|
||||||
; (_)))
|
; (_)))
|
||||||
|
|
||||||
|
|
||||||
; Meta punctuation
|
; Meta punctuation
|
||||||
;; NOTE: When the above `Function definitions` query captures the
|
; NOTE: When the above `Function definitions` query captures the
|
||||||
;; the @function it also captures the child meta_lit
|
; the @function it also captures the child meta_lit
|
||||||
;; We capture the meta_lit symbol (^) after so that the later
|
; We capture the meta_lit symbol (^) after so that the later
|
||||||
;; highlighting overrides the former
|
; highlighting overrides the former
|
||||||
"^" @punctuation.special
|
"^" @punctuation.special
|
||||||
|
|
||||||
;; namespaces
|
; namespaces
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @_include
|
(sym_lit) @_include
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier)
|
(identifier)
|
||||||
(argument_list
|
(argument_list
|
||||||
(argument (unquoted_argument)) @constant
|
(argument
|
||||||
)
|
(unquoted_argument)) @constant)
|
||||||
(#lua-match? @constant "^[%u@][%u%d_]+$")
|
(#lua-match? @constant "^[%u@][%u%d_]+$"))
|
||||||
)
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(quoted_argument)
|
(quoted_argument)
|
||||||
|
|
@ -12,6 +11,7 @@
|
||||||
] @string
|
] @string
|
||||||
|
|
||||||
(variable_ref) @none
|
(variable_ref) @none
|
||||||
|
|
||||||
(variable) @variable
|
(variable) @variable
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -19,11 +19,26 @@
|
||||||
(line_comment)
|
(line_comment)
|
||||||
] @comment @spell
|
] @comment @spell
|
||||||
|
|
||||||
(normal_command (identifier) @function)
|
(normal_command
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
["ENV" "CACHE"] @keyword.storage
|
[
|
||||||
["$" "{" "}" "<" ">"] @punctuation.special
|
"ENV"
|
||||||
["(" ")"] @punctuation.bracket
|
"CACHE"
|
||||||
|
] @keyword.storage
|
||||||
|
|
||||||
|
[
|
||||||
|
"$"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
(function)
|
(function)
|
||||||
|
|
@ -48,49 +63,45 @@
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @keyword.repeat
|
(identifier) @keyword.repeat
|
||||||
(#match? @keyword.repeat "\\c^(continue|break)$")
|
(#match? @keyword.repeat "\\c^(continue|break)$"))
|
||||||
)
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @keyword.return
|
(identifier) @keyword.return
|
||||||
(#match? @keyword.return "\\c^return$")
|
(#match? @keyword.return "\\c^return$"))
|
||||||
)
|
|
||||||
|
|
||||||
(function_command
|
(function_command
|
||||||
(function)
|
(function)
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @function
|
.
|
||||||
(argument)* @variable.parameter
|
(argument) @function
|
||||||
)
|
(argument)* @variable.parameter))
|
||||||
)
|
|
||||||
|
|
||||||
(macro_command
|
(macro_command
|
||||||
(macro)
|
(macro)
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @function.macro
|
.
|
||||||
(argument)* @variable.parameter
|
(argument) @function.macro
|
||||||
)
|
(argument)* @variable.parameter))
|
||||||
)
|
|
||||||
|
|
||||||
(block_def
|
(block_def
|
||||||
(block_command
|
(block_command
|
||||||
(block) @function.builtin
|
(block) @function.builtin
|
||||||
(argument_list
|
(argument_list
|
||||||
(argument (unquoted_argument) @constant)
|
(argument
|
||||||
)
|
(unquoted_argument) @constant))
|
||||||
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE")
|
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE"))
|
||||||
)
|
(endblock_command
|
||||||
(endblock_command (endblock) @function.builtin)
|
(endblock) @function.builtin))
|
||||||
)
|
|
||||||
;
|
;
|
||||||
((argument) @boolean
|
((argument) @boolean
|
||||||
(#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")
|
(#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$"))
|
||||||
)
|
|
||||||
;
|
;
|
||||||
(if_command
|
(if_command
|
||||||
(if)
|
(if)
|
||||||
(argument_list
|
(argument_list
|
||||||
(argument) @keyword.operator
|
(argument) @keyword.operator)
|
||||||
)
|
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @keyword.operator
|
(#any-of? @keyword.operator
|
||||||
"NOT" "AND" "OR"
|
"NOT" "AND" "OR"
|
||||||
|
|
@ -100,13 +111,12 @@
|
||||||
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
||||||
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
||||||
)
|
))
|
||||||
)
|
|
||||||
(elseif_command
|
(elseif_command
|
||||||
(elseif)
|
(elseif)
|
||||||
(argument_list
|
(argument_list
|
||||||
(argument) @keyword.operator
|
(argument) @keyword.operator)
|
||||||
)
|
|
||||||
; format-ignore
|
; format-ignore
|
||||||
(#any-of? @keyword.operator
|
(#any-of? @keyword.operator
|
||||||
"NOT" "AND" "OR"
|
"NOT" "AND" "OR"
|
||||||
|
|
@ -116,106 +126,105 @@
|
||||||
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
||||||
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
||||||
)
|
))
|
||||||
)
|
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @function.builtin
|
(identifier) @function.builtin
|
||||||
(#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$")
|
(#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$"))
|
||||||
)
|
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @variable
|
.
|
||||||
)
|
(argument) @variable)
|
||||||
(#match? @_function "\\c^set$")
|
(#match? @_function "\\c^set$"))
|
||||||
)
|
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(#match? @_function "\\c^set$")
|
(#match? @_function "\\c^set$")
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument)
|
.
|
||||||
(
|
(argument)
|
||||||
(argument) @_cache @keyword.storage
|
((argument) @_cache @keyword.storage
|
||||||
.
|
.
|
||||||
(argument) @_type @type
|
(argument) @_type @type
|
||||||
(#any-of? @_cache "CACHE")
|
(#any-of? @_cache "CACHE")
|
||||||
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL")
|
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL"))))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(#match? @_function "\\c^unset$")
|
(#match? @_function "\\c^unset$")
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument)
|
.
|
||||||
|
(argument)
|
||||||
(argument) @keyword.storage
|
(argument) @keyword.storage
|
||||||
(#any-of? @keyword.storage "CACHE" "PARENT_SCOPE")
|
(#any-of? @keyword.storage "CACHE" "PARENT_SCOPE")))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(#match? @_function "\\c^list$")
|
(#match? @_function "\\c^list$")
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @constant
|
.
|
||||||
|
(argument) @constant
|
||||||
(#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND")
|
(#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND")
|
||||||
. (argument) @variable
|
.
|
||||||
(argument) @variable .
|
(argument) @variable
|
||||||
)
|
(argument) @variable .))
|
||||||
)
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(#match? @_function "\\c^list$")
|
(#match? @_function "\\c^list$")
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @constant
|
.
|
||||||
. (argument) @variable
|
(argument) @constant
|
||||||
(#any-of? @constant "APPEND" "FILTER" "INSERT"
|
.
|
||||||
"POP_BACK" "POP_FRONT" "PREPEND"
|
(argument) @variable
|
||||||
"REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES"
|
(#any-of? @constant "APPEND" "FILTER" "INSERT" "POP_BACK" "POP_FRONT" "PREPEND" "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" "REVERSE" "SORT")))
|
||||||
"REVERSE" "SORT")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(#match? @_function "\\c^list$")
|
(#match? @_function "\\c^list$")
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @_transform @constant
|
.
|
||||||
. (argument) @variable
|
(argument) @_transform @constant
|
||||||
. (argument) @_action @constant
|
.
|
||||||
|
(argument) @variable
|
||||||
|
.
|
||||||
|
(argument) @_action @constant
|
||||||
|
(#eq? @_transform "TRANSFORM")
|
||||||
|
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")))
|
||||||
|
|
||||||
|
(normal_command
|
||||||
|
(identifier) @_function
|
||||||
|
(#match? @_function "\\c^list$")
|
||||||
|
(argument_list
|
||||||
|
.
|
||||||
|
(argument) @_transform @constant
|
||||||
|
.
|
||||||
|
(argument) @variable
|
||||||
|
.
|
||||||
|
(argument) @_action @constant
|
||||||
|
.
|
||||||
|
(argument)? @_selector @constant
|
||||||
(#eq? @_transform "TRANSFORM")
|
(#eq? @_transform "TRANSFORM")
|
||||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
||||||
)
|
(#any-of? @_selector "AT" "FOR" "REGEX")))
|
||||||
)
|
|
||||||
(normal_command
|
(normal_command
|
||||||
(identifier) @_function
|
(identifier) @_function
|
||||||
(#match? @_function "\\c^list$")
|
(#match? @_function "\\c^list$")
|
||||||
(argument_list
|
(argument_list
|
||||||
. (argument) @_transform @constant
|
.
|
||||||
. (argument) @variable
|
(argument) @_transform @constant
|
||||||
. (argument) @_action @constant
|
(argument) @constant
|
||||||
. (argument)? @_selector @constant
|
.
|
||||||
(#eq? @_transform "TRANSFORM")
|
|
||||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
|
||||||
(#any-of? @_selector "AT" "FOR" "REGEX")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(normal_command
|
|
||||||
(identifier) @_function
|
|
||||||
(#match? @_function "\\c^list$")
|
|
||||||
(argument_list
|
|
||||||
. (argument) @_transform @constant
|
|
||||||
(argument) @constant .
|
|
||||||
(argument) @variable
|
(argument) @variable
|
||||||
(#eq? @_transform "TRANSFORM")
|
(#eq? @_transform "TRANSFORM")
|
||||||
(#eq? @constant "OUTPUT_VARIABLE")
|
(#eq? @constant "OUTPUT_VARIABLE")))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
((source_file . (line_comment) @keyword.directive)
|
((source_file
|
||||||
|
.
|
||||||
|
(line_comment) @keyword.directive)
|
||||||
(#lua-match? @keyword.directive "^#!/"))
|
(#lua-match? @keyword.directive "^#!/"))
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
|
|
||||||
(")" @indent.branch)
|
(")" @indent.branch)
|
||||||
|
|
||||||
(")" @indent.end)
|
(")" @indent.end)
|
||||||
|
|
||||||
(argument_list) @indent.auto
|
(argument_list) @indent.auto
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@
|
||||||
|
|
||||||
((tag
|
((tag
|
||||||
(name) @comment.note @nospell
|
(name) @comment.note @nospell
|
||||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
("(" @punctuation.bracket
|
||||||
|
(user) @constant
|
||||||
|
")" @punctuation.bracket)?
|
||||||
":" @punctuation.delimiter)
|
":" @punctuation.delimiter)
|
||||||
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||||
|
|
||||||
|
|
@ -20,7 +22,9 @@
|
||||||
|
|
||||||
((tag
|
((tag
|
||||||
(name) @comment.warning @nospell
|
(name) @comment.warning @nospell
|
||||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
("(" @punctuation.bracket
|
||||||
|
(user) @constant
|
||||||
|
")" @punctuation.bracket)?
|
||||||
":" @punctuation.delimiter)
|
":" @punctuation.delimiter)
|
||||||
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
|
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||||
|
|
||||||
|
|
@ -29,7 +33,9 @@
|
||||||
|
|
||||||
((tag
|
((tag
|
||||||
(name) @comment.error @nospell
|
(name) @comment.error @nospell
|
||||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
("(" @punctuation.bracket
|
||||||
|
(user) @constant
|
||||||
|
")" @punctuation.bracket)?
|
||||||
":" @punctuation.delimiter)
|
":" @punctuation.delimiter)
|
||||||
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
|
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
(source (list_lit) @fold)
|
(source
|
||||||
|
(list_lit) @fold)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,20 +1,42 @@
|
||||||
|
(defun_header
|
||||||
|
function_name: (sym_lit) @local.definition.function
|
||||||
|
(#set! definition.function.scope "parent"))
|
||||||
|
|
||||||
(defun_header
|
(defun_header
|
||||||
function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent"))
|
lambda_list:
|
||||||
(defun_header
|
(list_lit
|
||||||
lambda_list: (list_lit (sym_lit) @local.definition.parameter))
|
(sym_lit) @local.definition.parameter))
|
||||||
|
|
||||||
(defun_header
|
(defun_header
|
||||||
keyword: (defun_keyword "defmethod")
|
keyword:
|
||||||
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @local.definition.type)))
|
(defun_keyword
|
||||||
|
"defmethod")
|
||||||
|
lambda_list:
|
||||||
|
(list_lit
|
||||||
|
(list_lit
|
||||||
|
.
|
||||||
|
(sym_lit)
|
||||||
|
.
|
||||||
|
(sym_lit) @local.definition.type)))
|
||||||
|
|
||||||
(defun_header
|
(defun_header
|
||||||
lambda_list: (list_lit (list_lit . (sym_lit) @local.definition.parameter . (_))))
|
lambda_list:
|
||||||
|
(list_lit
|
||||||
|
(list_lit
|
||||||
|
.
|
||||||
|
(sym_lit) @local.definition.parameter
|
||||||
|
.
|
||||||
|
(_))))
|
||||||
|
|
||||||
(sym_lit) @local.reference
|
(sym_lit) @local.reference
|
||||||
|
|
||||||
(defun) @local.scope
|
(defun) @local.scope
|
||||||
|
|
||||||
((list_lit . (sym_lit) @_defvar . (sym_lit) @local.definition.var)
|
((list_lit
|
||||||
|
.
|
||||||
|
(sym_lit) @_defvar
|
||||||
|
.
|
||||||
|
(sym_lit) @local.definition.var)
|
||||||
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
|
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
|
|
@ -31,42 +53,61 @@
|
||||||
(sym_lit) @local.definition.function
|
(sym_lit) @local.definition.function
|
||||||
(#eq? @_deftest "deftest")) @local.scope
|
(#eq? @_deftest "deftest")) @local.scope
|
||||||
|
|
||||||
(for_clause . (sym_lit) @local.definition.var)
|
(for_clause
|
||||||
(with_clause . (sym_lit) @local.definition.var)
|
.
|
||||||
|
(sym_lit) @local.definition.var)
|
||||||
|
|
||||||
|
(with_clause
|
||||||
|
.
|
||||||
|
(sym_lit) @local.definition.var)
|
||||||
|
|
||||||
(loop_macro) @local.scope
|
(loop_macro) @local.scope
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
|
(sym_lit) @_let
|
||||||
|
(#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
|
||||||
.
|
.
|
||||||
(list_lit (list_lit . (sym_lit) @local.definition.var))) @local.scope
|
(list_lit
|
||||||
|
(list_lit
|
||||||
|
.
|
||||||
|
(sym_lit) @local.definition.var))) @local.scope
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
|
(sym_lit) @_let
|
||||||
|
(#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
|
||||||
.
|
.
|
||||||
(list_lit . (sym_lit) @local.definition.var)) @local.scope
|
(list_lit
|
||||||
|
.
|
||||||
|
(sym_lit) @local.definition.var)) @local.scope
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
(kwd_lit) @_import_from
|
||||||
|
(#eq? @_import_from ":import-from")
|
||||||
.
|
.
|
||||||
(_)
|
(_)
|
||||||
(kwd_lit (kwd_symbol) @local.definition.import))
|
(kwd_lit
|
||||||
|
(kwd_symbol) @local.definition.import))
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
(kwd_lit) @_import_from
|
||||||
|
(#eq? @_import_from ":import-from")
|
||||||
.
|
.
|
||||||
(_)
|
(_)
|
||||||
(sym_lit) @local.definition.import)
|
(sym_lit) @local.definition.import)
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(kwd_lit) @_use (#eq? @_use ":use")
|
(kwd_lit) @_use
|
||||||
(kwd_lit (kwd_symbol) @local.definition.import))
|
(#eq? @_use ":use")
|
||||||
|
(kwd_lit
|
||||||
|
(kwd_symbol) @local.definition.import))
|
||||||
|
|
||||||
(list_lit
|
(list_lit
|
||||||
.
|
.
|
||||||
(kwd_lit) @_use (#eq? @_use ":use")
|
(kwd_lit) @_use
|
||||||
|
(#eq? @_use ":use")
|
||||||
(sym_lit) @local.definition.import)
|
(sym_lit) @local.definition.import)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
"let" @keyword
|
"let" @keyword
|
||||||
|
|
||||||
"in" @keyword
|
"in" @keyword
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -11,10 +12,15 @@
|
||||||
"." @punctuation.delimiter
|
"." @punctuation.delimiter
|
||||||
|
|
||||||
(input) @constant
|
(input) @constant
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
|
|
||||||
(float) @number.float
|
(float) @number.float
|
||||||
|
|
||||||
(boolean) @boolean
|
(boolean) @boolean
|
||||||
|
|
||||||
(null) @keyword
|
(null) @keyword
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,24 @@
|
||||||
[
|
[
|
||||||
(assign_block "{")
|
(assign_block
|
||||||
|
"{")
|
||||||
(object)
|
(object)
|
||||||
(array)
|
(array)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
(assign_block "}" @indent.branch)
|
(assign_block
|
||||||
(assign_block "}" @indent.end)
|
"}" @indent.branch)
|
||||||
|
|
||||||
(object "}" @indent.branch)
|
(assign_block
|
||||||
(object "}" @indent.end)
|
"}" @indent.end)
|
||||||
|
|
||||||
(array "]" @indent.branch)
|
(object
|
||||||
(array "]" @indent.end)
|
"}" @indent.branch)
|
||||||
|
|
||||||
|
(object
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
|
(array
|
||||||
|
"]" @indent.branch)
|
||||||
|
|
||||||
|
(array
|
||||||
|
"]" @indent.end)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
; scopes
|
; scopes
|
||||||
|
|
||||||
[
|
[
|
||||||
(object)
|
(object)
|
||||||
(array)
|
(array)
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
; definitions
|
; definitions
|
||||||
|
|
||||||
(assign_block
|
(assign_block
|
||||||
(assignment
|
(assignment
|
||||||
(input)
|
(input) @local.definition.constant))
|
||||||
@local.definition.constant))
|
|
||||||
|
|
||||||
(value (input) @local.reference)
|
|
||||||
|
|
||||||
|
(value
|
||||||
|
(input) @local.reference)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(hex_blob
|
(hex_blob
|
||||||
|
|
@ -15,7 +15,8 @@
|
||||||
"d" @character.special
|
"d" @character.special
|
||||||
(_) @string.special)
|
(_) @string.special)
|
||||||
|
|
||||||
(_ key: (_) @label)
|
(_
|
||||||
|
key: (_) @label)
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
|
|
@ -26,21 +27,28 @@
|
||||||
(null) @constant.builtin
|
(null) @constant.builtin
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
","
|
","
|
||||||
":"
|
":"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[ "{" "}" ] @punctuation.bracket
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "[" "]" ] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "<" ">" ] @punctuation.bracket
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
(("\"" @string)
|
(("\"" @string)
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
; Comments
|
; Comments
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
[
|
[
|
||||||
(document)
|
(document)
|
||||||
|
|
||||||
(meta_map)
|
(meta_map)
|
||||||
(map)
|
(map)
|
||||||
(array)
|
(array)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; inherits: c
|
; inherits: c
|
||||||
|
|
||||||
[
|
[
|
||||||
(for_range_loop)
|
(for_range_loop)
|
||||||
(class_specifier)
|
(class_specifier)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; inherits: c
|
; inherits: c
|
||||||
|
|
||||||
((identifier) @variable.member
|
((identifier) @variable.member
|
||||||
(#lua-match? @variable.member "^m_.*$"))
|
(#lua-match? @variable.member "^m_.*$"))
|
||||||
|
|
||||||
|
|
@ -8,14 +7,15 @@
|
||||||
|
|
||||||
; function(Foo ...foo)
|
; function(Foo ...foo)
|
||||||
(variadic_parameter_declaration
|
(variadic_parameter_declaration
|
||||||
declarator: (variadic_declarator
|
declarator:
|
||||||
|
(variadic_declarator
|
||||||
(_) @variable.parameter))
|
(_) @variable.parameter))
|
||||||
|
|
||||||
; int foo = 0
|
; int foo = 0
|
||||||
(optional_parameter_declaration
|
(optional_parameter_declaration
|
||||||
declarator: (_) @variable.parameter)
|
declarator: (_) @variable.parameter)
|
||||||
|
|
||||||
;(field_expression) @variable.parameter ;; How to highlight this?
|
;(field_expression) @variable.parameter ;; How to highlight this?
|
||||||
|
|
||||||
(((field_expression
|
(((field_expression
|
||||||
(field_identifier) @function.method)) @_parent
|
(field_identifier) @function.method)) @_parent
|
||||||
(#has-parent? @_parent template_method function_declarator))
|
(#has-parent? @_parent template_method function_declarator))
|
||||||
|
|
@ -38,13 +38,25 @@
|
||||||
(auto) @type.builtin
|
(auto) @type.builtin
|
||||||
|
|
||||||
(namespace_identifier) @module
|
(namespace_identifier) @module
|
||||||
|
|
||||||
((namespace_identifier) @type
|
((namespace_identifier) @type
|
||||||
(#lua-match? @type "^[%u]"))
|
(#lua-match? @type "^[%u]"))
|
||||||
|
|
||||||
(case_statement
|
(case_statement
|
||||||
value: (qualified_identifier (identifier) @constant))
|
value:
|
||||||
|
(qualified_identifier
|
||||||
|
(identifier) @constant))
|
||||||
|
|
||||||
(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module)
|
(using_declaration
|
||||||
|
.
|
||||||
|
"using"
|
||||||
|
.
|
||||||
|
"namespace"
|
||||||
|
.
|
||||||
|
[
|
||||||
|
(qualified_identifier)
|
||||||
|
(identifier)
|
||||||
|
] @module)
|
||||||
|
|
||||||
(destructor_name
|
(destructor_name
|
||||||
(identifier) @function.method)
|
(identifier) @function.method)
|
||||||
|
|
@ -53,15 +65,18 @@
|
||||||
(function_declarator
|
(function_declarator
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @function))
|
(identifier) @function))
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @function)))
|
(identifier) @function)))
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @function))))
|
(identifier) @function))))
|
||||||
|
|
||||||
((qualified_identifier
|
((qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
|
|
@ -74,21 +89,26 @@
|
||||||
(identifier) @function))
|
(identifier) @function))
|
||||||
|
|
||||||
(operator_name) @function
|
(operator_name) @function
|
||||||
|
|
||||||
"operator" @function
|
"operator" @function
|
||||||
|
|
||||||
"static_assert" @function.builtin
|
"static_assert" @function.builtin
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @function.call))
|
(identifier) @function.call))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @function.call)))
|
(identifier) @function.call)))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @function.call))))
|
(identifier) @function.call))))
|
||||||
|
|
||||||
((qualified_identifier
|
((qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
|
|
@ -99,21 +119,25 @@
|
||||||
(call_expression
|
(call_expression
|
||||||
(template_function
|
(template_function
|
||||||
(identifier) @function.call))
|
(identifier) @function.call))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(template_function
|
(template_function
|
||||||
(identifier) @function.call)))
|
(identifier) @function.call)))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(template_function
|
(template_function
|
||||||
(identifier) @function.call))))
|
(identifier) @function.call))))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(template_function
|
(template_function
|
||||||
(identifier) @function.call)))))
|
(identifier) @function.call)))))
|
||||||
|
|
||||||
((qualified_identifier
|
((qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
|
|
@ -126,12 +150,12 @@
|
||||||
(function_declarator
|
(function_declarator
|
||||||
(template_method
|
(template_method
|
||||||
(field_identifier) @function.method))
|
(field_identifier) @function.method))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
(field_expression
|
(field_expression
|
||||||
(field_identifier) @function.method.call))
|
(field_identifier) @function.method.call))
|
||||||
|
|
||||||
; constructors
|
; constructors
|
||||||
|
|
||||||
((function_declarator
|
((function_declarator
|
||||||
(qualified_identifier
|
(qualified_identifier
|
||||||
(identifier) @constructor))
|
(identifier) @constructor))
|
||||||
|
|
@ -140,37 +164,39 @@
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @constructor)
|
function: (identifier) @constructor)
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (qualified_identifier
|
function:
|
||||||
|
(qualified_identifier
|
||||||
name: (identifier) @constructor))
|
name: (identifier) @constructor))
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (field_expression
|
function:
|
||||||
|
(field_expression
|
||||||
field: (field_identifier) @constructor))
|
field: (field_identifier) @constructor))
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||||
((field_initializer
|
((field_initializer
|
||||||
(field_identifier) @constructor
|
(field_identifier) @constructor
|
||||||
(argument_list))
|
(argument_list))
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
|
|
||||||
; Constants
|
; Constants
|
||||||
|
|
||||||
(this) @variable.builtin
|
(this) @variable.builtin
|
||||||
(null "nullptr" @constant.builtin)
|
|
||||||
|
(null
|
||||||
|
"nullptr" @constant.builtin)
|
||||||
|
|
||||||
(true) @boolean
|
(true) @boolean
|
||||||
|
|
||||||
(false) @boolean
|
(false) @boolean
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(raw_string_literal) @string
|
(raw_string_literal) @string
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
"try"
|
"try"
|
||||||
"catch"
|
"catch"
|
||||||
|
|
@ -178,7 +204,6 @@
|
||||||
"throw"
|
"throw"
|
||||||
] @keyword.exception
|
] @keyword.exception
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"class"
|
"class"
|
||||||
"decltype"
|
"decltype"
|
||||||
|
|
@ -194,9 +219,7 @@
|
||||||
"constexpr"
|
"constexpr"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
[
|
"co_await" @keyword.coroutine
|
||||||
"co_await"
|
|
||||||
] @keyword.coroutine
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"co_yield"
|
"co_yield"
|
||||||
|
|
@ -214,7 +237,6 @@
|
||||||
[
|
[
|
||||||
"new"
|
"new"
|
||||||
"delete"
|
"delete"
|
||||||
|
|
||||||
"xor"
|
"xor"
|
||||||
"bitand"
|
"bitand"
|
||||||
"bitor"
|
"bitor"
|
||||||
|
|
@ -233,9 +255,15 @@
|
||||||
"::" @punctuation.delimiter
|
"::" @punctuation.delimiter
|
||||||
|
|
||||||
(template_argument_list
|
(template_argument_list
|
||||||
["<" ">"] @punctuation.bracket)
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
(template_parameter_list
|
(template_parameter_list
|
||||||
["<" ">"] @punctuation.bracket)
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
(literal_suffix) @operator
|
(literal_suffix) @operator
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
; inherits: c
|
; inherits: c
|
||||||
|
(condition_clause) @indent.begin
|
||||||
[
|
|
||||||
(condition_clause)
|
|
||||||
] @indent.begin
|
|
||||||
|
|
||||||
((field_initializer_list) @indent.begin
|
((field_initializer_list) @indent.begin
|
||||||
(#set! indent.start_at_same_line 1))
|
(#set! indent.start_at_same_line 1))
|
||||||
|
|
||||||
(access_specifier) @indent.branch
|
(access_specifier) @indent.branch
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
((preproc_arg) @injection.content
|
((preproc_arg) @injection.content
|
||||||
(#set! injection.language "cpp"))
|
(#set! injection.language "cpp"))
|
||||||
|
|
||||||
((comment) @injection.content
|
|
||||||
(#set! injection.language "comment"))
|
|
||||||
|
|
||||||
((comment) @injection.content
|
((comment) @injection.content
|
||||||
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
||||||
(#set! injection.language "doxygen"))
|
(#set! injection.language "doxygen"))
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
; inherits: c
|
; inherits: c
|
||||||
|
; Parameters
|
||||||
;; Parameters
|
|
||||||
(variadic_parameter_declaration
|
(variadic_parameter_declaration
|
||||||
declarator: (variadic_declarator
|
declarator:
|
||||||
|
(variadic_declarator
|
||||||
(identifier) @local.definition.parameter))
|
(identifier) @local.definition.parameter))
|
||||||
|
|
||||||
(optional_parameter_declaration
|
(optional_parameter_declaration
|
||||||
declarator: (identifier) @local.definition.parameter)
|
declarator: (identifier) @local.definition.parameter)
|
||||||
;; Class / struct definitions
|
|
||||||
|
; Class / struct definitions
|
||||||
(class_specifier) @local.scope
|
(class_specifier) @local.scope
|
||||||
|
|
||||||
(reference_declarator
|
(reference_declarator
|
||||||
|
|
@ -16,7 +18,8 @@
|
||||||
(identifier) @local.definition.var)
|
(identifier) @local.definition.var)
|
||||||
|
|
||||||
(struct_specifier
|
(struct_specifier
|
||||||
name: (qualified_identifier
|
name:
|
||||||
|
(qualified_identifier
|
||||||
name: (type_identifier) @local.definition.type))
|
name: (type_identifier) @local.definition.type))
|
||||||
|
|
||||||
(class_specifier
|
(class_specifier
|
||||||
|
|
@ -26,7 +29,8 @@
|
||||||
name: (identifier) @local.definition.type)
|
name: (identifier) @local.definition.type)
|
||||||
|
|
||||||
(class_specifier
|
(class_specifier
|
||||||
name: (qualified_identifier
|
name:
|
||||||
|
(qualified_identifier
|
||||||
name: (type_identifier) @local.definition.type))
|
name: (type_identifier) @local.definition.type))
|
||||||
|
|
||||||
(alias_declaration
|
(alias_declaration
|
||||||
|
|
@ -35,9 +39,10 @@
|
||||||
;template <typename T>
|
;template <typename T>
|
||||||
(type_parameter_declaration
|
(type_parameter_declaration
|
||||||
(type_identifier) @local.definition.type)
|
(type_identifier) @local.definition.type)
|
||||||
|
|
||||||
(template_declaration) @local.scope
|
(template_declaration) @local.scope
|
||||||
|
|
||||||
;; Namespaces
|
; Namespaces
|
||||||
(namespace_definition
|
(namespace_definition
|
||||||
name: (namespace_identifier) @local.definition.namespace
|
name: (namespace_identifier) @local.definition.namespace
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
@ -49,7 +54,7 @@
|
||||||
((namespace_identifier) @local.reference
|
((namespace_identifier) @local.reference
|
||||||
(#set! reference.kind "namespace"))
|
(#set! reference.kind "namespace"))
|
||||||
|
|
||||||
;; Function definitions
|
; Function definitions
|
||||||
(template_function
|
(template_function
|
||||||
name: (identifier) @local.definition.function) @local.scope
|
name: (identifier) @local.definition.function) @local.scope
|
||||||
|
|
||||||
|
|
@ -57,16 +62,18 @@
|
||||||
name: (field_identifier) @local.definition.method) @local.scope
|
name: (field_identifier) @local.definition.method) @local.scope
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (qualified_identifier
|
declarator:
|
||||||
|
(qualified_identifier
|
||||||
name: (identifier) @local.definition.function)) @local.scope
|
name: (identifier) @local.definition.function)) @local.scope
|
||||||
|
|
||||||
(field_declaration
|
(field_declaration
|
||||||
declarator: (function_declarator
|
declarator:
|
||||||
|
(function_declarator
|
||||||
(field_identifier) @local.definition.method))
|
(field_identifier) @local.definition.method))
|
||||||
|
|
||||||
(lambda_expression) @local.scope
|
(lambda_expression) @local.scope
|
||||||
|
|
||||||
;; Control structures
|
; Control structures
|
||||||
(try_statement
|
(try_statement
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1 @@
|
||||||
[
|
(rule_set) @fold
|
||||||
(rule_set)
|
|
||||||
] @fold
|
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,15 @@
|
||||||
|
|
||||||
(important) @type.qualifier
|
(important) @type.qualifier
|
||||||
|
|
||||||
(attribute_selector (plain_value) @string)
|
(attribute_selector
|
||||||
(pseudo_element_selector "::" (tag_name) @property)
|
(plain_value) @string)
|
||||||
(pseudo_class_selector (class_name) @property)
|
|
||||||
|
(pseudo_element_selector
|
||||||
|
"::"
|
||||||
|
(tag_name) @property)
|
||||||
|
|
||||||
|
(pseudo_class_selector
|
||||||
|
(class_name) @property)
|
||||||
|
|
||||||
[
|
[
|
||||||
(class_name)
|
(class_name)
|
||||||
|
|
@ -61,6 +67,7 @@
|
||||||
|
|
||||||
((property_name) @type.definition
|
((property_name) @type.definition
|
||||||
(#lua-match? @type.definition "^[-][-]"))
|
(#lua-match? @type.definition "^[-][-]"))
|
||||||
|
|
||||||
((plain_value) @type
|
((plain_value) @type
|
||||||
(#lua-match? @type "^[-][-]"))
|
(#lua-match? @type "^[-][-]"))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
(declaration)
|
(declaration)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
(block ("}") @indent.branch)
|
(block
|
||||||
|
("}") @indent.branch)
|
||||||
|
|
||||||
("}") @indent.dedent
|
("}") @indent.dedent
|
||||||
|
|
||||||
(comment) @indent.ignore
|
(comment) @indent.ignore
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
; inherits: tsv
|
; inherits: tsv
|
||||||
|
|
||||||
"," @punctuation.delimiter
|
"," @punctuation.delimiter
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
; inherits: cpp
|
; inherits: cpp
|
||||||
|
[
|
||||||
[ "<<<" ">>>" ] @punctuation.bracket
|
"<<<"
|
||||||
|
">>>"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
"__host__"
|
"__host__"
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,41 @@
|
||||||
; Includes
|
; Includes
|
||||||
|
|
||||||
[
|
[
|
||||||
"package"
|
"package"
|
||||||
"import"
|
"import"
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
; Namespaces
|
; Namespaces
|
||||||
|
|
||||||
(package_identifier) @module
|
(package_identifier) @module
|
||||||
|
|
||||||
(import_spec ["." "_"] @punctuation.special)
|
(import_spec
|
||||||
|
[
|
||||||
|
"."
|
||||||
|
"_"
|
||||||
|
] @punctuation.special)
|
||||||
|
|
||||||
[
|
[
|
||||||
(attr_path)
|
(attr_path)
|
||||||
(package_path)
|
(package_path)
|
||||||
] @string.special.url ;; In attributes
|
] @string.special.url ; In attributes
|
||||||
|
|
||||||
; Attributes
|
; Attributes
|
||||||
|
|
||||||
(attribute) @attribute
|
(attribute) @attribute
|
||||||
|
|
||||||
; Conditionals
|
; Conditionals
|
||||||
|
|
||||||
"if" @keyword.conditional
|
"if" @keyword.conditional
|
||||||
|
|
||||||
; Repeats
|
; Repeats
|
||||||
|
"for" @keyword.repeat
|
||||||
|
|
||||||
[
|
(for_clause
|
||||||
"for"
|
"_" @punctuation.special)
|
||||||
] @keyword.repeat
|
|
||||||
|
|
||||||
(for_clause "_" @punctuation.special)
|
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
"let" @keyword
|
||||||
|
|
||||||
[
|
"in" @keyword.operator
|
||||||
"let"
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
[
|
|
||||||
"in"
|
|
||||||
] @keyword.operator
|
|
||||||
|
|
||||||
; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
"+"
|
"+"
|
||||||
"-"
|
"-"
|
||||||
|
|
@ -66,7 +58,6 @@
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
; Fields & Properties
|
; Fields & Properties
|
||||||
|
|
||||||
(field
|
(field
|
||||||
(label
|
(label
|
||||||
(identifier) @variable.member))
|
(identifier) @variable.member))
|
||||||
|
|
@ -76,24 +67,24 @@
|
||||||
(identifier) @property)
|
(identifier) @property)
|
||||||
|
|
||||||
; Functions
|
; Functions
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (selector_expression
|
function:
|
||||||
|
(selector_expression
|
||||||
(_)
|
(_)
|
||||||
(identifier) @function.call))
|
(identifier) @function.call))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (builtin_function) @function.call)
|
function: (builtin_function) @function.call)
|
||||||
|
|
||||||
(builtin_function) @function.builtin
|
(builtin_function) @function.builtin
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
; Types
|
; Types
|
||||||
|
|
||||||
(primitive_type) @type.builtin
|
(primitive_type) @type.builtin
|
||||||
|
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
|
|
@ -102,22 +93,33 @@
|
||||||
[
|
[
|
||||||
(slice_type)
|
(slice_type)
|
||||||
(pointer_type)
|
(pointer_type)
|
||||||
] @type ;; In attributes
|
] @type ; In attributes
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
","
|
","
|
||||||
":"
|
":"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[ "{" "}" ] @punctuation.bracket
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "[" "]" ] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "(" ")" ] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "<" ">" ] @punctuation.bracket
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
(ellipsis)
|
(ellipsis)
|
||||||
|
|
@ -125,7 +127,6 @@
|
||||||
] @punctuation.special
|
] @punctuation.special
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -150,11 +151,15 @@
|
||||||
] @constant.builtin
|
] @constant.builtin
|
||||||
|
|
||||||
; Interpolations
|
; Interpolations
|
||||||
|
(interpolation
|
||||||
|
"\\(" @punctuation.special
|
||||||
|
(_)
|
||||||
|
")" @punctuation.special) @none
|
||||||
|
|
||||||
(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none
|
(interpolation
|
||||||
|
"\\("
|
||||||
(interpolation "\\(" (identifier) @variable ")")
|
(identifier) @variable
|
||||||
|
")")
|
||||||
|
|
||||||
; Comments
|
; Comments
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,20 @@
|
||||||
")"
|
")"
|
||||||
] @indent.end
|
] @indent.end
|
||||||
|
|
||||||
[ "{" "}" ] @indent.branch
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[ "[" "]" ] @indent.branch
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[ "(" ")" ] @indent.branch
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @indent.branch
|
||||||
|
|
||||||
[
|
[
|
||||||
(ERROR)
|
(ERROR)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
; Scopes
|
; Scopes
|
||||||
|
|
||||||
[
|
[
|
||||||
(source_file)
|
(source_file)
|
||||||
(field)
|
(field)
|
||||||
|
|
@ -7,11 +6,9 @@
|
||||||
] @local.scope
|
] @local.scope
|
||||||
|
|
||||||
; References
|
; References
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
|
|
||||||
(import_spec
|
(import_spec
|
||||||
path: (string) @local.definition.import)
|
path: (string) @local.definition.import)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
;; Misc
|
; Misc
|
||||||
|
|
||||||
[
|
[
|
||||||
(line_comment)
|
(line_comment)
|
||||||
(block_comment)
|
(block_comment)
|
||||||
|
|
@ -8,6 +7,7 @@
|
||||||
|
|
||||||
((line_comment) @comment.documentation
|
((line_comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^///[^/]"))
|
(#lua-match? @comment.documentation "^///[^/]"))
|
||||||
|
|
||||||
((line_comment) @comment.documentation
|
((line_comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^///$"))
|
(#lua-match? @comment.documentation "^///$"))
|
||||||
|
|
||||||
|
|
@ -18,9 +18,12 @@
|
||||||
(#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$"))
|
(#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$"))
|
||||||
|
|
||||||
[
|
[
|
||||||
"(" ")"
|
"("
|
||||||
"[" "]"
|
")"
|
||||||
"{" "}"
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -35,8 +38,7 @@
|
||||||
"$"
|
"$"
|
||||||
] @punctuation.special
|
] @punctuation.special
|
||||||
|
|
||||||
;; Constants
|
; Constants
|
||||||
|
|
||||||
[
|
[
|
||||||
"__FILE_FULL_PATH__"
|
"__FILE_FULL_PATH__"
|
||||||
"__FILE__"
|
"__FILE__"
|
||||||
|
|
@ -66,11 +68,9 @@
|
||||||
"false"
|
"false"
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
;; Functions
|
; Functions
|
||||||
|
|
||||||
(func_declarator
|
(func_declarator
|
||||||
(identifier) @function
|
(identifier) @function)
|
||||||
)
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"__traits"
|
"__traits"
|
||||||
|
|
@ -83,29 +83,22 @@
|
||||||
] @function.builtin
|
] @function.builtin
|
||||||
|
|
||||||
(import_expression
|
(import_expression
|
||||||
"import" @function.builtin
|
"import" @function.builtin)
|
||||||
)
|
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
(var_declarator
|
(var_declarator
|
||||||
(identifier) @variable.parameter
|
(identifier) @variable.parameter))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(function_literal
|
(function_literal
|
||||||
(identifier) @variable.parameter
|
(identifier) @variable.parameter)
|
||||||
)
|
|
||||||
|
|
||||||
(constructor
|
(constructor
|
||||||
"this" @constructor
|
"this" @constructor)
|
||||||
)
|
|
||||||
|
|
||||||
(destructor
|
(destructor
|
||||||
"this" @constructor
|
"this" @constructor)
|
||||||
)
|
|
||||||
|
|
||||||
;; Keywords
|
|
||||||
|
|
||||||
|
; Keywords
|
||||||
[
|
[
|
||||||
"case"
|
"case"
|
||||||
"default"
|
"default"
|
||||||
|
|
@ -238,51 +231,45 @@
|
||||||
] @type.qualifier
|
] @type.qualifier
|
||||||
|
|
||||||
(alias_assignment
|
(alias_assignment
|
||||||
. (identifier) @type.definition)
|
.
|
||||||
|
(identifier) @type.definition)
|
||||||
|
|
||||||
(module_declaration
|
(module_declaration
|
||||||
"module" @keyword.import
|
"module" @keyword.import)
|
||||||
)
|
|
||||||
|
|
||||||
(import_declaration
|
(import_declaration
|
||||||
"import" @keyword.import
|
"import" @keyword.import)
|
||||||
)
|
|
||||||
|
|
||||||
(type) @type
|
(type) @type
|
||||||
|
|
||||||
(catch_parameter
|
(catch_parameter
|
||||||
(qualified_identifier) @type
|
(qualified_identifier) @type)
|
||||||
)
|
|
||||||
|
|
||||||
(var_declarations
|
(var_declarations
|
||||||
(qualified_identifier) @type
|
(qualified_identifier) @type)
|
||||||
)
|
|
||||||
|
|
||||||
(func_declaration
|
(func_declaration
|
||||||
(qualified_identifier) @type
|
(qualified_identifier) @type)
|
||||||
)
|
|
||||||
|
|
||||||
(parameter
|
(parameter
|
||||||
(qualified_identifier) @type
|
(qualified_identifier) @type)
|
||||||
)
|
|
||||||
|
|
||||||
(class_declaration
|
(class_declaration
|
||||||
(identifier) @type
|
(identifier) @type)
|
||||||
)
|
|
||||||
|
|
||||||
(fundamental_type) @type.builtin
|
(fundamental_type) @type.builtin
|
||||||
|
|
||||||
(module_fully_qualified_name (packages (package_name) @module))
|
(module_fully_qualified_name
|
||||||
|
(packages
|
||||||
|
(package_name) @module))
|
||||||
|
|
||||||
(module_name) @module
|
(module_name) @module
|
||||||
|
|
||||||
(at_attribute) @attribute
|
(at_attribute) @attribute
|
||||||
|
|
||||||
(user_defined_attribute
|
(user_defined_attribute
|
||||||
"@" @attribute
|
"@" @attribute)
|
||||||
)
|
|
||||||
|
|
||||||
;; Variables
|
|
||||||
|
|
||||||
|
; Variables
|
||||||
(primary_expression
|
(primary_expression
|
||||||
"this" @variable.builtin
|
"this" @variable.builtin)
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,12 @@
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
[
|
[
|
||||||
"(" ")"
|
"("
|
||||||
"{" "}"
|
")"
|
||||||
"[" "]"
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,10 @@
|
||||||
(class_definition)
|
(class_definition)
|
||||||
(enum_declaration)
|
(enum_declaration)
|
||||||
(extension_declaration)
|
(extension_declaration)
|
||||||
|
|
||||||
(arguments)
|
(arguments)
|
||||||
(function_body)
|
(function_body)
|
||||||
|
|
||||||
(block)
|
(block)
|
||||||
(switch_block)
|
(switch_block)
|
||||||
|
|
||||||
(list_literal)
|
(list_literal)
|
||||||
(set_or_map_literal)
|
(set_or_map_literal)
|
||||||
(string_literal)
|
(string_literal)
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,21 @@
|
||||||
(dotted_identifier_list) @string
|
(dotted_identifier_list) @string
|
||||||
|
|
||||||
; Methods
|
; Methods
|
||||||
; --------------------
|
; --------------------
|
||||||
(super) @function
|
(super) @function
|
||||||
|
|
||||||
; TODO: add method/call_expression to grammar and
|
; TODO: add method/call_expression to grammar and
|
||||||
; distinguish method call from variable access
|
; distinguish method call from variable access
|
||||||
(function_expression_body (identifier) @function)
|
(function_expression_body
|
||||||
; ((identifier)(selector (argument_part)) @function)
|
(identifier) @function)
|
||||||
|
|
||||||
|
; ((identifier)(selector (argument_part)) @function)
|
||||||
; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't
|
; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't
|
||||||
; specifically identify a node as a function call
|
; specifically identify a node as a function call
|
||||||
(((identifier) @function (#lua-match? @function "^_?[%l]"))
|
(((identifier) @function
|
||||||
. (selector . (argument_part))) @function
|
(#lua-match? @function "^_?[%l]")).
|
||||||
|
(selector
|
||||||
|
.
|
||||||
|
(argument_part))) @function
|
||||||
|
|
||||||
; Annotations
|
; Annotations
|
||||||
; --------------------
|
; --------------------
|
||||||
|
|
@ -24,13 +27,11 @@
|
||||||
(template_substitution
|
(template_substitution
|
||||||
"$" @punctuation.special
|
"$" @punctuation.special
|
||||||
"{" @punctuation.special
|
"{" @punctuation.special
|
||||||
"}" @punctuation.special
|
"}" @punctuation.special) @none
|
||||||
) @none
|
|
||||||
|
|
||||||
(template_substitution
|
(template_substitution
|
||||||
"$" @punctuation.special
|
"$" @punctuation.special
|
||||||
(identifier_dollar_escaped) @variable
|
(identifier_dollar_escaped) @variable) @none
|
||||||
) @none
|
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
|
|
@ -79,20 +80,28 @@
|
||||||
; --------------------
|
; --------------------
|
||||||
(class_definition
|
(class_definition
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(constructor_signature
|
(constructor_signature
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(scoped_identifier
|
(scoped_identifier
|
||||||
scope: (identifier) @type)
|
scope: (identifier) @type)
|
||||||
|
|
||||||
(function_signature
|
(function_signature
|
||||||
name: (identifier) @function.method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
(getter_signature
|
(getter_signature
|
||||||
(identifier) @function.method)
|
(identifier) @function.method)
|
||||||
|
|
||||||
(setter_signature
|
(setter_signature
|
||||||
name: (identifier) @function.method)
|
name: (identifier) @function.method)
|
||||||
|
|
||||||
(enum_declaration
|
(enum_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(enum_constant
|
(enum_constant
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(void_type) @type
|
(void_type) @type
|
||||||
|
|
||||||
((scoped_identifier
|
((scoped_identifier
|
||||||
|
|
@ -134,7 +143,8 @@
|
||||||
name: (identifier) @variable.parameter)
|
name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
(named_argument
|
(named_argument
|
||||||
(label (identifier) @variable.parameter))
|
(label
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
; --------------------
|
; --------------------
|
||||||
|
|
@ -148,12 +158,17 @@
|
||||||
] @number
|
] @number
|
||||||
|
|
||||||
(symbol_literal) @string.special.symbol
|
(symbol_literal) @string.special.symbol
|
||||||
|
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
|
|
||||||
(true) @boolean
|
(true) @boolean
|
||||||
|
|
||||||
(false) @boolean
|
(false) @boolean
|
||||||
|
|
||||||
(null_literal) @constant.builtin
|
(null_literal) @constant.builtin
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
(documentation_comment) @comment.documentation @spell
|
(documentation_comment) @comment.documentation @spell
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
@ -191,10 +206,7 @@
|
||||||
"with"
|
"with"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
[
|
"return" @keyword.return
|
||||||
"return"
|
|
||||||
] @keyword.return
|
|
||||||
|
|
||||||
|
|
||||||
; Built in identifiers:
|
; Built in identifiers:
|
||||||
; alone these are marked as keywords
|
; alone these are marked as keywords
|
||||||
|
|
@ -235,29 +247,14 @@
|
||||||
|
|
||||||
; when used as an identifier:
|
; when used as an identifier:
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#any-of? @variable.builtin
|
(#any-of? @variable.builtin "abstract" "as" "covariant" "deferred" "dynamic" "export" "external" "factory" "Function" "get" "implements" "import" "interface" "library" "operator" "mixin" "part" "set" "static" "typedef"))
|
||||||
"abstract"
|
|
||||||
"as"
|
|
||||||
"covariant"
|
|
||||||
"deferred"
|
|
||||||
"dynamic"
|
|
||||||
"export"
|
|
||||||
"external"
|
|
||||||
"factory"
|
|
||||||
"Function"
|
|
||||||
"get"
|
|
||||||
"implements"
|
|
||||||
"import"
|
|
||||||
"interface"
|
|
||||||
"library"
|
|
||||||
"operator"
|
|
||||||
"mixin"
|
|
||||||
"part"
|
|
||||||
"set"
|
|
||||||
"static"
|
|
||||||
"typedef"))
|
|
||||||
|
|
||||||
["if" "else" "switch" "default"] @keyword.conditional
|
[
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
"switch"
|
||||||
|
"default"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
[
|
[
|
||||||
"try"
|
"try"
|
||||||
|
|
@ -267,4 +264,9 @@
|
||||||
(break_statement)
|
(break_statement)
|
||||||
] @keyword.exception
|
] @keyword.exception
|
||||||
|
|
||||||
["do" "while" "continue" "for"] @keyword.repeat
|
[
|
||||||
|
"do"
|
||||||
|
"while"
|
||||||
|
"continue"
|
||||||
|
"for"
|
||||||
|
] @keyword.repeat
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
(class_body)
|
(class_body)
|
||||||
(function_body)
|
(function_body)
|
||||||
(function_expression_body)
|
(function_expression_body)
|
||||||
(declaration (initializers))
|
(declaration
|
||||||
|
(initializers))
|
||||||
(switch_block)
|
(switch_block)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(formal_parameter_list)
|
(formal_parameter_list)
|
||||||
|
|
@ -32,14 +33,16 @@
|
||||||
"]"
|
"]"
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
|
|
||||||
[
|
"}" @indent.end
|
||||||
"}"
|
|
||||||
] @indent.end
|
|
||||||
|
|
||||||
(return_statement ";" @indent.end)
|
(return_statement
|
||||||
(break_statement ";" @indent.end)
|
";" @indent.end)
|
||||||
|
|
||||||
|
(break_statement
|
||||||
|
";" @indent.end)
|
||||||
|
|
||||||
; this one is for dedenting the else block
|
; this one is for dedenting the else block
|
||||||
(if_statement (block) @indent.branch)
|
(if_statement
|
||||||
|
(block) @indent.branch)
|
||||||
|
|
||||||
(comment) @indent.ignore
|
(comment) @indent.ignore
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
;; Definitions
|
; Definitions
|
||||||
|
|
||||||
(function_signature
|
(function_signature
|
||||||
name: (identifier) @local.definition.function)
|
name: (identifier) @local.definition.function)
|
||||||
|
|
||||||
|
|
@ -15,14 +14,13 @@
|
||||||
(static_final_declaration
|
(static_final_declaration
|
||||||
(identifier) @local.definition.var)
|
(identifier) @local.definition.var)
|
||||||
|
|
||||||
;; References
|
; References
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
;; Scopes
|
; Scopes
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
body: (_) @local.scope)
|
body: (_) @local.scope)
|
||||||
|
|
||||||
[
|
[
|
||||||
(block)
|
(block)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
(preproc_def) @constant.macro
|
(preproc_def) @constant.macro
|
||||||
|
|
||||||
(preproc_function_def) @function.macro
|
(preproc_function_def) @function.macro
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -22,14 +23,39 @@
|
||||||
(integer_literal) @number
|
(integer_literal) @number
|
||||||
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
(node (identifier) @module)
|
|
||||||
(property (identifier) @property)
|
(node
|
||||||
(labeled_item (identifier) @label)
|
(identifier) @module)
|
||||||
(call_expression (identifier) @function.macro)
|
|
||||||
|
(property
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
|
(labeled_item
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
(identifier) @function.macro)
|
||||||
|
|
||||||
(reference) @label ; referencing labeled_item.identifier
|
(reference) @label ; referencing labeled_item.identifier
|
||||||
|
|
||||||
(unit_address) @constant
|
(unit_address) @constant
|
||||||
|
|
||||||
[ "=" ] @operator
|
"=" @operator
|
||||||
[ "(" ")" "[" "]" "{" "}" "<" ">" ] @punctuation.bracket
|
|
||||||
[ ";" ":" "," "@" ] @punctuation.delimiter
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
";"
|
||||||
|
":"
|
||||||
|
","
|
||||||
|
"@"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,4 @@
|
||||||
">"
|
">"
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
|
|
||||||
[
|
(comment) @indent.ignore
|
||||||
(comment)
|
|
||||||
] @indent.ignore
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
[
|
[
|
||||||
(let_binding)
|
(let_binding)
|
||||||
|
|
||||||
(application_expression)
|
(application_expression)
|
||||||
(lambda_expression)
|
(lambda_expression)
|
||||||
|
|
||||||
(record_type)
|
(record_type)
|
||||||
(union_type)
|
(union_type)
|
||||||
|
|
||||||
(list_literal)
|
(list_literal)
|
||||||
(record_literal)
|
(record_literal)
|
||||||
|
|
||||||
(block_comment)
|
(block_comment)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
;; Text
|
; Text
|
||||||
|
; Imports
|
||||||
;; Imports
|
|
||||||
|
|
||||||
(missing_import) @keyword.import
|
(missing_import) @keyword.import
|
||||||
|
|
||||||
(local_import) @string.special.path
|
(local_import) @string.special.path
|
||||||
|
|
@ -13,47 +11,55 @@
|
||||||
(import_hash)
|
(import_hash)
|
||||||
] @string.special
|
] @string.special
|
||||||
|
|
||||||
[ (import_as_location) (import_as_text) ] @type
|
[
|
||||||
|
(import_as_location)
|
||||||
;; Types
|
(import_as_text)
|
||||||
|
] @type
|
||||||
|
|
||||||
|
; Types
|
||||||
([
|
([
|
||||||
(let_binding (label) @type)
|
(let_binding
|
||||||
(union_type_entry (label) @type)
|
(label) @type)
|
||||||
] (#lua-match? @type "^%u"))
|
(union_type_entry
|
||||||
|
(label) @type)
|
||||||
|
]
|
||||||
|
(#lua-match? @type "^%u"))
|
||||||
|
|
||||||
((primitive_expression
|
((primitive_expression
|
||||||
(identifier (label) @type)
|
(identifier
|
||||||
(selector (label) @type)) @variable
|
(label) @type)
|
||||||
|
(selector
|
||||||
|
(label) @type)) @variable
|
||||||
(#lua-match? @variable "^[A-Z][^.]*$"))
|
(#lua-match? @variable "^[A-Z][^.]*$"))
|
||||||
|
|
||||||
;; Parameters
|
; Parameters
|
||||||
|
(lambda_expression
|
||||||
(lambda_expression label: (label) @variable.parameter)
|
label: (label) @variable.parameter)
|
||||||
|
|
||||||
;; Variables
|
|
||||||
|
|
||||||
|
; Variables
|
||||||
(label) @variable
|
(label) @variable
|
||||||
|
|
||||||
(identifier [
|
(identifier
|
||||||
|
[
|
||||||
(label) @variable
|
(label) @variable
|
||||||
(de_bruijn_index) @operator
|
(de_bruijn_index) @operator
|
||||||
])
|
])
|
||||||
|
|
||||||
(let_binding label: (label) @variable)
|
(let_binding
|
||||||
|
label: (label) @variable)
|
||||||
|
|
||||||
; Fields
|
; Fields
|
||||||
|
(record_literal_entry
|
||||||
|
(label) @variable.member)
|
||||||
|
|
||||||
(record_literal_entry (label) @variable.member)
|
(record_type_entry
|
||||||
|
(label) @variable.member)
|
||||||
(record_type_entry (label) @variable.member)
|
|
||||||
|
|
||||||
(selector
|
(selector
|
||||||
(selector_dot)
|
(selector_dot)
|
||||||
(_) @variable.member)
|
(_) @variable.member)
|
||||||
|
|
||||||
;; Keywords
|
; Keywords
|
||||||
|
|
||||||
(env_import) @keyword
|
(env_import) @keyword
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -68,8 +74,7 @@
|
||||||
"with"
|
"with"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
;; Operators
|
; Operators
|
||||||
|
|
||||||
[
|
[
|
||||||
(type_operator)
|
(type_operator)
|
||||||
(assign_operator)
|
(assign_operator)
|
||||||
|
|
@ -82,10 +87,11 @@
|
||||||
(empty_record_literal)
|
(empty_record_literal)
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
;; Builtins
|
; Builtins
|
||||||
|
|
||||||
(builtin_function) @function.builtin
|
(builtin_function) @function.builtin
|
||||||
(builtin [
|
|
||||||
|
(builtin
|
||||||
|
[
|
||||||
"Natural"
|
"Natural"
|
||||||
"Natural/build"
|
"Natural/build"
|
||||||
"Natural/fold"
|
"Natural/fold"
|
||||||
|
|
@ -122,31 +128,47 @@
|
||||||
"Sort"
|
"Sort"
|
||||||
] @type.builtin)
|
] @type.builtin)
|
||||||
|
|
||||||
;; Punctuation
|
; Punctuation
|
||||||
|
[
|
||||||
|
","
|
||||||
|
"|"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[ "," "|" ] @punctuation.delimiter
|
|
||||||
(selector_dot) @punctuation.delimiter
|
(selector_dot) @punctuation.delimiter
|
||||||
|
|
||||||
[ "{" "}" ] @punctuation.bracket
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "[" "]" ] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "(" ")" ] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "<" ">" ] @punctuation.bracket
|
[
|
||||||
|
"<"
|
||||||
;; Conditionals
|
">"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
; Conditionals
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"then"
|
"then"
|
||||||
"else"
|
"else"
|
||||||
] @keyword.conditional
|
] @keyword.conditional
|
||||||
|
|
||||||
;; Literals
|
; Literals
|
||||||
|
|
||||||
(text_literal) @string
|
(text_literal) @string
|
||||||
(interpolation "}" @string)
|
|
||||||
|
(interpolation
|
||||||
|
"}" @string)
|
||||||
|
|
||||||
[
|
[
|
||||||
(double_quote_escaped)
|
(double_quote_escaped)
|
||||||
(single_quote_escaped)
|
(single_quote_escaped)
|
||||||
|
|
@ -161,10 +183,10 @@
|
||||||
|
|
||||||
(boolean_literal) @boolean
|
(boolean_literal) @boolean
|
||||||
|
|
||||||
(builtin "None") @constant.builtin
|
(builtin
|
||||||
|
"None") @constant.builtin
|
||||||
;; Comments
|
|
||||||
|
|
||||||
|
; Comments
|
||||||
[
|
[
|
||||||
(line_comment)
|
(line_comment)
|
||||||
(block_comment)
|
(block_comment)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
[(addition) (new_file)] @diff.plus
|
[
|
||||||
[(deletion) (old_file)] @diff.minus
|
(addition)
|
||||||
|
(new_file)
|
||||||
|
] @diff.plus
|
||||||
|
|
||||||
|
[
|
||||||
|
(deletion)
|
||||||
|
(old_file)
|
||||||
|
] @diff.minus
|
||||||
|
|
||||||
(commit) @constant
|
(commit) @constant
|
||||||
|
|
||||||
(location) @attribute
|
(location) @attribute
|
||||||
|
|
||||||
(command) @function
|
(command) @function
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,19 @@
|
||||||
"$"
|
"$"
|
||||||
"{"
|
"{"
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.special
|
] @punctuation.special)
|
||||||
)
|
|
||||||
|
|
||||||
((variable) @constant
|
((variable) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
(arg_instruction
|
(arg_instruction
|
||||||
. (unquoted_string) @property)
|
.
|
||||||
|
(unquoted_string) @property)
|
||||||
|
|
||||||
(env_instruction
|
(env_instruction
|
||||||
(env_pair . (unquoted_string) @property))
|
(env_pair
|
||||||
|
.
|
||||||
|
(unquoted_string) @property))
|
||||||
|
|
||||||
(expose_instruction
|
(expose_instruction
|
||||||
(expose_port) @number)
|
(expose_port) @number)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
|
|
||||||
(number_literal) @number
|
(number_literal) @number
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -32,19 +33,19 @@
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
(subgraph
|
(subgraph
|
||||||
id: (id
|
id:
|
||||||
(identifier) @module)
|
(id
|
||||||
)
|
(identifier) @module))
|
||||||
|
|
||||||
(attribute
|
(attribute
|
||||||
name: (id
|
name:
|
||||||
(identifier) @variable.member)
|
(id
|
||||||
)
|
(identifier) @variable.member))
|
||||||
|
|
||||||
(attribute
|
(attribute
|
||||||
value: (id
|
value:
|
||||||
(identifier) @constant)
|
(id
|
||||||
)
|
(identifier) @constant))
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
(identifier) @variable.parameter)
|
(identifier) @variable.parameter)
|
||||||
(#any-of? @_param "@param" "\\param"))
|
(#any-of? @_param "@param" "\\param"))
|
||||||
|
|
||||||
(function (identifier) @function)
|
(function
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
(function_link) @function
|
(function_link) @function
|
||||||
|
|
||||||
|
|
@ -48,6 +49,13 @@
|
||||||
(code_block_end)
|
(code_block_end)
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
(code_block_content) @none
|
(code_block_content) @none
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
((type) @injection.content
|
((type) @injection.content
|
||||||
(#set! injection.parent))
|
(#set! injection.parent))
|
||||||
|
|
||||||
([ (function_link) (code) ] @injection.content
|
([
|
||||||
|
(function_link)
|
||||||
|
(code)
|
||||||
|
] @injection.content
|
||||||
(#set! injection.parent))
|
(#set! injection.parent))
|
||||||
|
|
||||||
((link) @injection.content
|
((link) @injection.content
|
||||||
|
|
|
||||||
|
|
@ -1,80 +1,95 @@
|
||||||
;; XML declaration
|
; XML declaration
|
||||||
|
(XMLDecl
|
||||||
|
"xml" @keyword.directive)
|
||||||
|
|
||||||
(XMLDecl "xml" @keyword.directive)
|
(XMLDecl
|
||||||
|
[
|
||||||
|
"version"
|
||||||
|
"encoding"
|
||||||
|
] @tag.attribute)
|
||||||
|
|
||||||
(XMLDecl [ "version" "encoding" ] @tag.attribute)
|
(XMLDecl
|
||||||
|
(EncName) @string.special)
|
||||||
|
|
||||||
(XMLDecl (EncName) @string.special)
|
(XMLDecl
|
||||||
|
(VersionNum) @number)
|
||||||
(XMLDecl (VersionNum) @number)
|
|
||||||
|
|
||||||
;; Processing instructions
|
|
||||||
|
|
||||||
|
; Processing instructions
|
||||||
(PI) @keyword.directive
|
(PI) @keyword.directive
|
||||||
|
|
||||||
;; Element declaration
|
; Element declaration
|
||||||
|
|
||||||
(elementdecl
|
(elementdecl
|
||||||
"ELEMENT" @keyword.directive.define
|
"ELEMENT" @keyword.directive.define
|
||||||
(Name) @tag)
|
(Name) @tag)
|
||||||
|
|
||||||
(contentspec
|
(contentspec
|
||||||
(_ (Name) @tag.attribute))
|
(_
|
||||||
|
(Name) @tag.attribute))
|
||||||
|
|
||||||
"#PCDATA" @type.builtin
|
"#PCDATA" @type.builtin
|
||||||
|
|
||||||
[ "EMPTY" "ANY" ] @type.qualifier
|
[
|
||||||
|
"EMPTY"
|
||||||
|
"ANY"
|
||||||
|
] @type.qualifier
|
||||||
|
|
||||||
[ "*" "?" "+" ] @character.special
|
[
|
||||||
|
"*"
|
||||||
;; Entity declaration
|
"?"
|
||||||
|
"+"
|
||||||
|
] @character.special
|
||||||
|
|
||||||
|
; Entity declaration
|
||||||
(GEDecl
|
(GEDecl
|
||||||
"ENTITY" @keyword.directive.define
|
"ENTITY" @keyword.directive.define
|
||||||
(Name) @constant)
|
(Name) @constant)
|
||||||
|
|
||||||
(GEDecl (EntityValue) @string)
|
(GEDecl
|
||||||
|
(EntityValue) @string)
|
||||||
|
|
||||||
(NDataDecl
|
(NDataDecl
|
||||||
"NDATA" @keyword
|
"NDATA" @keyword
|
||||||
(Name) @label)
|
(Name) @label)
|
||||||
|
|
||||||
;; Parsed entity declaration
|
; Parsed entity declaration
|
||||||
|
|
||||||
(PEDecl
|
(PEDecl
|
||||||
"ENTITY" @keyword.directive.define
|
"ENTITY" @keyword.directive.define
|
||||||
"%" @operator
|
"%" @operator
|
||||||
(Name) @function.macro)
|
(Name) @function.macro)
|
||||||
|
|
||||||
(PEDecl (EntityValue) @string)
|
(PEDecl
|
||||||
|
(EntityValue) @string)
|
||||||
;; Notation declaration
|
|
||||||
|
|
||||||
|
; Notation declaration
|
||||||
(NotationDecl
|
(NotationDecl
|
||||||
"NOTATION" @keyword.directive
|
"NOTATION" @keyword.directive
|
||||||
(Name) @label)
|
(Name) @label)
|
||||||
|
|
||||||
((NotationDecl
|
((NotationDecl
|
||||||
(ExternalID
|
(ExternalID
|
||||||
(SystemLiteral (URI) @string.special.url))
|
(SystemLiteral
|
||||||
|
(URI) @string.special.url))
|
||||||
(#set! "priority" 105)))
|
(#set! "priority" 105)))
|
||||||
|
|
||||||
;; Attlist declaration
|
; Attlist declaration
|
||||||
|
|
||||||
(AttlistDecl
|
(AttlistDecl
|
||||||
"ATTLIST" @keyword.directive.define
|
"ATTLIST" @keyword.directive.define
|
||||||
(Name) @tag)
|
(Name) @tag)
|
||||||
|
|
||||||
(AttDef (Name) @tag.attribute)
|
(AttDef
|
||||||
|
(Name) @tag.attribute)
|
||||||
|
|
||||||
(AttDef (Enumeration (Nmtoken) @string))
|
(AttDef
|
||||||
|
(Enumeration
|
||||||
|
(Nmtoken) @string))
|
||||||
|
|
||||||
[
|
[
|
||||||
(StringType)
|
(StringType)
|
||||||
(TokenizedType)
|
(TokenizedType)
|
||||||
] @type.builtin
|
] @type.builtin
|
||||||
|
|
||||||
(NotationType "NOTATION" @type.builtin)
|
(NotationType
|
||||||
|
"NOTATION" @type.builtin)
|
||||||
|
|
||||||
[
|
[
|
||||||
"#REQUIRED"
|
"#REQUIRED"
|
||||||
|
|
@ -82,38 +97,57 @@
|
||||||
"#FIXED"
|
"#FIXED"
|
||||||
] @attribute
|
] @attribute
|
||||||
|
|
||||||
;; Entities
|
; Entities
|
||||||
|
|
||||||
(EntityRef) @constant
|
(EntityRef) @constant
|
||||||
|
|
||||||
((EntityRef) @constant.builtin
|
((EntityRef) @constant.builtin
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin "&" "<" ">" """ "'"))
|
||||||
"&" "<" ">" """ "'"))
|
|
||||||
|
|
||||||
(CharRef) @character
|
(CharRef) @character
|
||||||
|
|
||||||
(PEReference) @function.macro
|
(PEReference) @function.macro
|
||||||
|
|
||||||
;; External references
|
; External references
|
||||||
|
[
|
||||||
[ "PUBLIC" "SYSTEM" ] @keyword
|
"PUBLIC"
|
||||||
|
"SYSTEM"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
(PubidLiteral) @string.special
|
(PubidLiteral) @string.special
|
||||||
|
|
||||||
(SystemLiteral (URI) @string.special.url)
|
(SystemLiteral
|
||||||
|
(URI) @string.special.url)
|
||||||
|
|
||||||
;; Delimiters & punctuation
|
; Delimiters & punctuation
|
||||||
|
[
|
||||||
|
"<?"
|
||||||
|
"?>"
|
||||||
|
"<!"
|
||||||
|
">"
|
||||||
|
"]]>"
|
||||||
|
] @tag.delimiter
|
||||||
|
|
||||||
[ "<?" "?>" "<!" ">" "]]>" ] @tag.delimiter
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[ "(" ")" "[" ] @punctuation.bracket
|
[
|
||||||
|
"\""
|
||||||
|
"'"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[ "\"" "'" ] @punctuation.delimiter
|
[
|
||||||
|
","
|
||||||
|
"|"
|
||||||
|
"="
|
||||||
|
] @operator
|
||||||
|
|
||||||
[ "," "|" "=" ] @operator
|
; Misc
|
||||||
|
[
|
||||||
;; Misc
|
"INCLUDE"
|
||||||
|
"IGNORE"
|
||||||
[ "INCLUDE" "IGNORE" ] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
(Comment) @comment @spell
|
(Comment) @comment @spell
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
(elementdecl (Name) @local.definition.type)
|
(elementdecl
|
||||||
|
(Name) @local.definition.type)
|
||||||
|
|
||||||
(elementdecl
|
(elementdecl
|
||||||
(contentspec
|
(contentspec
|
||||||
(children (Name) @local.reference)))
|
(children
|
||||||
|
(Name) @local.reference)))
|
||||||
|
|
||||||
(AttlistDecl . (Name) @local.reference)
|
(AttlistDecl
|
||||||
|
.
|
||||||
|
(Name) @local.reference)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
;;;; Simple tokens ;;;;
|
; Simple tokens ;;;;
|
||||||
(terminal) @string.grammar
|
(terminal) @string.grammar
|
||||||
|
|
||||||
(special_sequence) @string.special.grammar
|
(special_sequence) @string.special.grammar
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
;;;; Identifiers ;;;;
|
; Identifiers ;;;;
|
||||||
|
|
||||||
; Allow different highlighting for specific casings
|
; Allow different highlighting for specific casings
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#lua-match? @type "^%u"))
|
(#lua-match? @type "^%u"))
|
||||||
|
|
@ -19,7 +18,7 @@
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^%u[%u%d_]+$"))
|
(#lua-match? @constant "^%u[%u%d_]+$"))
|
||||||
|
|
||||||
;;; Punctuation ;;;;
|
; Punctuation ;;;;
|
||||||
[
|
[
|
||||||
";"
|
";"
|
||||||
","
|
","
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,24 @@
|
||||||
; Types
|
; Types
|
||||||
|
|
||||||
; Javascript
|
; Javascript
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
;-----------
|
;-----------
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
; Properties
|
; Properties
|
||||||
;-----------
|
;-----------
|
||||||
|
|
||||||
(property_identifier) @property
|
(property_identifier) @property
|
||||||
|
|
||||||
(shorthand_property_identifier) @property
|
(shorthand_property_identifier) @property
|
||||||
|
|
||||||
(private_property_identifier) @property
|
(private_property_identifier) @property
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (object_pattern
|
name:
|
||||||
|
(object_pattern
|
||||||
(shorthand_property_identifier_pattern))) @variable
|
(shorthand_property_identifier_pattern))) @variable
|
||||||
|
|
||||||
; Special identifiers
|
; Special identifiers
|
||||||
;--------------------
|
;--------------------
|
||||||
|
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#lua-match? @type "^[A-Z]"))
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
|
|
@ -30,63 +29,32 @@
|
||||||
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
|
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#any-of? @variable.builtin
|
(#any-of? @variable.builtin "arguments" "module" "console" "window" "document"))
|
||||||
"arguments"
|
|
||||||
"module"
|
|
||||||
"console"
|
|
||||||
"window"
|
|
||||||
"document"))
|
|
||||||
|
|
||||||
((identifier) @type.builtin
|
((identifier) @type.builtin
|
||||||
(#any-of? @type.builtin
|
(#any-of? @type.builtin "Object" "Function" "Boolean" "Symbol" "Number" "Math" "Date" "String" "RegExp" "Map" "Set" "WeakMap" "WeakSet" "Promise" "Array" "Int8Array" "Uint8Array" "Uint8ClampedArray" "Int16Array" "Uint16Array" "Int32Array" "Uint32Array" "Float32Array" "Float64Array" "ArrayBuffer" "DataView" "Error" "EvalError" "InternalError" "RangeError" "ReferenceError" "SyntaxError" "TypeError" "URIError"))
|
||||||
"Object"
|
|
||||||
"Function"
|
|
||||||
"Boolean"
|
|
||||||
"Symbol"
|
|
||||||
"Number"
|
|
||||||
"Math"
|
|
||||||
"Date"
|
|
||||||
"String"
|
|
||||||
"RegExp"
|
|
||||||
"Map"
|
|
||||||
"Set"
|
|
||||||
"WeakMap"
|
|
||||||
"WeakSet"
|
|
||||||
"Promise"
|
|
||||||
"Array"
|
|
||||||
"Int8Array"
|
|
||||||
"Uint8Array"
|
|
||||||
"Uint8ClampedArray"
|
|
||||||
"Int16Array"
|
|
||||||
"Uint16Array"
|
|
||||||
"Int32Array"
|
|
||||||
"Uint32Array"
|
|
||||||
"Float32Array"
|
|
||||||
"Float64Array"
|
|
||||||
"ArrayBuffer"
|
|
||||||
"DataView"
|
|
||||||
"Error"
|
|
||||||
"EvalError"
|
|
||||||
"InternalError"
|
|
||||||
"RangeError"
|
|
||||||
"ReferenceError"
|
|
||||||
"SyntaxError"
|
|
||||||
"TypeError"
|
|
||||||
"URIError"))
|
|
||||||
|
|
||||||
; Function and method definitions
|
; Function and method definitions
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
(function
|
(function
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(generator_function
|
(generator_function
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(generator_function_declaration
|
(generator_function_declaration
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(method_definition
|
(method_definition
|
||||||
name: [(property_identifier) (private_property_identifier)] @function.method)
|
name:
|
||||||
|
[
|
||||||
|
(property_identifier)
|
||||||
|
(private_property_identifier)
|
||||||
|
] @function.method)
|
||||||
|
|
||||||
(method_definition
|
(method_definition
|
||||||
name: (property_identifier) @constructor
|
name: (property_identifier) @constructor
|
||||||
(#eq? @constructor "constructor"))
|
(#eq? @constructor "constructor"))
|
||||||
|
|
@ -94,22 +62,27 @@
|
||||||
(pair
|
(pair
|
||||||
key: (property_identifier) @function.method
|
key: (property_identifier) @function.method
|
||||||
value: (function))
|
value: (function))
|
||||||
|
|
||||||
(pair
|
(pair
|
||||||
key: (property_identifier) @function.method
|
key: (property_identifier) @function.method
|
||||||
value: (arrow_function))
|
value: (arrow_function))
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (member_expression
|
left:
|
||||||
|
(member_expression
|
||||||
property: (property_identifier) @function.method)
|
property: (property_identifier) @function.method)
|
||||||
right: (arrow_function))
|
right: (arrow_function))
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (member_expression
|
left:
|
||||||
|
(member_expression
|
||||||
property: (property_identifier) @function.method)
|
property: (property_identifier) @function.method)
|
||||||
right: (function))
|
right: (function))
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @function
|
name: (identifier) @function
|
||||||
value: (arrow_function))
|
value: (arrow_function))
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @function
|
name: (identifier) @function
|
||||||
value: (function))
|
value: (function))
|
||||||
|
|
@ -117,42 +90,35 @@
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (identifier) @function
|
left: (identifier) @function
|
||||||
right: (arrow_function))
|
right: (arrow_function))
|
||||||
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (identifier) @function
|
left: (identifier) @function
|
||||||
right: (function))
|
right: (function))
|
||||||
|
|
||||||
; Function and method calls
|
; Function and method calls
|
||||||
;--------------------------
|
;--------------------------
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (member_expression
|
function:
|
||||||
property: [(property_identifier) (private_property_identifier)] @function.method.call))
|
(member_expression
|
||||||
|
property:
|
||||||
|
[
|
||||||
|
(property_identifier)
|
||||||
|
(private_property_identifier)
|
||||||
|
] @function.method.call))
|
||||||
|
|
||||||
; Builtins
|
; Builtins
|
||||||
;---------
|
;---------
|
||||||
|
|
||||||
((identifier) @module.builtin
|
((identifier) @module.builtin
|
||||||
(#eq? @module.builtin "Intl"))
|
(#eq? @module.builtin "Intl"))
|
||||||
|
|
||||||
((identifier) @function.builtin
|
((identifier) @function.builtin
|
||||||
(#any-of? @function.builtin
|
(#any-of? @function.builtin "eval" "isFinite" "isNaN" "parseFloat" "parseInt" "decodeURI" "decodeURIComponent" "encodeURI" "encodeURIComponent" "require"))
|
||||||
"eval"
|
|
||||||
"isFinite"
|
|
||||||
"isNaN"
|
|
||||||
"parseFloat"
|
|
||||||
"parseInt"
|
|
||||||
"decodeURI"
|
|
||||||
"decodeURIComponent"
|
|
||||||
"encodeURI"
|
|
||||||
"encodeURIComponent"
|
|
||||||
"require"))
|
|
||||||
|
|
||||||
; Constructor
|
; Constructor
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
(new_expression
|
(new_expression
|
||||||
constructor: (identifier) @constructor)
|
constructor: (identifier) @constructor)
|
||||||
|
|
||||||
|
|
@ -163,12 +129,17 @@
|
||||||
|
|
||||||
; Decorators
|
; Decorators
|
||||||
;----------
|
;----------
|
||||||
(decorator "@" @attribute (identifier) @attribute)
|
(decorator
|
||||||
(decorator "@" @attribute (call_expression (identifier) @attribute))
|
"@" @attribute
|
||||||
|
(identifier) @attribute)
|
||||||
|
|
||||||
|
(decorator
|
||||||
|
"@" @attribute
|
||||||
|
(call_expression
|
||||||
|
(identifier) @attribute))
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
;---------
|
;---------
|
||||||
|
|
||||||
[
|
[
|
||||||
(this)
|
(this)
|
||||||
(super)
|
(super)
|
||||||
|
|
@ -198,27 +169,42 @@
|
||||||
(#eq? @keyword.directive "use strict"))
|
(#eq? @keyword.directive "use strict"))
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(template_string) @string
|
(template_string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(regex_pattern) @string.regexp
|
(regex_pattern) @string.regexp
|
||||||
|
|
||||||
(regex_flags) @character.special
|
(regex_flags) @character.special
|
||||||
(regex "/" @punctuation.bracket) ; Regex delimiters
|
|
||||||
|
(regex
|
||||||
|
"/" @punctuation.bracket) ; Regex delimiters
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
((identifier) @number
|
((identifier) @number
|
||||||
(#any-of? @number "NaN" "Infinity"))
|
(#any-of? @number "NaN" "Infinity"))
|
||||||
|
|
||||||
; Punctuation
|
; Punctuation
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
";" @punctuation.delimiter
|
";" @punctuation.delimiter
|
||||||
|
|
||||||
"." @punctuation.delimiter
|
"." @punctuation.delimiter
|
||||||
|
|
||||||
"," @punctuation.delimiter
|
"," @punctuation.delimiter
|
||||||
|
|
||||||
(pair ":" @punctuation.delimiter)
|
(pair
|
||||||
(pair_pattern ":" @punctuation.delimiter)
|
":" @punctuation.delimiter)
|
||||||
(switch_case ":" @punctuation.delimiter)
|
|
||||||
(switch_default ":" @punctuation.delimiter)
|
(pair_pattern
|
||||||
|
":" @punctuation.delimiter)
|
||||||
|
|
||||||
|
(switch_case
|
||||||
|
":" @punctuation.delimiter)
|
||||||
|
|
||||||
|
(switch_default
|
||||||
|
":" @punctuation.delimiter)
|
||||||
|
|
||||||
[
|
[
|
||||||
"--"
|
"--"
|
||||||
|
|
@ -265,10 +251,28 @@
|
||||||
"..."
|
"..."
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
(binary_expression "/" @operator)
|
(binary_expression
|
||||||
(ternary_expression ["?" ":"] @keyword.conditional.ternary)
|
"/" @operator)
|
||||||
(unary_expression ["!" "~" "-" "+"] @operator)
|
|
||||||
(unary_expression ["delete" "void"] @keyword.operator)
|
(ternary_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
|
(unary_expression
|
||||||
|
[
|
||||||
|
"!"
|
||||||
|
"~"
|
||||||
|
"-"
|
||||||
|
"+"
|
||||||
|
] @operator)
|
||||||
|
|
||||||
|
(unary_expression
|
||||||
|
[
|
||||||
|
"delete"
|
||||||
|
"void"
|
||||||
|
] @keyword.operator)
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
|
|
@ -279,11 +283,14 @@
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
((template_substitution ["${" "}"] @punctuation.special) @none)
|
((template_substitution
|
||||||
|
[
|
||||||
|
"${"
|
||||||
|
"}"
|
||||||
|
] @punctuation.special) @none)
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
;----------
|
;----------
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"else"
|
"else"
|
||||||
|
|
@ -296,10 +303,17 @@
|
||||||
"from"
|
"from"
|
||||||
] @keyword.import
|
] @keyword.import
|
||||||
|
|
||||||
(export_specifier "as" @keyword.import)
|
(export_specifier
|
||||||
(import_specifier "as" @keyword.import)
|
"as" @keyword.import)
|
||||||
(namespace_export "as" @keyword.import)
|
|
||||||
(namespace_import "as" @keyword.import)
|
(import_specifier
|
||||||
|
"as" @keyword.import)
|
||||||
|
|
||||||
|
(namespace_export
|
||||||
|
"as" @keyword.import)
|
||||||
|
|
||||||
|
(namespace_import
|
||||||
|
"as" @keyword.import)
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
|
|
@ -335,9 +349,7 @@
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword.return
|
] @keyword.return
|
||||||
|
|
||||||
[
|
"function" @keyword.function
|
||||||
"function"
|
|
||||||
] @keyword.function
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"new"
|
"new"
|
||||||
|
|
@ -356,5 +368,6 @@
|
||||||
|
|
||||||
(export_statement
|
(export_statement
|
||||||
"default" @keyword)
|
"default" @keyword)
|
||||||
|
|
||||||
(switch_default
|
(switch_default
|
||||||
"default" @keyword.conditional)
|
"default" @keyword.conditional)
|
||||||
|
|
|
||||||
|
|
@ -18,36 +18,56 @@
|
||||||
(ternary_expression)
|
(ternary_expression)
|
||||||
] @indent.begin
|
] @indent.begin
|
||||||
|
|
||||||
(arguments (call_expression) @indent.begin)
|
(arguments
|
||||||
(binary_expression (call_expression) @indent.begin)
|
(call_expression) @indent.begin)
|
||||||
(expression_statement (call_expression) @indent.begin)
|
|
||||||
|
(binary_expression
|
||||||
|
(call_expression) @indent.begin)
|
||||||
|
|
||||||
|
(expression_statement
|
||||||
|
(call_expression) @indent.begin)
|
||||||
|
|
||||||
(arrow_function
|
(arrow_function
|
||||||
body: (_) @_body
|
body: (_) @_body
|
||||||
(#not-has-type? @_body statement_block)
|
(#not-has-type? @_body statement_block)) @indent.begin
|
||||||
) @indent.begin
|
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
right: (_) @_right
|
right: (_) @_right
|
||||||
(#not-has-type? @_right arrow_function function)
|
(#not-has-type? @_right arrow_function function)) @indent.begin
|
||||||
) @indent.begin
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
value: (_) @_value
|
value: (_) @_value
|
||||||
(#not-has-type? @_value arrow_function call_expression function)
|
(#not-has-type? @_value arrow_function call_expression function)) @indent.begin
|
||||||
) @indent.begin
|
|
||||||
|
|
||||||
(arguments ")" @indent.end)
|
(arguments
|
||||||
(object "}" @indent.end)
|
")" @indent.end)
|
||||||
(statement_block "}" @indent.end)
|
|
||||||
|
(object
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
|
(statement_block
|
||||||
|
"}" @indent.end)
|
||||||
|
|
||||||
[
|
[
|
||||||
(arguments (object))
|
(arguments
|
||||||
|
(object))
|
||||||
")"
|
")"
|
||||||
"}"
|
"}"
|
||||||
"]"
|
"]"
|
||||||
] @indent.branch
|
] @indent.branch
|
||||||
(statement_block "{" @indent.branch)
|
|
||||||
|
|
||||||
(parenthesized_expression ("(" (_) ")" @indent.end))
|
(statement_block
|
||||||
["}" "]"] @indent.end
|
"{" @indent.branch)
|
||||||
|
|
||||||
|
(parenthesized_expression
|
||||||
|
("("
|
||||||
|
(_)
|
||||||
|
")" @indent.end))
|
||||||
|
|
||||||
|
[
|
||||||
|
"}"
|
||||||
|
"]"
|
||||||
|
] @indent.end
|
||||||
|
|
||||||
(template_string) @indent.ignore
|
(template_string) @indent.ignore
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,10 @@
|
||||||
|
|
||||||
; html(`...`), html`...`, sql(...) etc
|
; html(`...`), html`...`, sql(...) etc
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @injection.language)
|
function:
|
||||||
arguments: [
|
((identifier) @injection.language)
|
||||||
|
arguments:
|
||||||
|
[
|
||||||
(arguments
|
(arguments
|
||||||
(template_string) @injection.content)
|
(template_string) @injection.content)
|
||||||
(template_string) @injection.content
|
(template_string) @injection.content
|
||||||
|
|
@ -19,8 +21,11 @@
|
||||||
|
|
||||||
; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query
|
; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name (#eq? @_name "svg"))
|
function:
|
||||||
arguments: [
|
((identifier) @_name
|
||||||
|
(#eq? @_name "svg"))
|
||||||
|
arguments:
|
||||||
|
[
|
||||||
(arguments
|
(arguments
|
||||||
(template_string) @injection.content)
|
(template_string) @injection.content)
|
||||||
(template_string) @injection.content
|
(template_string) @injection.content
|
||||||
|
|
@ -28,18 +33,21 @@
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "html"))
|
(#set! injection.language "html"))
|
||||||
|
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name
|
function:
|
||||||
|
((identifier) @_name
|
||||||
(#eq? @_name "gql"))
|
(#eq? @_name "gql"))
|
||||||
arguments: ((template_string) @injection.content
|
arguments:
|
||||||
|
((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "graphql")))
|
(#set! injection.language "graphql")))
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: ((identifier) @_name
|
function:
|
||||||
|
((identifier) @_name
|
||||||
(#eq? @_name "hbs"))
|
(#eq? @_name "hbs"))
|
||||||
arguments: ((template_string) @injection.content
|
arguments:
|
||||||
|
((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "glimmer")))
|
(#set! injection.language "glimmer")))
|
||||||
|
|
||||||
|
|
@ -48,42 +56,53 @@
|
||||||
|
|
||||||
; styled.div`<css>`
|
; styled.div`<css>`
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (member_expression
|
function:
|
||||||
|
(member_expression
|
||||||
object: (identifier) @_name
|
object: (identifier) @_name
|
||||||
(#eq? @_name "styled"))
|
(#eq? @_name "styled"))
|
||||||
arguments: ((template_string) @injection.content
|
arguments:
|
||||||
|
((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "styled")))
|
(#set! injection.language "styled")))
|
||||||
|
|
||||||
; styled(Component)`<css>`
|
; styled(Component)`<css>`
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (call_expression
|
function:
|
||||||
|
(call_expression
|
||||||
function: (identifier) @_name
|
function: (identifier) @_name
|
||||||
(#eq? @_name "styled"))
|
(#eq? @_name "styled"))
|
||||||
arguments: ((template_string) @injection.content
|
arguments:
|
||||||
|
((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "styled")))
|
(#set! injection.language "styled")))
|
||||||
|
|
||||||
; styled.div.attrs({ prop: "foo" })`<css>`
|
; styled.div.attrs({ prop: "foo" })`<css>`
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (call_expression
|
function:
|
||||||
function: (member_expression
|
(call_expression
|
||||||
object: (member_expression
|
function:
|
||||||
|
(member_expression
|
||||||
|
object:
|
||||||
|
(member_expression
|
||||||
object: (identifier) @_name
|
object: (identifier) @_name
|
||||||
(#eq? @_name "styled"))))
|
(#eq? @_name "styled"))))
|
||||||
arguments: ((template_string) @injection.content
|
arguments:
|
||||||
|
((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "styled")))
|
(#set! injection.language "styled")))
|
||||||
|
|
||||||
|
|
||||||
; styled(Component).attrs({ prop: "foo" })`<css>`
|
; styled(Component).attrs({ prop: "foo" })`<css>`
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (call_expression
|
function:
|
||||||
function: (member_expression
|
(call_expression
|
||||||
object: (call_expression
|
function:
|
||||||
|
(member_expression
|
||||||
|
object:
|
||||||
|
(call_expression
|
||||||
function: (identifier) @_name
|
function: (identifier) @_name
|
||||||
(#eq? @_name "styled"))))
|
(#eq? @_name "styled"))))
|
||||||
arguments: ((template_string) @injection.content
|
arguments:
|
||||||
|
((template_string) @injection.content
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
(#set! injection.language "styled")))
|
(#set! injection.language "styled")))
|
||||||
|
|
||||||
|
|
@ -94,7 +113,6 @@
|
||||||
; (#eq? @_gql_comment "/* GraphQL */")
|
; (#eq? @_gql_comment "/* GraphQL */")
|
||||||
; (template_string) @injection.content
|
; (template_string) @injection.content
|
||||||
; (#set! injection.language "graphql"))
|
; (#set! injection.language "graphql"))
|
||||||
|
|
||||||
((template_string) @injection.content
|
((template_string) @injection.content
|
||||||
(#lua-match? @injection.content "^`#graphql")
|
(#lua-match? @injection.content "^`#graphql")
|
||||||
(#offset! @injection.content 0 1 0 -1)
|
(#offset! @injection.content 0 1 0 -1)
|
||||||
|
|
@ -117,5 +135,6 @@
|
||||||
property: (property_identifier) @_prop
|
property: (property_identifier) @_prop
|
||||||
(#any-of? @_prop "outerHTML" "innerHTML"))
|
(#any-of? @_prop "outerHTML" "innerHTML"))
|
||||||
right:
|
right:
|
||||||
(string (string_fragment) @injection.content)
|
(string
|
||||||
|
(string_fragment) @injection.content)
|
||||||
(#set! injection.language "html"))
|
(#set! injection.language "html"))
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,23 @@
|
||||||
; Scopes
|
; Scopes
|
||||||
;-------
|
;-------
|
||||||
|
|
||||||
(statement_block) @local.scope
|
(statement_block) @local.scope
|
||||||
|
|
||||||
(function) @local.scope
|
(function) @local.scope
|
||||||
|
|
||||||
(arrow_function) @local.scope
|
(arrow_function) @local.scope
|
||||||
|
|
||||||
(function_declaration) @local.scope
|
(function_declaration) @local.scope
|
||||||
|
|
||||||
(method_definition) @local.scope
|
(method_definition) @local.scope
|
||||||
|
|
||||||
(for_statement) @local.scope
|
(for_statement) @local.scope
|
||||||
|
|
||||||
(for_in_statement) @local.scope
|
(for_in_statement) @local.scope
|
||||||
|
|
||||||
(catch_clause) @local.scope
|
(catch_clause) @local.scope
|
||||||
|
|
||||||
; Definitions
|
; Definitions
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @local.definition.var)
|
name: (identifier) @local.definition.var)
|
||||||
|
|
||||||
|
|
@ -32,6 +37,6 @@
|
||||||
|
|
||||||
; References
|
; References
|
||||||
;------------
|
;------------
|
||||||
|
|
||||||
(identifier) @local.reference
|
(identifier) @local.reference
|
||||||
|
|
||||||
(shorthand_property_identifier) @local.reference
|
(shorthand_property_identifier) @local.reference
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
"=" @punctuation.delimiter
|
"=" @punctuation.delimiter
|
||||||
|
|
||||||
[ "[" "]" ] @punctuation.bracket
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
((section_name) @variable.builtin
|
((section_name) @variable.builtin
|
||||||
(#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$"))
|
(#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$"))
|
||||||
|
|
@ -14,36 +17,42 @@
|
||||||
|
|
||||||
(section
|
(section
|
||||||
(section_name) @_name
|
(section_name) @_name
|
||||||
(statement (key) @_key) @string
|
(statement
|
||||||
|
(key) @_key) @string
|
||||||
(#match? @_key "\\c^ParameterName$")
|
(#match? @_key "\\c^ParameterName$")
|
||||||
(#not-match? @_name "\\c^Comments$"))
|
(#not-match? @_name "\\c^Comments$"))
|
||||||
|
|
||||||
(section
|
(section
|
||||||
(section_name) @_name
|
(section_name) @_name
|
||||||
(statement (key) @_key) @type
|
(statement
|
||||||
|
(key) @_key) @type
|
||||||
(#match? @_key "\\c^ObjectType$")
|
(#match? @_key "\\c^ObjectType$")
|
||||||
(#not-match? @_name "\\c^Comments$"))
|
(#not-match? @_name "\\c^Comments$"))
|
||||||
|
|
||||||
(section
|
(section
|
||||||
(section_name) @_name
|
(section_name) @_name
|
||||||
(statement (key) @_key) @type
|
(statement
|
||||||
|
(key) @_key) @type
|
||||||
(#match? @_key "\\c^DataType$")
|
(#match? @_key "\\c^DataType$")
|
||||||
(#not-match? @_name "\\c^Comments$"))
|
(#not-match? @_name "\\c^Comments$"))
|
||||||
|
|
||||||
(section
|
(section
|
||||||
(section_name) @_name
|
(section_name) @_name
|
||||||
(statement (key) @_key) @type.qualifier
|
(statement
|
||||||
|
(key) @_key) @type.qualifier
|
||||||
(#match? @_key "\\c^AccessType$")
|
(#match? @_key "\\c^AccessType$")
|
||||||
(#not-match? @_name "\\c^Comments$"))
|
(#not-match? @_name "\\c^Comments$"))
|
||||||
|
|
||||||
(section
|
(section
|
||||||
(section_name) @_name
|
(section_name) @_name
|
||||||
(statement (key) @_key) @attribute
|
(statement
|
||||||
|
(key) @_key) @attribute
|
||||||
(#match? @_key "\\c^PDOMapping$")
|
(#match? @_key "\\c^PDOMapping$")
|
||||||
(#not-match? @_name "\\c^Comments$"))
|
(#not-match? @_name "\\c^Comments$"))
|
||||||
|
|
||||||
(section
|
(section
|
||||||
(section_name) @_name
|
(section_name) @_name
|
||||||
(statement (key) @_key) @number
|
(statement
|
||||||
|
(key) @_key) @number
|
||||||
(#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$")
|
(#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$")
|
||||||
(#not-match? @_name "\\c^Comments$"))
|
(#not-match? @_name "\\c^Comments$"))
|
||||||
|
|
|
||||||
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