chore: query formatting

This commit is contained in:
Pham Huy Hoang 2024-01-06 15:05:50 +09:00 committed by Christian Clason
parent 79975d6557
commit 57a8acf0c4
674 changed files with 18466 additions and 12648 deletions

View file

@ -1,14 +1,13 @@
;; Support for folding in Ada
;; za toggles folding a package, subprogram, if statement or loop
; Support for folding in Ada
; za toggles folding a package, subprogram, if statement or loop
[
(package_declaration)
(generic_package_declaration)
(package_body)
(subprogram_body)
(block_statement)
(if_statement)
(loop_statement)
(gnatprep_declarative_if_statement)
(gnatprep_if_statement)
(package_declaration)
(generic_package_declaration)
(package_body)
(subprogram_body)
(block_statement)
(if_statement)
(loop_statement)
(gnatprep_declarative_if_statement)
(gnatprep_if_statement)
] @fold

View file

@ -1,190 +1,288 @@
;; highlight queries.
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
;; for a list of recommended @ tags, though not all of them have matching
;; highlights in neovim.
; highlight queries.
; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
; for a list of recommended @ tags, though not all of them have matching
; highlights in neovim.
[
"abort"
"abs"
"abstract"
"accept"
"access"
"all"
"array"
"at"
"begin"
"declare"
"delay"
"delta"
"digits"
"do"
"end"
"entry"
"exit"
"generic"
"interface"
"is"
"limited"
"null"
"of"
"others"
"out"
"pragma"
"private"
"range"
"synchronized"
"tagged"
"task"
"terminate"
"until"
"when"
] @keyword
[
"abort"
"abs"
"abstract"
"accept"
"access"
"all"
"array"
"at"
"begin"
"declare"
"delay"
"delta"
"digits"
"do"
"end"
"entry"
"exit"
"generic"
"interface"
"is"
"limited"
"null"
"of"
"others"
"out"
"pragma"
"private"
"range"
"synchronized"
"tagged"
"task"
"terminate"
"until"
"when"
] @keyword
[
"aliased"
"constant"
"renames"
"aliased"
"constant"
"renames"
] @keyword.storage
[
"mod"
"new"
"protected"
"record"
"subtype"
"type"
"mod"
"new"
"protected"
"record"
"subtype"
"type"
] @keyword.type
[
"with"
"use"
"with"
"use"
] @keyword.import
[
"body"
"function"
"overriding"
"procedure"
"package"
"separate"
"body"
"function"
"overriding"
"procedure"
"package"
"separate"
] @keyword.function
[
"and"
"in"
"not"
"or"
"xor"
"and"
"in"
"not"
"or"
"xor"
] @keyword.operator
[
"while"
"loop"
"for"
"parallel"
"reverse"
"some"
"while"
"loop"
"for"
"parallel"
"reverse"
"some"
] @keyword.repeat
"return" @keyword.return
[
"return"
] @keyword.return
[
"case"
"if"
"else"
"then"
"elsif"
"select"
"case"
"if"
"else"
"then"
"elsif"
"select"
] @keyword.conditional
[
"exception"
"raise"
"exception"
"raise"
] @keyword.exception
(comment) @comment @spell
(string_literal) @string
(character_literal) @string
(numeric_literal) @number
;; Highlight the name of subprograms
(procedure_specification name: (_) @function)
(function_specification name: (_) @function)
(package_declaration name: (_) @function)
(package_body name: (_) @function)
(generic_instantiation name: (_) @function)
(entry_declaration . (identifier) @function)
; Highlight the name of subprograms
(procedure_specification
name: (_) @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)
(function_specification
name: (_) @function)
(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)
(package_declaration
name: (_) @function)
(raise_statement "with" @keyword.exception)
(package_body
name: (_) @function)
(gnatprep_declarative_if_statement) @keyword.directive
(gnatprep_if_statement) @keyword.directive
(gnatprep_identifier) @keyword.directive
(generic_instantiation
name: (_) @function)
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
(aspect_specification "with" @keyword.function)
(entry_declaration
.
(identifier) @function)
(full_type_declaration "is" @keyword.type)
(subtype_declaration "is" @keyword.type)
(record_definition "end" @keyword.type)
(full_type_declaration (_ "access" @keyword.type))
(array_type_definition "array" @keyword.type "of" @keyword.type)
(access_to_object_definition "access" @keyword.type)
(access_to_object_definition "access" @keyword.type
[
(general_access_modifier "constant" @keyword.type)
(general_access_modifier "all" @keyword.type)
]
)
(range_constraint "range" @keyword.type)
(signed_integer_type_definition "range" @keyword.type)
(index_subtype_definition "range" @keyword.type)
(record_type_definition "abstract" @keyword.type)
(record_type_definition "tagged" @keyword.type)
(record_type_definition "limited" @keyword.type)
(record_type_definition (record_definition "null" @keyword.type))
(private_type_declaration "is" @keyword.type "private" @keyword.type)
(private_type_declaration "tagged" @keyword.type)
(private_type_declaration "limited" @keyword.type)
(task_type_declaration "task" @keyword.type "is" @keyword.type)
; Some keywords should take different categories depending on the context
(use_clause
"use" @keyword.import
"type" @keyword.import)
;; Gray the body of expression functions
(with_clause
"private" @keyword.import)
(with_clause
"limited" @keyword.import)
(use_clause
(_) @module)
(with_clause
(_) @module)
(loop_statement
"end" @keyword.repeat)
(if_statement
"end" @keyword.conditional)
(loop_parameter_specification
"in" @keyword.repeat)
(loop_parameter_specification
"in" @keyword.repeat)
(iterator_specification
[
"in"
"of"
] @keyword.repeat)
(range_attribute_designator
"range" @keyword.repeat)
(raise_statement
"with" @keyword.exception)
(gnatprep_declarative_if_statement) @keyword.directive
(gnatprep_if_statement) @keyword.directive
(gnatprep_identifier) @keyword.directive
(subprogram_declaration
"is" @keyword.function
"abstract" @keyword.function)
(aspect_specification
"with" @keyword.function)
(full_type_declaration
"is" @keyword.type)
(subtype_declaration
"is" @keyword.type)
(record_definition
"end" @keyword.type)
(full_type_declaration
(_
"access" @keyword.type))
(array_type_definition
"array" @keyword.type
"of" @keyword.type)
(access_to_object_definition
"access" @keyword.type)
(access_to_object_definition
"access" @keyword.type
[
(general_access_modifier
"constant" @keyword.type)
(general_access_modifier
"all" @keyword.type)
])
(range_constraint
"range" @keyword.type)
(signed_integer_type_definition
"range" @keyword.type)
(index_subtype_definition
"range" @keyword.type)
(record_type_definition
"abstract" @keyword.type)
(record_type_definition
"tagged" @keyword.type)
(record_type_definition
"limited" @keyword.type)
(record_type_definition
(record_definition
"null" @keyword.type))
(private_type_declaration
"is" @keyword.type
"private" @keyword.type)
(private_type_declaration
"tagged" @keyword.type)
(private_type_declaration
"limited" @keyword.type)
(task_type_declaration
"task" @keyword.type
"is" @keyword.type)
; Gray the body of expression functions
(expression_function_declaration
(function_specification)
"is"
(_) @attribute
)
(subprogram_declaration (aspect_specification) @attribute)
(function_specification)
"is"
(_) @attribute)
;; Highlight full subprogram specifications
(subprogram_declaration
(aspect_specification) @attribute)
; Highlight full subprogram specifications
;(subprogram_body
; [
; (procedure_specification)
; (function_specification)
; ] @function.spec
;)
((comment) @comment.documentation
. [
(entry_declaration)
(subprogram_declaration)
(parameter_specification)
])
.
[
(entry_declaration)
(subprogram_declaration)
(parameter_specification)
])
(compilation_unit
. (comment) @comment.documentation)
(compilation_unit
.
(comment) @comment.documentation)
(component_list
(component_declaration)
. (comment) @comment.documentation)
.
(comment) @comment.documentation)
(enumeration_type_definition
(enumeration_type_definition
(identifier)
. (comment) @comment.documentation)
.
(comment) @comment.documentation)

View file

@ -1,33 +1,91 @@
;; Better highlighting by referencing to the definition, for variable
;; references. However, this is not yet supported by neovim
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
; Better highlighting by referencing to the definition, for variable
; references. However, this is not yet supported by neovim
; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
(compilation) @local.scope
(package_declaration) @local.scope
(package_body) @local.scope
(subprogram_declaration) @local.scope
(subprogram_body) @local.scope
(block_statement) @local.scope
(with_clause (identifier) @local.definition.import)
(procedure_specification name: (_) @local.definition.function)
(function_specification name: (_) @local.definition.function)
(package_declaration name: (_) @local.definition.var)
(package_body name: (_) @local.definition.var)
(generic_instantiation . name: (_) @local.definition.var)
(component_declaration . (identifier) @local.definition.var)
(exception_declaration . (identifier) @local.definition.var)
(formal_object_declaration . (identifier) @local.definition.var)
(object_declaration . (identifier) @local.definition.var)
(parameter_specification . (identifier) @local.definition.var)
(full_type_declaration . (identifier) @local.definition.type)
(private_type_declaration . (identifier) @local.definition.type)
(private_extension_declaration . (identifier) @local.definition.type)
(incomplete_type_declaration . (identifier) @local.definition.type)
(protected_type_declaration . (identifier) @local.definition.type)
(formal_complete_type_declaration . (identifier) @local.definition.type)
(formal_incomplete_type_declaration . (identifier) @local.definition.type)
(task_type_declaration . (identifier) @local.definition.type)
(subtype_declaration . (identifier) @local.definition.type)
(with_clause
(identifier) @local.definition.import)
(procedure_specification
name: (_) @local.definition.function)
(function_specification
name: (_) @local.definition.function)
(package_declaration
name: (_) @local.definition.var)
(package_body
name: (_) @local.definition.var)
(generic_instantiation
.
name: (_) @local.definition.var)
(component_declaration
.
(identifier) @local.definition.var)
(exception_declaration
.
(identifier) @local.definition.var)
(formal_object_declaration
.
(identifier) @local.definition.var)
(object_declaration
.
(identifier) @local.definition.var)
(parameter_specification
.
(identifier) @local.definition.var)
(full_type_declaration
.
(identifier) @local.definition.type)
(private_type_declaration
.
(identifier) @local.definition.type)
(private_extension_declaration
.
(identifier) @local.definition.type)
(incomplete_type_declaration
.
(identifier) @local.definition.type)
(protected_type_declaration
.
(identifier) @local.definition.type)
(formal_complete_type_declaration
.
(identifier) @local.definition.type)
(formal_incomplete_type_declaration
.
(identifier) @local.definition.type)
(task_type_declaration
.
(identifier) @local.definition.type)
(subtype_declaration
.
(identifier) @local.definition.type)
(identifier) @local.reference

View file

@ -1,4 +1,4 @@
[
(record)
(module)
(record)
(module)
] @fold

View file

@ -1,43 +1,52 @@
;; Constants
; Constants
(integer) @number
;; Variables and Symbols
; Variables and Symbols
(typed_binding
(atom
(qid) @variable))
(typed_binding (atom (qid) @variable))
(untyped_binding) @variable
(typed_binding (expr) @type)
(typed_binding
(expr) @type)
(id) @function
(bid) @function
(function_name (atom (qid) @function))
(function_name
(atom
(qid) @function))
(field_name) @function
[(data_name) (record_name)] @constructor
[
(data_name)
(record_name)
] @constructor
; Set
(SetN) @type.builtin
(expr . (atom) @function)
(expr
.
(atom) @function)
((atom) @boolean
(#any-of? @boolean "true" "false" "True" "False"))
;; Imports and Module Declarations
"import" @keyword.import
; Imports and Module Declarations
"import" @keyword.import
(module_name) @module
;; Pragmas and comments
; Pragmas and comments
(pragma) @keyword.directive
(comment) @comment @spell
;; Keywords
; Keywords
[
"where"
"data"
@ -62,20 +71,16 @@
"infixl"
"infixr"
"record"
]
@keyword
;;;(expr
;;; f_name: (atom) @function)
;; Brackets
] @keyword
;(expr
; f_name: (atom) @function)
; Brackets
[
"("
")"
"{"
"}"]
@punctuation.bracket
"}"
] @punctuation.bracket
[
"="
] @operator
"=" @operator

View file

@ -1,12 +1,19 @@
(identifier) @variable
(pipe_sequence "|" @operator)
(pipe_sequence
"|" @operator)
(string) @string
(number) @number
(pipe_call
name: (identifier) @function)
(pipe_call
arguments: (pipe_arguments
(identifier) @variable.parameter))
arguments:
(pipe_arguments
(identifier) @variable.parameter))
(structural_assignment
operator: (identifier) @keyword)
@ -18,32 +25,34 @@
function: (identifier) @function)
(call_expression
function: ((identifier) @function.builtin
(#eq? @function.builtin "$any")))
function:
((identifier) @function.builtin
(#eq? @function.builtin "$any")))
[
"let"
"as"
"let"
"as"
] @keyword
[
"("
")"
"["
"]"
"{"
"}"
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
";"
"."
","
"?."
";"
"."
","
"?."
] @punctuation.delimiter
((identifier) @boolean
(#any-of? @boolean "true" "false"))
((identifier) @variable.builtin
(#any-of? @variable.builtin "this" "\$event" "null"))

View file

@ -1,6 +1,6 @@
[
(class_body)
(constructor_declaration)
(argument_list)
(annotation_argument_list)
(class_body)
(constructor_declaration)
(argument_list)
(annotation_argument_list)
] @fold

View file

@ -1,7 +1,5 @@
; inherits: soql
;;; Apex + SOQL
; Apex + SOQL
[
"["
"]"
@ -17,16 +15,14 @@
":"
"?"
";"
] @punctuation.delimiter
;; Default general color defination
] @punctuation.delimiter
; Default general color defination
(identifier) @variable
(type_identifier) @type
;; Methods
; Methods
(method_declaration
name: (identifier) @function.method)
@ -35,13 +31,11 @@
(super) @function.builtin
;; Annotations
; Annotations
(annotation
name: (identifier) @attribute)
;; Types
; Types
(interface_declaration
name: (identifier) @type)
@ -49,7 +43,7 @@
name: (identifier) @type)
(class_declaration
(superclass) @type)
(superclass) @type)
(enum_declaration
name: (identifier) @type)
@ -57,8 +51,11 @@
(enum_constant
name: (identifier) @constant)
(type_arguments "<" @punctuation.delimiter)
(type_arguments ">" @punctuation.delimiter)
(type_arguments
"<" @punctuation.delimiter)
(type_arguments
">" @punctuation.delimiter)
((field_access
object: (identifier) @type))
@ -68,11 +65,11 @@
((scoped_identifier
scope: (identifier) @type)
(#match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
((method_invocation
object: (identifier) @type)
(#match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))
(method_declaration
(formal_parameters
@ -86,16 +83,21 @@
(assignment_operator) @operator
(update_expression ["++" "--"] @operator)
(update_expression
[
"++"
"--"
] @operator)
(trigger_declaration
name: (identifier) @type
object: (identifier) @type
(trigger_event) @keyword
("," (trigger_event) @keyword)*)
(","
(trigger_event) @keyword)*)
[
"@"
"@"
"="
"!="
"<="
@ -103,35 +105,39 @@
] @operator
(binary_expression
operator: [
">"
"<"
"=="
"==="
"!=="
"&&"
"||"
"+"
"-"
"*"
"/"
"&"
"|"
"^"
"%"
"<<"
">>"
">>>"] @operator)
operator:
[
">"
"<"
"=="
"==="
"!=="
"&&"
"||"
"+"
"-"
"*"
"/"
"&"
"|"
"^"
"%"
"<<"
">>"
">>>"
] @operator)
(unary_expression
operator: [
"+"
"-"
"!"
"~"
]) @operator
operator:
[
"+"
"-"
"!"
"~"
]) @operator
(map_initializer "=>" @operator)
(map_initializer
"=>" @operator)
[
(boolean_type)
@ -139,18 +145,27 @@
] @type.builtin
; Fields
(field_declaration
declarator: (variable_declarator
name: (identifier) @variable.member))
declarator:
(variable_declarator
name: (identifier) @variable.member))
(field_access
field: (identifier) @variable.member)
; Variables
(field_declaration
(modifiers (modifier ["final" "static"])(modifier ["final" "static"]))
(modifiers
(modifier
[
"final"
"static"
])
(modifier
[
"final"
"static"
]))
(variable_declarator
name: (identifier) @constant))
@ -163,7 +178,6 @@
(this) @variable.builtin
; Literals
[
(int)
(decimal)
@ -179,16 +193,15 @@
(null_literal) @constant.builtin
;; ;; Keywords
; ;; Keywords
[
"abstract"
"final"
"private"
"protected"
"public"
"static"
] @type.qualifier
"abstract"
"final"
"private"
"protected"
"public"
"static"
] @type.qualifier
[
"if"
@ -203,16 +216,14 @@
"break"
] @keyword.repeat
[
"return"
] @keyword.return
"return" @keyword.return
[
"throw"
"finally"
"try"
"catch"
] @keyword.exception
"throw"
"finally"
"try"
"catch"
] @keyword.exception
"new" @keyword.operator

View file

@ -1,41 +1,46 @@
; declarations
(class_declaration) @local.scope
(method_declaration) @local.scope
(constructor_declaration) @local.scope
(enum_declaration) @local.scope
(enhanced_for_statement) @local.scope
; if/else
(if_statement) @local.scope
(if_statement
consequence: (_) @local.scope) ; if body in case there are no braces
(if_statement
alternative: (_) @local.scope) ; else body in case there are no braces
; try/catch
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
(catch_clause) @local.scope ; needed because `Exception` variable
; loops
(for_statement) @local.scope
(for_statement ; "for" body in case there are no braces
(for_statement ; "for" body in case there are no braces
body: (_) @local.scope)
(do_statement
body: (_) @local.scope)
(while_statement
body: (_) @local.scope)
; Functions
(constructor_declaration) @local.scope
(method_declaration) @local.scope
;; definitions
; definitions
(enum_declaration
name: (identifier) @local.definition.enum)
@ -43,10 +48,11 @@
name: (identifier) @local.definition.method)
(local_variable_declaration
declarator: (variable_declarator
name: (identifier) @local.definition.var))
declarator:
(variable_declarator
name: (identifier) @local.definition.var))
(enhanced_for_statement
(enhanced_for_statement
name: (identifier) @local.definition.var)
(formal_parameter
@ -56,11 +62,11 @@
name: (identifier) @local.definition.parameter)
(field_declaration
declarator: (variable_declarator
name: (identifier) @local.definition.field))
;; REFERENCES
declarator:
(variable_declarator
name: (identifier) @local.definition.field))
; REFERENCES
(identifier) @local.reference
(type_identifier) @local.reference

View file

@ -1,5 +1,4 @@
; inherits: cpp
((identifier) @function.builtin
; format-ignore
(#any-of? @function.builtin
@ -72,25 +71,10 @@
"noInterrupts"))
((identifier) @type.builtin
(#any-of? @type.builtin
"Serial"
"SPI"
"Stream"
"Wire"
"Keyboard"
"Mouse"
"String"
))
(#any-of? @type.builtin "Serial" "SPI" "Stream" "Wire" "Keyboard" "Mouse" "String"))
((identifier) @constant.builtin
(#any-of? @constant.builtin
"HIGH"
"LOW"
"INPUT"
"OUTPUT"
"INPUT_PULLUP"
"LED_BUILTIN"
))
(#any-of? @constant.builtin "HIGH" "LOW" "INPUT" "OUTPUT" "INPUT_PULLUP" "LED_BUILTIN"))
(function_definition
(function_declarator

View file

@ -1,5 +1,5 @@
((preproc_arg) @injection.content
(#set! injection.language "arduino"))
(#set! injection.language "arduino"))
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,13 +1,20 @@
; inherits: html
"---" @punctuation.delimiter
[ "---" ] @punctuation.delimiter
[ "{" "}" ] @punctuation.special
[
"{"
"}"
] @punctuation.special
; custom components get `@type` highlighting
((start_tag (tag_name) @type)
(#lua-match? @type "^[A-Z]"))
((end_tag (tag_name) @type)
(#lua-match? @type "^[A-Z]"))
((erroneous_end_tag (erroneous_end_tag_name) @type)
(#lua-match? @type "^[A-Z]"))
((start_tag
(tag_name) @type)
(#lua-match? @type "^[A-Z]"))
((end_tag
(tag_name) @type)
(#lua-match? @type "^[A-Z]"))
((erroneous_end_tag
(erroneous_end_tag_name) @type)
(#lua-match? @type "^[A-Z]"))

View file

@ -1,5 +1,4 @@
; inherits: html_tags
(frontmatter
(raw_text) @injection.content
(#set! injection.language "typescript"))
@ -13,11 +12,12 @@
(#set! injection.language "typescript"))
(style_element
(start_tag
(attribute
(attribute_name) @_lang_attr
(quoted_attribute_value (attribute_value) @_lang_value)))
(raw_text) @injection.content
(#eq? @_lang_attr "lang")
(#eq? @_lang_value "scss")
(#set! injection.language "scss"))
(start_tag
(attribute
(attribute_name) @_lang_attr
(quoted_attribute_value
(attribute_value) @_lang_value)))
(raw_text) @injection.content
(#eq? @_lang_attr "lang")
(#eq? @_lang_value "scss")
(#set! injection.language "scss"))

View file

@ -11,7 +11,8 @@
(identifier) @type))
; relations
(rel_expression (identifier) @property)
(rel_expression
(identifier) @property)
(relation
(rel_expression
@ -20,16 +21,18 @@
(identifier) @constant))
; permissions
(perm_expression (identifier) @property)
(perm_expression
(identifier) @property)
(call_expression
function: (selector_expression
operand: (identifier) @constant
field: (field_identifier) @function.method))
function:
(selector_expression
operand: (identifier) @constant
field: (field_identifier) @function.method))
(perm_expression
(stabby) @operator
.
.
(identifier) @function)
; misc

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
(#set! injection.language "comment"))

View file

@ -1,67 +1,54 @@
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
[
(identifier)
(field_ref)
] @variable
(field_ref (_) @variable)
(field_ref
(_) @variable)
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
((identifier) @constant.builtin
(#any-of? @constant.builtin
"ARGC"
"ARGV"
"ARGIND"
"ENVIRON"
"ERRNO"
"FILENAME"
"FNR"
"NF"
"FUNCTAB"
"NR"
"PROCINFO"
"RLENGTH"
"RSTART"
"RT"
"SYMTAB"))
(#any-of? @constant.builtin "ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO" "RLENGTH" "RSTART" "RT" "SYMTAB"))
; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html
((identifier) @variable.builtin
(#any-of? @variable.builtin
"BINMODE"
"CONVFMT"
"FIELDWIDTHS"
"FPAT"
"FS"
"IGNORECASE"
"LINT"
"OFMT"
"OFS"
"ORS"
"PREC"
"ROUNDMODE"
"RS"
"SUBSEP"
"TEXTDOMAIN"))
(#any-of? @variable.builtin "BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC" "ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN"))
(number) @number
(string) @string
(regex) @string.regexp
(escape_sequence) @string.escape
(comment) @comment @spell
((program . (comment) @keyword.directive)
((program
.
(comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))
(ns_qualified_name (namespace) @module)
(ns_qualified_name "::" @punctuation.delimiter)
(ns_qualified_name
(namespace) @module)
(func_def name: (_ (identifier) @function) @function)
(func_call name: (_ (identifier) @function) @function)
(ns_qualified_name
"::" @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"
@ -110,80 +97,95 @@
"@namespace" @keyword.directive
[
"BEGIN"
"END"
"BEGINFILE"
"ENDFILE"
"BEGIN"
"END"
"BEGINFILE"
"ENDFILE"
] @label
(binary_exp [
"^"
"**"
"*"
"/"
"%"
"+"
"-"
"<"
">"
"<="
">="
"=="
"!="
"~"
"!~"
"in"
"&&"
"||"
] @operator)
(binary_exp
[
"^"
"**"
"*"
"/"
"%"
"+"
"-"
"<"
">"
"<="
">="
"=="
"!="
"~"
"!~"
"in"
"&&"
"||"
] @operator)
(unary_exp [
"!"
"+"
"-"
] @operator)
(unary_exp
[
"!"
"+"
"-"
] @operator)
(assignment_exp [
"="
"+="
"-="
"*="
"/="
"%="
"^="
] @operator)
(assignment_exp
[
"="
"+="
"-="
"*="
"/="
"%="
"^="
] @operator)
(ternary_exp [
"?"
":"
] @keyword.conditional.ternary)
(ternary_exp
[
"?"
":"
] @keyword.conditional.ternary)
(update_exp [
"++"
"--"
] @operator)
(update_exp
[
"++"
"--"
] @operator)
(redirected_io_statement [
">"
">>"
] @operator)
(redirected_io_statement
[
">"
">>"
] @operator)
(piped_io_statement [
"|"
"|&"
] @operator)
(piped_io_statement
[
"|"
"|&"
] @operator)
(piped_io_exp [
"|"
"|&"
] @operator)
(piped_io_exp
[
"|"
"|&"
] @operator)
(field_ref "$" @punctuation.delimiter)
(field_ref
"$" @punctuation.delimiter)
(regex "/" @punctuation.delimiter)
(regex_constant "@" @punctuation.delimiter)
(regex
"/" @punctuation.delimiter)
[ ";" "," ] @punctuation.delimiter
(regex_constant
"@" @punctuation.delimiter)
[
";"
","
] @punctuation.delimiter
[
"("

View file

@ -1,13 +1,17 @@
((comment) @injection.content
(#set! injection.language "comment"))
(#set! injection.language "comment"))
((regex) @injection.content
(#set! injection.language "regex"))
(#set! injection.language "regex"))
((print_statement
(exp_list . (string) @injection.content))
(#set! injection.language "printf"))
(exp_list
.
(string) @injection.content))
(#set! injection.language "printf"))
((printf_statement
(exp_list . (string) @injection.content))
(#set! injection.language "printf"))
(exp_list
.
(string) @injection.content))
(#set! injection.language "printf"))

View file

@ -1,84 +1,89 @@
[
"(" ")"
"{" "}"
"[" "]"
"[[" "]]"
"((" "))"
"("
")"
"{"
"}"
"["
"]"
"[["
"]]"
"(("
"))"
] @punctuation.bracket
[
";"
";;"
";&"
";;&"
"&"
";"
";;"
";&"
";;&"
"&"
] @punctuation.delimiter
[
">"
">>"
"<"
"<<"
"&&"
"|"
"|&"
"||"
"="
"+="
"=~"
"=="
"!="
"&>"
"&>>"
"<&"
">&"
">|"
"<&-"
">&-"
"<<-"
"<<<"
".."
">"
">>"
"<"
"<<"
"&&"
"|"
"|&"
"||"
"="
"+="
"=~"
"=="
"!="
"&>"
"&>>"
"<&"
">&"
">|"
"<&-"
">&-"
"<<-"
"<<<"
".."
] @operator
; Do *not* spell check strings since they typically have some sort of
; interpolation in them, or, are typically used for things like filenames, URLs,
; flags and file content.
[
(string)
(raw_string)
(ansi_c_string)
(heredoc_body)
(string)
(raw_string)
(ansi_c_string)
(heredoc_body)
] @string
[
(heredoc_start)
(heredoc_end)
(heredoc_start)
(heredoc_end)
] @label
(variable_assignment (word) @string)
(command argument: "$" @string) ; bare dollar
(variable_assignment
(word) @string)
(command
argument: "$" @string) ; bare dollar
[
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
] @keyword.conditional
[
"for"
"do"
"done"
"select"
"until"
"while"
"for"
"do"
"done"
"select"
"until"
"while"
] @keyword.repeat
[
@ -97,36 +102,54 @@
; trap -l
((word) @constant.builtin
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
((word) @boolean
(#any-of? @boolean "true" "false"))
(#any-of? @boolean "true" "false"))
(comment) @comment @spell
(test_operator) @operator
(command_substitution "$(" @punctuation.bracket)
(process_substitution "<(" @punctuation.bracket)
(command_substitution
"$(" @punctuation.bracket)
(process_substitution
"<(" @punctuation.bracket)
(arithmetic_expansion
[ "$((" "((" ] @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)
(unary_expression operator: _ @operator)
(postfix_expression operator: _ @operator)
(binary_expression
operator: _ @operator)
(unary_expression
operator: _ @operator)
(postfix_expression
operator: _ @operator)
(function_definition
name: (word) @function)
(command_name (word) @function.call)
(command_name
(word) @function.call)
((command_name (word) @function.builtin)
((command_name
(word) @function.builtin)
; format-ignore
(#any-of? @function.builtin
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
@ -140,14 +163,17 @@
"ulimit" "umask" "unalias" "wait"))
(command
argument: [
(word) @variable.parameter
(concatenation (word) @variable.parameter)
])
argument:
[
(word) @variable.parameter
(concatenation
(word) @variable.parameter)
])
(number) @number
((word) @number
(#lua-match? @number "^[0-9]+$"))
(#lua-match? @number "^[0-9]+$"))
(file_redirect
destination: (word) @variable.parameter)
@ -156,24 +182,30 @@
(simple_expansion
"$" @punctuation.special) @none
(expansion
"${" @punctuation.special
"}" @punctuation.special) @none
(expansion operator: _ @punctuation.special)
(expansion "@" . operator: _ @character.special)
(expansion
operator: _ @punctuation.special)
(expansion
"@"
.
operator: _ @character.special)
((expansion
(subscript
index: (word) @character.special))
(#any-of? @character.special "@" "*"))
(#any-of? @character.special "@" "*"))
"``" @punctuation.special
(variable_name) @variable
((variable_name) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(case_item
value: (word) @variable.parameter)
@ -183,5 +215,7 @@
(extglob_pattern)
] @string.regexp
((program . (comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))
((program
.
(comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))

View file

@ -1,35 +1,52 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))
((regex) @injection.content
(#set! injection.language "regex"))
(#set! injection.language "regex"))
((heredoc_redirect
(heredoc_body) @injection.content
(heredoc_end) @injection.language)
(#downcase! @injection.language))
(#downcase! @injection.language))
; printf 'format'
((command
name: (command_name) @_command
. argument: [(string) (raw_string)] @injection.content)
(#eq? @_command "printf")
(#set! injection.language "printf"))
.
argument:
[
(string)
(raw_string)
] @injection.content)
(#eq? @_command "printf")
(#set! injection.language "printf"))
; printf -v var 'format'
((command
name: (command_name) @_command
argument: (word) @_arg
. (_) . argument: [(string) (raw_string)] @injection.content)
(#eq? @_command "printf")
(#eq? @_arg "-v")
(#set! injection.language "printf"))
.
(_)
.
argument:
[
(string)
(raw_string)
] @injection.content)
(#eq? @_command "printf")
(#eq? @_arg "-v")
(#set! injection.language "printf"))
; printf -- 'format'
((command
name: (command_name) @_command
argument: (word) @_arg
. argument: [(string) (raw_string)] @injection.content)
(#eq? @_command "printf")
(#eq? @_arg "--")
(#set! injection.language "printf"))
.
argument:
[
(string)
(raw_string)
] @injection.content)
(#eq? @_command "printf")
(#eq? @_arg "--")
(#set! injection.language "printf"))

View file

@ -2,7 +2,7 @@
(function_definition) @local.scope
; Definitions
(variable_assignment
(variable_assignment
name: (variable_name) @local.definition.var)
(function_definition
@ -10,4 +10,5 @@
; References
(variable_name) @local.reference
(word) @local.reference

View file

@ -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)
;; Constants
(symbind
(symbol) @variable)
; Constants
((symbol) @constant
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
;; Functions
(list
. (symbol) @function)
;; Namespaces
; Functions
(list
.
(symbol) @function)
; Namespaces
(symbind
(symbol) @module
. (keyword))
;; Includes
.
(keyword))
; Includes
((symbol) @keyword.import
(#any-of? @keyword.import "use" "import" "load"))
;; Keywords
; Keywords
((symbol) @keyword
(#any-of? @keyword "do" "doc"))
;; Special Functions
; Special Functions
; Keywords construct a symbol
(keyword) @constructor
((list
. (symbol) @keyword.function
. (symbol) @function
.
(symbol) @keyword.function
.
(symbol) @function
(symbol)? @variable.parameter)
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
((cons
. (symbol) @keyword.function
. (symbol) @function
.
(symbol) @keyword.function
.
(symbol) @function
(symbol)? @variable.parameter)
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
@ -58,33 +60,38 @@
((symbol) @function.macro
(#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
;; Conditionals
; Conditionals
((symbol) @keyword.conditional
(#any-of? @keyword.conditional "if" "case" "cond" "when"))
;; Repeats
; Repeats
((symbol) @keyword.repeat
(#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
(#eq? @punctuation.delimiter "->"))
;; Literals
; Literals
(string) @string
(escape_sequence) @string.escape
@ -100,10 +107,7 @@
(null)
] @constant.builtin
[
"^"
] @character.special
;; Comments
"^" @character.special
; Comments
(comment) @comment @spell

View file

@ -10,11 +10,20 @@
"]"
] @indent.end
[ "(" ")" ] @indent.branch
[
"("
")"
] @indent.branch
[ "{" "}" ] @indent.branch
[
"{"
"}"
] @indent.branch
[ "[" "]" ] @indent.branch
[
"["
"]"
] @indent.branch
[
(ERROR)

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,5 +1,4 @@
; Scopes
[
(list)
(scope)
@ -7,19 +6,21 @@
] @local.scope
; References
(symbol) @local.reference
; Definitions
((list
. (symbol) @_fnkw
. (symbol) @local.definition.function
.
(symbol) @_fnkw
.
(symbol) @local.definition.function
(symbol)? @local.definition.parameter)
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
((cons
. (symbol) @_fnkw
. (symbol) @local.definition.function
.
(symbol) @_fnkw
.
(symbol) @local.definition.function
(symbol)? @local.definition.parameter)
(#any-of? @_fnkw "def" "defop" "defn" "fn"))

View file

@ -1,4 +1,4 @@
[
(transaction)
(section)
(transaction)
(section)
] @fold

View file

@ -1,24 +1,57 @@
(date) @variable.member
(txn) @attribute
(account) @type
(amount) @number
(incomplete_amount) @number
(compound_amount) @number
(amount_tolerance) @number
(currency) @property
(key) @label
(string) @string
(narration) @string @spell
(payee) @string @spell
(tag) @constant
(link) @constant
[
(minus) (plus) (slash) (asterisk)
(minus)
(plus)
(slash)
(asterisk)
] @operator
(comment) @comment @spell
[
(balance) (open) (close) (commodity) (pad)
(event) (price) (note) (document) (query)
(custom) (pushtag) (poptag) (pushmeta)
(popmeta) (option) (include) (plugin)
(balance)
(open)
(close)
(commodity)
(pad)
(event)
(price)
(note)
(document)
(query)
(custom)
(pushtag)
(poptag)
(pushmeta)
(popmeta)
(option)
(include)
(plugin)
] @keyword

View file

@ -1,3 +1 @@
[
(entry)
] @fold
(entry) @fold

View file

@ -1,5 +1,4 @@
; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex)
[
(string_type)
(preamble_type)

View file

@ -1,10 +1,8 @@
[
(entry)
] @indent.begin
(entry) @indent.begin
[
"{"
"}"
"{"
"}"
] @indent.branch
(comment) @indent.ignore

View file

@ -6,20 +6,14 @@
(resource_declaration)
(type_declaration)
(variable_declaration)
(parenthesized_expression)
(decorators)
(array)
(object)
(if_statement)
(for_statement)
(subscript_expression)
(ternary_expression)
(string)
(comment)
] @fold

View file

@ -1,5 +1,4 @@
; Includes
(import_statement
"import" @keyword.import)
@ -8,12 +7,10 @@
"with" @keyword.import)
; Namespaces
(module_declaration
(identifier) @module)
; Builtins
(primitive_type) @type.builtin
((member_expression
@ -21,12 +18,10 @@
(#eq? @type.builtin "sys"))
; Functions
(call_expression
function: (identifier) @function.call)
; Properties
(object_property
(identifier) @property
":" @punctuation.delimiter
@ -40,21 +35,20 @@
(property_identifier) @property
; Attributes
(decorator
"@" @attribute)
(decorator
(call_expression (identifier) @attribute))
(call_expression
(identifier) @attribute))
(decorator
(call_expression
(member_expression
object: (identifier) @attribute
property: (property_identifier) @attribute)))
object: (identifier) @attribute
property: (property_identifier) @attribute)))
; Types
(type_declaration
(identifier) @type)
@ -66,7 +60,8 @@
(type_declaration
(identifier)
"="
(array_type (identifier) @type))
(array_type
(identifier) @type))
(type
(identifier) @type)
@ -78,21 +73,22 @@
(identifier) @type)
; Parameters
(parameter_declaration
(identifier) @variable.parameter
(_))
(call_expression
function: (_)
(arguments (identifier) @variable.parameter))
function: (_)
(arguments
(identifier) @variable.parameter))
(call_expression
function: (_)
(arguments (member_expression object: (identifier) @variable.parameter)))
function: (_)
(arguments
(member_expression
object: (identifier) @variable.parameter)))
; Variables
(variable_declaration
(identifier) @variable
(_))
@ -117,7 +113,6 @@
(loop_enumerator) @variable))
; Conditionals
"if" @keyword.conditional
(ternary_expression
@ -125,14 +120,12 @@
":" @keyword.conditional.ternary)
; Loops
(for_statement
"for" @keyword.repeat
"in"
":" @punctuation.delimiter)
; Keywords
[
"module"
"metadata"
@ -146,7 +139,6 @@
] @keyword
; Operators
[
"+"
"-"
@ -169,14 +161,11 @@
"!"
] @operator
[
"in"
] @keyword.operator
"in" @keyword.operator
; Literals
(string) @string
(import_string
"'" @string
(import_name) @module
@ -192,17 +181,25 @@
(null) @constant.builtin
; Misc
(compatible_identifier
"?" @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
; Interpolation
(interpolation) @none
(interpolation
@ -223,7 +218,6 @@
(identifier) @variable)
; Comments
[
(comment)
(diagnostic_comment)

View file

@ -5,11 +5,20 @@
"}" @indent.end
[ "{" "}" ] @indent.branch
[
"{"
"}"
] @indent.branch
[ "[" "]" ] @indent.branch
[
"["
"]"
] @indent.branch
[ "(" ")" ] @indent.branch
[
"("
")"
] @indent.branch
[
(ERROR)

View file

@ -1,5 +1,5 @@
([
(comment)
(diagnostic_comment)
] @injection.content
(#set! injection.language "comment"))
] @injection.content
(#set! injection.language "comment"))

View file

@ -1,22 +1,17 @@
; Scopes
[
(infrastructure)
(call_expression)
(lambda_expression)
(subscript_expression)
(if_statement)
(for_statement)
(array)
(object)
(interpolation)
] @local.scope
; References
(property_identifier) @local.reference
(call_expression
@ -31,7 +26,6 @@
(identifier) @local.reference)
; Definitions
(type) @local.definition.associated
(object_property

View file

@ -2,28 +2,23 @@
(function_definition)
(anonymous_python_function)
(python_function_definition)
(while_statement)
(for_statement)
(if_statement)
(with_statement)
(try_statement)
(import_from_statement)
(parameters)
(argument_list)
(parenthesized_expression)
(generator_expression)
(list_comprehension)
(set_comprehension)
(dictionary_comprehension)
(tuple)
(list)
(set)
(dictionary)
(string)
(python_string)
] @fold

View file

@ -1,5 +1,4 @@
; Includes
[
"inherit"
"include"
@ -9,12 +8,10 @@
] @keyword.import
; Keywords
[
"unset"
"EXPORT_FUNCTIONS"
"python"
"assert"
"exec"
"global"
@ -34,19 +31,34 @@
"return"
"yield"
] @keyword.return
(yield "from" @keyword.return)
(yield
"from" @keyword.return)
(future_import_statement
"from" @keyword.import
"__future__" @constant.builtin)
(import_from_statement "from" @keyword.import)
(import_from_statement
"from" @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"
@ -56,7 +68,8 @@
"finally"
] @keyword.exception
(raise_statement "from" @keyword.exception)
(raise_statement
"from" @keyword.exception)
(try_statement
(else_clause
@ -82,7 +95,6 @@
] @type.qualifier
; Variables
[
(identifier)
(python_identifier)
@ -99,14 +111,18 @@
; Reset highlighting in f-string interpolations
(interpolation) @none
;; Identifier naming conventions
; Identifier naming conventions
((python_identifier) @type
(#lua-match? @type "^[A-Z].*[a-z]"))
([(identifier) (python_identifier)] @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(#lua-match? @type "^[A-Z].*[a-z]"))
([
(identifier)
(python_identifier)
] @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
((python_identifier) @constant.builtin
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
((python_identifier) @constant.builtin
; format-ignore
@ -117,128 +133,149 @@
((assignment
left: (python_identifier) @type.definition
(type (python_identifier) @_annotation))
(#eq? @_annotation "TypeAlias"))
(type
(python_identifier) @_annotation))
(#eq? @_annotation "TypeAlias"))
((assignment
left: (python_identifier) @type.definition
right: (call
function: (python_identifier) @_func))
(#any-of? @_func "TypeVar" "NewType"))
right:
(call
function: (python_identifier) @_func))
(#any-of? @_func "TypeVar" "NewType"))
; Fields
(flag) @variable.member
((attribute
attribute: (python_identifier) @variable.member)
(#lua-match? @variable.member "^[%l_].*$"))
attribute: (python_identifier) @variable.member)
(#lua-match? @variable.member "^[%l_].*$"))
; Functions
(call
function: (python_identifier) @function.call)
(call
function: (attribute
attribute: (python_identifier) @function.method.call))
function:
(attribute
attribute: (python_identifier) @function.method.call))
((call
function: (python_identifier) @constructor)
(#lua-match? @constructor "^%u"))
function: (python_identifier) @constructor)
(#lua-match? @constructor "^%u"))
((call
function: (attribute
attribute: (python_identifier) @constructor))
(#lua-match? @constructor "^%u"))
function:
(attribute
attribute: (python_identifier) @constructor))
(#lua-match? @constructor "^%u"))
((call
function: (python_identifier) @function.builtin)
(#any-of? @function.builtin
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod"
"compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format"
"frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass"
"iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow"
"print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str"
"sum" "super" "tuple" "type" "vars" "zip" "__import__"))
(#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__"))
(python_function_definition
name: (python_identifier) @function)
(type (python_identifier) @type)
(type
(python_identifier) @type)
(type
(subscript
(python_identifier) @type)) ; type subscript: Tuple[int]
((call
function: (python_identifier) @_isinstance
arguments: (argument_list
(_)
(python_identifier) @type))
(#eq? @_isinstance "isinstance"))
arguments:
(argument_list
(_)
(python_identifier) @type))
(#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
body:
(block
. (expression_statement (python_string) @string.documentation @spell)))
.
(expression_statement
(python_string) @string.documentation @spell)))
; Namespace
(inherit_path) @module
;; Normal parameters
; Normal parameters
(parameters
(python_identifier) @variable.parameter)
;; Lambda parameters
; Lambda parameters
(lambda_parameters
(python_identifier) @variable.parameter)
(lambda_parameters
(tuple_pattern
(python_identifier) @variable.parameter))
; Default parameters
(keyword_argument
name: (python_identifier) @variable.parameter)
; Naming parameters on call-site
(default_parameter
name: (python_identifier) @variable.parameter)
(typed_parameter
(python_identifier) @variable.parameter)
(typed_default_parameter
(python_identifier) @variable.parameter)
; Variadic parameters *args, **kwargs
(parameters
(list_splat_pattern ; *args
(list_splat_pattern
; *args
(python_identifier) @variable.parameter))
(parameters
(dictionary_splat_pattern ; **kwargs
(dictionary_splat_pattern
; **kwargs
(python_identifier) @variable.parameter))
;; Literals
; Literals
(none) @constant.builtin
[(true) (false)] @boolean
[
(true)
(false)
] @boolean
((python_identifier) @variable.builtin
(#eq? @variable.builtin "self"))
(#eq? @variable.builtin "self"))
((python_identifier) @variable.builtin
(#eq? @variable.builtin "cls"))
(#eq? @variable.builtin "cls"))
(integer) @number
(float) @number.float
; Operators
[
"?="
"??="
@ -293,12 +330,10 @@
"or"
"is not"
"not in"
"del"
] @keyword.operator
; Literals
[
(string)
(python_string)
@ -313,8 +348,14 @@
] @string.escape
; Punctuation
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
":"
@ -325,15 +366,28 @@
(ellipsis)
] @punctuation.delimiter
(variable_expansion [ "${" "}" ] @punctuation.special)
(inline_python [ "${@" "}" ] @punctuation.special)
(variable_expansion
[
"${"
"}"
] @punctuation.special)
(inline_python
[
"${@"
"}"
] @punctuation.special)
(interpolation
"{" @punctuation.special
"}" @punctuation.special)
(type_conversion) @function.macro
([(identifier) (python_identifier)] @type.builtin
([
(identifier)
(python_identifier)
] @type.builtin
; format-ignore
(#any-of? @type.builtin
; https://docs.python.org/3/library/exceptions.html

View file

@ -1,76 +1,101 @@
[
(import_from_statement)
(parenthesized_expression)
(generator_expression)
(list_comprehension)
(set_comprehension)
(dictionary_comprehension)
(tuple_pattern)
(list_pattern)
(binary_operator)
(lambda)
(concatenated_string)
] @indent.begin
((list) @indent.align
(#set! indent.open_delimiter "[")
(#set! indent.close_delimiter "]")
)
(#set! indent.open_delimiter "[")
(#set! indent.close_delimiter "]"))
((dictionary) @indent.align
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}")
)
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}"))
((set) @indent.align
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}")
)
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}"))
((for_statement) @indent.begin
(#set! indent.immediate 1))
(#set! indent.immediate 1))
((if_statement) @indent.begin
(#set! indent.immediate 1))
(#set! indent.immediate 1))
((while_statement) @indent.begin
(#set! indent.immediate 1))
(#set! indent.immediate 1))
((try_statement) @indent.begin
(#set! indent.immediate 1))
(ERROR "try" ":" @indent.begin (#set! indent.immediate 1))
(#set! indent.immediate 1))
(ERROR
"try"
":" @indent.begin
(#set! indent.immediate 1))
((python_function_definition) @indent.begin
(#set! indent.immediate 1))
(#set! indent.immediate 1))
(function_definition) @indent.begin
(anonymous_python_function) @indent.begin
((with_statement) @indent.begin
(#set! indent.immediate 1))
(#set! indent.immediate 1))
(if_statement
condition: (parenthesized_expression) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
(while_statement
condition: (parenthesized_expression) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_))
(ERROR
"(" @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
.
(_))
((argument_list) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
((parameters) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
((tuple) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
(#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 "}") . (_))
(ERROR
"{" @indent.align
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}")
.
(_))
[
(break_statement)
@ -78,24 +103,43 @@
] @indent.dedent
(ERROR
(_) @indent.branch ":" .
(_) @indent.branch
":"
.
(#lua-match? @indent.branch "^else"))
(ERROR
(_) @indent.branch @indent.dedent ":" .
(_) @indent.branch @indent.dedent
":"
.
(#lua-match? @indent.branch "^elif"))
(parenthesized_expression ")" @indent.end)
(generator_expression ")" @indent.end)
(list_comprehension "]" @indent.end)
(set_comprehension "}" @indent.end)
(dictionary_comprehension "}" @indent.end)
(parenthesized_expression
")" @indent.end)
(tuple_pattern ")" @indent.end)
(list_pattern "]" @indent.end)
(generator_expression
")" @indent.end)
(function_definition "}" @indent.end)
(anonymous_python_function "}" @indent.end)
(list_comprehension
"]" @indent.end)
(set_comprehension
"}" @indent.end)
(dictionary_comprehension
"}" @indent.end)
(tuple_pattern
")" @indent.end)
(list_pattern
"]" @indent.end)
(function_definition
"}" @indent.end)
(anonymous_python_function
"}" @indent.end)
(return_statement
[
@ -107,10 +151,12 @@
"}"
"]"
] @indent.end .)
(attribute
(attribute
attribute: (_) @indent.end)
(call
arguments: (_ ")" @indent.end))
arguments:
(_
")" @indent.end))
"return" @indent.end
] .)

View file

@ -1,8 +1,11 @@
(call
function: (attribute
object: (python_identifier) @_re)
arguments: (argument_list (python_string
(string_content) @injection.content) @_string)
function:
(attribute
object: (python_identifier) @_re)
arguments:
(argument_list
(python_string
(string_content) @injection.content) @_string)
(#eq? @_re "re")
(#lua-match? @_string "^r.*")
(#set! injection.language "regex"))
@ -11,4 +14,4 @@
(#set! injection.language "bash"))
((comment) @injection.content
(#set! injection.language "comment"))
(#set! injection.language "comment"))

View file

@ -7,10 +7,16 @@
; Imports
(aliased_import
alias: (python_identifier) @local.definition.import)
(import_statement
name: (dotted_name ((python_identifier) @local.definition.import)))
name:
(dotted_name
((python_identifier) @local.definition.import)))
(import_from_statement
name: (dotted_name ((python_identifier) @local.definition.import)))
name:
(dotted_name
((python_identifier) @local.definition.import)))
; Function with parameters, defines parameters
(parameters
@ -38,58 +44,80 @@
; Function defines function and scope
((python_function_definition
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!
(for_statement
left: (pattern_list
(python_identifier) @local.definition.var))
left:
(pattern_list
(python_identifier) @local.definition.var))
(for_statement
left: (tuple_pattern
(python_identifier) @local.definition.var))
left:
(tuple_pattern
(python_identifier) @local.definition.var))
(for_statement
left: (python_identifier) @local.definition.var)
; not a scope!
;(while_statement) @local.scope
; for in list comprehension
(for_in_clause
left: (python_identifier) @local.definition.var)
(for_in_clause
left: (tuple_pattern
(python_identifier) @local.definition.var))
left:
(tuple_pattern
(python_identifier) @local.definition.var))
(for_in_clause
left: (pattern_list
(python_identifier) @local.definition.var))
left:
(pattern_list
(python_identifier) @local.definition.var))
(dictionary_comprehension) @local.scope
(list_comprehension) @local.scope
(set_comprehension) @local.scope
;;; Assignments
; Assignments
(assignment
left: (python_identifier) @local.definition.var)
(assignment
left: (python_identifier) @local.definition.var)
left:
(pattern_list
(python_identifier) @local.definition.var))
(assignment
left: (pattern_list
(python_identifier) @local.definition.var))
(assignment
left: (tuple_pattern
(python_identifier) @local.definition.var))
left:
(tuple_pattern
(python_identifier) @local.definition.var))
(assignment
left: (attribute
(python_identifier)
(python_identifier) @local.definition.field))
left:
(attribute
(python_identifier)
(python_identifier) @local.definition.field))
(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var)
(variable_assignment
(identifier)
operator:
[
"="
"?="
"??="
":="
] @local.definition.var)
; Walrus operator x := 1
(named_expression

View file

@ -1,6 +1,7 @@
(object_id) @variable
(string) @string
(escape_sequence) @string.escape
(comment) @comment @spell
@ -15,30 +16,50 @@
(decorator) @attribute
(property_definition (property_name) @property)
(property_definition
(property_name) @property)
(object) @type
(signal_binding (signal_name) @function.builtin)
(signal_binding (function (identifier)) @function)
(signal_binding "swapped" @keyword)
(signal_binding
(signal_name) @function.builtin)
(styles_list "styles" @function.macro)
(layout_definition "layout" @function.macro)
(signal_binding
(function
(identifier)) @function)
(gettext_string "_" @function.builtin)
(signal_binding
"swapped" @keyword)
(menu_definition "menu" @keyword)
(menu_section "section" @keyword)
(menu_item "item" @function.macro)
(styles_list
"styles" @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
(number) @number
[

View file

@ -1,21 +1,21 @@
[
(for_statement)
(if_statement)
(while_statement)
(do_statement)
(switch_statement)
(case_statement)
(function_definition)
(struct_specifier)
(enum_specifier)
(comment)
(preproc_if)
(preproc_elif)
(preproc_else)
(preproc_ifdef)
(preproc_function_def)
(initializer_list)
(gnu_asm_expression)
(for_statement)
(if_statement)
(while_statement)
(do_statement)
(switch_statement)
(case_statement)
(function_definition)
(struct_specifier)
(enum_specifier)
(comment)
(preproc_if)
(preproc_elif)
(preproc_else)
(preproc_ifdef)
(preproc_function_def)
(initializer_list)
(gnu_asm_expression)
] @fold
(compound_statement

View file

@ -1,6 +1,9 @@
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
((identifier) @variable (#set! "priority" 95))
(preproc_def (preproc_arg) @variable)
((identifier) @variable
(#set! "priority" 95))
(preproc_def
(preproc_arg) @variable)
[
"default"
@ -17,7 +20,10 @@
"sizeof"
"offsetof"
] @keyword.operator
(alignof_expression . _ @keyword.operator)
(alignof_expression
.
_ @keyword.operator)
"return" @keyword.return
@ -30,10 +36,10 @@
] @keyword.repeat
[
"if"
"else"
"case"
"switch"
"if"
"else"
"case"
"switch"
] @keyword.conditional
[
@ -52,42 +58,48 @@
"#include" @keyword.import
[ ";" ":" "," "::" ] @punctuation.delimiter
[
";"
":"
","
"::"
] @punctuation.delimiter
"..." @punctuation.special
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
"="
"-"
"*"
"/"
"+"
"%"
"~"
"|"
"&"
"^"
"<<"
">>"
"->"
"."
"<"
"<="
">="
">"
"=="
"!="
"!"
"&&"
"||"
"-="
"+="
"*="
@ -102,42 +114,54 @@
"++"
] @operator
;; Make sure the comma operator is given a highlight group after the comma
;; punctuator so the operator is highlighted properly.
(comma_expression [ "," ] @operator)
; Make sure the comma operator is given a highlight group after the comma
; punctuator so the operator is highlighted properly.
(comma_expression
"," @operator)
[
(true)
(false)
] @boolean
(conditional_expression [ "?" ":" ] @keyword.conditional.ternary)
(conditional_expression
[
"?"
":"
] @keyword.conditional.ternary)
(string_literal) @string
(system_lib_string) @string
(escape_sequence) @string.escape
(null) @constant.builtin
(number_literal) @number
(char_literal) @character
((preproc_arg) @function.macro (#set! "priority" 90))
((preproc_arg) @function.macro
(#set! "priority" 90))
(preproc_defined) @function.macro
((field_expression
(field_identifier) @property) @_parent
(#not-has-parent? @_parent template_method function_declarator call_expression))
(field_identifier) @property) @_parent
(#not-has-parent? @_parent template_method function_declarator call_expression))
(field_designator) @property
((field_identifier) @property
(#has-ancestor? @property field_declaration)
(#not-has-ancestor? @property function_declarator))
(#has-ancestor? @property field_declaration)
(#not-has-ancestor? @property function_declarator))
(statement_identifier) @label
[
(type_identifier)
(type_descriptor)
(type_identifier)
(type_descriptor)
] @type
(storage_class_specifier) @keyword.storage
@ -156,14 +180,20 @@
(primitive_type) @type.builtin
(sized_type_specifier _ @type.builtin type: _?)
(sized_type_specifier
_ @type.builtin
type: _?)
((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
(preproc_def (preproc_arg) @constant
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
(preproc_def
(preproc_arg) @constant
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
(enumerator
name: (identifier) @constant)
(case_statement
value: (identifier) @constant)
@ -181,7 +211,9 @@
"__clang_wide_literal_encoding__"
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
"__VA_ARGS__" "__VA_OPT__"))
(preproc_def (preproc_arg) @constant.builtin
(preproc_def
(preproc_arg) @constant.builtin
; format-ignore
(#any-of? @constant.builtin
"stderr" "stdin" "stdout"
@ -197,21 +229,26 @@
"__VA_ARGS__" "__VA_OPT__"))
(attribute_specifier
(argument_list (identifier) @variable.builtin))
(argument_list
(identifier) @variable.builtin))
((attribute_specifier
(argument_list (call_expression
function: (identifier) @variable.builtin))))
(argument_list
(call_expression
function: (identifier) @variable.builtin))))
((call_expression
function: (identifier) @function.builtin)
(#lua-match? @function.builtin "^__builtin_"))
((call_expression
function: (identifier) @function.builtin)
function: (identifier) @function.builtin)
(#has-ancestor? @function.builtin attribute_specifier))
;; Preproc def / undef
; Preproc def / undef
(preproc_def
name: (_) @constant)
(preproc_call
directive: (preproc_directive) @_u
argument: (_) @constant
@ -219,15 +256,21 @@
(call_expression
function: (identifier) @function.call)
(call_expression
function: (field_expression
field: (field_identifier) @function.call))
function:
(field_expression
field: (field_identifier) @function.call))
(function_declarator
declarator: (identifier) @function)
(function_declarator
declarator: (parenthesized_declarator
(pointer_declarator
declarator: (field_identifier) @function)))
declarator:
(parenthesized_declarator
(pointer_declarator
declarator: (field_identifier) @function)))
(preproc_function_def
name: (identifier) @function.macro)
@ -236,7 +279,7 @@
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
;; Parameters
; Parameters
(parameter_declaration
declarator: (identifier) @variable.parameter)
@ -268,8 +311,8 @@
; declarator: _
; (declaration
; declarator: (pointer_declarator) @variable.parameter))
(preproc_params (identifier) @variable.parameter)
(preproc_params
(identifier) @variable.parameter)
[
"__attribute__"

View file

@ -1,5 +1,5 @@
[
(compound_statement)
(compound_statement)
(field_declaration_list)
(case_statement)
(enumerator_list)
@ -7,56 +7,62 @@
(initializer_list)
(init_declarator)
] @indent.begin
; With current indent logic, if we capture expression_statement with @indent.begin
; It will be affected by _parent_ node with error subnodes deep down the tree
; So narrow indent capture to check for error inside expression statement only,
; So narrow indent capture to check for error inside expression statement only,
(expression_statement
(_) @indent.begin
";" @indent.end)
(ERROR
"for" "(" @indent.begin ";" ";" ")" @indent.end)
"for"
"(" @indent.begin
";"
";"
")" @indent.end)
((for_statement
body: (_) @_body) @indent.begin
body: (_) @_body) @indent.begin
(#not-has-type? @_body compound_statement))
(while_statement
condition: (_) @indent.begin)
((while_statement
body: (_) @_body) @indent.begin
body: (_) @_body) @indent.begin
(#not-has-type? @_body compound_statement))
(
(if_statement)
((if_statement)
.
(ERROR "else" @indent.begin))
(ERROR
"else" @indent.begin))
(if_statement
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
consequence:
(_ ";" @indent.end) @_consequence
(#not-has-type? @_consequence compound_statement)
consequence:
(_
";" @indent.end) @_consequence
(#not-has-type? @_consequence compound_statement)
alternative:
(else_clause
(else_clause
"else" @indent.branch
[
(if_statement (compound_statement) @indent.dedent)? @indent.dedent
[
(if_statement
(compound_statement) @indent.dedent)? @indent.dedent
(compound_statement)? @indent.dedent
(_)? @indent.dedent
]
)?
) @indent.begin)
])?) @indent.begin)
(else_clause (_ . "{" @indent.branch))
(else_clause
(_
.
"{" @indent.branch))
(compound_statement "}" @indent.end)
(compound_statement
"}" @indent.end)
[
")"
@ -79,12 +85,16 @@
(string_literal)
] @indent.ignore
((ERROR (parameter_declaration)) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
([(argument_list) (parameter_list)] @indent.align
((ERROR
(parameter_declaration)) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
([
(argument_list)
(parameter_list)
] @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
(comment) @indent.auto

View file

@ -1,8 +1,8 @@
((preproc_arg) @injection.content
(#set! injection.language "c"))
(#set! injection.language "c"))
((comment) @injection.content
(#set! injection.language "comment"))
(#set! injection.language "comment"))
((comment) @injection.content
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
@ -14,8 +14,11 @@
((call_expression
function: (identifier) @_function
arguments: (argument_list
. (string_literal (string_content) @injection.content)))
arguments:
(argument_list
.
(string_literal
(string_content) @injection.content)))
; format-ignore
(#any-of? @_function
"printf" "printf_s"
@ -29,12 +32,16 @@
"cscanf" "_cscanf"
"printw"
"scanw")
(#set! injection.language "printf"))
(#set! injection.language "printf"))
((call_expression
function: (identifier) @_function
arguments: (argument_list
(_) . (string_literal (string_content) @injection.content)))
arguments:
(argument_list
(_)
.
(string_literal
(string_content) @injection.content)))
; format-ignore
(#any-of? @_function
"fprintf" "fprintf_s"
@ -57,12 +64,18 @@
"vw_printw" "vwprintw"
"wscanw"
"vw_scanw" "vwscanw")
(#set! injection.language "printf"))
(#set! injection.language "printf"))
((call_expression
function: (identifier) @_function
arguments: (argument_list
(_) . (_) . (string_literal (string_content) @injection.content)))
arguments:
(argument_list
(_)
.
(_)
.
(string_literal
(string_content) @injection.content)))
; format-ignore
(#any-of? @_function
"sprintf_s"
@ -75,15 +88,22 @@
"vsnwprintf_s"
"mvprintw"
"mvscanw")
(#set! injection.language "printf"))
(#set! injection.language "printf"))
((call_expression
function: (identifier) @_function
arguments: (argument_list
(_) . (_) . (_) . (string_literal (string_content) @injection.content)))
(#any-of? @_function "mvwprintw"
"mvwscanw")
(#set! injection.language "printf"))
arguments:
(argument_list
(_)
.
(_)
.
(_)
.
(string_literal
(string_content) @injection.content)))
(#any-of? @_function "mvwprintw" "mvwscanw")
(#set! injection.language "printf"))
; TODO: add when asm is added
; (gnu_asm_expression assembly_code: (string_literal) @injection.content

View file

@ -1,53 +1,67 @@
;; Functions definitions
; Functions definitions
(function_declarator
declarator: (identifier) @local.definition.function)
(preproc_function_def
name: (identifier) @local.definition.macro) @local.scope
(preproc_def
name: (identifier) @local.definition.macro)
(pointer_declarator
declarator: (identifier) @local.definition.var)
(parameter_declaration
declarator: (identifier) @local.definition.parameter)
(init_declarator
declarator: (identifier) @local.definition.var)
(array_declarator
declarator: (identifier) @local.definition.var)
(declaration
declarator: (identifier) @local.definition.var)
(enum_specifier
name: (_) @local.definition.type
(enumerator_list
(enumerator name: (identifier) @local.definition.var)))
(enumerator
name: (identifier) @local.definition.var)))
;; Type / Struct / Enum
; Type / Struct / Enum
(field_declaration
declarator: (field_identifier) @local.definition.field)
(type_definition
declarator: (type_identifier) @local.definition.type)
(struct_specifier
name: (type_identifier) @local.definition.type)
;; goto
(labeled_statement (statement_identifier) @local.definition)
; goto
(labeled_statement
(statement_identifier) @local.definition)
;; References
; References
(identifier) @local.reference
((field_identifier) @local.reference
(#set! reference.kind "field"))
(#set! reference.kind "field"))
((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)
(if_statement)
(while_statement)
(translation_unit)
(function_definition)
(compound_statement) ; a block in curly braces
(struct_specifier)
(for_statement)
(if_statement)
(while_statement)
(translation_unit)
(function_definition)
(compound_statement) ; a block in curly braces
(struct_specifier)
] @local.scope

View file

@ -1,15 +1,10 @@
body: [
(declaration_list)
(switch_body)
(enum_member_declaration_list)
] @fold
accessors: [
(accessor_list)
] @fold
initializer: [
(initializer_expression)
] @fold
body:
[
(declaration_list)
(switch_body)
(enum_member_declaration_list)
] @fold
accessors: (accessor_list) @fold
initializer: (initializer_expression) @fold
(block) @fold

View file

@ -26,18 +26,23 @@
name: (identifier) @function.method.call))
(invocation_expression
function: (conditional_access_expression
(member_binding_expression
name: (identifier) @function.method.call)))
function:
(conditional_access_expression
(member_binding_expression
name: (identifier) @function.method.call)))
(namespace_declaration
name: [(qualified_name) (identifier)] @module)
name:
[
(qualified_name)
(identifier)
] @module)
(qualified_name
(identifier) @type)
(invocation_expression
(identifier) @function.method.call)
(identifier) @function.method.call)
(field_declaration
(variable_declaration
@ -50,29 +55,29 @@
(parameter_list
(parameter
name: (identifier) @variable.parameter))
name: (identifier) @variable.parameter))
(parameter_list
(parameter
type: (identifier) @type))
type: (identifier) @type))
(integer_literal) @number
(real_literal) @number.float
(null_literal) @constant.builtin
(character_literal) @character
[
(string_literal)
(verbatim_string_literal)
(interpolated_string_expression)
(string_literal)
(verbatim_string_literal)
(interpolated_string_expression)
] @string
(boolean_literal) @boolean
[
(predefined_type)
] @type.builtin
(predefined_type) @type.builtin
(implicit_type) @keyword
@ -83,6 +88,7 @@
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///[^/]"))
((comment) @comment.documentation
(#lua-match? @comment.documentation "^///$"))
@ -90,7 +96,8 @@
(identifier) @type)
(using_directive
(name_equals (identifier) @type.definition))
(name_equals
(identifier) @type.definition))
(property_declaration
name: (identifier) @property)
@ -106,20 +113,25 @@
(interface_declaration
name: (identifier) @type)
(class_declaration
name: (identifier) @type)
(record_declaration
name: (identifier) @type)
(enum_declaration
name: (identifier) @type)
(constructor_declaration
name: (identifier) @constructor)
(constructor_initializer [
"base" @constructor
])
(constructor_initializer
"base" @constructor)
(variable_declaration
(identifier) @type)
(object_creation_expression
(identifier) @type)
@ -142,19 +154,23 @@
(object_creation_expression
(generic_name
(identifier) @type))
(identifier) @type))
(property_declaration
(generic_name
(identifier) @type))
(_
type: (generic_name
(identifier) @type))
type:
(generic_name
(identifier) @type))
; Generic Method invocation with generic type
(invocation_expression
function: (generic_name
. (identifier) @function.method.call))
function:
(generic_name
.
(identifier) @function.method.call))
(invocation_expression
(member_access_expression
@ -165,7 +181,7 @@
(identifier) @type)
(type_argument_list
(identifier) @type)
(identifier) @type)
(type_parameter_list
(type_parameter) @type)
@ -174,7 +190,7 @@
target: (identifier) @type)
(attribute
name: (identifier) @attribute)
name: (identifier) @attribute)
(for_each_statement
type: (identifier) @type)
@ -197,180 +213,194 @@
(identifier) @variable.parameter)
(warning_directive) @comment.warning
(error_directive) @keyword.exception
(define_directive
(identifier) @constant) @constant.macro
(undef_directive
(identifier) @constant) @constant.macro
(line_directive) @constant.macro
(line_directive
(preproc_integer_literal) @constant
(preproc_string_literal)? @string)
(pragma_directive
(identifier) @constant) @constant.macro
(pragma_directive
(preproc_string_literal) @string) @constant.macro
[
(nullable_directive)
(region_directive)
(endregion_directive)
(nullable_directive)
(region_directive)
(endregion_directive)
] @constant.macro
[
"if"
"else"
"switch"
"break"
"case"
"when"
(if_directive)
(elif_directive)
(else_directive)
(endif_directive)
"if"
"else"
"switch"
"break"
"case"
"when"
(if_directive)
(elif_directive)
(else_directive)
(endif_directive)
] @keyword.conditional
(if_directive
(identifier) @constant)
(elif_directive
(identifier) @constant)
[
"while"
"for"
"do"
"continue"
"goto"
"foreach"
"while"
"for"
"do"
"continue"
"goto"
"foreach"
] @keyword.repeat
[
"try"
"catch"
"throw"
"finally"
"try"
"catch"
"throw"
"finally"
] @keyword.exception
[
"+"
"?"
":"
"++"
"-"
"--"
"&"
"&&"
"|"
"||"
"!"
"!="
"=="
"*"
"/"
"%"
"<"
"<="
">"
">="
"="
"-="
"+="
"*="
"/="
"%="
"^"
"^="
"&="
"|="
"~"
">>"
">>>"
"<<"
"<<="
">>="
">>>="
"=>"
"??"
"??="
"+"
"?"
":"
"++"
"-"
"--"
"&"
"&&"
"|"
"||"
"!"
"!="
"=="
"*"
"/"
"%"
"<"
"<="
">"
">="
"="
"-="
"+="
"*="
"/="
"%="
"^"
"^="
"&="
"|="
"~"
">>"
">>>"
"<<"
"<<="
">>="
">>>="
"=>"
"??"
"??="
] @operator
[
";"
"."
","
":"
";"
"."
","
":"
] @punctuation.delimiter
(conditional_expression ["?" ":"] @keyword.conditional.ternary)
(conditional_expression
[
"?"
":"
] @keyword.conditional.ternary)
[
"["
"]"
"{"
"}"
"("
")"
"["
"]"
"{"
"}"
"("
")"
] @punctuation.bracket
(type_argument_list ["<" ">"] @punctuation.bracket)
(type_argument_list
[
"<"
">"
] @punctuation.bracket)
[
(this_expression)
(base_expression)
(this_expression)
(base_expression)
] @variable.builtin
[
"using"
"as"
"using"
"as"
] @keyword.import
(alias_qualified_name
(identifier "global") @keyword.import)
(identifier
"global") @keyword.import)
[
"with"
"new"
"typeof"
"sizeof"
"is"
"and"
"or"
"not"
"stackalloc"
"in"
"out"
"ref"
"with"
"new"
"typeof"
"sizeof"
"is"
"and"
"or"
"not"
"stackalloc"
"in"
"out"
"ref"
] @keyword.operator
[
"lock"
"params"
"operator"
"default"
"implicit"
"explicit"
"override"
"class"
"delegate"
"enum"
"interface"
"namespace"
"struct"
"get"
"set"
"init"
"where"
"record"
"event"
"add"
"remove"
"checked"
"unchecked"
"fixed"
"alias"
"lock"
"params"
"operator"
"default"
"implicit"
"explicit"
"override"
"class"
"delegate"
"enum"
"interface"
"namespace"
"struct"
"get"
"set"
"init"
"where"
"record"
"event"
"add"
"remove"
"checked"
"unchecked"
"fixed"
"alias"
] @keyword
[
@ -379,39 +409,40 @@
] @keyword.coroutine
[
"const"
"extern"
"readonly"
"static"
"volatile"
"required"
"const"
"extern"
"readonly"
"static"
"volatile"
"required"
] @keyword.storage
[
"abstract"
"private"
"protected"
"internal"
"public"
"partial"
"sealed"
"virtual"
"abstract"
"private"
"protected"
"internal"
"public"
"partial"
"sealed"
"virtual"
] @type.qualifier
(parameter_modifier) @operator
(query_expression
(_ [
"from"
"orderby"
"select"
"group"
"by"
"ascending"
"descending"
"equals"
"let"
] @keyword))
(_
[
"from"
"orderby"
"select"
"group"
"by"
"ascending"
"descending"
"equals"
"let"
] @keyword))
[
"return"

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,6 +1,7 @@
;; Definitions
; Definitions
(variable_declarator
. (identifier) @local.definition.var)
.
(identifier) @local.definition.var)
(variable_declarator
(tuple_pattern
@ -13,8 +14,9 @@
left: (identifier) @local.definition.var)
(for_each_statement
left: (tuple_pattern
(identifier) @local.definition.var))
left:
(tuple_pattern
(identifier) @local.definition.var))
(parameter
(identifier) @local.definition.parameter)
@ -34,8 +36,8 @@
(class_declaration
name: (identifier) @local.definition)
;; References
; References
(identifier) @local.reference
;; Scope
; Scope
(block) @local.scope

View file

@ -5,20 +5,16 @@
(enum_item)
(impl_item)
(type_item)
(use_declaration)
(let_declaration)
(namespace_definition)
(arguments)
(implicit_arguments)
(tuple_type)
(import_statement)
(attribute_statement)
(with_statement)
(if_statement)
(function_definition)
(struct_definition)
(loop_expression)
@ -26,6 +22,5 @@
(match_expression)
(call_expression)
(tuple_expression)
(attribute_item)
] @fold

View file

@ -1,13 +1,18 @@
; Preproc
[
"%builtins"
"%lang"
] @keyword.directive
; Includes
(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . ))
(import_statement
[
"from"
"import"
] @keyword.import
module_name:
(dotted_name
(identifier) @module .))
[
"as"
@ -16,41 +21,42 @@
] @keyword.import
; Variables
(identifier) @variable
; Namespaces
(namespace_definition (identifier) @module)
(namespace_definition
(identifier) @module)
(mod_item
name: (identifier) @module)
(use_list (self) @module)
(use_list
(self) @module)
(scoped_use_list (self) @module)
(scoped_use_list
(self) @module)
(scoped_identifier
path: (identifier) @module)
(scoped_identifier
(scoped_identifier
name: (identifier) @module))
(scoped_identifier
name: (identifier) @module))
(scoped_type_identifier
path: (identifier) @module)
((scoped_identifier
path: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
(#lua-match? @type "^[A-Z]"))
((scoped_identifier
name: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
name: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
((scoped_identifier
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
((scoped_identifier
path: (identifier) @type
@ -68,17 +74,25 @@
path: (identifier) @module)
(scoped_use_list
path: (scoped_identifier
(identifier) @module))
path:
(scoped_identifier
(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
[
; 0.x
"using"
@ -96,7 +110,6 @@
"with"
"call"
"nondet"
; 1.0
"type"
"impl"
@ -133,9 +146,7 @@
"match"
] @keyword.conditional
[
"loop"
] @keyword.repeat
"loop" @keyword.repeat
[
"assert"
@ -144,33 +155,52 @@
] @keyword.exception
; 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 left: (identifier) @variable.member))
(tuple_expression
(assignment_expression
left: (identifier) @variable.member))
(field_identifier) @variable.member
(shorthand_field_initializer (identifier) @variable.member)
(shorthand_field_initializer
(identifier) @variable.member)
; 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
(builtin_directive
(identifier) @variable.builtin)
(builtin_directive (identifier) @variable.builtin)
(lang_directive (identifier) @variable.builtin)
(lang_directive
(identifier) @variable.builtin)
[
"ap"
@ -179,32 +209,45 @@
] @variable.builtin
; Functions
(function_definition
"func"
(identifier) @function)
(function_definition "func" (identifier) @function)
(function_definition "fn" (identifier) @function)
(function_signature "fn" (identifier) @function)
(extern_function_statement (identifier) @function)
(function_definition
"fn"
(identifier) @function)
(function_signature
"fn"
(identifier) @function)
(extern_function_statement
(identifier) @function)
(call_expression
function: (identifier) @function.call)
(call_expression
function: (scoped_identifier
(identifier) @function.call .))
function:
(scoped_identifier
(identifier) @function.call .))
(call_expression
function: (field_expression
field: (field_identifier) @function.call))
function:
(field_expression
field: (field_identifier) @function.call))
[
"jmp"
] @function.builtin
"jmp" @function.builtin
; 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)
@ -217,7 +260,6 @@
(type_identifier) @type
; Constants
((identifier) @constant
(#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
@ -225,49 +267,68 @@
name: (identifier) @constant)
(call_expression
function: (scoped_identifier
"::"
name: (identifier) @constant)
function:
(scoped_identifier
"::"
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern (identifier) @constant))
(#lua-match? @constant "^[A-Z]"))
pattern:
(match_pattern
(identifier) @constant))
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern
(scoped_identifier
name: (identifier) @constant)))
(#lua-match? @constant "^[A-Z]"))
pattern:
(match_pattern
(scoped_identifier
name: (identifier) @constant)))
(#lua-match? @constant "^[A-Z]"))
((identifier) @constant.builtin
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
; Constructors
(unary_expression
"new"
(call_expression
.
(identifier) @constructor))
(unary_expression "new" (call_expression . (identifier) @constructor))
((call_expression . (identifier) @constructor)
((call_expression
.
(identifier) @constructor)
(#lua-match? @constructor "^%u"))
; Attributes
(decorator
"@" @attribute
(identifier) @attribute)
(decorator "@" @attribute (identifier) @attribute)
(attribute_item
(identifier) @function.macro)
(attribute_item (identifier) @function.macro)
(attribute_item (scoped_identifier (identifier) @function.macro .))
(attribute_item
(scoped_identifier
(identifier) @function.macro .))
; 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" . (identifier) @label)
(inst_jnz_to_label
"jmp"
.
(identifier) @label)
; Operators
[
"+"
"-"
@ -307,7 +368,6 @@
] @operator
; Literals
(number) @number
(boolean) @boolean
@ -318,17 +378,41 @@
] @string
; 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 [ "<" ">" ] @punctuation.bracket)
(type_arguments
[
"<"
">"
] @punctuation.bracket)
; Comment
(comment) @comment @spell

View file

@ -18,19 +18,36 @@
(tuple_pattern)
] @indent.begin
(import_statement "(") @indent.begin
(import_statement
"(") @indent.begin
(block
"}" @indent.end)
(block "}" @indent.end)
(enum_item
body: (enum_variant_list "}" @indent.end))
body:
(enum_variant_list
"}" @indent.end))
(match_expression
body: (match_block "}" @indent.end))
body:
(match_block
"}" @indent.end))
(mod_item
body: (declaration_list "}" @indent.end))
body:
(declaration_list
"}" @indent.end))
(struct_item
body: (field_declaration_list "}" @indent.end))
body:
(field_declaration_list
"}" @indent.end))
(trait_item
body: (declaration_list "}" @indent.end))
body:
(declaration_list
"}" @indent.end))
[
")"

View file

@ -1,3 +1,5 @@
(python_code) @python
((python_code) @injection.content
(#set! injection.language "python"))
(comment) @comment
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,13 +1,13 @@
; References
(identifier) @local.reference
((type_identifier) @local.reference
(#set! reference.kind "type"))
((field_identifier) @local.reference
(#set! reference.kind "field"))
; Scopes
[
(program)
(block)
@ -16,53 +16,52 @@
(if_expression)
(match_expression)
(match_arm)
(struct_item)
(enum_item)
(impl_item)
] @local.scope
(use_declaration
argument: (scoped_identifier
name: (identifier) @local.definition.import))
(use_declaration
argument:
(scoped_identifier
name: (identifier) @local.definition.import))
(use_as_clause
(use_as_clause
alias: (identifier) @local.definition.import)
(use_list
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
; Functions
(function_definition
(identifier) @local.definition.function)
(identifier) @local.definition.function)
(function_definition
(identifier) @local.definition.method
(parameter (self)))
(parameter
(self)))
; Function with parameters, defines parameters
(parameter
[ (identifier) (self) ] @local.definition.parameter)
[
(identifier)
(self)
] @local.definition.parameter)
; Types
(struct_item
name: (type_identifier) @local.definition.type)
(constrained_type_parameter
(constrained_type_parameter
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
(enum_item
name: (type_identifier) @local.definition.type)
; Module
(mod_item
(mod_item
name: (identifier) @local.definition.namespace)
; Variables
(assignment_expression
left: (identifier) @local.definition.var)
left: (identifier) @local.definition.var)

View file

@ -1,12 +1,10 @@
; Preproc
[
(unique_id)
(top_level_annotation_body)
] @keyword.directive
; Includes
[
"import"
"$import"
@ -17,7 +15,6 @@
(import_path) @string.special.path
; Keywords
[
"annotation"
"enum"
@ -30,10 +27,7 @@
] @keyword
; Builtins
[
"const"
] @type.qualifier
"const" @type.qualifier
[
(primitive_type)
@ -41,30 +35,24 @@
] @type.builtin
; Typedefs
(type_definition) @type.definition
; Labels (@number, @number!)
(field_version) @label
; Methods
[
(annotation_definition_identifier)
(method_identifier)
] @function.method
; Fields
(field_identifier) @variable.member
; Properties
(property) @property
; Parameters
[
(param_identifier)
(return_identifier)
@ -73,7 +61,6 @@
(annotation_target) @variable.parameter.builtin
; Constants
[
(const_identifier)
(local_const)
@ -83,7 +70,6 @@
(void) @constant.builtin
; Types
[
(enum_identifier)
(extend_type)
@ -91,18 +77,15 @@
] @type
; Attributes
[
(annotation_identifier)
(attribute)
] @attribute
; Operators
"=" @operator
; Literals
[
(string)
(concatenated_string)
@ -125,18 +108,26 @@
(data_hex) @string.special.symbol
; Punctuation
[
"*"
"$"
":"
] @punctuation.special
["{" "}"] @punctuation.bracket
[
"{"
"}"
] @punctuation.bracket
["(" ")"] @punctuation.bracket
[
"("
")"
] @punctuation.bracket
["[" "]"] @punctuation.bracket
[
"["
"]"
] @punctuation.bracket
[
"."
@ -146,5 +137,4 @@
] @punctuation.delimiter
; Comments
(comment) @comment @spell

View file

@ -13,14 +13,17 @@
(field)
] @indent.begin
((struct_shorthand (property)) @indent.align
((struct_shorthand
(property)) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
((method (field_version)) @indent.align
((method
(field_version)) @indent.align
(#set! indent.open_delimiter field_version))
((const_list (const_value)) @indent.align
((const_list
(const_value)) @indent.align
(#set! indent.open_delimiter "[")
(#set! indent.close_delimiter "]"))
@ -31,7 +34,6 @@
")"
] @indent.end @indent.branch
[
(ERROR)
(comment)

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -18,17 +18,21 @@
(extend_type)
(field_type)
] @local.reference
(custom_type (type_identifier) @local.reference)
(custom_type
(type_identifier) @local.reference)
(custom_type
(generics
(generic_parameters
(generic_parameters
(generic_identifier) @local.reference)))
(annotation_definition_identifier) @local.definition
(const_identifier) @local.definition.constant
(enum (enum_identifier) @local.definition.enum)
(enum
(enum_identifier) @local.definition.enum)
[
(enum_member)
@ -44,16 +48,19 @@
(return_identifier)
] @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)
(struct
(generics
(generic_parameters

View file

@ -1,5 +1,5 @@
[
(intent_def)
(slot_def)
(alias_def)
(intent_def)
(slot_def)
(alias_def)
] @fold

View file

@ -1,24 +1,32 @@
;; Punctuation
; Punctuation
[
"%["
"@["
"~["
"*["
"]"
"("
")"
"%["
"@["
"~["
"*["
"]"
"("
")"
] @punctuation.bracket
[":" ","] @punctuation.delimiter
[
":"
","
] @punctuation.delimiter
(["\"" "'"] @punctuation.special
(#set! conceal ""))
([
"\""
"'"
] @punctuation.special
(#set! conceal ""))
["%" "?" "#"] @character.special
;; Entities
[
"%"
"?"
"#"
] @character.special
; Entities
(intent) @module
(slot) @type
@ -35,16 +43,13 @@
(escape) @string.escape
;; Import
; Import
"import" @keyword.import
(file) @string.special.path
;; Text
; Text
(word) @spell
;; Comment
; Comment
(comment) @comment @spell

View file

@ -1,7 +1,8 @@
[
(intent_def)
(slot_def)
(alias_def)
(intent_def)
(slot_def)
(alias_def)
] @indent.begin
(ERROR "]") @indent.begin
(ERROR
"]") @indent.begin

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,10 +1,16 @@
;; Definitions
; Definitions
(intent_def
(intent) @local.definition)
(intent_def (intent) @local.definition)
(slot_def (slot) @local.definition)
(alias_def (alias) @local.definition)
(slot_def
(slot) @local.definition)
;; References
(alias_def
(alias) @local.definition)
(slot_ref (slot) @local.reference)
(alias_ref (alias) @local.reference)
; References
(slot_ref
(slot) @local.reference)
(alias_ref
(alias) @local.reference)

View file

@ -1 +1,2 @@
(source (list_lit) @fold)
(source
(list_lit) @fold)

View file

@ -1,69 +1,87 @@
;; >> Explanation
;; 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
;; highlighted as they should be.
;;
;; For the most part this means that some things have to be assigned multiple
;; groups.
;; By doing this we can add a basic capture and then later refine it with more
;; specialized captures.
;; This can mean that sometimes things are highlighted weirdly because they
;; have multiple highlight groups applied to them.
; >> Explanation
; 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
; highlighted as they should be.
;
; For the most part this means that some things have to be assigned multiple
; groups.
; By doing this we can add a basic capture and then later refine it with more
; specialized captures.
; This can mean that sometimes things are highlighted weirdly because they
; have multiple highlight groups applied to them.
; >> Literals
((dis_expr) @comment
(#set! "priority" 105)
; Higher priority to mark the whole sexpr as a comment
)
;; >> Literals
(
(dis_expr) @comment
(#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment
)
(kwd_lit) @string.special.symbol
(str_lit) @string
(num_lit) @number
(char_lit) @character
(bool_lit) @boolean
(nil_lit) @constant.builtin
(comment) @comment @spell
(regex_lit) @string.regexp
["'" "`"] @string.escape
[
"'"
"`"
] @string.escape
["~" "~@" "#"] @punctuation.special
[
"~"
"~@"
"#"
] @punctuation.special
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
;; >> Symbols
[
"{"
"}"
"["
"]"
"("
")"
] @punctuation.bracket
; >> Symbols
; General symbol highlighting
(sym_lit) @variable
; General function calls
(list_lit
.
(sym_lit) @function.call)
.
(sym_lit) @function.call)
(anon_fn_lit
.
(sym_lit) @function.call)
.
(sym_lit) @function.call)
; Quoted symbols
(quoting_lit
(sym_lit) @string.special.symbol)
(sym_lit) @string.special.symbol)
(syn_quoting_lit
(sym_lit) @string.special.symbol)
(sym_lit) @string.special.symbol)
; Used in destructure pattern
((sym_lit) @variable.parameter
(#lua-match? @variable.parameter "^[&]"))
(#lua-match? @variable.parameter "^[&]"))
; Inline function variables
((sym_lit) @variable.builtin
(#lua-match? @variable.builtin "^%%"))
(#lua-match? @variable.builtin "^%%"))
; Constructor
((sym_lit) @constructor
(#lua-match? @constructor "^-%>[^>].*"))
(#lua-match? @constructor "^-%>[^>].*"))
; Builtin dynamic variables
((sym_lit) @variable.builtin
@ -84,94 +102,91 @@
; Builtin repl variables
((sym_lit) @variable.builtin
(#any-of? @variable.builtin
"*1" "*2" "*3" "*e"))
(#any-of? @variable.builtin "*1" "*2" "*3" "*e"))
; Gensym
;; Might not be needed
; Might not be needed
((sym_lit) @variable
(#lua-match? @variable "^.*#$"))
(#lua-match? @variable "^.*#$"))
; Types
;; TODO: improve?
; TODO: improve?
((sym_lit) @type
(#lua-match? @type "^[%u][^/]*$"))
;; Symbols with `.` but not `/`
(#lua-match? @type "^[%u][^/]*$"))
; Symbols with `.` but not `/`
((sym_lit) @type
(#lua-match? @type "^[^/]+[.][^/]*$"))
(#lua-match? @type "^[^/]+[.][^/]*$"))
; Interop
; (.instanceMember instance args*)
; (.instanceMember Classname args*)
((sym_lit) @function.method
(#lua-match? @function.method "^%.[^-]"))
(#lua-match? @function.method "^%.[^-]"))
; (.-instanceField instance)
((sym_lit) @variable.member
(#lua-match? @variable.member "^%.%-.*"))
(#lua-match? @variable.member "^%.%-.*"))
; Classname/staticField
((sym_lit) @variable.member
(#lua-match? @variable.member "^[%u].*/.+"))
(#lua-match? @variable.member "^[%u].*/.+"))
; (Classname/staticMethod args*)
(list_lit
.
(sym_lit) @function.method
(#lua-match? @function.method "^[%u].*/.+"))
;; TODO: Special casing for the `.` macro
.
(sym_lit) @function.method
(#lua-match? @function.method "^[%u].*/.+"))
; TODO: Special casing for the `.` macro
; Operators
((sym_lit) @operator
(#any-of? @operator
"*" "*'" "+" "+'" "-" "-'" "/"
"<" "<=" ">" ">=" "=" "=="))
(#any-of? @operator "*" "*'" "+" "+'" "-" "-'" "/" "<" "<=" ">" ">=" "=" "=="))
((sym_lit) @keyword.operator
(#any-of? @keyword.operator
"not" "not=" "and" "or"))
(#any-of? @keyword.operator "not" "not=" "and" "or"))
; Definition functions
((sym_lit) @keyword
(#any-of? @keyword
"def" "defonce" "defrecord" "defmacro" "definline" "definterface"
"defmulti" "defmethod" "defstruct" "defprotocol"
"deftype"))
(#any-of? @keyword "def" "defonce" "defrecord" "defmacro" "definline" "definterface" "defmulti" "defmethod" "defstruct" "defprotocol" "deftype"))
((sym_lit) @keyword
(#eq? @keyword "declare"))
(#eq? @keyword "declare"))
((sym_name) @keyword.coroutine
(#any-of? @keyword.coroutine
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
(#any-of? @keyword.coroutine "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
((sym_lit) @keyword.function
(#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
(#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
; Comment
((sym_lit) @comment
(#any-of? @comment "comment"))
(#any-of? @comment "comment"))
; Conditionals
((sym_lit) @keyword.conditional
(#any-of? @keyword.conditional
"case" "cond" "cond->" "cond->>" "condp"))
(#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp"))
((sym_lit) @keyword.conditional
(#any-of? @keyword.conditional
"if" "if-let" "if-not" "if-some"))
(#any-of? @keyword.conditional "if" "if-let" "if-not" "if-some"))
((sym_lit) @keyword.conditional
(#any-of? @keyword.conditional
"when" "when-first" "when-let" "when-not" "when-some"))
(#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some"))
; Repeats
((sym_lit) @keyword.repeat
(#any-of? @keyword.repeat
"doseq" "dotimes" "for" "loop" "recur" "while"))
(#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while"))
; Exception
((sym_lit) @keyword.exception
(#any-of? @keyword.exception
"throw" "try" "catch" "finally"))
(#any-of? @keyword.exception "throw" "try" "catch" "finally"))
; Includes
((sym_lit) @keyword.import
(#any-of? @keyword.import "ns" "import" "require" "use"))
(#any-of? @keyword.import "ns" "import" "require" "use"))
; Builtin macros
;; TODO: Do all these items belong here?
; TODO: Do all these items belong here?
((sym_lit) @function.macro
; format-ignore
(#any-of? @function.macro
@ -191,7 +206,7 @@
; (keep (fn [[s v]] (when-not (:macro (meta v)) s)))
; sort
; clojure.pprint/pprint))
;; ...and then lots of manual filtering...
; ...and then lots of manual filtering...
((sym_lit) @function.builtin
; format-ignore
(#any-of? @function.builtin
@ -316,48 +331,43 @@
"seq-to-map-for-destructuring" "update-keys" "update-vals"
;; 1.12
"partitionv" "partitionv-all" "splitv-at"))
;; >> Context based highlighting
;; def-likes
;; Correctly highlight docstrings
; >> Context based highlighting
; def-likes
; Correctly highlight docstrings
;(list_lit
;.
;(sym_lit) @_keyword ; Don't really want to highlight twice
;(#any-of? @_keyword
;"def" "defonce" "defrecord" "defmacro" "definline"
;"defmulti" "defmethod" "defstruct" "defprotocol"
;"deftype")
;.
;(sym_lit)
;.
;;; TODO: Add @comment highlight
;(str_lit)?
;.
;(_))
;.
;(sym_lit) @_keyword ; Don't really want to highlight twice
;(#any-of? @_keyword
;"def" "defonce" "defrecord" "defmacro" "definline"
;"defmulti" "defmethod" "defstruct" "defprotocol"
;"deftype")
;.
;(sym_lit)
;.
; TODO: Add @comment highlight
;(str_lit)?
;.
;(_))
; Function definitions
(list_lit
.
(sym_lit) @_keyword.function
(#any-of? @_keyword.function "fn" "fn*" "defn" "defn-")
.
(sym_lit)? @function
.
;; TODO: Add @comment highlight
(str_lit)?)
;; TODO: Fix parameter highlighting
;; I think there's a bug here in nvim-treesitter
;; TODO: Reproduce bug and file ticket
;.
;[(vec_lit
; (sym_lit)* @variable.parameter)
; (list_lit
; (vec_lit
; (sym_lit)* @variable.parameter))])
.
(sym_lit) @_keyword.function
(#any-of? @_keyword.function "fn" "fn*" "defn" "defn-")
.
(sym_lit)? @function
.
; TODO: Add @comment highlight
(str_lit)?)
; TODO: Fix parameter highlighting
; I think there's a bug here in nvim-treesitter
; TODO: Reproduce bug and file ticket
;.
;[(vec_lit
; (sym_lit)* @variable.parameter)
; (list_lit
; (vec_lit
; (sym_lit)* @variable.parameter))])
;[((list_lit
; (vec_lit
; (sym_lit) @variable.parameter)
@ -366,19 +376,17 @@
; ((vec_lit
; (sym_lit) @variable.parameter)
; (_)))
; Meta punctuation
;; NOTE: When the above `Function definitions` query captures the
;; the @function it also captures the child meta_lit
;; We capture the meta_lit symbol (^) after so that the later
;; highlighting overrides the former
; NOTE: When the above `Function definitions` query captures the
; the @function it also captures the child meta_lit
; We capture the meta_lit symbol (^) after so that the later
; highlighting overrides the former
"^" @punctuation.special
;; namespaces
; namespaces
(list_lit
.
(sym_lit) @_include
(#eq? @_include "ns")
.
(sym_lit) @module)
.
(sym_lit) @_include
(#eq? @_include "ns")
.
(sym_lit) @module)

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,8 +1,8 @@
[
(if_condition)
(foreach_loop)
(while_loop)
(function_def)
(macro_def)
(block_def)
(if_condition)
(foreach_loop)
(while_loop)
(function_def)
(macro_def)
(block_def)
] @fold

View file

@ -1,96 +1,107 @@
(normal_command
(identifier)
(argument_list
(argument (unquoted_argument)) @constant
)
(#lua-match? @constant "^[%u@][%u%d_]+$")
)
(argument
(unquoted_argument)) @constant)
(#lua-match? @constant "^[%u@][%u%d_]+$"))
[
(quoted_argument)
(bracket_argument)
(quoted_argument)
(bracket_argument)
] @string
(variable_ref) @none
(variable) @variable
[
(bracket_comment)
(line_comment)
(bracket_comment)
(line_comment)
] @comment @spell
(normal_command (identifier) @function)
["ENV" "CACHE"] @keyword.storage
["$" "{" "}" "<" ">"] @punctuation.special
["(" ")"] @punctuation.bracket
(normal_command
(identifier) @function)
[
(function)
(endfunction)
(macro)
(endmacro)
"ENV"
"CACHE"
] @keyword.storage
[
"$"
"{"
"}"
"<"
">"
] @punctuation.special
[
"("
")"
] @punctuation.bracket
[
(function)
(endfunction)
(macro)
(endmacro)
] @keyword.function
[
(if)
(elseif)
(else)
(endif)
(if)
(elseif)
(else)
(endif)
] @keyword.conditional
[
(foreach)
(endforeach)
(while)
(endwhile)
(foreach)
(endforeach)
(while)
(endwhile)
] @keyword.repeat
(normal_command
(identifier) @keyword.repeat
(#match? @keyword.repeat "\\c^(continue|break)$")
)
(#match? @keyword.repeat "\\c^(continue|break)$"))
(normal_command
(identifier) @keyword.return
(#match? @keyword.return "\\c^return$")
)
(#match? @keyword.return "\\c^return$"))
(function_command
(function)
(argument_list
. (argument) @function
(argument)* @variable.parameter
)
)
.
(argument) @function
(argument)* @variable.parameter))
(macro_command
(macro)
(argument_list
. (argument) @function.macro
(argument)* @variable.parameter
)
)
.
(argument) @function.macro
(argument)* @variable.parameter))
(block_def
(block_command
(block) @function.builtin
(argument_list
(argument (unquoted_argument) @constant)
)
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE")
)
(endblock_command (endblock) @function.builtin)
)
(argument
(unquoted_argument) @constant))
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE"))
(endblock_command
(endblock) @function.builtin))
;
((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)
(argument_list
(argument) @keyword.operator
)
(argument) @keyword.operator)
; format-ignore
(#any-of? @keyword.operator
"NOT" "AND" "OR"
@ -100,13 +111,12 @@
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
)
)
))
(elseif_command
(elseif)
(argument_list
(argument) @keyword.operator
)
(argument) @keyword.operator)
; format-ignore
(#any-of? @keyword.operator
"NOT" "AND" "OR"
@ -116,106 +126,105 @@
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
)
)
))
(normal_command
(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
(identifier) @_function
(argument_list
. (argument) @variable
)
(#match? @_function "\\c^set$")
)
(normal_command
(identifier) @_function
(#match? @_function "\\c^set$")
(argument_list
. (argument)
(
(argument) @_cache @keyword.storage
.
(argument) @_type @type
(#any-of? @_cache "CACHE")
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL")
)
)
)
(argument) @variable)
(#match? @_function "\\c^set$"))
(normal_command
(identifier) @_function
(#match? @_function "\\c^set$")
(argument_list
.
(argument)
((argument) @_cache @keyword.storage
.
(argument) @_type @type
(#any-of? @_cache "CACHE")
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL"))))
(normal_command
(identifier) @_function
(#match? @_function "\\c^unset$")
(argument_list
. (argument)
.
(argument)
(argument) @keyword.storage
(#any-of? @keyword.storage "CACHE" "PARENT_SCOPE")
)
)
(#any-of? @keyword.storage "CACHE" "PARENT_SCOPE")))
(normal_command
(identifier) @_function
(#match? @_function "\\c^list$")
(argument_list
. (argument) @constant
.
(argument) @constant
(#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND")
. (argument) @variable
(argument) @variable .
)
)
.
(argument) @variable
(argument) @variable .))
(normal_command
(identifier) @_function
(#match? @_function "\\c^list$")
(argument_list
. (argument) @constant
. (argument) @variable
(#any-of? @constant "APPEND" "FILTER" "INSERT"
"POP_BACK" "POP_FRONT" "PREPEND"
"REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES"
"REVERSE" "SORT")
)
)
.
(argument) @constant
.
(argument) @variable
(#any-of? @constant "APPEND" "FILTER" "INSERT" "POP_BACK" "POP_FRONT" "PREPEND" "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" "REVERSE" "SORT")))
(normal_command
(identifier) @_function
(#match? @_function "\\c^list$")
(argument_list
. (argument) @_transform @constant
. (argument) @variable
. (argument) @_action @constant
.
(argument) @_transform @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")
(#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) @variable
. (argument) @_action @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) @_transform @constant
(argument) @constant
.
(argument) @variable
(#eq? @_transform "TRANSFORM")
(#eq? @constant "OUTPUT_VARIABLE")
)
)
(#eq? @constant "OUTPUT_VARIABLE")))
(escape_sequence) @string.escape
((source_file . (line_comment) @keyword.directive)
((source_file
.
(line_comment) @keyword.directive)
(#lua-match? @keyword.directive "^#!/"))

View file

@ -9,17 +9,18 @@
] @indent.begin
[
(elseif_command)
(else_command)
(endif_command)
(endforeach_command)
(endwhile_command)
(endfunction_command)
(endmacro_command)
(endblock_command)
(elseif_command)
(else_command)
(endif_command)
(endforeach_command)
(endwhile_command)
(endfunction_command)
(endmacro_command)
(endblock_command)
] @indent.branch
(")" @indent.branch)
(")" @indent.end)
(argument_list) @indent.auto

View file

@ -11,33 +11,39 @@
((tag
(name) @comment.note @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
("(" @punctuation.bracket
(user) @constant
")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
("text" @comment.note @nospell
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
((tag
(name) @comment.warning @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
("(" @punctuation.bracket
(user) @constant
")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
("text" @comment.warning @nospell
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
((tag
(name) @comment.error @nospell
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
("(" @punctuation.bracket
(user) @constant
")" @punctuation.bracket)?
":" @punctuation.delimiter)
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
("text" @comment.error @nospell
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
; Issue number (#123)
("text" @number
(#lua-match? @number "^#[0-9]+$"))
(#lua-match? @number "^#[0-9]+$"))
((uri) @string.special.url @nospell)

View file

@ -1 +1,2 @@
(source (list_lit) @fold)
(source
(list_lit) @fold)

File diff suppressed because one or more lines are too long

View file

@ -1,72 +1,113 @@
(defun_header
function_name: (sym_lit) @local.definition.function
(#set! definition.function.scope "parent"))
(defun_header
function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent"))
(defun_header
lambda_list: (list_lit (sym_lit) @local.definition.parameter))
lambda_list:
(list_lit
(sym_lit) @local.definition.parameter))
(defun_header
keyword: (defun_keyword "defmethod")
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @local.definition.type)))
keyword:
(defun_keyword
"defmethod")
lambda_list:
(list_lit
(list_lit
.
(sym_lit)
.
(sym_lit) @local.definition.type)))
(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
(defun) @local.scope
((list_lit . (sym_lit) @_defvar . (sym_lit) @local.definition.var)
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
((list_lit
.
(sym_lit) @_defvar
.
(sym_lit) @local.definition.var)
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
(list_lit
.
(sym_lit) @_deftest
.
(sym_lit) @local.definition.function
(#eq? @_deftest "deftest")) @local.scope
.
(sym_lit) @_deftest
.
(sym_lit) @local.definition.function
(#eq? @_deftest "deftest")) @local.scope
(list_lit
.
(sym_lit) @_deftest
.
(sym_lit) @local.definition.function
(#eq? @_deftest "deftest")) @local.scope
.
(sym_lit) @_deftest
.
(sym_lit) @local.definition.function
(#eq? @_deftest "deftest")) @local.scope
(for_clause
.
(sym_lit) @local.definition.var)
(with_clause
.
(sym_lit) @local.definition.var)
(for_clause . (sym_lit) @local.definition.var)
(with_clause . (sym_lit) @local.definition.var)
(loop_macro) @local.scope
(list_lit
.
(sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
.
(list_lit (list_lit . (sym_lit) @local.definition.var))) @local.scope
.
(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
.
(sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
.
(list_lit . (sym_lit) @local.definition.var)) @local.scope
.
(sym_lit) @_let
(#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
.
(list_lit
.
(sym_lit) @local.definition.var)) @local.scope
(list_lit
.
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
.
(_)
(kwd_lit (kwd_symbol) @local.definition.import))
.
(kwd_lit) @_import_from
(#eq? @_import_from ":import-from")
.
(_)
(kwd_lit
(kwd_symbol) @local.definition.import))
(list_lit
.
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
.
(_)
(sym_lit) @local.definition.import)
.
(kwd_lit) @_import_from
(#eq? @_import_from ":import-from")
.
(_)
(sym_lit) @local.definition.import)
(list_lit
.
(kwd_lit) @_use (#eq? @_use ":use")
(kwd_lit (kwd_symbol) @local.definition.import))
.
(kwd_lit) @_use
(#eq? @_use ":use")
(kwd_lit
(kwd_symbol) @local.definition.import))
(list_lit
.
(kwd_lit) @_use (#eq? @_use ":use")
(sym_lit) @local.definition.import)
.
(kwd_lit) @_use
(#eq? @_use ":use")
(sym_lit) @local.definition.import)

View file

@ -3,20 +3,20 @@
(ingredient
"@" @tag
(name)? @markup.heading
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(timer
"~" @tag
(name)? @markup.heading
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(cookware
"#" @tag
(name)? @markup.heading
(amount
(quantity)? @number
(units)? @tag.attribute)?)
(amount
(quantity)? @number
(units)? @tag.attribute)?)

View file

@ -1,5 +1,5 @@
[
(object)
(array)
(assign_block)
(object)
(array)
(assign_block)
] @fold

View file

@ -1,4 +1,5 @@
"let" @keyword
"in" @keyword
[
@ -11,10 +12,15 @@
"." @punctuation.delimiter
(input) @constant
(comment) @comment @spell
(string) @string
(integer) @number
(float) @number.float
(boolean) @boolean
(null) @keyword

View file

@ -1,14 +1,24 @@
[
(assign_block "{")
(object)
(array)
(assign_block
"{")
(object)
(array)
] @indent.begin
(assign_block "}" @indent.branch)
(assign_block "}" @indent.end)
(assign_block
"}" @indent.branch)
(object "}" @indent.branch)
(object "}" @indent.end)
(assign_block
"}" @indent.end)
(array "]" @indent.branch)
(array "]" @indent.end)
(object
"}" @indent.branch)
(object
"}" @indent.end)
(array
"]" @indent.branch)
(array
"]" @indent.end)

View file

@ -1,16 +1,13 @@
; scopes
[
(object)
(array)
] @local.scope
; definitions
(assign_block
(assign_block
(assignment
(input)
@local.definition.constant))
(value (input) @local.reference)
(input) @local.definition.constant))
(value
(input) @local.reference)

View file

@ -1,6 +1,6 @@
; Literals
(string) @string
(escape_sequence) @string.escape
(hex_blob
@ -15,7 +15,8 @@
"d" @character.special
(_) @string.special)
(_ key: (_) @label)
(_
key: (_) @label)
(number) @number
@ -26,21 +27,28 @@
(null) @constant.builtin
; Punctuation
[
","
":"
] @punctuation.delimiter
[ "{" "}" ] @punctuation.bracket
[
"{"
"}"
] @punctuation.bracket
[ "[" "]" ] @punctuation.bracket
[
"["
"]"
] @punctuation.bracket
[ "<" ">" ] @punctuation.bracket
[
"<"
">"
] @punctuation.bracket
(("\"" @string)
(#set! conceal ""))
(#set! conceal ""))
; Comments
(comment) @comment @spell

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,6 +1,5 @@
[
(document)
(document)
(meta_map)
(map)
(array)

View file

@ -1,14 +1,13 @@
; inherits: c
[
(for_range_loop)
(class_specifier)
(field_declaration
type: (enum_specifier)
default_value: (initializer_list))
(template_declaration)
(namespace_definition)
(try_statement)
(catch_clause)
(lambda_expression)
(for_range_loop)
(class_specifier)
(field_declaration
type: (enum_specifier)
default_value: (initializer_list))
(template_declaration)
(namespace_definition)
(try_statement)
(catch_clause)
(lambda_expression)
] @fold

View file

@ -1,5 +1,4 @@
; inherits: c
((identifier) @variable.member
(#lua-match? @variable.member "^m_.*$"))
@ -8,23 +7,24 @@
; function(Foo ...foo)
(variadic_parameter_declaration
declarator: (variadic_declarator
(_) @variable.parameter))
declarator:
(variadic_declarator
(_) @variable.parameter))
; int foo = 0
(optional_parameter_declaration
declarator: (_) @variable.parameter)
declarator: (_) @variable.parameter)
;(field_expression) @variable.parameter ;; How to highlight this?
(((field_expression
(field_identifier) @function.method)) @_parent
(#has-parent? @_parent template_method function_declarator))
(field_identifier) @function.method)) @_parent
(#has-parent? @_parent template_method function_declarator))
(field_declaration
(field_identifier) @variable.member)
(field_initializer
(field_identifier) @property)
(field_identifier) @property)
(function_declarator
declarator: (field_identifier) @function.method)
@ -38,13 +38,25 @@
(auto) @type.builtin
(namespace_identifier) @module
((namespace_identifier) @type
(#lua-match? @type "^[%u]"))
(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
(identifier) @function.method)
@ -53,15 +65,18 @@
(function_declarator
(qualified_identifier
(identifier) @function))
(function_declarator
(qualified_identifier
(qualified_identifier
(identifier) @function)))
(function_declarator
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
@ -74,21 +89,26 @@
(identifier) @function))
(operator_name) @function
"operator" @function
"static_assert" @function.builtin
(call_expression
(qualified_identifier
(identifier) @function.call))
(call_expression
(qualified_identifier
(qualified_identifier
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(identifier) @function.call))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
@ -99,21 +119,25 @@
(call_expression
(template_function
(identifier) @function.call))
(call_expression
(qualified_identifier
(template_function
(identifier) @function.call)))
(call_expression
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call))))
(call_expression
(qualified_identifier
(qualified_identifier
(qualified_identifier
(template_function
(identifier) @function.call)))))
((qualified_identifier
(qualified_identifier
(qualified_identifier
@ -126,12 +150,12 @@
(function_declarator
(template_method
(field_identifier) @function.method))
(call_expression
(field_expression
(field_identifier) @function.method.call))
; constructors
((function_declarator
(qualified_identifier
(identifier) @constructor))
@ -139,93 +163,91 @@
((call_expression
function: (identifier) @constructor)
(#lua-match? @constructor "^%u"))
((call_expression
function: (qualified_identifier
name: (identifier) @constructor))
(#lua-match? @constructor "^%u"))
(#lua-match? @constructor "^%u"))
((call_expression
function: (field_expression
field: (field_identifier) @constructor))
(#lua-match? @constructor "^%u"))
function:
(qualified_identifier
name: (identifier) @constructor))
(#lua-match? @constructor "^%u"))
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
((call_expression
function:
(field_expression
field: (field_identifier) @constructor))
(#lua-match? @constructor "^%u"))
; constructing a type in an initializer list: Constructor (): **SuperType (1)**
((field_initializer
(field_identifier) @constructor
(argument_list))
(#lua-match? @constructor "^%u"))
(#lua-match? @constructor "^%u"))
; Constants
(this) @variable.builtin
(null "nullptr" @constant.builtin)
(null
"nullptr" @constant.builtin)
(true) @boolean
(false) @boolean
; Literals
(raw_string_literal) @string
(raw_string_literal) @string
; Keywords
[
"try"
"catch"
"noexcept"
"throw"
"try"
"catch"
"noexcept"
"throw"
] @keyword.exception
[
"class"
"decltype"
"explicit"
"friend"
"namespace"
"override"
"template"
"typename"
"using"
"concept"
"requires"
"constexpr"
"class"
"decltype"
"explicit"
"friend"
"namespace"
"override"
"template"
"typename"
"using"
"concept"
"requires"
"constexpr"
] @keyword
[
"co_await"
] @keyword.coroutine
"co_await" @keyword.coroutine
[
"co_yield"
"co_return"
"co_yield"
"co_return"
] @keyword.coroutine.return
[
"public"
"private"
"protected"
"virtual"
"final"
"public"
"private"
"protected"
"virtual"
"final"
] @type.qualifier
[
"new"
"delete"
"xor"
"bitand"
"bitor"
"compl"
"not"
"xor_eq"
"and_eq"
"or_eq"
"not_eq"
"and"
"or"
"new"
"delete"
"xor"
"bitand"
"bitor"
"compl"
"not"
"xor_eq"
"and_eq"
"or_eq"
"not_eq"
"and"
"or"
] @keyword.operator
"<=>" @operator
@ -233,9 +255,15 @@
"::" @punctuation.delimiter
(template_argument_list
["<" ">"] @punctuation.bracket)
[
"<"
">"
] @punctuation.bracket)
(template_parameter_list
["<" ">"] @punctuation.bracket)
[
"<"
">"
] @punctuation.bracket)
(literal_suffix) @operator

View file

@ -1,9 +1,7 @@
; inherits: c
[
(condition_clause)
] @indent.begin
(condition_clause) @indent.begin
((field_initializer_list) @indent.begin
(#set! indent.start_at_same_line 1))
(access_specifier) @indent.branch

View file

@ -1,8 +1,5 @@
((preproc_arg) @injection.content
(#set! injection.language "cpp"))
((comment) @injection.content
(#set! injection.language "comment"))
(#set! injection.language "cpp"))
((comment) @injection.content
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")

View file

@ -1,12 +1,14 @@
; inherits: c
;; Parameters
; Parameters
(variadic_parameter_declaration
declarator: (variadic_declarator
(identifier) @local.definition.parameter))
declarator:
(variadic_declarator
(identifier) @local.definition.parameter))
(optional_parameter_declaration
declarator: (identifier) @local.definition.parameter)
;; Class / struct definitions
; Class / struct definitions
(class_specifier) @local.scope
(reference_declarator
@ -16,8 +18,9 @@
(identifier) @local.definition.var)
(struct_specifier
name: (qualified_identifier
name: (type_identifier) @local.definition.type))
name:
(qualified_identifier
name: (type_identifier) @local.definition.type))
(class_specifier
name: (type_identifier) @local.definition.type)
@ -26,8 +29,9 @@
name: (identifier) @local.definition.type)
(class_specifier
name: (qualified_identifier
name: (type_identifier) @local.definition.type))
name:
(qualified_identifier
name: (type_identifier) @local.definition.type))
(alias_declaration
name: (type_identifier) @local.definition.type)
@ -35,9 +39,10 @@
;template <typename T>
(type_parameter_declaration
(type_identifier) @local.definition.type)
(template_declaration) @local.scope
;; Namespaces
; Namespaces
(namespace_definition
name: (namespace_identifier) @local.definition.namespace
body: (_) @local.scope)
@ -47,9 +52,9 @@
body: (_) @local.scope)
((namespace_identifier) @local.reference
(#set! reference.kind "namespace"))
(#set! reference.kind "namespace"))
;; Function definitions
; Function definitions
(template_function
name: (identifier) @local.definition.function) @local.scope
@ -57,16 +62,18 @@
name: (field_identifier) @local.definition.method) @local.scope
(function_declarator
declarator: (qualified_identifier
name: (identifier) @local.definition.function)) @local.scope
declarator:
(qualified_identifier
name: (identifier) @local.definition.function)) @local.scope
(field_declaration
declarator: (function_declarator
(field_identifier) @local.definition.method))
declarator:
(function_declarator
(field_identifier) @local.definition.method))
(lambda_expression) @local.scope
;; Control structures
; Control structures
(try_statement
body: (_) @local.scope)

View file

@ -1,3 +1 @@
[
(rule_set)
] @fold
(rule_set) @fold

View file

@ -1,92 +1,99 @@
[
"@media"
"@charset"
"@namespace"
"@supports"
"@keyframes"
(at_keyword)
(to)
(from)
] @keyword
"@media"
"@charset"
"@namespace"
"@supports"
"@keyframes"
(at_keyword)
(to)
(from)
] @keyword
"@import" @keyword.import
(comment) @comment @spell
[
(tag_name)
(nesting_selector)
(universal_selector)
] @type
(tag_name)
(nesting_selector)
(universal_selector)
] @type
(function_name) @function
[
"~"
">"
"+"
"-"
"*"
"/"
"="
"^="
"|="
"~="
"$="
"*="
] @operator
"~"
">"
"+"
"-"
"*"
"/"
"="
"^="
"|="
"~="
"$="
"*="
] @operator
[
"and"
"or"
"not"
"only"
] @keyword.operator
"and"
"or"
"not"
"only"
] @keyword.operator
(important) @type.qualifier
(attribute_selector (plain_value) @string)
(pseudo_element_selector "::" (tag_name) @property)
(pseudo_class_selector (class_name) @property)
(attribute_selector
(plain_value) @string)
(pseudo_element_selector
"::"
(tag_name) @property)
(pseudo_class_selector
(class_name) @property)
[
(class_name)
(id_name)
(property_name)
(feature_name)
(attribute_name)
] @property
(class_name)
(id_name)
(property_name)
(feature_name)
(attribute_name)
] @property
(namespace_name) @module
((property_name) @type.definition
(#lua-match? @type.definition "^[-][-]"))
((plain_value) @type
(#lua-match? @type "^[-][-]"))
[
(string_value)
(color_value)
(unit)
] @string
(string_value)
(color_value)
(unit)
] @string
[
(integer_value)
(float_value)
] @number
(integer_value)
(float_value)
] @number
[
"#"
","
"."
":"
"::"
";"
] @punctuation.delimiter
"#"
","
"."
":"
"::"
";"
] @punctuation.delimiter
[
"{"
")"
"("
"}"
] @punctuation.bracket
"{"
")"
"("
"}"
] @punctuation.bracket

View file

@ -3,7 +3,9 @@
(declaration)
] @indent.begin
(block ("}") @indent.branch)
(block
("}") @indent.branch)
("}") @indent.dedent
(comment) @indent.ignore

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,3 +1,2 @@
; inherits: tsv
"," @punctuation.delimiter

View file

@ -1,6 +1,8 @@
; inherits: cpp
[ "<<<" ">>>" ] @punctuation.bracket
[
"<<<"
">>>"
] @punctuation.bracket
[
"__host__"

View file

@ -1,5 +1,5 @@
((preproc_arg) @injection.content
(#set! injection.language "cuda"))
(#set! injection.language "cuda"))
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,49 +1,41 @@
; Includes
[
"package"
"import"
] @keyword.import
; Namespaces
(package_identifier) @module
(import_spec ["." "_"] @punctuation.special)
(import_spec
[
"."
"_"
] @punctuation.special)
[
(attr_path)
(package_path)
] @string.special.url ;; In attributes
] @string.special.url ; In attributes
; Attributes
(attribute) @attribute
; Conditionals
"if" @keyword.conditional
; Repeats
"for" @keyword.repeat
[
"for"
] @keyword.repeat
(for_clause "_" @punctuation.special)
(for_clause
"_" @punctuation.special)
; Keywords
"let" @keyword
[
"let"
] @keyword
[
"in"
] @keyword.operator
"in" @keyword.operator
; Operators
[
"+"
"-"
@ -66,34 +58,33 @@
] @operator
; Fields & Properties
(field
(label
(identifier) @variable.member))
(field
(label
(identifier) @variable.member))
(selector_expression
(_)
(identifier) @property)
; Functions
(call_expression
function: (identifier) @function.call)
(call_expression
function: (selector_expression
(_)
(identifier) @function.call))
function:
(selector_expression
(_)
(identifier) @function.call))
(call_expression
function: (builtin_function) @function.call)
(builtin_function) @function.builtin
; Variables
(identifier) @variable
; Types
(primitive_type) @type.builtin
((identifier) @type
@ -102,22 +93,33 @@
[
(slice_type)
(pointer_type)
] @type ;; In attributes
] @type ; In attributes
; Punctuation
[
","
":"
] @punctuation.delimiter
[ "{" "}" ] @punctuation.bracket
[
"{"
"}"
] @punctuation.bracket
[ "[" "]" ] @punctuation.bracket
[
"["
"]"
] @punctuation.bracket
[ "(" ")" ] @punctuation.bracket
[
"("
")"
] @punctuation.bracket
[ "<" ">" ] @punctuation.bracket
[
"<"
">"
] @punctuation.bracket
[
(ellipsis)
@ -125,7 +127,6 @@
] @punctuation.special
; Literals
(string) @string
[
@ -150,11 +151,15 @@
] @constant.builtin
; Interpolations
(interpolation
"\\(" @punctuation.special
(_)
")" @punctuation.special) @none
(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none
(interpolation "\\(" (identifier) @variable ")")
(interpolation
"\\("
(identifier) @variable
")")
; Comments
(comment) @comment @spell

View file

@ -9,11 +9,20 @@
")"
] @indent.end
[ "{" "}" ] @indent.branch
[
"{"
"}"
] @indent.branch
[ "[" "]" ] @indent.branch
[
"["
"]"
] @indent.branch
[ "(" ")" ] @indent.branch
[
"("
")"
] @indent.branch
[
(ERROR)

View file

@ -1,2 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View file

@ -1,5 +1,4 @@
; Scopes
[
(source_file)
(field)
@ -7,17 +6,15 @@
] @local.scope
; References
(identifier) @local.reference
; Definitions
(import_spec
path: (string) @local.definition.import)
(field
(label
(identifier) @local.definition.field))
(identifier) @local.definition.field))
(package_identifier) @local.definition.namespace

View file

@ -1,5 +1,4 @@
;; Misc
; Misc
[
(line_comment)
(block_comment)
@ -8,6 +7,7 @@
((line_comment) @comment.documentation
(#lua-match? @comment.documentation "^///[^/]"))
((line_comment) @comment.documentation
(#lua-match? @comment.documentation "^///$"))
@ -18,9 +18,12 @@
(#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$"))
[
"(" ")"
"[" "]"
"{" "}"
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
@ -35,8 +38,7 @@
"$"
] @punctuation.special
;; Constants
; Constants
[
"__FILE_FULL_PATH__"
"__FILE__"
@ -66,11 +68,9 @@
"false"
] @boolean
;; Functions
; Functions
(func_declarator
(identifier) @function
)
(identifier) @function)
[
"__traits"
@ -83,29 +83,22 @@
] @function.builtin
(import_expression
"import" @function.builtin
)
"import" @function.builtin)
(parameter
(var_declarator
(identifier) @variable.parameter
)
)
(identifier) @variable.parameter))
(function_literal
(identifier) @variable.parameter
)
(identifier) @variable.parameter)
(constructor
"this" @constructor
)
"this" @constructor)
(destructor
"this" @constructor
)
;; Keywords
"this" @constructor)
; Keywords
[
"case"
"default"
@ -238,51 +231,45 @@
] @type.qualifier
(alias_assignment
. (identifier) @type.definition)
.
(identifier) @type.definition)
(module_declaration
"module" @keyword.import
)
"module" @keyword.import)
(import_declaration
"import" @keyword.import
)
"import" @keyword.import)
(type) @type
(catch_parameter
(qualified_identifier) @type
)
(qualified_identifier) @type)
(var_declarations
(qualified_identifier) @type
)
(qualified_identifier) @type)
(func_declaration
(qualified_identifier) @type
)
(qualified_identifier) @type)
(parameter
(qualified_identifier) @type
)
(qualified_identifier) @type)
(class_declaration
(identifier) @type
)
(identifier) @type)
(fundamental_type) @type.builtin
(module_fully_qualified_name (packages (package_name) @module))
(module_fully_qualified_name
(packages
(package_name) @module))
(module_name) @module
(at_attribute) @attribute
(user_defined_attribute
"@" @attribute
)
;; Variables
"@" @attribute)
; Variables
(primary_expression
"this" @variable.builtin
)
"this" @variable.builtin)

View file

@ -5,9 +5,12 @@
] @indent.begin
[
"(" ")"
"{" "}"
"[" "]"
"("
")"
"{"
"}"
"["
"]"
] @indent.branch
[

View file

@ -2,8 +2,8 @@
(line_comment)
(block_comment)
(nesting_block_comment)
] @injection.content
(#set! injection.language "comment"))
] @injection.content
(#set! injection.language "comment"))
((token_string_tokens) @injection.content
(#set! injection.language "d"))
(#set! injection.language "d"))

Some files were not shown because too many files have changed in this diff Show more