aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorChristoph Sax2023-08-04 14:20:12 +0000
committerGitHub2023-08-04 14:20:12 +0000
commit5a51036bc1e0b5b0bffa599dd2caf171d6924546 (patch)
tree2a710e3f4f0a12700b04a4b748cb8cb48928da7e /runtime
parent286e44050d838adcf6ff1b2bdb82653a5420cd45 (diff)
Update t32 language queries to version 2.2.1 (#7811)
Version 2.2.1 of the grammar adds extended support for HLL (C, C++,..) expressions. Quite a few node types were added, renamed or removed in the process. This change brings the highlight queries in sync with the ones found in the repository of the grammar. The highlighting tests "look" okay after updating the queries. Recently, Codeberg had some reliability issues. That is why the language is now using the mirror repository on GitLab as source instead. Co-authored-by: Christoph Sax <christoph.sax@mailbox.org>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/t32/highlights.scm134
1 files changed, 108 insertions, 26 deletions
diff --git a/runtime/queries/t32/highlights.scm b/runtime/queries/t32/highlights.scm
index c3bba814..8a29cee2 100644
--- a/runtime/queries/t32/highlights.scm
+++ b/runtime/queries/t32/highlights.scm
@@ -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
+
[
"="
"^^"
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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