Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update t32 language queries to version 2.2.1 #7811

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "t32"
source = { git = "https://codeberg.org/xasc/tree-sitter-t32", rev = "1dd98248b01e4a3933c1b85b58bab0875e2ba437" }
source = { git = "https://gitlab.com/xasc/tree-sitter-t32", rev = "6da5e3cbabd376b566d04282005e52ffe67ef74a" }

[[language]]
name = "webc"
Expand Down
134 changes: 108 additions & 26 deletions runtime/queries/t32/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
; Operators in command and conditional HLL expressions
(hll_comma_expression
"," @operator)

(hll_conditional_expression
[
"?"
":"
] @operator)


; Keywords, punctuation and operators
[
"enum"
"struct"
"union"
] @keyword.storage.type

"sizeof" @keyword.operator

[
"const"
"volatile"
] @keyword.storage.modifier

[
"="
"^^"
Expand Down Expand Up @@ -28,49 +53,89 @@
"&"
"->"
"*"
"-="
"+="
"*="
"/="
"%="
"|="
"&="
"^="
">>="
"<<="
"--"
"++"
] @operator

[
"("
")"
"{"
"}"
"["
"]"
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket

[
","
"."
";"
] @punctuation.delimiter

; Constants

; Strings and others literal types
(access_class) @constant.builtin

[
(access_class)
(address)
(bitmask)
(file_handle)
(frequency)
(time)
] @constant.builtin
(integer)
(hll_number_literal)
] @constant.numeric.integer

[
(float)
(frequency)
(percentage)
(time)
] @constant.numeric.float

(integer) @constant.numeric.integer

(character) @constant.character
[
(string)
(hll_string_literal)
] @string

; Strings
(string) @string
(hll_escape_sequence) @constant.character.escape

(path) @string.special.path

(symbol) @string.special.symbol

[
(character)
(hll_char_literal)
] @constant.character


; Types in HLL expressions
[
(hll_type_identifier)
(hll_type_descriptor)
] @type

(hll_type_qualifier) @keyword.storage.modifier

(hll_primitive_type) @type.builtin


; HLL call expressions
(hll_call_expression
function: (hll_field_expression
field: (hll_field_identifier) @function))

(hll_call_expression
function: (identifier) @function)


; Returns
(
(command_expression
Expand All @@ -83,11 +148,13 @@
(#match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$")
)


; Subroutine calls
(subroutine_call_expression
command: (identifier) @keyword
subroutine: (identifier) @function)


; Subroutine blocks
(subroutine_block
command: (identifier) @keyword
Expand All @@ -97,15 +164,17 @@
label: (identifier) @function
(block))


; Parameter declarations
(parameter_declaration
command: (identifier) @keyword
(identifier)? @constant.builtin
macro: (macro) @variable.parameter)


; Variables, constants and labels
(macro) @variable
(internal_c_variable) @variable
(macro) @variable.builtin
(trace32_hll_variable) @variable.builtin

(
(command_expression
Expand All @@ -116,17 +185,28 @@
(labeled_expression
label: (identifier) @label)

(option_expression
(identifier) @constant.builtin)

(format_expression
(identifier) @constant.builtin)

(
(argument_list (identifier) @constant.builtin)
(#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$")
(argument_list (identifier) @constant.builtin)
(#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$")
)
(argument_list
(identifier) @constant)
(identifier) @constant.builtin)


; Commands
(command_expression command: (identifier) @keyword)
(macro_definition command: (identifier) @keyword)

(call_expression
function: (identifier) @function.builtin)


; Control flow
(if_block
command: (identifier) @keyword.control.conditional.if)
Expand All @@ -138,8 +218,10 @@
(repeat_block
command: (identifier) @keyword.control.loop)

(call_expression
function: (identifier) @function)

(type_identifier) @type
; HLL variables
(identifier) @variable
(hll_field_identifier) @variable.other.member


(comment) @comment