on master help sign in
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>

commit5a51036bc1e0b5b0bffa599dd2caf171d6924546 authorChristoph Sax <xasc@users.noreply.github.com> dateFri 4 Aug 2023, 16:20 (3 years ago) parent286e440
2 files changed+109−27
languages.toml+1−1 runtime/queries/t32/highlights.scm+108−26
languages.toml+1−1
@@ -2691,7 +2691,7 @@ indent = { tab-width = 2, unit = " " }
26912691
26922692[[grammar]]
26932693name = "t32"
2694−source = { git = "https://codeberg.org/xasc/tree-sitter-t32", rev = "1dd98248b01e4a3933c1b85b58bab0875e2ba437" }
2694+source = { git = "https://gitlab.com/xasc/tree-sitter-t32", rev = "6da5e3cbabd376b566d04282005e52ffe67ef74a" }
26952695
26962696[[language]]
26972697name = "webc"
runtime/queries/t32/highlights.scm+108−26
@@ -1,3 +1,28 @@
1+; Operators in command and conditional HLL expressions
2+(hll_comma_expression
3+ "," @operator)
4+
5+(hll_conditional_expression
6+ [
7+ "?"
8+ ":"
9+] @operator)
10+
11+
12+; Keywords, punctuation and operators
13+[
14+ "enum"
15+ "struct"
16+ "union"
17+] @keyword.storage.type
18+
19+"sizeof" @keyword.operator
20+
21+[
22+ "const"
23+ "volatile"
24+] @keyword.storage.modifier
25+
126[
227 "="
328 "^^"
@@ -28,49 +53,89 @@
2853 "&"
2954 "->"
3055 "*"
56+ "-="
57+ "+="
58+ "*="
59+ "/="
60+ "%="
61+ "|="
62+ "&="
63+ "^="
64+ ">>="
65+ "<<="
66+ "--"
67+ "++"
3168] @operator
3269
3370[
34− "("
35− ")"
36− "{"
37− "}"
38− "["
39− "]"
71+ "("
72+ ")"
73+ "{"
74+ "}"
75+ "["
76+ "]"
4077] @punctuation.bracket
4178
4279[
4380 ","
4481 "."
45− ";"
4682] @punctuation.delimiter
4783
48−; Constants
84+
85+; Strings and others literal types
86+(access_class) @constant.builtin
87+
4988[
50− (access_class)
5189 (address)
5290 (bitmask)
5391 (file_handle)
54− (frequency)
55− (time)
56−] @constant.builtin
92+ (integer)
93+ (hll_number_literal)
94+] @constant.numeric.integer
5795
5896[
5997 (float)
98+ (frequency)
6099 (percentage)
100+ (time)
61101] @constant.numeric.float
62102
63−(integer) @constant.numeric.integer
64−
65−(character) @constant.character
103+[
104+ (string)
105+ (hll_string_literal)
106+] @string
66107
67−; Strings
68−(string) @string
108+(hll_escape_sequence) @constant.character.escape
69109
70110(path) @string.special.path
71−
72111(symbol) @string.special.symbol
73112
113+[
114+ (character)
115+ (hll_char_literal)
116+] @constant.character
117+
118+
119+; Types in HLL expressions
120+[
121+ (hll_type_identifier)
122+ (hll_type_descriptor)
123+] @type
124+
125+(hll_type_qualifier) @keyword.storage.modifier
126+
127+(hll_primitive_type) @type.builtin
128+
129+
130+; HLL call expressions
131+(hll_call_expression
132+ function: (hll_field_expression
133+ field: (hll_field_identifier) @function))
134+
135+(hll_call_expression
136+ function: (identifier) @function)
137+
138+
74139; Returns
75140(
76141 (command_expression
@@ -83,11 +148,13 @@
83148 (#match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$")
84149)
85150
151+
86152; Subroutine calls
87153(subroutine_call_expression
88154 command: (identifier) @keyword
89155 subroutine: (identifier) @function)
90156
157+
91158; Subroutine blocks
92159(subroutine_block
93160 command: (identifier) @keyword
@@ -97,15 +164,17 @@
97164 label: (identifier) @function
98165 (block))
99166
167+
100168; Parameter declarations
101169(parameter_declaration
102170 command: (identifier) @keyword
103171 (identifier)? @constant.builtin
104172 macro: (macro) @variable.parameter)
105173
174+
106175; Variables, constants and labels
107−(macro) @variable
108−(internal_c_variable) @variable
176+(macro) @variable.builtin
177+(trace32_hll_variable) @variable.builtin
109178
110179(
111180 (command_expression
@@ -116,17 +185,28 @@
116185(labeled_expression
117186 label: (identifier) @label)
118187
188+(option_expression
189+ (identifier) @constant.builtin)
190+
191+(format_expression
192+ (identifier) @constant.builtin)
193+
119194(
120− (argument_list (identifier) @constant.builtin)
121− (#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$")
195+ (argument_list (identifier) @constant.builtin)
196+ (#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$")
122197)
123198(argument_list
124− (identifier) @constant)
199+ (identifier) @constant.builtin)
200+
125201
126202; Commands
127203(command_expression command: (identifier) @keyword)
128204(macro_definition command: (identifier) @keyword)
129205
206+(call_expression
207+ function: (identifier) @function.builtin)
208+
209+
130210; Control flow
131211(if_block
132212 command: (identifier) @keyword.control.conditional.if)
@@ -138,8 +218,10 @@
138218(repeat_block
139219 command: (identifier) @keyword.control.loop)
140220
141−(call_expression
142− function: (identifier) @function)
143221
144−(type_identifier) @type
222+; HLL variables
223+(identifier) @variable
224+(hll_field_identifier) @variable.other.member
225+
226+
145227(comment) @comment