mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(t32)!: update queries for new HLL node types
- Lock grammar to version 2.1.1 - Update query for syntax hightlighting - fix missing locals query - reduce number of "(identifier) @variable" highlight queries - revert to capture @function.builtin for PRACTICE call expressions
This commit is contained in:
parent
e8648569d8
commit
2fb7359828
3 changed files with 119 additions and 26 deletions
|
|
@ -1512,7 +1512,7 @@ list.t32 = {
|
|||
install_info = {
|
||||
url = "https://codeberg.org/xasc/tree-sitter-t32",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
revision = "1dd98248b01e4a3933c1b85b58bab0875e2ba437",
|
||||
revision = "767f3c52fe649e4a6ab3551ac287e5b6038c9148",
|
||||
},
|
||||
maintainers = { "@xasc" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
; Keywords, punctuation and operators
|
||||
[
|
||||
"="
|
||||
"^^"
|
||||
|
|
@ -28,50 +29,129 @@
|
|||
"&"
|
||||
"->"
|
||||
"*"
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"|="
|
||||
"&="
|
||||
"^="
|
||||
">>="
|
||||
"<<="
|
||||
"--"
|
||||
"++"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
"."
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
(access_class)
|
||||
"enum"
|
||||
"struct"
|
||||
"union"
|
||||
] @keyword
|
||||
|
||||
"sizeof" @keyword.operator
|
||||
|
||||
[
|
||||
"const"
|
||||
"volatile"
|
||||
] @type.qualifier
|
||||
|
||||
|
||||
; Operators in comma and conditional HLL expressions
|
||||
(hll_comma_expression
|
||||
"," @operator)
|
||||
|
||||
(hll_conditional_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @conditional.ternary)
|
||||
|
||||
|
||||
; Strings and others literal types
|
||||
(access_class) @constant.builtin
|
||||
|
||||
[
|
||||
(address)
|
||||
(bitmask)
|
||||
(file_handle)
|
||||
(frequency)
|
||||
(integer)
|
||||
(percentage)
|
||||
(time)
|
||||
(hll_number_literal)
|
||||
] @number
|
||||
|
||||
(float) @float
|
||||
[
|
||||
(float)
|
||||
(frequency)
|
||||
(percentage)
|
||||
(time)
|
||||
] @float
|
||||
|
||||
(string) @string
|
||||
[
|
||||
(string)
|
||||
(hll_string_literal)
|
||||
] @string
|
||||
|
||||
(hll_escape_sequence) @string.escape
|
||||
|
||||
(path) @string.special
|
||||
|
||||
(symbol) @symbol
|
||||
|
||||
(character) @character
|
||||
[
|
||||
(character)
|
||||
(hll_char_literal)
|
||||
] @character
|
||||
|
||||
|
||||
; Types in HLL expressions
|
||||
[
|
||||
(hll_type_identifier)
|
||||
(hll_type_descriptor)
|
||||
] @type
|
||||
|
||||
(hll_type_qualifier) @type.qualifier
|
||||
|
||||
(hll_primitive_type) @type.builtin
|
||||
|
||||
|
||||
; HLL expressions
|
||||
(hll_call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(hll_call_expression
|
||||
function: (hll_field_expression
|
||||
field: (hll_field_identifier) @function.call))
|
||||
|
||||
|
||||
; HLL variables
|
||||
(identifier) @variable
|
||||
(hll_field_identifier) @field
|
||||
|
||||
|
||||
; Commands
|
||||
(command_expression
|
||||
command: (identifier) @keyword)
|
||||
|
||||
(macro_definition
|
||||
command: (identifier) @keyword)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
|
||||
|
||||
; Returns
|
||||
(
|
||||
(command_expression
|
||||
|
|
@ -84,20 +164,23 @@
|
|||
(#lua-match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$")
|
||||
)
|
||||
|
||||
|
||||
; Subroutine calls
|
||||
(subroutine_call_expression
|
||||
command: (identifier) @keyword
|
||||
subroutine: (identifier) @function.call)
|
||||
|
||||
|
||||
; Variables, constants and labels
|
||||
(macro) @variable.builtin
|
||||
(internal_c_variable) @variable.builtin
|
||||
(trace32_hll_variable) @variable.builtin
|
||||
|
||||
(argument_list
|
||||
(identifier) @constant)
|
||||
(identifier) @constant.builtin)
|
||||
|
||||
(
|
||||
(argument_list (identifier) @constant.builtin)
|
||||
(#lua-match? @constant.builtin "^[%%/][%l%u][%l%u%d.]*$")
|
||||
(argument_list (identifier) @constant.builtin)
|
||||
(#lua-match? @constant.builtin "^[%%/][%l%u][%l%u%d.]*$")
|
||||
)
|
||||
|
||||
(
|
||||
|
|
@ -106,24 +189,34 @@
|
|||
arguments: (argument_list . (identifier) @label))
|
||||
(#lua-match? @keyword "^[gG][oO][tT][oO]$")
|
||||
)
|
||||
|
||||
(labeled_expression
|
||||
label: (identifier) @label)
|
||||
|
||||
(option_expression
|
||||
(identifier) @constant.builtin)
|
||||
|
||||
(format_expression
|
||||
(identifier) @constant.builtin)
|
||||
|
||||
|
||||
; Subroutine blocks
|
||||
(subroutine_block
|
||||
command: (identifier) @keyword
|
||||
command: (identifier) @keyword.function
|
||||
subroutine: (identifier) @function)
|
||||
|
||||
(labeled_expression
|
||||
label: (identifier) @function
|
||||
(block))
|
||||
|
||||
|
||||
; Parameter declarations
|
||||
(parameter_declaration
|
||||
command: (identifier) @keyword
|
||||
(identifier)? @constant.builtin
|
||||
macro: (macro) @parameter)
|
||||
|
||||
|
||||
; Control flow
|
||||
(if_block
|
||||
command: (identifier) @conditional)
|
||||
|
|
@ -135,8 +228,5 @@
|
|||
(repeat_block
|
||||
command: (identifier) @repeat)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
|
||||
(type_identifier) @type
|
||||
(comment) @comment @spell
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
(command_expression
|
||||
command: (identifier)
|
||||
arguments: (argument_list
|
||||
variable: (identifier) @definition.var))
|
||||
declarator: (trace32_hll_variable) @definition.var))
|
||||
|
||||
; Function definitions
|
||||
(subroutine_block
|
||||
|
|
@ -32,4 +32,7 @@
|
|||
(#set! reference.kind "function")
|
||||
)
|
||||
|
||||
(macro) @reference
|
||||
[
|
||||
(macro)
|
||||
(trace32_hll_variable)
|
||||
] @reference
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue