refactor(format): drop extra indentation for field

This commit is contained in:
Phạm Huy Hoàng 2024-03-21 20:44:35 +09:00 committed by Christian Clason
parent c28396de30
commit 722617e672
140 changed files with 2146 additions and 2766 deletions

View file

@ -12,9 +12,8 @@
name: (identifier) @function) name: (identifier) @function)
(pipe_call (pipe_call
arguments: arguments: (pipe_arguments
(pipe_arguments (identifier) @variable.parameter))
(identifier) @variable.parameter))
(structural_directive (structural_directive
"*" @keyword "*" @keyword
@ -47,14 +46,12 @@
function: (identifier) @function) function: (identifier) @function)
(call_expression (call_expression
function: function: ((identifier) @function.builtin
((identifier) @function.builtin (#eq? @function.builtin "$any")))
(#eq? @function.builtin "$any")))
(pair (pair
key: key: ((identifier) @variable.builtin
((identifier) @variable.builtin (#eq? @variable.builtin "$implicit")))
(#eq? @variable.builtin "$implicit")))
((control_keyword) @keyword.repeat ((control_keyword) @keyword.repeat
(#any-of? @keyword.repeat "for" "empty")) (#any-of? @keyword.repeat "for" "empty"))

View file

@ -106,36 +106,34 @@
] @operator ] @operator
(binary_expression (binary_expression
operator: operator: [
[ ">"
">" "<"
"<" "=="
"==" "==="
"===" "!=="
"!==" "&&"
"&&" "||"
"||" "+"
"+" "-"
"-" "*"
"*" "/"
"/" "&"
"&" "|"
"|" "^"
"^" "%"
"%" "<<"
"<<" ">>"
">>" ">>>"
">>>" ] @operator)
] @operator)
(unary_expression (unary_expression
operator: operator: [
[ "+"
"+" "-"
"-" "!"
"!" "~"
"~" ]) @operator
]) @operator
(map_initializer (map_initializer
"=>" @operator) "=>" @operator)
@ -147,9 +145,8 @@
; Fields ; Fields
(field_declaration (field_declaration
declarator: declarator: (variable_declarator
(variable_declarator name: (identifier) @variable.member))
name: (identifier) @variable.member))
(field_access (field_access
field: (identifier) @variable.member) field: (identifier) @variable.member)

View file

@ -48,9 +48,8 @@
name: (identifier) @local.definition.method) name: (identifier) @local.definition.method)
(local_variable_declaration (local_variable_declaration
declarator: declarator: (variable_declarator
(variable_declarator name: (identifier) @local.definition.var))
name: (identifier) @local.definition.var))
(enhanced_for_statement (enhanced_for_statement
name: (identifier) @local.definition.var) name: (identifier) @local.definition.var)
@ -62,9 +61,8 @@
name: (identifier) @local.definition.parameter) name: (identifier) @local.definition.parameter)
(field_declaration (field_declaration
declarator: declarator: (variable_declarator
(variable_declarator name: (identifier) @local.definition.field))
name: (identifier) @local.definition.field))
; REFERENCES ; REFERENCES
(identifier) @local.reference (identifier) @local.reference

View file

@ -25,10 +25,9 @@
(identifier) @property) (identifier) @property)
(call_expression (call_expression
function: function: (selector_expression
(selector_expression operand: (identifier) @constant
operand: (identifier) @constant field: (field_identifier) @function.method))
field: (field_identifier) @function.method))
(perm_expression (perm_expression
(stabby) @operator (stabby) @operator

View file

@ -41,14 +41,12 @@
"::" @punctuation.delimiter) "::" @punctuation.delimiter)
(func_def (func_def
name: name: (_
(_ (identifier) @function) @function)
(identifier) @function) @function)
(func_call (func_call
name: name: (_
(_ (identifier) @function) @function)
(identifier) @function) @function)
(func_def (func_def
(param_list (param_list

View file

@ -170,12 +170,11 @@
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait")) "trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
(command (command
argument: argument: [
[ (word) @variable.parameter
(word) @variable.parameter (concatenation
(concatenation (word) @variable.parameter)
(word) @variable.parameter) ])
])
(number) @number (number) @number

View file

@ -13,11 +13,10 @@
((command ((command
name: (command_name) @_command name: (command_name) @_command
. .
argument: argument: [
[ (string)
(string) (raw_string)
(raw_string) ] @injection.content)
] @injection.content)
(#eq? @_command "printf") (#eq? @_command "printf")
(#set! injection.language "printf")) (#set! injection.language "printf"))
@ -28,11 +27,10 @@
. .
(_) (_)
. .
argument: argument: [
[ (string)
(string) (raw_string)
(raw_string) ] @injection.content)
] @injection.content)
(#eq? @_command "printf") (#eq? @_command "printf")
(#eq? @_arg "-v") (#eq? @_arg "-v")
(#set! injection.language "printf")) (#set! injection.language "printf"))
@ -42,11 +40,10 @@
name: (command_name) @_command name: (command_name) @_command
argument: (word) @_arg argument: (word) @_arg
. .
argument: argument: [
[ (string)
(string) (raw_string)
(raw_string) ] @injection.content)
] @injection.content)
(#eq? @_command "printf") (#eq? @_command "printf")
(#eq? @_arg "--") (#eq? @_arg "--")
(#set! injection.language "printf")) (#set! injection.language "printf"))

View file

@ -137,9 +137,8 @@
((assignment ((assignment
left: (python_identifier) @type.definition left: (python_identifier) @type.definition
right: right: (call
(call function: (python_identifier) @_func))
function: (python_identifier) @_func))
(#any-of? @_func "TypeVar" "NewType")) (#any-of? @_func "TypeVar" "NewType"))
; Fields ; Fields
@ -154,18 +153,16 @@
function: (python_identifier) @function.call) function: (python_identifier) @function.call)
(call (call
function: function: (attribute
(attribute attribute: (python_identifier) @function.method.call))
attribute: (python_identifier) @function.method.call))
((call ((call
function: (python_identifier) @constructor) function: (python_identifier) @constructor)
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
((call ((call
function: function: (attribute
(attribute attribute: (python_identifier) @constructor))
attribute: (python_identifier) @constructor))
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
((call ((call
@ -191,10 +188,9 @@
((call ((call
function: (python_identifier) @_isinstance function: (python_identifier) @_isinstance
arguments: arguments: (argument_list
(argument_list (_)
(_) (python_identifier) @type))
(python_identifier) @type))
(#eq? @_isinstance "isinstance")) (#eq? @_isinstance "isinstance"))
(anonymous_python_function (anonymous_python_function
@ -216,11 +212,10 @@
(identifier) @function) (identifier) @function)
(python_function_definition (python_function_definition
body: body: (block
(block .
. (expression_statement
(expression_statement (python_string) @string.documentation @spell)))
(python_string) @string.documentation @spell)))
; Namespace ; Namespace
(inherit_path) @module (inherit_path) @module

View file

@ -154,9 +154,8 @@
(attribute (attribute
attribute: (_) @indent.end) attribute: (_) @indent.end)
(call (call
arguments: arguments: (_
(_ ")" @indent.end))
")" @indent.end))
"return" @indent.end "return" @indent.end
] .) ] .)

View file

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

View file

@ -9,14 +9,12 @@
alias: (python_identifier) @local.definition.import) alias: (python_identifier) @local.definition.import)
(import_statement (import_statement
name: name: (dotted_name
(dotted_name (python_identifier) @local.definition.import))
(python_identifier) @local.definition.import))
(import_from_statement (import_from_statement
name: name: (dotted_name
(dotted_name (python_identifier) @local.definition.import))
(python_identifier) @local.definition.import))
; Function with parameters, defines parameters ; Function with parameters, defines parameters
(parameters (parameters
@ -55,14 +53,12 @@
; Loops ; Loops
; not a scope! ; not a scope!
(for_statement (for_statement
left: left: (pattern_list
(pattern_list (python_identifier) @local.definition.var))
(python_identifier) @local.definition.var))
(for_statement (for_statement
left: left: (tuple_pattern
(tuple_pattern (python_identifier) @local.definition.var))
(python_identifier) @local.definition.var))
(for_statement (for_statement
left: (python_identifier) @local.definition.var) left: (python_identifier) @local.definition.var)
@ -74,14 +70,12 @@
left: (python_identifier) @local.definition.var) left: (python_identifier) @local.definition.var)
(for_in_clause (for_in_clause
left: left: (tuple_pattern
(tuple_pattern (python_identifier) @local.definition.var))
(python_identifier) @local.definition.var))
(for_in_clause (for_in_clause
left: left: (pattern_list
(pattern_list (python_identifier) @local.definition.var))
(python_identifier) @local.definition.var))
(dictionary_comprehension) @local.scope (dictionary_comprehension) @local.scope
@ -94,30 +88,26 @@
left: (python_identifier) @local.definition.var) left: (python_identifier) @local.definition.var)
(assignment (assignment
left: left: (pattern_list
(pattern_list (python_identifier) @local.definition.var))
(python_identifier) @local.definition.var))
(assignment (assignment
left: left: (tuple_pattern
(tuple_pattern (python_identifier) @local.definition.var))
(python_identifier) @local.definition.var))
(assignment (assignment
left: left: (attribute
(attribute (python_identifier)
(python_identifier) (python_identifier) @local.definition.field))
(python_identifier) @local.definition.field))
(variable_assignment (variable_assignment
(identifier) (identifier)
operator: operator: [
[ "="
"=" "?="
"?=" "??="
"??=" ":="
":=" ] @local.definition.var)
] @local.definition.var)
; Walrus operator x := 1 ; Walrus operator x := 1
(named_expression (named_expression

View file

@ -263,18 +263,16 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (field_expression
(field_expression field: (field_identifier) @function.call))
field: (field_identifier) @function.call))
(function_declarator (function_declarator
declarator: (identifier) @function) declarator: (identifier) @function)
(function_declarator (function_declarator
declarator: declarator: (parenthesized_declarator
(parenthesized_declarator (pointer_declarator
(pointer_declarator declarator: (field_identifier) @function)))
declarator: (field_identifier) @function)))
(preproc_function_def (preproc_function_def
name: (identifier) @function.macro) name: (identifier) @function.macro)

View file

@ -43,19 +43,17 @@
; Supports if without braces (but not both if-else without braces) ; Supports if without braces (but not both if-else without braces)
(if_statement (if_statement
consequence: consequence: (_
(_ ";" @indent.end) @_consequence
";" @indent.end) @_consequence
(#not-has-type? @_consequence compound_statement) (#not-has-type? @_consequence compound_statement)
alternative: alternative: (else_clause
(else_clause "else" @indent.branch
"else" @indent.branch [
[ (if_statement
(if_statement (compound_statement) @indent.dedent)? @indent.dedent
(compound_statement) @indent.dedent)? @indent.dedent (compound_statement)? @indent.dedent
(compound_statement)? @indent.dedent (_)? @indent.dedent
(_)? @indent.dedent ])?) @indent.begin
])?) @indent.begin
(else_clause (else_clause
(_ (_

View file

@ -14,11 +14,10 @@
((call_expression ((call_expression
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (string_literal
(string_literal (string_content) @injection.content)))
(string_content) @injection.content)))
; format-ignore ; format-ignore
(#any-of? @_function (#any-of? @_function
"printf" "printf_s" "printf" "printf_s"
@ -36,12 +35,11 @@
((call_expression ((call_expression
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list (_)
(_) .
. (string_literal
(string_literal (string_content) @injection.content)))
(string_content) @injection.content)))
; format-ignore ; format-ignore
(#any-of? @_function (#any-of? @_function
"fprintf" "fprintf_s" "fprintf" "fprintf_s"
@ -68,14 +66,13 @@
((call_expression ((call_expression
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list (_)
(_) .
. (_)
(_) .
. (string_literal
(string_literal (string_content) @injection.content)))
(string_content) @injection.content)))
; format-ignore ; format-ignore
(#any-of? @_function (#any-of? @_function
"sprintf_s" "sprintf_s"
@ -92,16 +89,15 @@
((call_expression ((call_expression
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list (_)
(_) .
. (_)
(_) .
. (_)
(_) .
. (string_literal
(string_literal (string_content) @injection.content)))
(string_content) @injection.content)))
(#any-of? @_function "mvwprintw" "mvwscanw") (#any-of? @_function "mvwprintw" "mvwscanw")
(#set! injection.language "printf")) (#set! injection.language "printf"))

View file

@ -1,9 +1,8 @@
body: body: [
[ (declaration_list)
(declaration_list) (switch_body)
(switch_body) (enum_member_declaration_list)
(enum_member_declaration_list) ] @fold
] @fold
accessors: (accessor_list) @fold accessors: (accessor_list) @fold

View file

@ -32,28 +32,25 @@
name: (identifier) @function.method.call)) name: (identifier) @function.method.call))
(invocation_expression (invocation_expression
function: function: (conditional_access_expression
(conditional_access_expression (member_binding_expression
(member_binding_expression name: (identifier) @function.method.call)))
name: (identifier) @function.method.call)))
(namespace_declaration (namespace_declaration
name: name: [
[ (qualified_name)
(qualified_name) (identifier)
(identifier) ] @module)
] @module)
(qualified_name (qualified_name
(identifier) @type) (identifier) @type)
(namespace_declaration (namespace_declaration
name: name: [
[ (qualified_name
(qualified_name (identifier) @module)
(identifier) @module) (identifier) @module
(identifier) @module ])
])
(invocation_expression (invocation_expression
(identifier) @function.method.call) (identifier) @function.method.call)
@ -184,16 +181,14 @@
(identifier) @type)) (identifier) @type))
(_ (_
type: type: (generic_name
(generic_name (identifier) @type))
(identifier) @type))
; Generic Method invocation with generic type ; Generic Method invocation with generic type
(invocation_expression (invocation_expression
function: function: (generic_name
(generic_name .
. (identifier) @function.method.call))
(identifier) @function.method.call))
(invocation_expression (invocation_expression
(member_access_expression (member_access_expression

View file

@ -14,9 +14,8 @@
left: (identifier) @local.definition.var) left: (identifier) @local.definition.var)
(for_each_statement (for_each_statement
left: left: (tuple_pattern
(tuple_pattern (identifier) @local.definition.var))
(identifier) @local.definition.var))
(parameter (parameter
(identifier) @local.definition.parameter) (identifier) @local.definition.parameter)

View file

@ -10,9 +10,8 @@
"from" "from"
"import" "import"
] @keyword.import ] @keyword.import
module_name: module_name: (dotted_name
(dotted_name (identifier) @module .))
(identifier) @module .))
[ [
"as" "as"
@ -74,9 +73,8 @@
path: (identifier) @module) path: (identifier) @module)
(scoped_use_list (scoped_use_list
path: path: (scoped_identifier
(scoped_identifier (identifier) @module))
(identifier) @module))
(use_list (use_list
(scoped_identifier (scoped_identifier
@ -228,14 +226,12 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (scoped_identifier
(scoped_identifier (identifier) @function.call .))
(identifier) @function.call .))
(call_expression (call_expression
function: function: (field_expression
(field_expression field: (field_identifier) @function.call))
field: (field_identifier) @function.call))
"jmp" @function.builtin "jmp" @function.builtin
@ -267,23 +263,20 @@
name: (identifier) @constant) name: (identifier) @constant)
(call_expression (call_expression
function: function: (scoped_identifier
"::"
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern
(identifier) @constant))
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern
(scoped_identifier (scoped_identifier
"::" name: (identifier) @constant)))
name: (identifier) @constant)
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern:
(match_pattern
(identifier) @constant))
(#lua-match? @constant "^[A-Z]"))
((match_arm
pattern:
(match_pattern
(scoped_identifier
name: (identifier) @constant)))
(#lua-match? @constant "^[A-Z]")) (#lua-match? @constant "^[A-Z]"))
((identifier) @constant.builtin ((identifier) @constant.builtin

View file

@ -25,29 +25,24 @@
"}" @indent.end) "}" @indent.end)
(enum_item (enum_item
body: body: (enum_variant_list
(enum_variant_list "}" @indent.end))
"}" @indent.end))
(match_expression (match_expression
body: body: (match_block
(match_block "}" @indent.end))
"}" @indent.end))
(mod_item (mod_item
body: body: (declaration_list
(declaration_list "}" @indent.end))
"}" @indent.end))
(struct_item (struct_item
body: body: (field_declaration_list
(field_declaration_list "}" @indent.end))
"}" @indent.end))
(trait_item (trait_item
body: body: (declaration_list
(declaration_list "}" @indent.end))
"}" @indent.end))
[ [
")" ")"

View file

@ -22,9 +22,8 @@
] @local.scope ] @local.scope
(use_declaration (use_declaration
argument: argument: (scoped_identifier
(scoped_identifier name: (identifier) @local.definition.import))
name: (identifier) @local.definition.import))
(use_as_clause (use_as_clause
alias: (identifier) @local.definition.import) alias: (identifier) @local.definition.import)

View file

@ -11,30 +11,26 @@
function_name: (_) @function) function_name: (_) @function)
(defun_header (defun_header
lambda_list: lambda_list: (list_lit
(list_lit (sym_lit) @variable.parameter))
(sym_lit) @variable.parameter))
(defun_header (defun_header
keyword: keyword: (defun_keyword
(defun_keyword "defmethod")
"defmethod") lambda_list: (list_lit
lambda_list:
(list_lit (list_lit
(list_lit .
. (sym_lit)
(sym_lit) .
. (sym_lit) @string.special.symbol)))
(sym_lit) @string.special.symbol)))
(defun_header (defun_header
lambda_list: lambda_list: (list_lit
(list_lit (list_lit
(list_lit .
. (sym_lit) @variable.parameter
(sym_lit) @variable.parameter .
. (_))))
(_))))
(defun_header (defun_header
specifier: (sym_lit) @string.special.symbol) specifier: (sym_lit) @string.special.symbol)

View file

@ -3,30 +3,26 @@
(#set! definition.function.scope "parent")) (#set! definition.function.scope "parent"))
(defun_header (defun_header
lambda_list: lambda_list: (list_lit
(list_lit (sym_lit) @local.definition.parameter))
(sym_lit) @local.definition.parameter))
(defun_header (defun_header
keyword: keyword: (defun_keyword
(defun_keyword "defmethod")
"defmethod") lambda_list: (list_lit
lambda_list:
(list_lit (list_lit
(list_lit .
. (sym_lit)
(sym_lit) .
. (sym_lit) @local.definition.type)))
(sym_lit) @local.definition.type)))
(defun_header (defun_header
lambda_list: lambda_list: (list_lit
(list_lit (list_lit
(list_lit .
. (sym_lit) @local.definition.parameter
(sym_lit) @local.definition.parameter .
. (_))))
(_))))
(sym_lit) @local.reference (sym_lit) @local.reference

View file

@ -8,9 +8,8 @@
; function(Foo ...foo) ; function(Foo ...foo)
(variadic_parameter_declaration (variadic_parameter_declaration
declarator: declarator: (variadic_declarator
(variadic_declarator (_) @variable.parameter))
(_) @variable.parameter))
; int foo = 0 ; int foo = 0
(optional_parameter_declaration (optional_parameter_declaration
@ -44,9 +43,8 @@
(#lua-match? @type "^[%u]")) (#lua-match? @type "^[%u]"))
(case_statement (case_statement
value: value: (qualified_identifier
(qualified_identifier (identifier) @constant))
(identifier) @constant))
(using_declaration (using_declaration
. .
@ -167,15 +165,13 @@
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
((call_expression ((call_expression
function: function: (qualified_identifier
(qualified_identifier name: (identifier) @constructor))
name: (identifier) @constructor))
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
((call_expression ((call_expression
function: function: (field_expression
(field_expression field: (field_identifier) @constructor))
field: (field_identifier) @constructor))
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
; constructing a type in an initializer list: Constructor (): **SuperType (1)** ; constructing a type in an initializer list: Constructor (): **SuperType (1)**

View file

@ -2,9 +2,8 @@
; Parameters ; Parameters
(variadic_parameter_declaration (variadic_parameter_declaration
declarator: declarator: (variadic_declarator
(variadic_declarator (identifier) @local.definition.parameter))
(identifier) @local.definition.parameter))
(optional_parameter_declaration (optional_parameter_declaration
declarator: (identifier) @local.definition.parameter) declarator: (identifier) @local.definition.parameter)
@ -19,9 +18,8 @@
(identifier) @local.definition.var) (identifier) @local.definition.var)
(struct_specifier (struct_specifier
name: name: (qualified_identifier
(qualified_identifier name: (type_identifier) @local.definition.type))
name: (type_identifier) @local.definition.type))
(class_specifier (class_specifier
name: (type_identifier) @local.definition.type) name: (type_identifier) @local.definition.type)
@ -30,9 +28,8 @@
name: (identifier) @local.definition.type) name: (identifier) @local.definition.type)
(class_specifier (class_specifier
name: name: (qualified_identifier
(qualified_identifier name: (type_identifier) @local.definition.type))
name: (type_identifier) @local.definition.type))
(alias_declaration (alias_declaration
name: (type_identifier) @local.definition.type) name: (type_identifier) @local.definition.type)
@ -63,14 +60,12 @@
name: (field_identifier) @local.definition.method) @local.scope name: (field_identifier) @local.definition.method) @local.scope
(function_declarator (function_declarator
declarator: declarator: (qualified_identifier
(qualified_identifier name: (identifier) @local.definition.function)) @local.scope
name: (identifier) @local.definition.function)) @local.scope
(field_declaration (field_declaration
declarator: declarator: (function_declarator
(function_declarator (field_identifier) @local.definition.method))
(field_identifier) @local.definition.method))
(lambda_expression) @local.scope (lambda_expression) @local.scope

View file

@ -71,10 +71,9 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (selector_expression
(selector_expression (_)
(_) (identifier) @function.call))
(identifier) @function.call))
(call_expression (call_expression
function: (builtin_function) @function.call) function: (builtin_function) @function.call)

View file

@ -33,19 +33,16 @@
] @punctuation.bracket ] @punctuation.bracket
(subgraph (subgraph
id: id: (id
(id (identifier) @module))
(identifier) @module))
(attribute (attribute
name: name: (id
(id (identifier) @variable.member))
(identifier) @variable.member))
(attribute (attribute
value: value: (id
(id (identifier) @constant))
(identifier) @constant))
(comment) @comment @spell (comment) @comment @spell

View file

@ -58,11 +58,10 @@
name: (identifier) @function) name: (identifier) @function)
(method_definition (method_definition
name: name: [
[ (property_identifier)
(property_identifier) (private_property_identifier)
(private_property_identifier) ] @function.method)
] @function.method)
(method_definition (method_definition
name: (property_identifier) @constructor name: (property_identifier) @constructor
@ -77,15 +76,13 @@
value: (arrow_function)) value: (arrow_function))
(assignment_expression (assignment_expression
left: left: (member_expression
(member_expression property: (property_identifier) @function.method)
property: (property_identifier) @function.method)
right: (arrow_function)) right: (arrow_function))
(assignment_expression (assignment_expression
left: left: (member_expression
(member_expression property: (property_identifier) @function.method)
property: (property_identifier) @function.method)
right: (function_expression)) right: (function_expression))
(variable_declarator (variable_declarator
@ -110,13 +107,11 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (member_expression
(member_expression property: [
property: (property_identifier)
[ (private_property_identifier)
(property_identifier) ] @function.method.call))
(private_property_identifier)
] @function.method.call))
; Builtins ; Builtins
;--------- ;---------

View file

@ -8,12 +8,11 @@
; html(`...`), html`...`, sql(...) etc ; html(`...`), html`...`, sql(...) etc
(call_expression (call_expression
function: (identifier) @injection.language function: (identifier) @injection.language
arguments: arguments: [
[ (arguments
(arguments (template_string) @injection.content)
(template_string) @injection.content) (template_string) @injection.content
(template_string) @injection.content ]
]
(#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$")
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children) (#set! injection.include-children)
@ -24,38 +23,32 @@
; svg`...` or svg(`...`) ; svg`...` or svg(`...`)
(call_expression (call_expression
function: function: ((identifier) @_name
((identifier) @_name (#eq? @_name "svg"))
(#eq? @_name "svg")) arguments: [
arguments: (arguments
[ (template_string) @injection.content)
(arguments (template_string) @injection.content
(template_string) @injection.content) ]
(template_string) @injection.content
]
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children) (#set! injection.include-children)
(#set! injection.language "html")) (#set! injection.language "html"))
(call_expression (call_expression
function: function: ((identifier) @_name
((identifier) @_name (#eq? @_name "gql"))
(#eq? @_name "gql")) arguments: ((template_string) @injection.content
arguments: (#offset! @injection.content 0 1 0 -1)
((template_string) @injection.content (#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1) (#set! injection.language "graphql")))
(#set! injection.include-children)
(#set! injection.language "graphql")))
(call_expression (call_expression
function: function: ((identifier) @_name
((identifier) @_name (#eq? @_name "hbs"))
(#eq? @_name "hbs")) arguments: ((template_string) @injection.content
arguments: (#offset! @injection.content 0 1 0 -1)
((template_string) @injection.content (#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1) (#set! injection.language "glimmer")))
(#set! injection.include-children)
(#set! injection.language "glimmer")))
((glimmer_template) @injection.content ((glimmer_template) @injection.content
(#set! injection.language "glimmer")) (#set! injection.language "glimmer"))
@ -64,67 +57,54 @@
(call_expression (call_expression
function: (identifier) @_name function: (identifier) @_name
(#any-of? @_name "css" "keyframes") (#any-of? @_name "css" "keyframes")
arguments: arguments: ((template_string) @injection.content
((template_string) @injection.content (#offset! @injection.content 0 1 0 -1)
(#offset! @injection.content 0 1 0 -1) (#set! injection.include-children)
(#set! injection.include-children) (#set! injection.language "styled")))
(#set! injection.language "styled")))
; styled.div`<css>` ; styled.div`<css>`
(call_expression (call_expression
function: function: (member_expression
(member_expression object: (identifier) @_name
object: (identifier) @_name (#eq? @_name "styled"))
(#eq? @_name "styled")) arguments: ((template_string) @injection.content
arguments: (#offset! @injection.content 0 1 0 -1)
((template_string) @injection.content (#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1) (#set! injection.language "styled")))
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component)`<css>` ; styled(Component)`<css>`
(call_expression (call_expression
function: function: (call_expression
(call_expression function: (identifier) @_name
function: (identifier) @_name (#eq? @_name "styled"))
(#eq? @_name "styled")) arguments: ((template_string) @injection.content
arguments: (#offset! @injection.content 0 1 0 -1)
((template_string) @injection.content (#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1) (#set! injection.language "styled")))
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled.div.attrs({ prop: "foo" })`<css>` ; styled.div.attrs({ prop: "foo" })`<css>`
(call_expression (call_expression
function: function: (call_expression
(call_expression function: (member_expression
function: object: (member_expression
(member_expression object: (identifier) @_name
object: (#eq? @_name "styled"))))
(member_expression arguments: ((template_string) @injection.content
object: (identifier) @_name (#offset! @injection.content 0 1 0 -1)
(#eq? @_name "styled")))) (#set! injection.include-children)
arguments: (#set! injection.language "styled")))
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
; styled(Component).attrs({ prop: "foo" })`<css>` ; styled(Component).attrs({ prop: "foo" })`<css>`
(call_expression (call_expression
function: function: (call_expression
(call_expression function: (member_expression
function: object: (call_expression
(member_expression function: (identifier) @_name
object: (#eq? @_name "styled"))))
(call_expression arguments: ((template_string) @injection.content
function: (identifier) @_name (#offset! @injection.content 0 1 0 -1)
(#eq? @_name "styled")))) (#set! injection.include-children)
arguments: (#set! injection.language "styled")))
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "styled")))
((regex_pattern) @injection.content ((regex_pattern) @injection.content
(#set! injection.language "regex")) (#set! injection.language "regex"))
@ -141,10 +121,9 @@
; el.innerHTML = `<html>` ; el.innerHTML = `<html>`
(assignment_expression (assignment_expression
left: left: (member_expression
(member_expression property: (property_identifier) @_prop
property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML"))
(#any-of? @_prop "outerHTML" "innerHTML"))
right: (template_string) @injection.content right: (template_string) @injection.content
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children) (#set! injection.include-children)
@ -152,13 +131,11 @@
; el.innerHTML = '<html>' ; el.innerHTML = '<html>'
(assignment_expression (assignment_expression
left: left: (member_expression
(member_expression property: (property_identifier) @_prop
property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML"))
(#any-of? @_prop "outerHTML" "innerHTML")) right: (string
right: (string_fragment) @injection.content)
(string
(string_fragment) @injection.content)
(#set! injection.language "html")) (#set! injection.language "html"))
;---- Angular injections ----- ;---- Angular injections -----
@ -167,61 +144,49 @@
; }) ; })
(decorator (decorator
(call_expression (call_expression
function: function: ((identifier) @_name
((identifier) @_name (#eq? @_name "Component"))
(#eq? @_name "Component")) arguments: (arguments
arguments: (object
(arguments (pair
(object key: ((property_identifier) @_prop
(pair (#eq? @_prop "template"))
key: value: ((template_string) @injection.content
((property_identifier) @_prop (#offset! @injection.content 0 1 0 -1)
(#eq? @_prop "template")) (#set! injection.include-children)
value: (#set! injection.language "angular")))))))
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "angular")))))))
; @Component({ ; @Component({
; styles: [`<css>`] ; styles: [`<css>`]
; }) ; })
(decorator (decorator
(call_expression (call_expression
function: function: ((identifier) @_name
((identifier) @_name (#eq? @_name "Component"))
(#eq? @_name "Component")) arguments: (arguments
arguments: (object
(arguments (pair
(object key: ((property_identifier) @_prop
(pair (#eq? @_prop "styles"))
key: value: (array
((property_identifier) @_prop ((template_string) @injection.content
(#eq? @_prop "styles")) (#offset! @injection.content 0 1 0 -1)
value: (#set! injection.include-children)
(array (#set! injection.language "css"))))))))
((template_string) @injection.content
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "css"))))))))
; @Component({ ; @Component({
; styles: `<css>` ; styles: `<css>`
; }) ; })
(decorator (decorator
(call_expression (call_expression
function: function: ((identifier) @_name
((identifier) @_name (#eq? @_name "Component"))
(#eq? @_name "Component")) arguments: (arguments
arguments: (object
(arguments (pair
(object key: ((property_identifier) @_prop
(pair (#eq? @_prop "styles"))
key: value: ((template_string) @injection.content
((property_identifier) @_prop (#set! injection.include-children)
(#eq? @_prop "styles")) (#offset! @injection.content 0 1 0 -1)
value: (#set! injection.language "css")))))))
((template_string) @injection.content
(#set! injection.include-children)
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "css")))))))

View file

@ -95,42 +95,37 @@
; Remote Function Calls ; Remote Function Calls
(call (call
target: target: (dot
(dot left: [
left: (atom) @type
[ (_)
(atom) @type ]
(_) right: (identifier) @function.call)
]
right: (identifier) @function.call)
(arguments)) (arguments))
; Definition Function Calls ; Definition Function Calls
(call (call
target: target: ((identifier) @keyword.function
((identifier) @keyword.function (#any-of? @keyword.function
(#any-of? @keyword.function "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop"
"def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
"defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
(arguments (arguments
[ [
(call (call
(identifier) @function) (identifier) @function)
(identifier) @function (identifier) @function
(binary_operator (binary_operator
left: left: (call
(call target: (identifier) @function)
target: (identifier) @function)
operator: "when") operator: "when")
])?) ])?)
; Kernel Keywords & Special Forms ; Kernel Keywords & Special Forms
(call (call
target: target: ((identifier) @keyword
((identifier) @keyword (#any-of? @keyword
(#any-of? @keyword "alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require"
"alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with")))
"reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with")))
; Special Constants ; Special Constants
((identifier) @constant.builtin ((identifier) @constant.builtin
@ -160,22 +155,19 @@
; Capture Operator ; Capture Operator
(unary_operator (unary_operator
operator: "&" operator: "&"
operand: operand: [
[ (integer) @operator
(integer) @operator (binary_operator
(binary_operator left: [
left: (call
[ target: (dot
(call left: (_)
target: right: (identifier) @function))
(dot (identifier) @function
left: (_) ]
right: (identifier) @function)) operator: "/"
(identifier) @function right: (integer) @operator)
] ])
operator: "/"
right: (integer) @operator)
])
; Non-String Sigils ; Non-String Sigils
(sigil (sigil
@ -199,30 +191,27 @@
; Module attributes ; Module attributes
(unary_operator (unary_operator
operator: "@" operator: "@"
operand: operand: [
[ (identifier)
(identifier) (call
(call target: (identifier))
target: (identifier)) ] @constant) @constant
] @constant) @constant
; Documentation ; Documentation
(unary_operator (unary_operator
operator: "@" operator: "@"
operand: operand: (call
(call target: ((identifier) @_identifier
target: (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation
((identifier) @_identifier (arguments
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation [
(arguments (string)
[ (boolean)
(string) (charlist)
(boolean) (sigil
(charlist) "~" @comment.documentation
(sigil (sigil_name) @comment.documentation
"~" @comment.documentation quoted_start: _ @comment.documentation
(sigil_name) @comment.documentation (quoted_content) @comment.documentation
quoted_start: _ @comment.documentation quoted_end: _ @comment.documentation)
(quoted_content) @comment.documentation ] @comment.documentation))) @comment.documentation
quoted_end: _ @comment.documentation)
] @comment.documentation))) @comment.documentation

View file

@ -5,19 +5,17 @@
; Documentation ; Documentation
(unary_operator (unary_operator
operator: "@" operator: "@"
operand: operand: (call
(call target: ((identifier) @_identifier
target: (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
((identifier) @_identifier (arguments
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) [
(arguments (string
[ (quoted_content) @injection.content)
(string (sigil
(quoted_content) @injection.content) (quoted_content) @injection.content)
(sigil ])
(quoted_content) @injection.content) (#set! injection.language "markdown")))
])
(#set! injection.language "markdown")))
; HEEx ; HEEx
(sigil (sigil

View file

@ -5,9 +5,8 @@
; Module Definitions ; Module Definitions
(call (call
target: target: ((identifier) @_identifier
((identifier) @_identifier (#eq? @_identifier "defmodule"))
(#eq? @_identifier "defmodule"))
(arguments (arguments
(alias) @local.definition.type)) (alias) @local.definition.type))

View file

@ -97,40 +97,34 @@
; Functions ; Functions
;---------- ;----------
(value_declaration (value_declaration
functionDeclarationLeft: functionDeclarationLeft: (function_declaration_left
(function_declaration_left (lower_case_identifier) @function
(lower_case_identifier) @function (pattern)))
(pattern)))
(value_declaration (value_declaration
functionDeclarationLeft: functionDeclarationLeft: (function_declaration_left
(function_declaration_left (lower_case_identifier) @function
(lower_case_identifier) @function pattern: (_)))
pattern: (_)))
(value_declaration (value_declaration
functionDeclarationLeft: functionDeclarationLeft: (function_declaration_left
(function_declaration_left (lower_case_identifier) @function)
(lower_case_identifier) @function)
body: (anonymous_function_expr)) body: (anonymous_function_expr))
(type_annotation (type_annotation
name: (lower_case_identifier) @function name: (lower_case_identifier) @function
typeExpression: typeExpression: (type_expression
(type_expression (arrow)))
(arrow)))
(port_annotation (port_annotation
name: (lower_case_identifier) @function name: (lower_case_identifier) @function
typeExpression: typeExpression: (type_expression
(type_expression (arrow)))
(arrow)))
(function_call_expr (function_call_expr
target: target: (value_expr
(value_expr (value_qid
(value_qid (lower_case_identifier) @function.call)))
(lower_case_identifier) @function.call)))
; Operators ; Operators
;---------- ;----------

View file

@ -106,10 +106,9 @@
(export_type_attribute) @type.definition (export_type_attribute) @type.definition
(export_type_attribute (export_type_attribute
types: types: (fa
(fa fun: _ @type
fun: _ @type (#set! "priority" 101)))
(#set! "priority" 101)))
(behaviour_attribute) @keyword.import (behaviour_attribute) @keyword.import
@ -117,9 +116,8 @@
(atom) @module) @keyword.import (atom) @module) @keyword.import
(wild_attribute (wild_attribute
name: name: (attr_name
(attr_name name: _ @attribute)) @attribute
name: _ @attribute)) @attribute
; Records ; Records
(record_expr) @type (record_expr) @type
@ -157,12 +155,11 @@
; expr_function_call ; expr_function_call
(call (call
expr: expr: [
[ (atom)
(atom) (remote)
(remote) (var)
(var) ] @function)
] @function)
(call (call
(atom) @keyword.exception (atom) @keyword.exception
@ -170,10 +167,9 @@
; Parenthesized expression: (SomeFunc)(), only highlight the parens ; Parenthesized expression: (SomeFunc)(), only highlight the parens
(call (call
expr: expr: (paren_expr
(paren_expr "(" @function.call
"(" @function.call ")" @function.call))
")" @function.call))
; function ; function
(external_fun) @function.call (external_fun) @function.call

View file

@ -35,12 +35,11 @@
; Types ; Types
(_ (_
type: type: [
[ (int_type)
(int_type) (float_type)
(float_type) (any_type)
(any_type) ]) @type.builtin
]) @type.builtin
[ [
(single_precision) (single_precision)

View file

@ -27,9 +27,8 @@
(#any-of? @_fn "fn" "lambda" "λ" "hashfn")) @fold (#any-of? @_fn "fn" "lambda" "λ" "hashfn")) @fold
(reader_macro (reader_macro
macro: macro: [
[ "'"
"'" "`"
"`" ]
]
expression: (_) @fold) expression: (_) @fold)

View file

@ -42,14 +42,12 @@
. .
(table (table
(table_pair (table_pair
key: key: (string
(string (string_content) @_command
(string_content) @_command (#eq? @_command "command"))
(#eq? @_command "command")) value: (string
value: (string_content) @injection.content
(string (#set! injection.language "vim")))))
(string_content) @injection.content
(#set! injection.language "vim")))))
(list (list
. .

View file

@ -98,11 +98,10 @@
; Commands ; Commands
(command (command
argument: argument: [
[ (word) @variable.parameter
(word) @variable.parameter (#lua-match? @variable.parameter "^[-]")
(#lua-match? @variable.parameter "^[-]") ])
])
(command_substitution (command_substitution
"$" @punctuation.bracket) "$" @punctuation.bracket)
@ -113,15 +112,14 @@
; derived from builtin -n (fish 3.2.2) ; derived from builtin -n (fish 3.2.2)
(command (command
name: name: [
[ (word) @function.builtin
(word) @function.builtin (#any-of? @function.builtin
(#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command"
"." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg"
"commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set"
"functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait")
"set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") ])
])
; Functions ; Functions
(function_definition (function_definition
@ -131,19 +129,17 @@
] @keyword.function) ] @keyword.function)
(function_definition (function_definition
name: name: [
[ (word)
(word) (concatenation)
(concatenation) ] @function)
] @function)
(function_definition (function_definition
option: option: [
[ (word)
(word) (concatenation
(concatenation (word))
(word)) ] @variable.parameter
] @variable.parameter
(#lua-match? @variable.parameter "^[-]")) (#lua-match? @variable.parameter "^[-]"))
; Strings ; Strings

View file

@ -7,6 +7,5 @@
keyword: (_) @local.definition.parameter) keyword: (_) @local.definition.parameter)
(key_value (key_value
value: value: (macro
(macro (identifier)*)* @local.reference)
(identifier)*)* @local.reference)

View file

@ -130,11 +130,10 @@
member: (ident) @property) member: (ident) @property)
(call_expr (call_expr
function: function: [
[ (ident)
(ident) (builtin_type)
(builtin_type) ] @function)
] @function)
(call_expr (call_expr
function: (builtin_type) @function.call) function: (builtin_type) @function.call)

View file

@ -21,10 +21,9 @@
(section_header (section_header
(section_name) @_alias) (section_name) @_alias)
(variable (variable
value: value: (string
(string "\""
"\"" "\"") @injection.content)
"\"") @injection.content)
(#eq? @_alias "alias") (#eq? @_alias "alias")
(#lua-match? @injection.content "^\"!") (#lua-match? @injection.content "^\"!")
(#offset! @injection.content 0 2 0 -1) (#offset! @injection.content 0 2 0 -1)

View file

@ -92,8 +92,7 @@
(module) @module (module) @module
(import (import
alias: alias: ((identifier) @module)?)
((identifier) @module)?)
(remote_type_identifier (remote_type_identifier
module: (identifier) @module) module: (identifier) @module)
@ -114,10 +113,9 @@
; Function Parameter Labels ; Function Parameter Labels
(function_call (function_call
arguments: arguments: (arguments
(arguments (argument
(argument label: (label) @label)))
label: (label) @label)))
(function_parameter (function_parameter
label: (label)? @label label: (label)? @label
@ -125,10 +123,9 @@
; Records ; Records
(record (record
arguments: arguments: (arguments
(arguments (argument
(argument label: (label) @variable.member)?))
label: (label) @variable.member)?))
(record_pattern_argument (record_pattern_argument
label: (label) @variable.member) label: (label) @variable.member)
@ -173,9 +170,8 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(function_call (function_call
function: function: (field_access
(field_access field: (label) @function.call))
field: (label) @function.call))
; External Functions ; External Functions
(external_function (external_function

View file

@ -50,12 +50,11 @@
; As are arguments in a block statement ; As are arguments in a block statement
(block_statement_start (block_statement_start
argument: argument: [
[ (path_expression
(path_expression (identifier) @variable)
(identifier) @variable) (identifier) @variable
(identifier) @variable ])
])
; As is an identifier in a block param ; As is an identifier in a block param
(block_params (block_params
@ -63,12 +62,11 @@
; As are helper arguments ; As are helper arguments
((helper_invocation ((helper_invocation
argument: argument: [
[ (path_expression
(path_expression (identifier) @variable)
(identifier) @variable) (identifier) @variable
(identifier) @variable ])
])
(#not-eq? @variable "this")) (#not-eq? @variable "this"))
; `this` should be highlighted as a built-in variable ; `this` should be highlighted as a built-in variable
@ -82,12 +80,11 @@
; Helpers are functions ; Helpers are functions
((helper_invocation ((helper_invocation
helper: helper: [
[ (path_expression
(path_expression (identifier) @function)
(identifier) @function) (identifier) @function
(identifier) @function ])
])
(#not-any-of? @function "if" "yield")) (#not-any-of? @function "if" "yield"))
((helper_invocation ((helper_invocation

View file

@ -29,9 +29,8 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call_expression (call_expression
function: function: (selector_expression
(selector_expression field: (field_identifier) @function.method.call))
field: (field_identifier) @function.method.call))
; Function definitions ; Function definitions
(function_declaration (function_declaration

View file

@ -20,24 +20,20 @@
(#set! injection.language "re2c")) (#set! injection.language "re2c"))
((call_expression ((call_expression
function: function: (selector_expression
(selector_expression field: (field_identifier) @_method)
field: (field_identifier) @_method) arguments: (argument_list
arguments: .
(argument_list (interpreted_string_literal) @injection.content))
.
(interpreted_string_literal) @injection.content))
(#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf" "Errorf" "Skipf" "Logf") (#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf" "Errorf" "Skipf" "Logf")
(#set! injection.language "printf")) (#set! injection.language "printf"))
((call_expression ((call_expression
function: function: (selector_expression
(selector_expression field: (field_identifier) @_method)
field: (field_identifier) @_method) arguments: (argument_list
arguments: (_)
(argument_list .
(_) (interpreted_string_literal) @injection.content))
.
(interpreted_string_literal) @injection.content))
(#any-of? @_method "Fprintf" "Fscanf" "Appendf" "Sscanf") (#any-of? @_method "Fprintf" "Fscanf" "Appendf" "Sscanf")
(#set! injection.language "printf")) (#set! injection.language "printf"))

View file

@ -7,9 +7,8 @@
) )
(short_var_declaration (short_var_declaration
left: left: (expression_list
(expression_list (identifier) @local.definition.var))
(identifier) @local.definition.var))
(var_spec (var_spec
name: (identifier) @local.definition.var) name: (identifier) @local.definition.var)
@ -22,9 +21,8 @@
(for_statement (for_statement
(range_clause (range_clause
left: left: (expression_list
(expression_list (identifier) @local.definition.var)))
(identifier) @local.definition.var)))
(const_declaration (const_declaration
(const_spec (const_spec
@ -57,22 +55,19 @@
(#set! reference.kind "call")) (#set! reference.kind "call"))
((call_expression ((call_expression
function: function: (selector_expression
field: (field_identifier) @local.reference))
(#set! reference.kind "call"))
((call_expression
function: (parenthesized_expression
(identifier) @local.reference))
(#set! reference.kind "call"))
((call_expression
function: (parenthesized_expression
(selector_expression (selector_expression
field: (field_identifier) @local.reference)) field: (field_identifier) @local.reference)))
(#set! reference.kind "call"))
((call_expression
function:
(parenthesized_expression
(identifier) @local.reference))
(#set! reference.kind "call"))
((call_expression
function:
(parenthesized_expression
(selector_expression
field: (field_identifier) @local.reference)))
(#set! reference.kind "call")) (#set! reference.kind "call"))
; Scopes ; Scopes

View file

@ -11,9 +11,8 @@
function: (identifier) @function) function: (identifier) @function)
(method_call (method_call
method: method: (selector_expression
(selector_expression field: (field_identifier) @function))
field: (field_identifier) @function))
; Builtin functions ; Builtin functions
(function_call (function_call

View file

@ -4,20 +4,18 @@
; {{"put" | printf "%s%s" "out" | printf "%q"}} ; {{"put" | printf "%s%s" "out" | printf "%q"}}
(function_call (function_call
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (interpreted_string_literal) @injection.content)
(interpreted_string_literal) @injection.content)
(#eq? @_function "printf") (#eq? @_function "printf")
(#set! injection.language "printf")) (#set! injection.language "printf"))
; {{ js "var a = 1 + 1" }} ; {{ js "var a = 1 + 1" }}
(function_call (function_call
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (interpreted_string_literal) @injection.content)
(interpreted_string_literal) @injection.content)
(#eq? @_function "js") (#eq? @_function "js")
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.language "javascript")) (#set! injection.language "javascript"))
@ -25,10 +23,9 @@
; {{ html "<h1>hello</h1>" }} ; {{ html "<h1>hello</h1>" }}
(function_call (function_call
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (interpreted_string_literal) @injection.content)
(interpreted_string_literal) @injection.content)
(#eq? @_function "html") (#eq? @_function "html")
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.language "html")) (#set! injection.language "html"))

View file

@ -215,9 +215,8 @@
function: (identifier) @function) function: (identifier) @function)
(function_call (function_call
function: function: (dotted_identifier
(dotted_identifier (identifier) @function .))
(identifier) @function .))
(function_call (function_call
(argument_list (argument_list
@ -228,9 +227,8 @@
function: (identifier) @function) function: (identifier) @function)
(juxt_function_call (juxt_function_call
function: function: (dotted_identifier
(dotted_identifier (identifier) @function .))
(identifier) @function .))
(juxt_function_call (juxt_function_call
(argument_list (argument_list

View file

@ -195,20 +195,17 @@
(variable) @variable.parameter) (variable) @variable.parameter)
(call_expression (call_expression
function: function: (qualified_identifier
(identifier) @function.call .))
(call_expression
function: (scoped_identifier
(identifier) @function.call .))
(call_expression
function: (selection_expression
(qualified_identifier (qualified_identifier
(identifier) @function.call .)) (identifier) @function.method.call .)))
(call_expression
function:
(scoped_identifier
(identifier) @function.call .))
(call_expression
function:
(selection_expression
(qualified_identifier
(identifier) @function.method.call .)))
(qualified_identifier (qualified_identifier
(_) @module (_) @module

View file

@ -7,23 +7,20 @@
(pat_wildcard) @variable (pat_wildcard) @variable
(function (function
patterns: patterns: (patterns
(patterns (_) @variable.parameter))
(_) @variable.parameter))
(exp_lambda (exp_lambda
(_)+ @variable.parameter (_)+ @variable.parameter
"->") "->")
(function (function
infix: infix: (infix
(infix lhs: (_) @variable.parameter))
lhs: (_) @variable.parameter))
(function (function
infix: infix: (infix
(infix rhs: (_) @variable.parameter))
rhs: (_) @variable.parameter))
; ---------------------------------------------------------------------------- ; ----------------------------------------------------------------------------
; Literals and comments ; Literals and comments
@ -185,7 +182,24 @@
(function (function
name: (variable) @variable name: (variable) @variable
rhs: rhs: [
(exp_literal)
(exp_apply
(exp_name
[
(constructor)
(variable)
(qualified_variable)
]))
(quasiquote)
((exp_name)
.
(operator))
])
(function
name: (variable) @variable
rhs: (exp_infix
[ [
(exp_literal) (exp_literal)
(exp_apply (exp_apply
@ -199,26 +213,7 @@
((exp_name) ((exp_name)
. .
(operator)) (operator))
]) ]))
(function
name: (variable) @variable
rhs:
(exp_infix
[
(exp_literal)
(exp_apply
(exp_name
[
(constructor)
(variable)
(qualified_variable)
]))
(quasiquote)
((exp_name)
.
(operator))
]))
; Consider signatures (and accompanying functions) ; Consider signatures (and accompanying functions)
; with only one value on the rhs as variables ; with only one value on the rhs as variables
@ -403,14 +398,13 @@
; function defined in terms of a function composition ; function defined in terms of a function composition
(function (function
name: (variable) @function name: (variable) @function
rhs: rhs: (exp_infix
(exp_infix (_)
(_) .
. (operator) @_op
(operator) @_op .
. (_)
(_) (#any-of? @_op "." ">>>" "***" ">=>" "<=<")))
(#any-of? @_op "." ">>>" "***" ">=>" "<=<")))
(exp_apply (exp_apply
(exp_name (exp_name
@ -486,9 +480,8 @@
; scoped function types (func :: a -> b) ; scoped function types (func :: a -> b)
(pat_typed (pat_typed
pattern: pattern: (pat_name
(pat_name (variable) @function)
(variable) @function)
type: (fun)) type: (fun))
; signatures that have a function type ; signatures that have a function type
@ -618,12 +611,11 @@
(variable) @variable.member)) (variable) @variable.member))
(exp_field (exp_field
field: field: [
[ (variable) @variable.member
(variable) @variable.member (qualified_variable
(qualified_variable (variable) @variable.member)
(variable) @variable.member) ])
])
; ---------------------------------------------------------------------------- ; ----------------------------------------------------------------------------
; Spell checking ; Spell checking

View file

@ -104,10 +104,9 @@
; ;
; highlight identifier keys as though they were block attributes ; highlight identifier keys as though they were block attributes
(object_elem (object_elem
key: key: (expression
(expression (variable_expr
(variable_expr (identifier) @variable.member)))
(identifier) @variable.member)))
; var.foo, data.bar ; var.foo, data.bar
; ;

View file

@ -31,11 +31,10 @@
; {{ .Values.test }} ; {{ .Values.test }}
(selector_expression (selector_expression
operand: operand: (field
(field name: (identifier) @constant.builtin
name: (identifier) @constant.builtin (#any-of? @constant.builtin
(#any-of? @constant.builtin "Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))
(field_identifier)) (field_identifier))
; {{ $.Values.test }} ; {{ $.Values.test }}

View file

@ -7,10 +7,9 @@
; {{ regexFind "[a-zA-Z][1-9]" "abcd1234" }} ; {{ regexFind "[a-zA-Z][1-9]" "abcd1234" }}
(function_call (function_call
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (interpreted_string_literal) @injection.content)
(interpreted_string_literal) @injection.content)
(#any-of? @_function (#any-of? @_function
"regexMatch" "mustRegexMatch" "regexFindAll" "mustRegexFinDall" "regexFind" "mustRegexFind" "regexMatch" "mustRegexMatch" "regexFindAll" "mustRegexFinDall" "regexFind" "mustRegexFind"
"regexReplaceAll" "mustRegexReplaceAll" "regexReplaceAllLiteral" "mustRegexReplaceAllLiteral" "regexReplaceAll" "mustRegexReplaceAll" "regexReplaceAllLiteral" "mustRegexReplaceAllLiteral"
@ -20,20 +19,18 @@
(function_call (function_call
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (interpreted_string_literal) @injection.content)
(interpreted_string_literal) @injection.content)
(#any-of? @_function "fromYaml" "fromYamlArray") (#any-of? @_function "fromYaml" "fromYamlArray")
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.language "yaml")) (#set! injection.language "yaml"))
(function_call (function_call
function: (identifier) @_function function: (identifier) @_function
arguments: arguments: (argument_list
(argument_list .
. (interpreted_string_literal) @injection.content)
(interpreted_string_literal) @injection.content)
(#any-of? @_function "fromJson" "fromJsonArray") (#any-of? @_function "fromJson" "fromJsonArray")
(#offset! @injection.content 0 1 0 -1) (#offset! @injection.content 0 1 0 -1)
(#set! injection.language "json")) (#set! injection.language "json"))

View file

@ -111,9 +111,8 @@
; Fields ; Fields
(field_declaration (field_declaration
declarator: declarator: (variable_declarator
(variable_declarator name: (identifier) @variable.member))
name: (identifier) @variable.member))
(field_access (field_access
field: (identifier) @variable.member) field: (identifier) @variable.member)

View file

@ -10,19 +10,17 @@
((method_invocation ((method_invocation
name: (identifier) @_method name: (identifier) @_method
arguments: arguments: (argument_list
(argument_list .
(string_literal
. .
(string_literal (_) @injection.content)))
.
(_) @injection.content)))
(#any-of? @_method "format" "printf") (#any-of? @_method "format" "printf")
(#set! injection.language "printf")) (#set! injection.language "printf"))
((method_invocation ((method_invocation
object: object: (string_literal
(string_literal (string_fragment) @injection.content)
(string_fragment) @injection.content)
name: (identifier) @_method) name: (identifier) @_method)
(#eq? @_method "formatted") (#eq? @_method "formatted")
(#set! injection.language "printf")) (#set! injection.language "printf"))

View file

@ -67,9 +67,8 @@
name: (identifier) @local.definition.method) name: (identifier) @local.definition.method)
(local_variable_declaration (local_variable_declaration
declarator: declarator: (variable_declarator
(variable_declarator name: (identifier) @local.definition.var))
name: (identifier) @local.definition.var))
(enhanced_for_statement (enhanced_for_statement
; for (var item : items) { ; for (var item : items) {
@ -92,9 +91,8 @@
(#has-ancestor? @local.definition.import import_declaration)) (#has-ancestor? @local.definition.import import_declaration))
(field_declaration (field_declaration
declarator: declarator: (variable_declarator
(variable_declarator name: (identifier) @local.definition.field))
name: (identifier) @local.definition.field))
; REFERENCES ; REFERENCES
(identifier) @local.reference (identifier) @local.reference

View file

@ -7,18 +7,16 @@
; this.quuz = "qux"; ; this.quuz = "qux";
; } ; }
(field_definition (field_definition
property: property: [
[ (property_identifier)
(property_identifier) (private_property_identifier)
(private_property_identifier) ] @local.definition.var)
] @local.definition.var)
; this.foo = "bar" ; this.foo = "bar"
(assignment_expression (assignment_expression
left: left: (member_expression
(member_expression object: (this)
object: (this) property: (property_identifier) @local.definition.var))
property: (property_identifier) @local.definition.var))
(formal_parameters (formal_parameters
(identifier) @local.definition.parameter) (identifier) @local.definition.parameter)

View file

@ -104,15 +104,13 @@
; Functions ; Functions
(field (field
function: function: (fieldname
(fieldname (id) @function))
(id) @function))
(field (field
function: function: (fieldname
(fieldname (string
(string (string_content) @function)))
(string_content) @function)))
(param (param
identifier: (id) @variable.parameter) identifier: (id) @variable.parameter)

View file

@ -9,9 +9,8 @@
(local_bind) @local.scope (local_bind) @local.scope
(field (field
function: function: (fieldname
(fieldname (id) @local.definition.function)
(id) @local.definition.function)
(#set! "definition.function.scope" "parent")) (#set! "definition.function.scope" "parent"))
(bind (bind

View file

@ -1,18 +1,16 @@
(jsx_element (jsx_element
open_tag: open_tag: (jsx_opening_element
(jsx_opening_element [
[ "<"
"<" ">"
">" ] @tag.delimiter))
] @tag.delimiter))
(jsx_element (jsx_element
close_tag: close_tag: (jsx_closing_element
(jsx_closing_element [
[ "</"
"</" ">"
">" ] @tag.delimiter))
] @tag.delimiter))
(jsx_self_closing_element (jsx_self_closing_element
[ [

View file

@ -31,14 +31,12 @@
name: (identifier) @function) name: (identifier) @function)
(function_definition (function_definition
name: name: (field_expression
(field_expression (identifier) @function .))
(identifier) @function .))
(short_function_definition (short_function_definition
name: name: (field_expression
(field_expression (identifier) @function .))
(identifier) @function .))
; calls ; calls
(call_expression (call_expression

View file

@ -42,22 +42,19 @@
; General environments ; General environments
(begin (begin
command: _ @module command: _ @module
name: name: (curly_group_text
(curly_group_text (text) @label))
(text) @label))
(end (end
command: _ @module command: _ @module
name: name: (curly_group_text
(curly_group_text (text) @label))
(text) @label))
; Definitions and references ; Definitions and references
(new_command_definition (new_command_definition
command: _ @function.macro command: _ @function.macro
declaration: declaration: (curly_group_command_name
(curly_group_command_name (_) @function))
(_) @function))
(old_command_definition (old_command_definition
command: _ @function.macro command: _ @function.macro
@ -69,48 +66,40 @@
(environment_definition (environment_definition
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(theorem_definition (theorem_definition
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @label))
(_) @label))
(paired_delimiter_definition (paired_delimiter_definition
command: _ @function.macro command: _ @function.macro
declaration: declaration: (curly_group_command_name
(curly_group_command_name (_) @function))
(_) @function))
(label_definition (label_definition
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(label_reference_range (label_reference_range
command: _ @function.macro command: _ @function.macro
from: from: (curly_group_text
(curly_group_text (_) @markup.link)
(_) @markup.link) to: (curly_group_text
to: (_) @markup.link))
(curly_group_text
(_) @markup.link))
(label_reference (label_reference
command: _ @function.macro command: _ @function.macro
names: names: (curly_group_text_list
(curly_group_text_list (_) @markup.link))
(_) @markup.link))
(label_number (label_number
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link)
(_) @markup.link)
number: (_) @markup.link) number: (_) @markup.link)
(citation (citation
@ -119,52 +108,44 @@
(glossary_entry_definition (glossary_entry_definition
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(glossary_entry_reference (glossary_entry_reference
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(acronym_definition (acronym_definition
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(acronym_reference (acronym_reference
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(color_definition (color_definition
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
(color_reference (color_reference
command: _ @function.macro command: _ @function.macro
name: name: (curly_group_text
(curly_group_text (_) @markup.link))
(_) @markup.link))
; Formatting ; Formatting
(text_mode (text_mode
content: content: (curly_group
(curly_group (_) @none @spell))
(_) @none @spell))
(math_environment (math_environment
(begin (begin
command: _ @markup.math command: _ @markup.math
name: name: (curly_group_text
(curly_group_text (_) @markup.math)))
(_) @markup.math)))
(math_environment (math_environment
(_) @markup.math) (_) @markup.math)
@ -172,95 +153,76 @@
(math_environment (math_environment
(end (end
command: _ @markup.math command: _ @markup.math
name: name: (curly_group_text
(curly_group_text (_) @markup.math)))
(_) @markup.math)))
; Sectioning ; Sectioning
(title_declaration (title_declaration
command: _ @module command: _ @module
options: options: (brack_group
(brack_group (_) @markup.heading.1)?
(_) @markup.heading.1)? text: (curly_group
text: (_) @markup.heading.1))
(curly_group
(_) @markup.heading.1))
(author_declaration (author_declaration
command: _ @module command: _ @module
authors: authors: (curly_group_author_list
(curly_group_author_list (author)+ @markup.heading.1))
(author)+ @markup.heading.1))
(chapter (chapter
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.2)?
(_) @markup.heading.2)? text: (curly_group
text: (_) @markup.heading.2))
(curly_group
(_) @markup.heading.2))
(part (part
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.2)?
(_) @markup.heading.2)? text: (curly_group
text: (_) @markup.heading.2))
(curly_group
(_) @markup.heading.2))
(section (section
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.3)?
(_) @markup.heading.3)? text: (curly_group
text: (_) @markup.heading.3))
(curly_group
(_) @markup.heading.3))
(subsection (subsection
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.4)?
(_) @markup.heading.4)? text: (curly_group
text: (_) @markup.heading.4))
(curly_group
(_) @markup.heading.4))
(subsubsection (subsubsection
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.5)?
(_) @markup.heading.5)? text: (curly_group
text: (_) @markup.heading.5))
(curly_group
(_) @markup.heading.5))
(paragraph (paragraph
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.6)?
(_) @markup.heading.6)? text: (curly_group
text: (_) @markup.heading.6))
(curly_group
(_) @markup.heading.6))
(subparagraph (subparagraph
command: _ @module command: _ @module
toc: toc: (brack_group
(brack_group (_) @markup.heading.6)?
(_) @markup.heading.6)? text: (curly_group
text: (_) @markup.heading.6))
(curly_group
(_) @markup.heading.6))
; Beamer frames ; Beamer frames
(generic_environment (generic_environment
(begin (begin
name: name: (curly_group_text
(curly_group_text (text) @label)
(text) @label)
(#any-of? @label "frame")) (#any-of? @label "frame"))
. .
(curly_group (curly_group
@ -268,38 +230,33 @@
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
arg: arg: (curly_group
(curly_group (text) @markup.heading))
(text) @markup.heading))
(#eq? @_name "\\frametitle")) (#eq? @_name "\\frametitle"))
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
arg: arg: (curly_group
(curly_group (_) @markup.italic))
(_) @markup.italic))
(#eq? @_name "\\emph")) (#eq? @_name "\\emph"))
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
arg: arg: (curly_group
(curly_group (_) @markup.italic))
(_) @markup.italic))
(#any-of? @_name "\\textit" "\\mathit")) (#any-of? @_name "\\textit" "\\mathit"))
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
arg: arg: (curly_group
(curly_group (_) @markup.strong))
(_) @markup.strong))
(#any-of? @_name "\\textbf" "\\mathbf")) (#any-of? @_name "\\textbf" "\\mathbf"))
((generic_command ((generic_command
command: (command_name) @_name command: (command_name) @_name
. .
arg: arg: (curly_group
(curly_group (_) @markup.link.url))
(_) @markup.link.url))
(#any-of? @_name "\\url" "\\href")) (#any-of? @_name "\\url" "\\href"))
; File inclusion commands ; File inclusion commands

View file

@ -19,15 +19,13 @@
(minted_environment (minted_environment
(begin (begin
language: language: (curly_group_text
(curly_group_text (text) @injection.language))
(text) @injection.language))
(source_code) @injection.content) (source_code) @injection.content)
((generic_environment ((generic_environment
(begin (begin
name: name: (curly_group_text
(curly_group_text (text) @_env))) @injection.content
(text) @_env))) @injection.content
(#set! injection.language "c") (#set! injection.language "c")
(#any-of? @_env "asy" "asydef")) (#any-of? @_env "asy" "asydef"))

View file

@ -180,27 +180,24 @@
(vararg_expression) @variable.parameter.builtin (vararg_expression) @variable.parameter.builtin
(function_declaration (function_declaration
name: name: [
[ (identifier) @function
(identifier) @function (dot_index_expression
(dot_index_expression field: (identifier) @function)
field: (identifier) @function) ])
])
(function_declaration (function_declaration
name: name: (method_index_expression
(method_index_expression method: (identifier) @function.method))
method: (identifier) @function.method))
(assignment_statement (assignment_statement
(variable_list (variable_list
. .
name: name: [
[ (identifier) @function
(identifier) @function (dot_index_expression
(dot_index_expression field: (identifier) @function)
field: (identifier) @function) ])
])
(expression_list (expression_list
. .
value: (function_definition))) value: (function_definition)))
@ -211,14 +208,13 @@
value: (function_definition))) value: (function_definition)))
(function_call (function_call
name: name: [
[ (identifier) @function.call
(identifier) @function.call (dot_index_expression
(dot_index_expression field: (identifier) @function.call)
field: (identifier) @function.call) (method_index_expression
(method_index_expression method: (identifier) @function.method.call)
method: (identifier) @function.method.call) ])
])
(function_call (function_call
(identifier) @function.builtin (identifier) @function.builtin
@ -253,21 +249,19 @@
(dot_index_expression (dot_index_expression
field: (identifier) @_method field: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub")) (#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (string
(string content: (string_content) @string.regexp)))
content: (string_content) @string.regexp)))
;("123"):match("%d+") ;("123"):match("%d+")
(function_call (function_call
(method_index_expression (method_index_expression
method: (identifier) @_method method: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub")) (#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (string
(string content: (string_content) @string.regexp)))
content: (string_content) @string.regexp)))

View file

@ -1,49 +1,44 @@
((function_call ((function_call
name: name: [
[ (identifier) @_cdef_identifier
(identifier) @_cdef_identifier (_
(_ _
_ (identifier) @_cdef_identifier)
(identifier) @_cdef_identifier) ]
] arguments: (arguments
arguments: (string
(arguments content: _ @injection.content)))
(string
content: _ @injection.content)))
(#set! injection.language "c") (#set! injection.language "c")
(#eq? @_cdef_identifier "cdef")) (#eq? @_cdef_identifier "cdef"))
((function_call ((function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments (string
(string content: _ @injection.content)))
content: _ @injection.content)))
(#set! injection.language "vim") (#set! injection.language "vim")
(#any-of? @_vimcmd_identifier (#any-of? @_vimcmd_identifier
"vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2")) "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
((function_call ((function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments (string
(string content: _ @injection.content) .))
content: _ @injection.content) .))
(#set! injection.language "query") (#set! injection.language "query")
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse")) (#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
((function_call ((function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (string
(string content: _ @_method)
content: _ @_method) .
. (string
(string content: _ @injection.content)))
content: _ @injection.content)))
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify") (#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
(#eq? @_method "nvim_exec_lua") (#eq? @_method "nvim_exec_lua")
(#set! injection.language "lua")) (#set! injection.language "lua"))
@ -51,17 +46,15 @@
; vim.api.nvim_create_autocmd("FileType", { command = "injected here" }) ; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
(function_call (function_call
name: (_) @_vimcmd_identifier name: (_) @_vimcmd_identifier
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (table_constructor
(table_constructor (field
(field name: (identifier) @_command
name: (identifier) @_command value: (string
value: content: (_) @injection.content))) .)
(string
content: (_) @injection.content))) .)
; limit so only 2-argument functions gets matched before pred handle ; limit so only 2-argument functions gets matched before pred handle
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd") (#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
(#eq? @_command "command") (#eq? @_command "command")
@ -69,31 +62,29 @@
(function_call (function_call
name: (_) @_user_cmd name: (_) @_user_cmd
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (string
(string content: (_) @injection.content)
content: (_) @injection.content) .
. (_) .)
(_) .)
(#eq? @_user_cmd "vim.api.nvim_create_user_command") (#eq? @_user_cmd "vim.api.nvim_create_user_command")
(#set! injection.language "vim")) (#set! injection.language "vim"))
(function_call (function_call
name: (_) @_user_cmd name: (_) @_user_cmd
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (_)
(_) .
. (string
(string content: (_) @injection.content)
content: (_) @injection.content) .
. (_) .)
(_) .)
; Limiting predicate handling to only functions with 4 arguments ; Limiting predicate handling to only functions with 4 arguments
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command") (#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
(#set! injection.language "vim")) (#set! injection.language "vim"))
@ -141,48 +132,44 @@
(dot_index_expression (dot_index_expression
field: (identifier) @_method field: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub")) (#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (string
(string content: (string_content) @injection.content
content: (string_content) @injection.content (#set! injection.language "luap")
(#set! injection.language "luap") (#set! injection.include-children))))
(#set! injection.include-children))))
;("123"):match("%d+") ;("123"):match("%d+")
(function_call (function_call
(method_index_expression (method_index_expression
method: (identifier) @_method method: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub")) (#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (string
(string content: (string_content) @injection.content
content: (string_content) @injection.content (#set! injection.language "luap")
(#set! injection.language "luap") (#set! injection.include-children))))
(#set! injection.include-children))))
; string.format("pi = %.2f", 3.14159) ; string.format("pi = %.2f", 3.14159)
((function_call ((function_call
(dot_index_expression (dot_index_expression
field: (identifier) @_method) field: (identifier) @_method)
arguments: arguments: (arguments
(arguments .
. (string
(string (string_content) @injection.content)))
(string_content) @injection.content)))
(#eq? @_method "format") (#eq? @_method "format")
(#set! injection.language "printf")) (#set! injection.language "printf"))
; ("pi = %.2f"):format(3.14159) ; ("pi = %.2f"):format(3.14159)
((function_call ((function_call
(method_index_expression (method_index_expression
table: table: (_
(_ (string
(string (string_content) @injection.content))
(string_content) @injection.content))
method: (identifier) @_method)) method: (identifier) @_method))
(#eq? @_method "format") (#eq? @_method "format")
(#set! injection.language "printf")) (#set! injection.language "printf"))

View file

@ -27,19 +27,17 @@
(#set! definition.function.scope "parent")) (#set! definition.function.scope "parent"))
((function_declaration ((function_declaration
name: name: (dot_index_expression
(dot_index_expression .
. (_) @local.definition.associated
(_) @local.definition.associated (identifier) @local.definition.function))
(identifier) @local.definition.function))
(#set! definition.method.scope "parent")) (#set! definition.method.scope "parent"))
((function_declaration ((function_declaration
name: name: (method_index_expression
(method_index_expression .
. (_) @local.definition.associated
(_) @local.definition.associated (identifier) @local.definition.method))
(identifier) @local.definition.method))
(#set! definition.method.scope "parent")) (#set! definition.method.scope "parent"))
(for_generic_clause (for_generic_clause

View file

@ -199,14 +199,12 @@
name: (identifier) @function) name: (identifier) @function)
(function_call (function_call
name: name: (dot_index_expression
(dot_index_expression field: (identifier) @function.call))
field: (identifier) @function.call))
(function_declaration (function_declaration
name: name: (dot_index_expression
(dot_index_expression field: (identifier) @function))
field: (identifier) @function))
(method_index_expression (method_index_expression
method: (identifier) @function.method.call) method: (identifier) @function.method.call)
@ -256,13 +254,12 @@
] @punctuation.bracket ] @punctuation.bracket
(variable_list (variable_list
attribute: attribute: (attribute
(attribute ([
([ "<"
"<" ">"
">" ] @punctuation.bracket
] @punctuation.bracket (identifier) @attribute)))
(identifier) @attribute)))
(generic_type (generic_type
[ [
@ -290,21 +287,19 @@
(dot_index_expression (dot_index_expression
field: (identifier) @_method field: (identifier) @_method
(#any-of? @_method "find" "format" "match" "gmatch" "gsub")) (#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (string
(string content: _ @string.regexp)))
content: _ @string.regexp)))
; ("123"):match("%d+") ; ("123"):match("%d+")
(function_call (function_call
(method_index_expression (method_index_expression
method: (identifier) @_method method: (identifier) @_method
(#any-of? @_method "find" "format" "match" "gmatch" "gsub")) (#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (string
(string content: _ @string.regexp)))
content: _ @string.regexp)))

View file

@ -1,15 +1,13 @@
((function_call ((function_call
name: name: [
[ (identifier) @_cdef_identifier
(identifier) @_cdef_identifier (_
(_ _
_ (identifier) @_cdef_identifier)
(identifier) @_cdef_identifier) ]
] arguments: (arguments
arguments: (string
(arguments content: _ @injection.content)))
(string
content: _ @injection.content)))
(#eq? @_cdef_identifier "cdef") (#eq? @_cdef_identifier "cdef")
(#set! injection.language "c")) (#set! injection.language "c"))
@ -23,13 +21,12 @@
(dot_index_expression (dot_index_expression
field: (identifier) @_method field: (identifier) @_method
(#any-of? @_method "find" "format" "match" "gmatch" "gsub")) (#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (_)
(_) .
. (string
(string content: _ @injection.content))
content: _ @injection.content))
(#set! injection.language "luap")) (#set! injection.language "luap"))
; ("123"):match("%d+") ; ("123"):match("%d+")
@ -37,11 +34,10 @@
(method_index_expression (method_index_expression
method: (identifier) @_method method: (identifier) @_method
(#any-of? @_method "find" "format" "match" "gmatch" "gsub")) (#any-of? @_method "find" "format" "match" "gmatch" "gsub"))
arguments: arguments: (arguments
(arguments .
. (string
(string content: _ @injection.content))
content: _ @injection.content))
(#set! injection.language "luap")) (#set! injection.language "luap"))
((comment) @injection.content ((comment) @injection.content

View file

@ -30,19 +30,17 @@
(#set! definition.function.scope "parent")) (#set! definition.function.scope "parent"))
((function_declaration ((function_declaration
name: name: (dot_index_expression
(dot_index_expression .
. (_) @local.definition.associated
(_) @local.definition.associated (identifier) @local.definition.function))
(identifier) @local.definition.function))
(#set! definition.method.scope "parent")) (#set! definition.method.scope "parent"))
((function_declaration ((function_declaration
name: name: (method_index_expression
(method_index_expression .
. (_) @local.definition.associated
(_) @local.definition.associated (identifier) @local.definition.method))
(identifier) @local.definition.method))
(#set! definition.method.scope "parent")) (#set! definition.method.scope "parent"))
(for_generic_clause (for_generic_clause

View file

@ -20,8 +20,7 @@
name: (symbol) @local.definition.constant) name: (symbol) @local.definition.constant)
(external_reference (external_reference
symbols: symbols: (symbol_list
(symbol_list (symbol) @local.definition.import))
(symbol) @local.definition.import))
(symbol) @local.reference (symbol) @local.reference

View file

@ -48,9 +48,8 @@
"include" "include"
"-include" "-include"
] @keyword.import ] @keyword.import
filenames: filenames: (list
(list (word) @string.special.path))
(word) @string.special.path))
(variable_assignment (variable_assignment
name: (word) @string.special.symbol name: (word) @string.special.symbol

View file

@ -66,11 +66,9 @@
(builtin) @function.builtin (builtin) @function.builtin
(fun_expr (fun_expr
pats: pats: (pattern_fun
(pattern_fun (ident) @variable.parameter))
(ident) @variable.parameter))
(applicative (applicative
t1: t1: (applicative
(applicative (record_operand) @function))
(record_operand) @function))

View file

@ -35,20 +35,16 @@
; NOTE: has to be before literals and punctuation etc. ; NOTE: has to be before literals and punctuation etc.
; identifiers in "case" "of" branches have to be enums ; identifiers in "case" "of" branches have to be enums
(case (case
alternative: alternative: (of_branch
(of_branch values: (expression_list
values: (_) @constant)))
(expression_list
(_) @constant)))
; NOTE: has to be before literals and punctuation etc. ; NOTE: has to be before literals and punctuation etc.
; in variant objects with "case" "of" ; in variant objects with "case" "of"
(variant_declaration (variant_declaration
alternative: alternative: (of_branch
(of_branch values: (expression_list
values: (_) @constant)))
(expression_list
(_) @constant)))
; NOTE: has to be before literals and punctuation etc. ; NOTE: has to be before literals and punctuation etc.
; ============================================================================= ; =============================================================================
@ -154,9 +150,8 @@
(colon_expression (colon_expression
left: (identifier) @_emit_keyword left: (identifier) @_emit_keyword
(#eq? @_emit_keyword "emit") (#eq? @_emit_keyword "emit")
right: right: (_
(_ (string_content) @none))))
(string_content) @none))))
; ============================================================================= ; =============================================================================
; @string.escape ; escape sequences ; @string.escape ; escape sequences
@ -184,240 +179,215 @@
; ============================================================================= ; =============================================================================
; @function ; function definitions ; @function ; function definitions
(proc_declaration (proc_declaration
name: name: [
[ (identifier) @function
(identifier) @function (accent_quoted
(identifier) @function)
(exported_symbol
(identifier) @function)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function) (identifier) @function))
(exported_symbol ])
(identifier) @function)
(exported_symbol
(accent_quoted
(identifier) @function))
])
(func_declaration (func_declaration
name: name: [
[ (identifier) @function
(identifier) @function (accent_quoted
(identifier) @function)
(exported_symbol
(identifier) @function)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function) (identifier) @function))
(exported_symbol ])
(identifier) @function)
(exported_symbol
(accent_quoted
(identifier) @function))
])
(iterator_declaration (iterator_declaration
name: name: [
[ (identifier) @function
(identifier) @function (accent_quoted
(identifier) @function)
(exported_symbol
(identifier) @function)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function) (identifier) @function))
(exported_symbol ])
(identifier) @function)
(exported_symbol
(accent_quoted
(identifier) @function))
])
(converter_declaration (converter_declaration
name: name: [
[ (identifier) @function
(identifier) @function (accent_quoted
(identifier) @function)
(exported_symbol
(identifier) @function)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function) (identifier) @function))
(exported_symbol ])
(identifier) @function)
(exported_symbol
(accent_quoted
(identifier) @function))
])
; ============================================================================= ; =============================================================================
; @function.call ; function calls ; @function.call ; function calls
(call (call
function: function: [
[ (identifier) @function.call
(identifier) @function.call (accent_quoted
(accent_quoted (identifier) @function.call)
(identifier) @function.call) ; generic types
; generic types (bracket_expression
(bracket_expression left: (identifier) @function.call)
left: (identifier) @function.call) (bracket_expression
(bracket_expression left: (accent_quoted
left: (identifier) @function.call))
(accent_quoted ; dot accessor
(identifier) @function.call)) (dot_expression
; dot accessor right: (identifier) @function.call)
(dot_expression (dot_expression
right: (identifier) @function.call) right: (accent_quoted
(dot_expression (identifier) @function.call))
right: ; both
(accent_quoted (bracket_expression
(identifier) @function.call)) left: (dot_expression
; both right: (identifier) @function.call))
(bracket_expression (bracket_expression
left: left: (dot_expression
(dot_expression right: (accent_quoted
right: (identifier) @function.call)) (identifier) @function.call)))
(bracket_expression ])
left:
(dot_expression
right:
(accent_quoted
(identifier) @function.call)))
])
(dot_generic_call (dot_generic_call
function: function: [
[ (identifier) @function.call
(identifier) @function.call (accent_quoted
(accent_quoted (identifier) @function.call)
(identifier) @function.call) ])
])
; generalized_string is a function call ; generalized_string is a function call
; `identifier"string literal"` ; `identifier"string literal"`
; is short for ; is short for
; `identifier(r"string literal")` ; `identifier(r"string literal")`
(generalized_string (generalized_string
function: function: [
[ (identifier) @function.call
(identifier) @function.call (accent_quoted
(accent_quoted (identifier) @function.call)
(identifier) @function.call) ])
])
; call with leading literal ; call with leading literal
(dot_expression (dot_expression
left: left: [
[ (nil_literal)
(nil_literal) (integer_literal)
(integer_literal) (float_literal)
(float_literal) (custom_numeric_literal)
(custom_numeric_literal) (char_literal)
(char_literal) (interpreted_string_literal)
(interpreted_string_literal) (long_string_literal)
(long_string_literal) (raw_string_literal)
(raw_string_literal) (generalized_string)
(generalized_string) (array_construction)
; for sequences
(prefix_expression
operator: (operator) @_at
(array_construction) (array_construction)
; for sequences (#eq? @_at "@"))
(prefix_expression (tuple_construction)
operator: (operator) @_at (curly_construction)
(array_construction) ]
(#eq? @_at "@")) right: [
(tuple_construction) (identifier) @function.call
(curly_construction) (accent_quoted
] (identifier) @function.call)
right: ])
[
(identifier) @function.call
(accent_quoted
(identifier) @function.call)
])
; NOTE: will double capture as @function.call if it also has argument_list ; NOTE: will double capture as @function.call if it also has argument_list
; function.calls in `varargs[type, routine]` ; function.calls in `varargs[type, routine]`
(bracket_expression (bracket_expression
left: (identifier) @_varargs left: (identifier) @_varargs
right: right: (argument_list
(argument_list .
. (_)
(_) .
. [
[ (identifier) @function.call
(identifier) @function.call (accent_quoted
(accent_quoted (identifier) @function.call)
(identifier) @function.call) (dot_expression
(dot_expression right: (identifier) @function.call)
right: (identifier) @function.call) (dot_expression
(dot_expression right: (accent_quoted
right: (identifier) @function.call))
(accent_quoted ])
(identifier) @function.call))
])
(#eq? @_varargs "varargs")) (#eq? @_varargs "varargs"))
; ============================================================================= ; =============================================================================
; @function.macro ; preprocessor macros ; @function.macro ; preprocessor macros
(template_declaration (template_declaration
name: name: [
[ (identifier) @function.macro
(identifier) @function.macro (accent_quoted
(identifier) @function.macro)
(exported_symbol
(identifier) @function.macro)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function.macro) (identifier) @function.macro))
(exported_symbol ])
(identifier) @function.macro)
(exported_symbol
(accent_quoted
(identifier) @function.macro))
])
(macro_declaration (macro_declaration
name: name: [
[ (identifier) @function.macro
(identifier) @function.macro (accent_quoted
(identifier) @function.macro)
(exported_symbol
(identifier) @function.macro)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function.macro) (identifier) @function.macro))
(exported_symbol ])
(identifier) @function.macro)
(exported_symbol
(accent_quoted
(identifier) @function.macro))
])
; ============================================================================= ; =============================================================================
; @function.method ; method definitions ; @function.method ; method definitions
(method_declaration (method_declaration
name: name: [
[ (identifier) @function.method
(identifier) @function.method (accent_quoted
(identifier) @function.method)
(exported_symbol
(identifier) @function.method)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @function.method) (identifier) @function.method))
(exported_symbol ])
(identifier) @function.method)
(exported_symbol
(accent_quoted
(identifier) @function.method))
])
; ============================================================================= ; =============================================================================
; @constructor ; constructor calls and definitions ; @constructor ; constructor calls and definitions
(call (call
function: function: [
[ (identifier) @constructor
(identifier) @constructor (accent_quoted
(accent_quoted (identifier) @constructor)
(identifier) @constructor) ; generic types
; generic types (bracket_expression
(bracket_expression left: (identifier) @constructor)
left: (identifier) @constructor) (bracket_expression
(bracket_expression left: (accent_quoted
left: (identifier) @constructor))
(accent_quoted ; dot accessor
(identifier) @constructor)) (dot_expression
; dot accessor right: (identifier) @constructor)
(dot_expression (dot_expression
right: (identifier) @constructor) right: (accent_quoted
(dot_expression (identifier) @constructor))
right: ; both
(accent_quoted (bracket_expression
(identifier) @constructor)) left: (dot_expression
; both right: (identifier) @constructor))
(bracket_expression (bracket_expression
left: left: (dot_expression
(dot_expression right: (accent_quoted
right: (identifier) @constructor)) (identifier) @constructor)))
(bracket_expression ]
left:
(dot_expression
right:
(accent_quoted
(identifier) @constructor)))
]
(argument_list (argument_list
(colon_expression)+)) (colon_expression)+))
@ -520,12 +490,11 @@
; ============================================================================= ; =============================================================================
; @label ; GOTO and other labels (e.g. `label:` in C) ; @label ; GOTO and other labels (e.g. `label:` in C)
(block (block
label: label: [
[ (identifier) @label
(identifier) @label (accent_quoted
(accent_quoted (identifier) @label)
(identifier) @label) ])
])
; ============================================================================= ; =============================================================================
; @keyword.import ; keywords for including modules (e.g. `import` / `from` in Python) ; @keyword.import ; keywords for including modules (e.g. `import` / `from` in Python)
@ -554,9 +523,8 @@
; @type ; type or class definitions and annotations ; @type ; type or class definitions and annotations
; generic types when calling ; generic types when calling
(call (call
function: function: (bracket_expression
(bracket_expression right: (argument_list) @type))
right: (argument_list) @type))
; NOTE: this also falsely matches ; NOTE: this also falsely matches
; when accessing and directly call elements from an array of routines ; when accessing and directly call elements from an array of routines
@ -567,11 +535,10 @@
; right side of `is` operator is always type ; right side of `is` operator is always type
(infix_expression (infix_expression
operator: operator: [
[ "is"
"is" "isnot"
"isnot" ]
]
right: (_) @type) right: (_) @type)
; except branch always contains types of errors ; except branch always contains types of errors
@ -582,16 +549,14 @@
; overrule special case in (except_branch) with "as" operator ; overrule special case in (except_branch) with "as" operator
; `except module.exception[gen_type] as variable:` ; `except module.exception[gen_type] as variable:`
(except_branch (except_branch
values: values: (expression_list
(expression_list (infix_expression
(infix_expression operator: "as"
operator: "as" right: [
right: (identifier) @variable
[ (accent_quoted
(identifier) @variable (identifier) @variable)
(accent_quoted ])))
(identifier) @variable)
])))
; for inline tuple types ; for inline tuple types
; `type a = tuple[a: int]` ; `type a = tuple[a: int]`
@ -608,24 +573,22 @@
; call(parameter_name=arg) ; call(parameter_name=arg)
(argument_list (argument_list
(equal_expression (equal_expression
left: left: [
[ (identifier) @variable.parameter
(identifier) @variable.parameter (accent_quoted
(accent_quoted (identifier) @variable.parameter)
(identifier) @variable.parameter) ]))
]))
; parameters in function declaration ; parameters in function declaration
(parameter_declaration_list (parameter_declaration_list
(parameter_declaration (parameter_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @variable.parameter
(identifier) @variable.parameter (accent_quoted
(accent_quoted (identifier) @variable.parameter)
(identifier) @variable.parameter) ]))))
]))))
; NOTE: needs to be after @type ; NOTE: needs to be after @type
; generic types when declaring ; generic types when declaring
@ -633,43 +596,38 @@
(parameter_declaration (parameter_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @variable.parameter
(identifier) @variable.parameter (accent_quoted
(accent_quoted (identifier) @variable.parameter)
(identifier) @variable.parameter) ]))))
]))))
; for loop variables ; for loop variables
(for (for
left: left: (symbol_declaration_list
(symbol_declaration_list (symbol_declaration
(symbol_declaration name: [
name: (identifier) @variable.parameter
[ (accent_quoted
(identifier) @variable.parameter (identifier) @variable.parameter)
(accent_quoted ])))
(identifier) @variable.parameter)
])))
((tuple_deconstruct_declaration ((tuple_deconstruct_declaration
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @variable.parameter
(identifier) @variable.parameter (accent_quoted
(accent_quoted (identifier) @variable.parameter)
(identifier) @variable.parameter) ])) @_tuple_decons
])) @_tuple_decons
(#has-ancestor? @_tuple_decons for)) (#has-ancestor? @_tuple_decons for))
(concept_declaration (concept_declaration
parameters: parameters: (parameter_list
(parameter_list [
[ (identifier) @variable.parameter
(identifier) @variable.parameter (accent_quoted
(accent_quoted (identifier) @variable.parameter)
(identifier) @variable.parameter) ]))
]))
(var_parameter (var_parameter
[ [
@ -711,17 +669,16 @@
(type_section (type_section
(type_declaration (type_declaration
(type_symbol_declaration (type_symbol_declaration
name: name: [
[ (identifier) @type.definition
(identifier) @type.definition (accent_quoted
(identifier) @type.definition)
(exported_symbol
(identifier) @type.definition)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @type.definition) (identifier) @type.definition))
(exported_symbol ])))
(identifier) @type.definition)
(exported_symbol
(accent_quoted
(identifier) @type.definition))
])))
; ============================================================================= ; =============================================================================
; @keyword.modifier ; type qualifier keywords (e.g. `const`) ; @keyword.modifier ; type qualifier keywords (e.g. `const`)
@ -761,8 +718,41 @@
(field_declaration (field_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @variable.member
(accent_quoted
(identifier) @variable.member)
(exported_symbol
(identifier) @variable.member)
(exported_symbol
(accent_quoted
(identifier) @variable.member))
])))
; fields in object construction
(call
(argument_list
(colon_expression
left: [
(identifier) @variable.member
(accent_quoted
(identifier) @variable.member)
])))
; fields in tuple construction
(tuple_construction
(colon_expression
left: [
(identifier) @variable.member
(accent_quoted
(identifier) @variable.member)
]))
(variant_declaration
(variant_discriminator_declaration
(symbol_declaration_list
(symbol_declaration
name: [
(identifier) @variable.member (identifier) @variable.member
(accent_quoted (accent_quoted
(identifier) @variable.member) (identifier) @variable.member)
@ -771,44 +761,7 @@
(exported_symbol (exported_symbol
(accent_quoted (accent_quoted
(identifier) @variable.member)) (identifier) @variable.member))
]))) ]))))
; fields in object construction
(call
(argument_list
(colon_expression
left:
[
(identifier) @variable.member
(accent_quoted
(identifier) @variable.member)
])))
; fields in tuple construction
(tuple_construction
(colon_expression
left:
[
(identifier) @variable.member
(accent_quoted
(identifier) @variable.member)
]))
(variant_declaration
(variant_discriminator_declaration
(symbol_declaration_list
(symbol_declaration
name:
[
(identifier) @variable.member
(accent_quoted
(identifier) @variable.member)
(exported_symbol
(identifier) @variable.member)
(exported_symbol
(accent_quoted
(identifier) @variable.member))
]))))
; ============================================================================= ; =============================================================================
; @variable.builtin ; built-in variable names (e.g. `this`) ; @variable.builtin ; built-in variable names (e.g. `this`)
@ -824,84 +777,75 @@
; enum declaration ; enum declaration
(enum_field_declaration (enum_field_declaration
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @constant
(identifier) @constant (accent_quoted
(accent_quoted (identifier) @constant)
(identifier) @constant) ]))
]))
; constant declaration ; constant declaration
(const_section (const_section
(variable_declaration (variable_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @constant
(identifier) @constant (accent_quoted
(identifier) @constant)
(exported_symbol
(identifier) @constant)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @constant) (identifier) @constant))
(exported_symbol ]))))
(identifier) @constant)
(exported_symbol
(accent_quoted
(identifier) @constant))
]))))
((tuple_deconstruct_declaration ((tuple_deconstruct_declaration
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @constant
(identifier) @constant (accent_quoted
(identifier) @constant)
(exported_symbol
(identifier) @constant)
(exported_symbol
(accent_quoted (accent_quoted
(identifier) @constant) (identifier) @constant))
(exported_symbol ])) @_tuple_decons
(identifier) @constant)
(exported_symbol
(accent_quoted
(identifier) @constant))
])) @_tuple_decons
(#has-ancestor? @_tuple_decons const_section)) (#has-ancestor? @_tuple_decons const_section))
; constants x and y in `array[x..y, type]` ; constants x and y in `array[x..y, type]`
(bracket_expression (bracket_expression
left: (identifier) @_array left: (identifier) @_array
right: right: (argument_list
(argument_list .
. (infix_expression
(infix_expression right: [
right: (identifier) @constant
[ (accent_quoted
(identifier) @constant (identifier) @constant)
(accent_quoted (dot_expression
(identifier) @constant) right: (identifier) @constant)
(dot_expression (dot_expression
right: (identifier) @constant) right: (accent_quoted
(dot_expression (identifier) @constant))
right: ]))
(accent_quoted
(identifier) @constant))
]))
(#any-of? @_array "array" "range")) (#any-of? @_array "array" "range"))
(bracket_expression (bracket_expression
left: (identifier) @_array left: (identifier) @_array
right: right: (argument_list
(argument_list .
. (infix_expression
(infix_expression left: [
left: (identifier) @constant
[ (accent_quoted
(identifier) @constant (identifier) @constant)
(accent_quoted (dot_expression
(identifier) @constant) right: (identifier) @constant)
(dot_expression (dot_expression
right: (identifier) @constant) right: (accent_quoted
(dot_expression (identifier) @constant))
right: ]))
(accent_quoted
(identifier) @constant))
]))
(#any-of? @_array "array" "range")) (#any-of? @_array "array" "range"))
; NOTE: can only do this for (infix_expression)s, since standalone identifiers ; NOTE: can only do this for (infix_expression)s, since standalone identifiers
@ -926,19 +870,17 @@
(expression_list (expression_list
(infix_expression (infix_expression
operator: (operator) @_operator operator: (operator) @_operator
right: right: [
[ (identifier) @module
(identifier) @module (array_construction
(array_construction (identifier) @module)
(identifier) @module) ]))
]))
(#eq? @_operator "/")) (#eq? @_operator "/"))
(import_from_statement (import_from_statement
module: module: (infix_expression
(infix_expression operator: (operator) @_operator
operator: (operator) @_operator right: (identifier) @module)
right: (identifier) @module)
(#eq? @_operator "/")) (#eq? @_operator "/"))
(export_statement (export_statement
@ -949,12 +891,11 @@
; overrule things ; overrule things
; left identifier in dot_expression ; left identifier in dot_expression
(dot_expression (dot_expression
left: left: [
[ (identifier) @none
(identifier) @none (accent_quoted
(accent_quoted (identifier) @none)
(identifier) @none) ])
])
; NOTE: we can't know what the left identifier is, so better leave it alone ; NOTE: we can't know what the left identifier is, so better leave it alone
; for consistency ; for consistency

View file

@ -52,9 +52,8 @@
(colon_expression (colon_expression
left: (identifier) @_emit_keyword left: (identifier) @_emit_keyword
(#eq? @_emit_keyword "emit") (#eq? @_emit_keyword "emit")
right: right: (_
(_ (string_content) @injection.content)))))
(string_content) @injection.content)))))
; ============================================================================= ; =============================================================================
; asm statement ; asm statement

View file

@ -1,11 +1,10 @@
; ============================================================================== ; ==============================================================================
; @local.definition ; various definitions ; @local.definition ; various definitions
(block (block
label: label: [
[ (identifier) @local.definition
(identifier) @local.definition (accent_quoted) @local.definition
(accent_quoted) @local.definition ])
])
; ============================================================================== ; ==============================================================================
; @local.definition.constant ; constants ; @local.definition.constant ; constants
@ -13,79 +12,73 @@
(variable_declaration (variable_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.constant
(identifier) @local.definition.constant (accent_quoted) @local.definition.constant
(accent_quoted) @local.definition.constant (exported_symbol
(exported_symbol (identifier) @local.definition.constant)
(identifier) @local.definition.constant) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.constant)
(accent_quoted) @local.definition.constant) ]))
]))
type: (type_expression)? @local.definition.associated)) type: (type_expression)? @local.definition.associated))
; ============================================================================== ; ==============================================================================
; @local.definition.function ; functions ; @local.definition.function ; functions
(proc_declaration (proc_declaration
name: name: [
[ (identifier) @local.definition.function
(identifier) @local.definition.function (accent_quoted) @local.definition.function
(accent_quoted) @local.definition.function (exported_symbol
(exported_symbol (identifier) @local.definition.function)
(identifier) @local.definition.function) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.function)
(accent_quoted) @local.definition.function) ]
]
(#set! "definition.function.scope" "parent")) (#set! "definition.function.scope" "parent"))
(func_declaration (func_declaration
name: name: [
[ (identifier) @local.definition.function
(identifier) @local.definition.function (accent_quoted) @local.definition.function
(accent_quoted) @local.definition.function (exported_symbol
(exported_symbol (identifier) @local.definition.function)
(identifier) @local.definition.function) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.function)
(accent_quoted) @local.definition.function) ]
]
(#set! "definition.function.scope" "parent")) (#set! "definition.function.scope" "parent"))
(iterator_declaration (iterator_declaration
name: name: [
[ (identifier) @local.definition.function
(identifier) @local.definition.function (accent_quoted) @local.definition.function
(accent_quoted) @local.definition.function (exported_symbol
(exported_symbol (identifier) @local.definition.function)
(identifier) @local.definition.function) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.function)
(accent_quoted) @local.definition.function) ]
]
(#set! "definition.function.scope" "parent")) (#set! "definition.function.scope" "parent"))
(converter_declaration (converter_declaration
name: name: [
[ (identifier) @local.definition.function
(identifier) @local.definition.function (accent_quoted) @local.definition.function
(accent_quoted) @local.definition.function (exported_symbol
(exported_symbol (identifier) @local.definition.function)
(identifier) @local.definition.function) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.function)
(accent_quoted) @local.definition.function) ]
]
(#set! "definition.function.scope" "parent")) (#set! "definition.function.scope" "parent"))
; ============================================================================== ; ==============================================================================
; @local.definition.method ; methods ; @local.definition.method ; methods
(method_declaration (method_declaration
name: name: [
[ (identifier) @local.definition.method
(identifier) @local.definition.method (accent_quoted) @local.definition.method
(accent_quoted) @local.definition.method (exported_symbol
(exported_symbol (identifier) @local.definition.method)
(identifier) @local.definition.method) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.method)
(accent_quoted) @local.definition.method) ]
]
(#set! "definition.method.scope" "parent")) (#set! "definition.method.scope" "parent"))
; ============================================================================== ; ==============================================================================
@ -94,72 +87,65 @@
(variable_declaration (variable_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.var
(identifier) @local.definition.var (accent_quoted) @local.definition.var
(accent_quoted) @local.definition.var (exported_symbol
(exported_symbol (identifier) @local.definition.var)
(identifier) @local.definition.var) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.var)
(accent_quoted) @local.definition.var) ]))
]))
type: (type_expression)? @local.definition.associated)) type: (type_expression)? @local.definition.associated))
(let_section (let_section
(variable_declaration (variable_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.var
(identifier) @local.definition.var (accent_quoted) @local.definition.var
(accent_quoted) @local.definition.var (exported_symbol
(exported_symbol (identifier) @local.definition.var)
(identifier) @local.definition.var) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.var)
(accent_quoted) @local.definition.var) ]))
]))
type: (type_expression)? @local.definition.associated)) type: (type_expression)? @local.definition.associated))
(for (for
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.var
(identifier) @local.definition.var (accent_quoted) @local.definition.var
(accent_quoted) @local.definition.var ])))
])))
(try (try
(except_branch (except_branch
values: values: (expression_list
(expression_list (infix_expression
(infix_expression right: [
right: (identifier) @local.definition.var
[ (accent_quoted) @local.definition.var
(identifier) @local.definition.var ]))))
(accent_quoted) @local.definition.var
]))))
; ============================================================================== ; ==============================================================================
; @local.definition.parameter ; parameters ; @local.definition.parameter ; parameters
(parameter_declaration (parameter_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.parameter
(identifier) @local.definition.parameter (accent_quoted) @local.definition.parameter
(accent_quoted) @local.definition.parameter ]))
]))
type: (type_expression)? @local.definition.associated) type: (type_expression)? @local.definition.associated)
(concept_declaration (concept_declaration
parameters: parameters: (parameter_list
(parameter_list [
[ (identifier) @local.definition.parameter
(identifier) @local.definition.parameter (accent_quoted
(accent_quoted (identifier) @local.definition.parameter)
(identifier) @local.definition.parameter) ]))
]))
(var_parameter (var_parameter
[ [
@ -199,42 +185,39 @@
; ============================================================================== ; ==============================================================================
; @local.definition.macro ; preprocessor macros ; @local.definition.macro ; preprocessor macros
(template_declaration (template_declaration
name: name: [
[ (identifier) @local.definition.macro
(identifier) @local.definition.macro (accent_quoted) @local.definition.macro
(accent_quoted) @local.definition.macro (exported_symbol
(exported_symbol (identifier) @local.definition.macro)
(identifier) @local.definition.macro) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.macro)
(accent_quoted) @local.definition.macro) ]
]
(#set! "definition.macro.scope" "parent")) (#set! "definition.macro.scope" "parent"))
(macro_declaration (macro_declaration
name: name: [
[ (identifier) @local.definition.macro
(identifier) @local.definition.macro (accent_quoted) @local.definition.macro
(accent_quoted) @local.definition.macro (exported_symbol
(exported_symbol (identifier) @local.definition.macro)
(identifier) @local.definition.macro) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.macro)
(accent_quoted) @local.definition.macro) ]
]
(#set! "definition.macro.scope" "parent")) (#set! "definition.macro.scope" "parent"))
; ============================================================================== ; ==============================================================================
; @local.definition.type ; types or classes ; @local.definition.type ; types or classes
(type_declaration (type_declaration
(type_symbol_declaration (type_symbol_declaration
name: name: [
[ (identifier) @local.definition.type
(identifier) @local.definition.type (accent_quoted) @local.definition.type
(accent_quoted) @local.definition.type (exported_symbol
(exported_symbol (identifier) @local.definition.type)
(identifier) @local.definition.type) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.type)
(accent_quoted) @local.definition.type) ]))
]))
; ============================================================================== ; ==============================================================================
; @local.definition.field ; fields or properties ; @local.definition.field ; fields or properties
@ -246,15 +229,14 @@
(field_declaration (field_declaration
(symbol_declaration_list (symbol_declaration_list
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.field
(identifier) @local.definition.field (accent_quoted) @local.definition.field
(accent_quoted) @local.definition.field (exported_symbol
(exported_symbol (identifier) @local.definition.field)
(identifier) @local.definition.field) (exported_symbol
(exported_symbol (accent_quoted) @local.definition.field)
(accent_quoted) @local.definition.field) ]))
]))
type: (type_expression)? @local.definition.associated) type: (type_expression)? @local.definition.associated)
; ============================================================================== ; ==============================================================================
@ -262,11 +244,10 @@
(enum_declaration (enum_declaration
(enum_field_declaration (enum_field_declaration
(symbol_declaration (symbol_declaration
name: name: [
[ (identifier) @local.definition.enum
(identifier) @local.definition.enum (accent_quoted) @local.definition.enum
(accent_quoted) @local.definition.enum ])))
])))
; ============================================================================== ; ==============================================================================
; @local.definition.namespace ; modules or namespaces ; @local.definition.namespace ; modules or namespaces
@ -285,19 +266,17 @@
(expression_list (expression_list
(infix_expression (infix_expression
operator: (operator) @_operator operator: (operator) @_operator
right: right: [
[ (identifier) @local.definition.namespace
(identifier) @local.definition.namespace (array_construction
(array_construction (identifier) @local.definition.namespace)
(identifier) @local.definition.namespace) ]))
]))
(#eq? @_operator "/")) (#eq? @_operator "/"))
(import_from_statement (import_from_statement
module: module: (infix_expression
(infix_expression operator: (operator) @_operator
operator: (operator) @_operator right: (identifier) @local.definition.namespace)
right: (identifier) @local.definition.namespace)
(expression_list (expression_list
[ [
(identifier) @local.definition.import (identifier) @local.definition.import

View file

@ -16,6 +16,5 @@
type: (type)? @type) type: (type)? @type)
(matching_curlies (matching_curlies
nim_expression: nim_expression: (nim_expression
(nim_expression escaped_curly: (escaped_curly)+ @string.escape) @none)
escaped_curly: (escaped_curly)+ @string.escape) @none)

View file

@ -65,9 +65,8 @@
; ------------------ ; ------------------
(manifest (manifest
(let (let
name: name: ((identifier) @constant.builtin
((identifier) @constant.builtin (#any-of? @constant.builtin "builddir" "ninja_required_version"))))
(#any-of? @constant.builtin "builddir" "ninja_required_version"))))
; Rules bindings ; Rules bindings
; ----------------- ; -----------------

View file

@ -84,9 +84,8 @@
; function calls ; function calls
(apply_expression (apply_expression
function: function: (variable_expression
(variable_expression name: (identifier) @function.call))
name: (identifier) @function.call))
; basic identifiers ; basic identifiers
(variable_expression) @variable (variable_expression) @variable
@ -101,12 +100,10 @@
; builtin functions (with builtins prefix) ; builtin functions (with builtins prefix)
(select_expression (select_expression
expression: expression: (variable_expression
(variable_expression name: (identifier) @_id)
name: (identifier) @_id) attrpath: (attrpath
attrpath: attr: (identifier) @function.builtin)
(attrpath
attr: (identifier) @function.builtin)
(#eq? @_id "builtins")) (#eq? @_id "builtins"))
; builtin functions (without builtins prefix) ; builtin functions (without builtins prefix)
@ -158,9 +155,8 @@
(select_expression (select_expression
expression: (_) @_expr expression: (_) @_expr
attrpath: attrpath: (attrpath
(attrpath attr: (identifier) @variable.member)
attr: (identifier) @variable.member)
(#not-eq? @_expr "builtins")) (#not-eq? @_expr "builtins"))
(attrset_expression (attrset_expression
@ -179,9 +175,8 @@
; function definition ; function definition
(binding (binding
attrpath: attrpath: (attrpath
(attrpath attr: (identifier) @function)
attr: (identifier) @function)
expression: (function_expression)) expression: (function_expression))
; unary operators ; unary operators

View file

@ -14,193 +14,165 @@
(apply_expression (apply_expression
function: (_) @_func function: (_) @_func
argument: argument: [
[ (string_expression
(string_expression ((string_fragment) @injection.content
((string_fragment) @injection.content (#set! injection.language "regex")))
(#set! injection.language "regex"))) (indented_string_expression
(indented_string_expression ((string_fragment) @injection.content
((string_fragment) @injection.content (#set! injection.language "regex")))
(#set! injection.language "regex"))) ]
]
(#match? @_func "(^|\\.)match$") (#match? @_func "(^|\\.)match$")
(#set! injection.combined)) (#set! injection.combined))
(binding (binding
attrpath: attrpath: (attrpath
(attrpath (identifier) @_path)
(identifier) @_path) expression: [
expression: (string_expression
[ ((string_fragment) @injection.content
(string_expression (#set! injection.language "bash")))
((string_fragment) @injection.content (indented_string_expression
(#set! injection.language "bash"))) ((string_fragment) @injection.content
(indented_string_expression (#set! injection.language "bash")))
((string_fragment) @injection.content ]
(#set! injection.language "bash")))
]
(#match? @_path "(^\\w+(Phase|Hook|Check)|(pre|post)[A-Z]\\w+|script)$")) (#match? @_path "(^\\w+(Phase|Hook|Check)|(pre|post)[A-Z]\\w+|script)$"))
(apply_expression (apply_expression
function: (_) @_func function: (_) @_func
argument: argument: (_
(_)*
(_ (_
(_)* (_)*
(_ (binding
(_)* attrpath: (attrpath
(binding (identifier) @_path)
attrpath: expression: [
(attrpath (string_expression
(identifier) @_path) ((string_fragment) @injection.content
expression: (#set! injection.language "bash")))
[ (indented_string_expression
(string_expression ((string_fragment) @injection.content
((string_fragment) @injection.content (#set! injection.language "bash")))
(#set! injection.language "bash"))) ])))
(indented_string_expression
((string_fragment) @injection.content
(#set! injection.language "bash")))
])))
(#match? @_func "(^|\\.)writeShellApplication$") (#match? @_func "(^|\\.)writeShellApplication$")
(#match? @_path "^text$") (#match? @_path "^text$")
(#set! injection.combined)) (#set! injection.combined))
(apply_expression (apply_expression
function: function: (apply_expression
(apply_expression function: (apply_expression
function: function: (_) @_func))
(apply_expression argument: [
function: (_) @_func)) (string_expression
argument: ((string_fragment) @injection.content
[ (#set! injection.language "bash")))
(string_expression (indented_string_expression
((string_fragment) @injection.content ((string_fragment) @injection.content
(#set! injection.language "bash"))) (#set! injection.language "bash")))
(indented_string_expression ]
((string_fragment) @injection.content
(#set! injection.language "bash")))
]
(#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$") (#match? @_func "(^|\\.)runCommand((No)?CC)?(Local)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (_) @_func)
function: (_) @_func) argument: [
argument: (string_expression
[ ((string_fragment) @injection.content
(string_expression (#set! injection.language "bash")))
((string_fragment) @injection.content (indented_string_expression
(#set! injection.language "bash"))) ((string_fragment) @injection.content
(indented_string_expression (#set! injection.language "bash")))
((string_fragment) @injection.content ])
(#set! injection.language "bash")))
])
(#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$") (#match? @_func "(^|\\.)write(Bash|Dash|ShellScript)(Bin)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (_) @_func)
function: (_) @_func) argument: [
argument: (string_expression
[ ((string_fragment) @injection.content
(string_expression (#set! injection.language "fish")))
((string_fragment) @injection.content (indented_string_expression
(#set! injection.language "fish"))) ((string_fragment) @injection.content
(indented_string_expression (#set! injection.language "fish")))
((string_fragment) @injection.content ])
(#set! injection.language "fish")))
])
(#match? @_func "(^|\\.)writeFish(Bin)?$") (#match? @_func "(^|\\.)writeFish(Bin)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (apply_expression
function: function: (_) @_func))
(apply_expression argument: [
function: (_) @_func)) (string_expression
argument: ((string_fragment) @injection.content
[ (#set! injection.language "haskell")))
(string_expression (indented_string_expression
((string_fragment) @injection.content ((string_fragment) @injection.content
(#set! injection.language "haskell"))) (#set! injection.language "haskell")))
(indented_string_expression ])
((string_fragment) @injection.content
(#set! injection.language "haskell")))
])
(#match? @_func "(^|\\.)writeHaskell(Bin)?$") (#match? @_func "(^|\\.)writeHaskell(Bin)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (apply_expression
function: function: (_) @_func))
(apply_expression argument: [
function: (_) @_func)) (string_expression
argument: ((string_fragment) @injection.content
[ (#set! injection.language "javascript")))
(string_expression (indented_string_expression
((string_fragment) @injection.content ((string_fragment) @injection.content
(#set! injection.language "javascript"))) (#set! injection.language "javascript")))
(indented_string_expression ])
((string_fragment) @injection.content
(#set! injection.language "javascript")))
])
(#match? @_func "(^|\\.)writeJS(Bin)?$") (#match? @_func "(^|\\.)writeJS(Bin)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (apply_expression
function: function: (_) @_func))
(apply_expression argument: [
function: (_) @_func)) (string_expression
argument: ((string_fragment) @injection.content
[ (#set! injection.language "perl")))
(string_expression (indented_string_expression
((string_fragment) @injection.content ((string_fragment) @injection.content
(#set! injection.language "perl"))) (#set! injection.language "perl")))
(indented_string_expression ])
((string_fragment) @injection.content
(#set! injection.language "perl")))
])
(#match? @_func "(^|\\.)writePerl(Bin)?$") (#match? @_func "(^|\\.)writePerl(Bin)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (apply_expression
function: function: (_) @_func))
(apply_expression argument: [
function: (_) @_func)) (string_expression
argument: ((string_fragment) @injection.content
[ (#set! injection.language "python")))
(string_expression (indented_string_expression
((string_fragment) @injection.content ((string_fragment) @injection.content
(#set! injection.language "python"))) (#set! injection.language "python")))
(indented_string_expression ])
((string_fragment) @injection.content
(#set! injection.language "python")))
])
(#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$") (#match? @_func "(^|\\.)write(PyPy|Python)[23](Bin)?$")
(#set! injection.combined)) (#set! injection.combined))
((apply_expression ((apply_expression
function: function: (apply_expression
(apply_expression function: (apply_expression
function: function: (_) @_func))
(apply_expression argument: [
function: (_) @_func)) (string_expression
argument: ((string_fragment) @injection.content
[ (#set! injection.language "rust")))
(string_expression (indented_string_expression
((string_fragment) @injection.content ((string_fragment) @injection.content
(#set! injection.language "rust"))) (#set! injection.language "rust")))
(indented_string_expression ])
((string_fragment) @injection.content
(#set! injection.language "rust")))
])
(#match? @_func "(^|\\.)writeRust(Bin)?$") (#match? @_func "(^|\\.)writeRust(Bin)?$")
(#set! injection.combined)) (#set! injection.combined))

View file

@ -244,12 +244,10 @@
declarator: (identifier) @variable.parameter) declarator: (identifier) @variable.parameter)
(parameter_declaration (parameter_declaration
declarator: declarator: (function_declarator
(function_declarator declarator: (parenthesized_declarator
declarator: (block_pointer_declarator
(parenthesized_declarator declarator: (identifier) @variable.parameter))))
(block_pointer_declarator
declarator: (identifier) @variable.parameter))))
"..." @variable.parameter.builtin "..." @variable.parameter.builtin

View file

@ -40,11 +40,10 @@
(let_binding (let_binding
pattern: (value_name) @function pattern: (value_name) @function
body: body: [
[ (fun_expression)
(fun_expression) (function_expression)
(function_expression) ])
])
(value_specification (value_specification
(value_name) @function) (value_name) @function)
@ -57,23 +56,20 @@
; Application ; Application
;------------ ;------------
(infix_expression (infix_expression
left: left: (value_path
(value_path (value_name) @function.call)
(value_name) @function.call)
operator: (concat_operator) @_operator operator: (concat_operator) @_operator
(#eq? @_operator "@@")) (#eq? @_operator "@@"))
(infix_expression (infix_expression
operator: (rel_operator) @_operator operator: (rel_operator) @_operator
right: right: (value_path
(value_path (value_name) @function.call)
(value_name) @function.call)
(#eq? @_operator "|>")) (#eq? @_operator "|>"))
(application_expression (application_expression
function: function: (value_path
(value_path (value_name) @function.call))
(value_name) @function.call))
((value_name) @function.builtin ((value_name) @function.builtin
(#any-of? @function.builtin "raise" "raise_notrace" "failwith" "invalid_arg")) (#any-of? @function.builtin "raise" "raise_notrace" "failwith" "invalid_arg"))

View file

@ -28,16 +28,14 @@
(#set! definition.var.scope "parent")) (#set! definition.var.scope "parent"))
(let_binding (let_binding
pattern: pattern: (tuple_pattern
(tuple_pattern (value_name) @local.definition.var)
(value_name) @local.definition.var)
(#set! definition.var.scope "parent")) (#set! definition.var.scope "parent"))
(let_binding (let_binding
pattern: pattern: (record_pattern
(record_pattern (field_pattern
(field_pattern (value_name) @local.definition.var))
(value_name) @local.definition.var))
(#set! definition.var.scope "parent")) (#set! definition.var.scope "parent"))
(external (external

View file

@ -291,9 +291,8 @@
name: (identifier) @type) name: (identifier) @type)
(declType (declType
name: name: (genericTpl
(genericTpl entity: (identifier) @type))
entity: (identifier) @type))
; -- Procedure & function declarations ; -- Procedure & function declarations
; foobar ; foobar
@ -302,23 +301,19 @@
; foobar<t> ; foobar<t>
(declProc (declProc
name: name: (genericTpl
(genericTpl entity: (identifier) @function))
entity: (identifier) @function))
; foo.bar ; foo.bar
(declProc (declProc
name: name: (genericDot
(genericDot rhs: (identifier) @function))
rhs: (identifier) @function))
; foo.bar<t> ; foo.bar<t>
(declProc (declProc
name: name: (genericDot
(genericDot rhs: (genericTpl
rhs: entity: (identifier) @function)))
(genericTpl
entity: (identifier) @function)))
; Treat property declarations like functions ; Treat property declarations like functions
(declProp (declProp
@ -342,9 +337,8 @@
type: (typeref) @type) type: (typeref) @type)
(declProc (declProc
name: name: (genericDot
(genericDot lhs: (identifier) @type))
lhs: (identifier) @type))
(declType (declType
(genericDot (genericDot
@ -362,9 +356,8 @@
entity: (identifier) @type) entity: (identifier) @type)
(genericTpl (genericTpl
entity: entity: (genericDot
(genericDot (identifier) @type))
(identifier) @type))
; -- Exception parameters ; -- Exception parameters
(exceptionHandler (exceptionHandler
@ -432,23 +425,19 @@
; foobar<t> ; foobar<t>
(exprCall (exprCall
entity: entity: (exprTpl
(exprTpl entity: (identifier) @function))
entity: (identifier) @function))
; foo.bar ; foo.bar
(exprCall (exprCall
entity: entity: (exprDot
(exprDot rhs: (identifier) @function))
rhs: (identifier) @function))
; foo.bar<t> ; foo.bar<t>
(exprCall (exprCall
entity: entity: (exprDot
(exprDot rhs: (exprTpl
rhs: entity: (identifier) @function)))
(exprTpl
entity: (identifier) @function)))
(inherited) @function (inherited) @function
@ -469,9 +458,8 @@
(statement (statement
(exprDot (exprDot
rhs: rhs: (exprTpl
(exprTpl entity: (identifier) @function)))
entity: (identifier) @function)))
; -- Break, Continue & Exit ; -- Break, Continue & Exit
; (Not ideal: ideally, there would be a way to check if these special ; (Not ideal: ideally, there would be a way to check if these special
@ -482,9 +470,8 @@
(statement (statement
(exprCall (exprCall
entity: entity: ((identifier) @keyword.return
((identifier) @keyword.return (#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))))
(#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))))
(statement (statement
((identifier) @keyword.repeat ((identifier) @keyword.repeat
@ -505,9 +492,8 @@
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(assignment (assignment
rhs: rhs: ((identifier) @constant
((identifier) @constant (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(exprBrackets (exprBrackets
((identifier) @constant ((identifier) @constant
@ -518,14 +504,12 @@
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$"))) (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(exprDot (exprDot
rhs: rhs: ((identifier) @constant
((identifier) @constant (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(exprTpl (exprTpl
args: args: ((identifier) @constant
((identifier) @constant (#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(#match? @constant "^[A-Z][A-Z0-9_]+$|^[a-z]{2,3}[A-Z].+$")))
(exprArgs (exprArgs
((identifier) @constant ((identifier) @constant

View file

@ -45,9 +45,8 @@
name: (identifier) @local.definition) name: (identifier) @local.definition)
(declType (declType
name: name: (genericTpl
(genericTpl entity: (identifier) @local.definition))
entity: (identifier) @local.definition))
(declProc (declProc
name: (identifier) @local.definition) name: (identifier) @local.definition)

View file

@ -60,12 +60,11 @@
]) ])
(scoped_call_expression (scoped_call_expression
scope: scope: [
[ (name) @type
(name) @type (qualified_name
(qualified_name (name) @type)
(name) @type) ])
])
(class_constant_access_expression (class_constant_access_expression
. .
@ -84,12 +83,11 @@
(binary_expression (binary_expression
operator: "instanceof" operator: "instanceof"
right: right: [
[ (name) @type
(name) @type (qualified_name
(qualified_name (name) @type)
(name) @type) ])
])
; Functions, methods, constructors ; Functions, methods, constructors
(array_creation_expression (array_creation_expression
@ -102,9 +100,8 @@
name: (name) @function.method) name: (name) @function.method)
(function_call_expression (function_call_expression
function: function: (qualified_name
(qualified_name (name) @function.call))
(name) @function.call))
(function_call_expression (function_call_expression
(name) @function.call) (name) @function.call)
@ -146,17 +143,15 @@
(variable_name) @property) (variable_name) @property)
(member_access_expression (member_access_expression
name: name: (variable_name
(variable_name (name)) @variable.member)
(name)) @variable.member)
(member_access_expression (member_access_expression
name: (name) @variable.member) name: (name) @variable.member)
(nullsafe_member_access_expression (nullsafe_member_access_expression
name: name: (variable_name
(variable_name (name)) @variable.member)
(name)) @variable.member)
(nullsafe_member_access_expression (nullsafe_member_access_expression
name: (name) @variable.member) name: (name) @variable.member)
@ -169,9 +164,8 @@
; Namespace ; Namespace
(namespace_definition (namespace_definition
name: name: (namespace_name
(namespace_name (name) @module))
(name) @module))
(namespace_name_as_prefix (namespace_name_as_prefix
(namespace_name (namespace_name

View file

@ -16,24 +16,22 @@
; regex ; regex
((function_call_expression ((function_call_expression
function: (_) @_preg_func_identifier function: (_) @_preg_func_identifier
arguments: arguments: (arguments
(arguments .
. (argument
(argument (_
(_ (string_value) @injection.content))))
(string_value) @injection.content))))
(#set! injection.language "regex") (#set! injection.language "regex")
(#lua-match? @_preg_func_identifier "^preg_")) (#lua-match? @_preg_func_identifier "^preg_"))
; bash ; bash
((function_call_expression ((function_call_expression
function: (_) @_shell_func_identifier function: (_) @_shell_func_identifier
arguments: arguments: (arguments
(arguments .
. (argument
(argument (_
(_ (string_value) @injection.content))))
(string_value) @injection.content))))
(#set! injection.language "bash") (#set! injection.language "bash")
(#any-of? @_shell_func_identifier (#any-of? @_shell_func_identifier
"shell_exec" "escapeshellarg" "escapeshellcmd" "exec" "passthru" "proc_open" "shell_exec" "shell_exec" "escapeshellarg" "escapeshellcmd" "exec" "passthru" "proc_open" "shell_exec"

View file

@ -67,10 +67,9 @@
(#set! reference.kind "method")) (#set! reference.kind "method"))
(function_call_expression (function_call_expression
function: function: (qualified_name
(qualified_name (name) @local.reference
(name) @local.reference (#set! reference.kind "function")))
(#set! reference.kind "function")))
(object_creation_expression (object_creation_expression
(qualified_name (qualified_name
@ -78,9 +77,8 @@
(#set! reference.kind "type"))) (#set! reference.kind "type")))
(scoped_call_expression (scoped_call_expression
scope: scope: (qualified_name
(qualified_name (name) @local.reference
(name) @local.reference (#set! reference.kind "type"))
(#set! reference.kind "type"))
name: (name) @local.reference name: (name) @local.reference
(#set! reference.kind "method")) (#set! reference.kind "method"))

View file

@ -133,15 +133,14 @@
(#set! "priority" 105)) (#set! "priority" 105))
(call_expression (call_expression
callee: callee: [
[ (identifier) @function.method.call
(identifier) @function.method.call (ffi_identifier
(ffi_identifier (identifier) @function.method.call)
(identifier) @function.method.call) (member_expression
(member_expression "."
"." (identifier) @function.method.call)
(identifier) @function.method.call) ])
])
; Parameters ; Parameters
(parameter (parameter
@ -168,22 +167,20 @@
; Operators ; Operators
(unary_expression (unary_expression
operator: operator: [
[ "not"
"not" "addressof"
"addressof" "digestof"
"digestof" ] @keyword.operator)
] @keyword.operator)
(binary_expression (binary_expression
operator: operator: [
[ "and"
"and" "or"
"or" "xor"
"xor" "is"
"is" "isnt"
"isnt" ] @keyword.operator)
] @keyword.operator)
[ [
"=" "="

View file

@ -42,9 +42,8 @@
name: (identifier) @attribute) name: (identifier) @attribute)
(attribute (attribute
name: name: (variable
(variable (identifier) @attribute))
(identifier) @attribute))
; Parameters ; Parameters
(lambda (lambda

View file

@ -35,9 +35,8 @@
((assignment ((assignment
left: (identifier) @type.definition left: (identifier) @type.definition
right: right: (call
(call function: (identifier) @_func))
function: (identifier) @_func))
(#any-of? @_func "TypeVar" "NewType")) (#any-of? @_func "TypeVar" "NewType"))
; Function calls ; Function calls
@ -45,18 +44,16 @@
function: (identifier) @function.call) function: (identifier) @function.call)
(call (call
function: function: (attribute
(attribute attribute: (identifier) @function.method.call))
attribute: (identifier) @function.method.call))
((call ((call
function: (identifier) @constructor) function: (identifier) @constructor)
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
((call ((call
function: function: (attribute
(attribute attribute: (identifier) @constructor))
attribute: (identifier) @constructor))
(#lua-match? @constructor "^%u")) (#lua-match? @constructor "^%u"))
; Decorators ; Decorators
@ -109,10 +106,9 @@
((call ((call
function: (identifier) @_isinstance function: (identifier) @_isinstance
arguments: arguments: (argument_list
(argument_list (_)
(_) (identifier) @type))
(identifier) @type))
(#eq? @_isinstance "isinstance")) (#eq? @_isinstance "isinstance"))
; Normal parameters ; Normal parameters
@ -211,18 +207,16 @@
(string) @string.documentation @spell)) (string) @string.documentation @spell))
(class_definition (class_definition
body: body: (block
(block .
. (expression_statement
(expression_statement (string) @string.documentation @spell)))
(string) @string.documentation @spell)))
(function_definition (function_definition
body: body: (block
(block .
. (expression_statement
(expression_statement (string) @string.documentation @spell)))
(string) @string.documentation @spell)))
; Tokens ; Tokens
[ [
@ -378,32 +372,27 @@
name: (identifier) @type) name: (identifier) @type)
(class_definition (class_definition
body: body: (block
(block (function_definition
(function_definition name: (identifier) @function.method)))
name: (identifier) @function.method)))
(class_definition (class_definition
superclasses: superclasses: (argument_list
(argument_list (identifier) @type))
(identifier) @type))
((class_definition ((class_definition
body: body: (block
(block (expression_statement
(expression_statement (assignment
(assignment left: (identifier) @variable.member))))
left: (identifier) @variable.member))))
(#lua-match? @variable.member "^[%l_].*$")) (#lua-match? @variable.member "^[%l_].*$"))
((class_definition ((class_definition
body: body: (block
(block (expression_statement
(expression_statement (assignment
(assignment left: (_
left: (identifier) @variable.member)))))
(_
(identifier) @variable.member)))))
(#lua-match? @variable.member "^[%l_].*$")) (#lua-match? @variable.member "^[%l_].*$"))
((class_definition ((class_definition
@ -434,12 +423,10 @@
; Regex from the `re` module ; Regex from the `re` module
(call (call
function: function: (attribute
(attribute object: (identifier) @_re)
object: (identifier) @_re) arguments: (argument_list
arguments: .
(argument_list (string
. (string_content) @string.regexp))
(string
(string_content) @string.regexp))
(#eq? @_re "re")) (#eq? @_re "re"))

View file

@ -164,9 +164,8 @@
(attribute (attribute
attribute: (_) @indent.end) attribute: (_) @indent.end)
(call (call
arguments: arguments: (_
(_ ")" @indent.end))
")" @indent.end))
"return" @indent.end "return" @indent.end
] .) ] .)

View file

@ -1,19 +1,16 @@
(call (call
function: function: (attribute
(attribute object: (identifier) @_re)
object: (identifier) @_re) arguments: (argument_list
arguments: .
(argument_list (string
. (string_content) @injection.content))
(string
(string_content) @injection.content))
(#eq? @_re "re") (#eq? @_re "re")
(#set! injection.language "regex")) (#set! injection.language "regex"))
((binary_operator ((binary_operator
left: left: (string
(string (string_content) @injection.content)
(string_content) @injection.content)
operator: "%") operator: "%")
(#set! injection.language "printf")) (#set! injection.language "printf"))

View file

@ -2,34 +2,29 @@
(module) @local.scope (module) @local.scope
(class_definition (class_definition
body: body: (block
(block (expression_statement
(expression_statement (assignment
(assignment left: (identifier) @local.definition.field)))) @local.scope
left: (identifier) @local.definition.field)))) @local.scope
(class_definition (class_definition
body: body: (block
(block (expression_statement
(expression_statement (assignment
(assignment left: (_
left: (identifier) @local.definition.field))))) @local.scope
(_
(identifier) @local.definition.field))))) @local.scope
; Imports ; Imports
(aliased_import (aliased_import
alias: (identifier) @local.definition.import) alias: (identifier) @local.definition.import)
(import_statement (import_statement
name: name: (dotted_name
(dotted_name (identifier) @local.definition.import))
(identifier) @local.definition.import))
(import_from_statement (import_from_statement
name: name: (dotted_name
(dotted_name (identifier) @local.definition.import))
(identifier) @local.definition.import))
; Function with parameters, defines parameters ; Function with parameters, defines parameters
(parameters (parameters
@ -64,22 +59,19 @@
(#set! definition.type.scope "parent")) (#set! definition.type.scope "parent"))
(class_definition (class_definition
body: body: (block
(block (function_definition
(function_definition name: (identifier) @local.definition.method)))
name: (identifier) @local.definition.method)))
; Loops ; Loops
; not a scope! ; not a scope!
(for_statement (for_statement
left: left: (pattern_list
(pattern_list (identifier) @local.definition.var))
(identifier) @local.definition.var))
(for_statement (for_statement
left: left: (tuple_pattern
(tuple_pattern (identifier) @local.definition.var))
(identifier) @local.definition.var))
(for_statement (for_statement
left: (identifier) @local.definition.var) left: (identifier) @local.definition.var)
@ -91,14 +83,12 @@
left: (identifier) @local.definition.var) left: (identifier) @local.definition.var)
(for_in_clause (for_in_clause
left: left: (tuple_pattern
(tuple_pattern (identifier) @local.definition.var))
(identifier) @local.definition.var))
(for_in_clause (for_in_clause
left: left: (pattern_list
(pattern_list (identifier) @local.definition.var))
(identifier) @local.definition.var))
(dictionary_comprehension) @local.scope (dictionary_comprehension) @local.scope
@ -111,20 +101,17 @@
left: (identifier) @local.definition.var) left: (identifier) @local.definition.var)
(assignment (assignment
left: left: (pattern_list
(pattern_list (identifier) @local.definition.var))
(identifier) @local.definition.var))
(assignment (assignment
left: left: (tuple_pattern
(tuple_pattern (identifier) @local.definition.var))
(identifier) @local.definition.var))
(assignment (assignment
left: left: (attribute
(attribute (identifier)
(identifier) (identifier) @local.definition.field))
(identifier) @local.definition.field))
; Walrus operator x := 1 ; Walrus operator x := 1
(named_expression (named_expression

View file

@ -4,12 +4,11 @@
; Annotations ; Annotations
(ui_annotation (ui_annotation
"@" @operator "@" @operator
type_name: type_name: [
[ (identifier) @attribute
(identifier) @attribute (nested_identifier
(nested_identifier (identifier) @attribute)
(identifier) @attribute) ])
])
; type ; type
(ui_property (ui_property
@ -17,28 +16,25 @@
; Properties ; Properties
(ui_object_definition_binding (ui_object_definition_binding
name: name: [
[ (identifier) @property
(identifier) @property (nested_identifier
(nested_identifier (identifier) @property)
(identifier) @property) ])
])
(ui_binding (ui_binding
name: name: [
[ (identifier) @property
(identifier) @property (nested_identifier
(nested_identifier (identifier) @property)
(identifier) @property) ])
])
; locals query appears not working unless id: <ref> isn't a parameter. ; locals query appears not working unless id: <ref> isn't a parameter.
(ui_binding (ui_binding
name: (identifier) @property name: (identifier) @property
(#eq? @property "id") (#eq? @property "id")
value: value: (expression_statement
(expression_statement (identifier) @variable))
(identifier) @variable))
(ui_property (ui_property
name: (identifier) @property) name: (identifier) @property)
@ -77,10 +73,9 @@
; function ; function
(call_expression (call_expression
function: function: (member_expression
(member_expression object: (identifier) @variable
object: (identifier) @variable property: (property_identifier) @function))
property: (property_identifier) @function))
; js ; js
; Literals ; Literals

View file

@ -68,20 +68,18 @@
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters (string
(string "\"" @string
"\"" @string "\"" @string) @string.regexp))
"\"" @string) @string.regexp))
(#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match")) (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match"))
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters (string
(string "\"" @string
"\"" @string "\"" @string) @string.regexp
"\"" @string) @string.regexp .
. (string) .))
(string) .))
(#any-of? @_name "gsub" "not-gsub")) (#any-of? @_name "gsub" "not-gsub"))

View file

@ -1,28 +1,25 @@
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters (string) @injection.content))
(string) @injection.content))
(#any-of? @_name "match" "not-match" "vim-match" "not-vim-match") (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match")
(#set! injection.language "regex") (#set! injection.language "regex")
(#offset! @injection.content 0 1 0 -1)) (#offset! @injection.content 0 1 0 -1))
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters (string) @injection.content))
(string) @injection.content))
(#any-of? @_name "lua-match" "not-lua-match") (#any-of? @_name "lua-match" "not-lua-match")
(#set! injection.language "luap") (#set! injection.language "luap")
(#offset! @injection.content 0 1 0 -1)) (#offset! @injection.content 0 1 0 -1))
((predicate ((predicate
name: (identifier) @_name name: (identifier) @_name
parameters: parameters: (parameters
(parameters (string) @injection.content
(string) @injection.content .
. (string) .))
(string) .))
(#any-of? @_name "gsub" "not-gsub") (#any-of? @_name "gsub" "not-gsub")
(#set! injection.language "luap") (#set! injection.language "luap")
(#offset! @injection.content 0 1 0 -1)) (#offset! @injection.content 0 1 0 -1))

View file

@ -55,36 +55,34 @@
] @operator ] @operator
(unary (unary
operator: operator: [
[ "-"
"-" "+"
"+" "!"
"!" "~"
"~" "?"
"?" ] @operator)
] @operator)
(binary (binary
operator: operator: [
[ "-"
"-" "+"
"+" "*"
"*" "/"
"/" "^"
"^" "<"
"<" ">"
">" "<="
"<=" ">="
">=" "=="
"==" "!="
"!=" "||"
"||" "|"
"|" "&&"
"&&" "&"
"&" ":"
":" "~"
"~" ] @operator)
] @operator)
[ [
"|>" "|>"
@ -157,7 +155,6 @@
function: (identifier) @function.call)) function: (identifier) @function.call))
(call (call
function: function: (dollar
(dollar _
_ (identifier) @function.method.call))
(identifier) @function.method.call))

View file

@ -44,14 +44,12 @@
(number) @number (number) @number
(expr_call (expr_call
func_name: func_name: (fn_name
(fn_name (var) @function .))
(var) @function .))
(expr_call (expr_call
func_arguments: func_arguments: (fn_args
(fn_args (expr) @variable.parameter))
(expr) @variable.parameter))
(rule_args (rule_args
(term) @variable.parameter) (term) @variable.parameter)

View file

@ -8,11 +8,10 @@
"END" @indent.branch) "END" @indent.branch)
(for_statement (for_statement
right: right: (_
(_ (arguments
(arguments (continuation
(continuation (ellipses) @indent.branch))))
(ellipses) @indent.branch))))
(while_statement) @indent.begin (while_statement) @indent.begin

View file

@ -22,9 +22,8 @@
name: (type) @function) name: (type) @function)
(directive (directive
body: body: (body
(body (arguments) @variable.parameter))
(arguments) @variable.parameter))
((directive ((directive
name: (type) @keyword.import) name: (type) @keyword.import)
@ -143,9 +142,8 @@
(directive (directive
name: (type) @_directive name: (type) @_directive
body: body: (body
(body (content) @spell
(content) @spell (#not-any-of? @_directive "code" "code-block" "sourcecode")))
(#not-any-of? @_directive "code" "code-block" "sourcecode")))
(paragraph) @spell (paragraph) @spell

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