mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 18:30:06 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,8 +1,7 @@
|
|||
; ; Intended for consumption by nvim-treesitter
|
||||
; ; Intended for consumption by nvim-treesitter
|
||||
; ; Default capture names for nvim-treesitter found here:
|
||||
; ; https://github.com/nvim-treesitter/nvim-treesitter/blob/e473630fe0872cb0ed97cd7085e724aa58bc1c84/lua/nvim-treesitter/highlight.lua#L14-L104
|
||||
; ; In this file, captures defined later take precedence over captures defined earlier
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"ACTION"
|
||||
|
|
@ -97,96 +96,203 @@
|
|||
"when"
|
||||
"with"
|
||||
] @keyword
|
||||
|
||||
"await" @keyword.coroutine
|
||||
|
||||
(pcal_with
|
||||
("=") @keyword)
|
||||
|
||||
(pcal_process
|
||||
("=") @keyword)
|
||||
|
||||
[
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
(pcal_with ("=") @keyword)
|
||||
(pcal_process ("=") @keyword)
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"elsif"
|
||||
(pcal_end_if)
|
||||
"either"
|
||||
(pcal_end_either)
|
||||
] @keyword.conditional
|
||||
[
|
||||
"while"
|
||||
"do"
|
||||
(pcal_end_while)
|
||||
"with"
|
||||
|
||||
[
|
||||
"while"
|
||||
"do"
|
||||
(pcal_end_while)
|
||||
"with"
|
||||
(pcal_end_with)
|
||||
] @keyword.repeat
|
||||
|
||||
("return") @keyword.return
|
||||
|
||||
("print") @function.macro
|
||||
|
||||
|
||||
; Literals
|
||||
(binary_number (format) @keyword)
|
||||
(binary_number (value) @number)
|
||||
(binary_number
|
||||
(format) @keyword)
|
||||
|
||||
(binary_number
|
||||
(value) @number)
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(boolean_set) @type
|
||||
(hex_number (format) @keyword)
|
||||
(hex_number (value) @number)
|
||||
|
||||
(hex_number
|
||||
(format) @keyword)
|
||||
|
||||
(hex_number
|
||||
(value) @number)
|
||||
|
||||
(int_number_set) @type
|
||||
|
||||
(nat_number) @number
|
||||
|
||||
(nat_number_set) @type
|
||||
(octal_number (format) @keyword)
|
||||
(octal_number (value) @number)
|
||||
|
||||
(octal_number
|
||||
(format) @keyword)
|
||||
|
||||
(octal_number
|
||||
(value) @number)
|
||||
|
||||
(real_number) @number
|
||||
|
||||
(real_number_set) @type
|
||||
|
||||
(string) @string
|
||||
|
||||
(escape_char) @string.escape
|
||||
|
||||
(string_set) @type
|
||||
|
||||
; Namespaces
|
||||
(extends (identifier_ref) @module)
|
||||
(instance (identifier_ref) @module)
|
||||
(module name: (identifier) @module)
|
||||
(pcal_algorithm name: (identifier) @module)
|
||||
(extends
|
||||
(identifier_ref) @module)
|
||||
|
||||
(instance
|
||||
(identifier_ref) @module)
|
||||
|
||||
(module
|
||||
name: (identifier) @module)
|
||||
|
||||
(pcal_algorithm
|
||||
name: (identifier) @module)
|
||||
|
||||
; Operators, functions, and macros
|
||||
(bound_infix_op symbol: (_) @operator)
|
||||
(bound_nonfix_op symbol: (_) @operator)
|
||||
(bound_postfix_op symbol: (_) @operator)
|
||||
(bound_prefix_op symbol: (_) @operator)
|
||||
(bound_infix_op
|
||||
symbol: (_) @operator)
|
||||
|
||||
(bound_nonfix_op
|
||||
symbol: (_) @operator)
|
||||
|
||||
(bound_postfix_op
|
||||
symbol: (_) @operator)
|
||||
|
||||
(bound_prefix_op
|
||||
symbol: (_) @operator)
|
||||
|
||||
((prefix_op_symbol) @operator)
|
||||
|
||||
((infix_op_symbol) @operator)
|
||||
|
||||
((postfix_op_symbol) @operator)
|
||||
(function_definition name: (identifier) @function)
|
||||
(module_definition name: (_) @keyword.import)
|
||||
(operator_definition name: (_) @function.macro)
|
||||
(pcal_macro_decl name: (identifier) @function.macro)
|
||||
(pcal_macro_call name: (identifier) @function.macro)
|
||||
(pcal_proc_decl name: (identifier) @function.macro)
|
||||
(pcal_process name: (identifier) @function)
|
||||
(recursive_declaration (identifier) @function.macro)
|
||||
(recursive_declaration (operator_declaration name: (_) @function.macro))
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(module_definition
|
||||
name: (_) @keyword.import)
|
||||
|
||||
(operator_definition
|
||||
name: (_) @function.macro)
|
||||
|
||||
(pcal_macro_decl
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(pcal_macro_call
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(pcal_proc_decl
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
(pcal_process
|
||||
name: (identifier) @function)
|
||||
|
||||
(recursive_declaration
|
||||
(identifier) @function.macro)
|
||||
|
||||
(recursive_declaration
|
||||
(operator_declaration
|
||||
name: (_) @function.macro))
|
||||
|
||||
; Constants and variables
|
||||
(constant_declaration (identifier) @constant)
|
||||
(constant_declaration (operator_declaration name: (_) @constant))
|
||||
(pcal_var_decl (identifier) @variable)
|
||||
(pcal_with (identifier) @variable.parameter)
|
||||
((".") . (identifier) @attribute)
|
||||
(record_literal (identifier) @attribute)
|
||||
(set_of_records (identifier) @attribute)
|
||||
(variable_declaration (identifier) @variable)
|
||||
(constant_declaration
|
||||
(identifier) @constant)
|
||||
|
||||
(constant_declaration
|
||||
(operator_declaration
|
||||
name: (_) @constant))
|
||||
|
||||
(pcal_var_decl
|
||||
(identifier) @variable)
|
||||
|
||||
(pcal_with
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
((".")
|
||||
.
|
||||
(identifier) @attribute)
|
||||
|
||||
(record_literal
|
||||
(identifier) @attribute)
|
||||
|
||||
(set_of_records
|
||||
(identifier) @attribute)
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @variable)
|
||||
|
||||
; Parameters
|
||||
(choose (identifier) @variable.parameter)
|
||||
(choose (tuple_of_identifiers (identifier) @variable.parameter))
|
||||
(lambda (identifier) @variable.parameter)
|
||||
(module_definition (operator_declaration name: (_) @variable.parameter))
|
||||
(module_definition parameter: (identifier) @variable.parameter)
|
||||
(operator_definition (operator_declaration name: (_) @variable.parameter))
|
||||
(operator_definition parameter: (identifier) @variable.parameter)
|
||||
(pcal_macro_decl parameter: (identifier) @variable.parameter)
|
||||
(pcal_proc_var_decl (identifier) @variable.parameter)
|
||||
(quantifier_bound (identifier) @variable.parameter)
|
||||
(quantifier_bound (tuple_of_identifiers (identifier) @variable.parameter))
|
||||
(unbounded_quantification (identifier) @variable.parameter)
|
||||
(choose
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(choose
|
||||
(tuple_of_identifiers
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(lambda
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(module_definition
|
||||
(operator_declaration
|
||||
name: (_) @variable.parameter))
|
||||
|
||||
(module_definition
|
||||
parameter: (identifier) @variable.parameter)
|
||||
|
||||
(operator_definition
|
||||
(operator_declaration
|
||||
name: (_) @variable.parameter))
|
||||
|
||||
(operator_definition
|
||||
parameter: (identifier) @variable.parameter)
|
||||
|
||||
(pcal_macro_decl
|
||||
parameter: (identifier) @variable.parameter)
|
||||
|
||||
(pcal_proc_var_decl
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(quantifier_bound
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(quantifier_bound
|
||||
(tuple_of_identifiers
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(unbounded_quantification
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Delimiters
|
||||
[
|
||||
|
|
@ -201,6 +307,7 @@
|
|||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
":"
|
||||
|
|
@ -214,57 +321,69 @@
|
|||
] @punctuation.delimiter
|
||||
|
||||
; Proofs
|
||||
(assume_prove (new (identifier) @variable.parameter))
|
||||
(assume_prove (new (operator_declaration name: (_) @variable.parameter)))
|
||||
(assumption name: (identifier) @constant)
|
||||
(pick_proof_step (identifier) @variable.parameter)
|
||||
(proof_step_id "<" @punctuation.bracket)
|
||||
(proof_step_id (level) @label)
|
||||
(proof_step_id (name) @label)
|
||||
(proof_step_id ">" @punctuation.bracket)
|
||||
(proof_step_ref "<" @punctuation.bracket)
|
||||
(proof_step_ref (level) @label)
|
||||
(proof_step_ref (name) @label)
|
||||
(proof_step_ref ">" @punctuation.bracket)
|
||||
(take_proof_step (identifier) @variable.parameter)
|
||||
(theorem name: (identifier) @constant)
|
||||
(assume_prove
|
||||
(new
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(assume_prove
|
||||
(new
|
||||
(operator_declaration
|
||||
name: (_) @variable.parameter)))
|
||||
|
||||
(assumption
|
||||
name: (identifier) @constant)
|
||||
|
||||
(pick_proof_step
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(proof_step_id
|
||||
"<" @punctuation.bracket)
|
||||
|
||||
(proof_step_id
|
||||
(level) @label)
|
||||
|
||||
(proof_step_id
|
||||
(name) @label)
|
||||
|
||||
(proof_step_id
|
||||
">" @punctuation.bracket)
|
||||
|
||||
(proof_step_ref
|
||||
"<" @punctuation.bracket)
|
||||
|
||||
(proof_step_ref
|
||||
(level) @label)
|
||||
|
||||
(proof_step_ref
|
||||
(name) @label)
|
||||
|
||||
(proof_step_ref
|
||||
">" @punctuation.bracket)
|
||||
|
||||
(take_proof_step
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(theorem
|
||||
name: (identifier) @constant)
|
||||
|
||||
; Comments and tags
|
||||
(block_comment "(*" @comment)
|
||||
(block_comment "*)" @comment)
|
||||
(block_comment_text) @comment @spell
|
||||
(comment) @comment @spell
|
||||
(single_line) @comment
|
||||
(_ label: (identifier) @label)
|
||||
(label name: (_) @label)
|
||||
(pcal_goto statement: (identifier) @label)
|
||||
(block_comment
|
||||
"(*" @comment)
|
||||
|
||||
; Reference highlighting with the same color as declarations.
|
||||
; `constant`, `operator`, and others are custom captures defined in locals.scm
|
||||
((identifier_ref) @constant (#is? @constant constant))
|
||||
((identifier_ref) @function (#is? @function function))
|
||||
((identifier_ref) @function.macro (#is? @function.macro macro))
|
||||
((identifier_ref) @include (#is? @include import))
|
||||
((identifier_ref) @parameter (#is? @parameter parameter))
|
||||
((identifier_ref) @variable (#is? @variable var))
|
||||
((prefix_op_symbol) @constant (#is? @constant constant))
|
||||
((prefix_op_symbol) @function.macro (#is? @function.macro macro))
|
||||
((prefix_op_symbol) @parameter (#is? @parameter parameter))
|
||||
((infix_op_symbol) @constant (#is? @constant constant))
|
||||
((infix_op_symbol) @function.macro (#is? @function.macro macro))
|
||||
((infix_op_symbol) @parameter (#is? @parameter parameter))
|
||||
((postfix_op_symbol) @constant (#is? @constant constant))
|
||||
((postfix_op_symbol) @function.macro (#is? @function.macro macro))
|
||||
((postfix_op_symbol) @parameter (#is? @parameter parameter))
|
||||
(bound_prefix_op symbol: (_) @constant (#is? @constant constant))
|
||||
(bound_prefix_op symbol: (_) @function.macro (#is? @function.macro macro))
|
||||
(bound_prefix_op symbol: (_) @parameter (#is? @parameter parameter))
|
||||
(bound_infix_op symbol: (_) @constant (#is? @constant constant))
|
||||
(bound_infix_op symbol: (_) @function.macro (#is? @function.macro macro))
|
||||
(bound_infix_op symbol: (_) @parameter (#is? @parameter parameter))
|
||||
(bound_postfix_op symbol: (_) @constant (#is? @constant constant))
|
||||
(bound_postfix_op symbol: (_) @function.macro (#is? @function.macro macro))
|
||||
(bound_postfix_op symbol: (_) @parameter (#is? @parameter parameter))
|
||||
(bound_nonfix_op symbol: (_) @constant (#is? @constant constant))
|
||||
(bound_nonfix_op symbol: (_) @function.macro (#is? @function.macro macro))
|
||||
(bound_nonfix_op symbol: (_) @parameter (#is? @parameter parameter))
|
||||
(block_comment
|
||||
"*)" @comment)
|
||||
|
||||
(block_comment_text) @comment @spell
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(single_line) @comment
|
||||
|
||||
(_
|
||||
label: (identifier) @label)
|
||||
|
||||
(label
|
||||
name: (_) @label)
|
||||
|
||||
(pcal_goto
|
||||
statement: (identifier) @label)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
([
|
||||
(comment)
|
||||
(block_comment_text)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
[
|
||||
(bounded_quantification)
|
||||
(choose)
|
||||
(function_definition)
|
||||
(function_definition)
|
||||
(function_literal)
|
||||
(lambda)
|
||||
(lambda)
|
||||
(let_in)
|
||||
(module)
|
||||
(module)
|
||||
(module_definition)
|
||||
(operator_definition)
|
||||
(set_filter)
|
||||
|
|
@ -14,28 +14,63 @@
|
|||
(unbounded_quantification)
|
||||
] @local.scope
|
||||
|
||||
(choose (identifier) @local.definition.parameter)
|
||||
(choose (tuple_of_identifiers (identifier) @local.definition.parameter))
|
||||
(constant_declaration (identifier) @local.definition.constant)
|
||||
(constant_declaration (operator_declaration name: (_) @local.definition.constant))
|
||||
(choose
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(choose
|
||||
(tuple_of_identifiers
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(constant_declaration
|
||||
(identifier) @local.definition.constant)
|
||||
|
||||
(constant_declaration
|
||||
(operator_declaration
|
||||
name: (_) @local.definition.constant))
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.function.scope" "parent"))
|
||||
(lambda (identifier) @local.definition.parameter)
|
||||
|
||||
(lambda
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(module_definition
|
||||
name: (_) @local.definition.import
|
||||
(#set! "definition.import.scope" "parent"))
|
||||
(module_definition parameter: (identifier) @local.definition.parameter)
|
||||
(module_definition parameter: (operator_declaration name: (_) @local.definition.parameter))
|
||||
|
||||
(module_definition
|
||||
parameter: (identifier) @local.definition.parameter)
|
||||
|
||||
(module_definition
|
||||
parameter:
|
||||
(operator_declaration
|
||||
name: (_) @local.definition.parameter))
|
||||
|
||||
(operator_definition
|
||||
name: (_) @local.definition.macro
|
||||
(#set! "definition.macro.scope" "parent"))
|
||||
(operator_definition parameter: (identifier) @local.definition.parameter)
|
||||
(operator_definition parameter: (operator_declaration name: (_) @local.definition.parameter))
|
||||
(quantifier_bound (identifier) @local.definition.parameter)
|
||||
(quantifier_bound (tuple_of_identifiers (identifier) @local.definition.parameter))
|
||||
(unbounded_quantification (identifier) @local.definition.parameter)
|
||||
(variable_declaration (identifier) @local.definition.var)
|
||||
|
||||
(operator_definition
|
||||
parameter: (identifier) @local.definition.parameter)
|
||||
|
||||
(operator_definition
|
||||
parameter:
|
||||
(operator_declaration
|
||||
name: (_) @local.definition.parameter))
|
||||
|
||||
(quantifier_bound
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(quantifier_bound
|
||||
(tuple_of_identifiers
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(unbounded_quantification
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
; Proof scopes and definitions
|
||||
[
|
||||
|
|
@ -44,11 +79,24 @@
|
|||
(theorem)
|
||||
] @local.scope
|
||||
|
||||
(assume_prove (new (identifier) @local.definition.parameter))
|
||||
(assume_prove (new (operator_declaration name: (_) @local.definition.parameter)))
|
||||
(assumption name: (identifier) @local.definition.constant)
|
||||
(pick_proof_step (identifier) @local.definition.parameter)
|
||||
(take_proof_step (identifier) @local.definition.parameter)
|
||||
(assume_prove
|
||||
(new
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(assume_prove
|
||||
(new
|
||||
(operator_declaration
|
||||
name: (_) @local.definition.parameter)))
|
||||
|
||||
(assumption
|
||||
name: (identifier) @local.definition.constant)
|
||||
|
||||
(pick_proof_step
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(take_proof_step
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(theorem
|
||||
name: (identifier) @local.definition.constant
|
||||
(#set! "definition.constant.scope" "parent"))
|
||||
|
|
@ -61,28 +109,61 @@
|
|||
(pcal_with)
|
||||
] @local.scope
|
||||
|
||||
(pcal_macro_decl parameter: (identifier) @local.definition.parameter)
|
||||
(pcal_proc_var_decl (identifier) @local.definition.parameter)
|
||||
(pcal_var_decl (identifier) @local.definition.var)
|
||||
(pcal_with (identifier) @local.definition.parameter)
|
||||
(pcal_macro_decl
|
||||
parameter: (identifier) @local.definition.parameter)
|
||||
|
||||
(pcal_proc_var_decl
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(pcal_var_decl
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(pcal_with
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
; Built-in PlusCal variables
|
||||
(pcal_algorithm_body
|
||||
[
|
||||
(_ (identifier_ref) @local.definition.var)
|
||||
(_ (_ (identifier_ref) @local.definition.var))
|
||||
(_ (_ (_ (identifier_ref) @local.definition.var)))
|
||||
(_ (_ (_ (_ (identifier_ref) @local.definition.var))))
|
||||
(_ (_ (_ (_ (_ (identifier_ref) @local.definition.var)))))
|
||||
(_
|
||||
(identifier_ref) @local.definition.var)
|
||||
(_
|
||||
(_
|
||||
(identifier_ref) @local.definition.var))
|
||||
(_
|
||||
(_
|
||||
(_
|
||||
(identifier_ref) @local.definition.var)))
|
||||
(_
|
||||
(_
|
||||
(_
|
||||
(_
|
||||
(identifier_ref) @local.definition.var))))
|
||||
(_
|
||||
(_
|
||||
(_
|
||||
(_
|
||||
(_
|
||||
(identifier_ref) @local.definition.var)))))
|
||||
]
|
||||
(#any-of? @local.definition.var "self" "pc" "stack"))
|
||||
|
||||
; References
|
||||
(identifier_ref) @local.reference
|
||||
|
||||
((prefix_op_symbol) @local.reference)
|
||||
(bound_prefix_op symbol: (_) @local.reference)
|
||||
|
||||
(bound_prefix_op
|
||||
symbol: (_) @local.reference)
|
||||
|
||||
((infix_op_symbol) @local.reference)
|
||||
(bound_infix_op symbol: (_) @local.reference)
|
||||
|
||||
(bound_infix_op
|
||||
symbol: (_) @local.reference)
|
||||
|
||||
((postfix_op_symbol) @local.reference)
|
||||
(bound_postfix_op symbol: (_) @local.reference)
|
||||
(bound_nonfix_op symbol: (_) @local.reference)
|
||||
|
||||
(bound_postfix_op
|
||||
symbol: (_) @local.reference)
|
||||
|
||||
(bound_nonfix_op
|
||||
symbol: (_) @local.reference)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue