tree-sitter-t32 7.1.3__cp310-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ """Lauterbach TRACE32® script language grammar for Tree-sitter"""
2
+
3
+ from importlib.resources import files as _files
4
+
5
+ from ._binding import language
6
+
7
+
8
+ def _get_query(name, file):
9
+ query = _files(f"{__package__}.queries") / file
10
+ globals()[name] = query.read_text()
11
+ return globals()[name]
12
+
13
+
14
+ def __getattr__(name):
15
+ # NOTE: uncomment these to include any queries that this grammar contains:
16
+
17
+ if name == "HIGHLIGHTS_QUERY":
18
+ return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
19
+ if name == "INJECTIONS_QUERY":
20
+ return _get_query("INJECTIONS_QUERY", "injections.scm")
21
+ if name == "LOCALS_QUERY":
22
+ return _get_query("LOCALS_QUERY", "locals.scm")
23
+ if name == "TAGS_QUERY":
24
+ return _get_query("TAGS_QUERY", "tags.scm")
25
+
26
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
27
+
28
+
29
+ __all__ = [
30
+ "language",
31
+ "HIGHLIGHTS_QUERY",
32
+ "INJECTIONS_QUERY",
33
+ "LOCALS_QUERY",
34
+ "TAGS_QUERY",
35
+ ]
36
+
37
+
38
+ def __dir__():
39
+ return sorted(__all__ + [
40
+ "__all__", "__builtins__", "__cached__", "__doc__", "__file__",
41
+ "__loader__", "__name__", "__package__", "__path__", "__spec__",
42
+ ])
@@ -0,0 +1,10 @@
1
+ from typing import Final
2
+
3
+ # NOTE: uncomment these to include any queries that this grammar contains:
4
+
5
+ HIGHLIGHTS_QUERY: Final[str]
6
+ INJECTIONS_QUERY: Final[str]
7
+ LOCALS_QUERY: Final[str]
8
+ TAGS_QUERY: Final[str]
9
+
10
+ def language() -> object: ...
Binary file
@@ -0,0 +1,27 @@
1
+ #include <Python.h>
2
+
3
+ typedef struct TSLanguage TSLanguage;
4
+
5
+ TSLanguage *tree_sitter_t32(void);
6
+
7
+ static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
8
+ return PyCapsule_New(tree_sitter_t32(), "tree_sitter.Language", NULL);
9
+ }
10
+
11
+ static PyMethodDef methods[] = {
12
+ {"language", _binding_language, METH_NOARGS,
13
+ "Get the tree-sitter language for this grammar."},
14
+ {NULL, NULL, 0, NULL}
15
+ };
16
+
17
+ static struct PyModuleDef module = {
18
+ .m_base = PyModuleDef_HEAD_INIT,
19
+ .m_name = "_binding",
20
+ .m_doc = NULL,
21
+ .m_size = -1,
22
+ .m_methods = methods
23
+ };
24
+
25
+ PyMODINIT_FUNC PyInit__binding(void) {
26
+ return PyModule_Create(&module);
27
+ }
File without changes
@@ -0,0 +1,5 @@
1
+ ;;; SPDX-FileCopyrightText: 2022 Christoph Sax <c_sax@mailbox.org>
2
+ ;;;
3
+ ;;; SPDX-License-Identifier: MIT
4
+
5
+ (block) @fold
@@ -0,0 +1,232 @@
1
+ ;;; SPDX-FileCopyrightText: 2022 Christoph Sax <c_sax@mailbox.org>
2
+ ;;;
3
+ ;;; SPDX-License-Identifier: MIT
4
+
5
+ ; Keywords, punctuation and operators
6
+ [
7
+ "="
8
+ "^^"
9
+ "||"
10
+ "&&"
11
+ "+"
12
+ "-"
13
+ "*"
14
+ "/"
15
+ "%"
16
+ "|"
17
+ "^"
18
+ "=="
19
+ "!="
20
+ ">"
21
+ ">="
22
+ "<="
23
+ "<"
24
+ "<<"
25
+ ">>"
26
+ ".."
27
+ "--"
28
+ "++"
29
+ "+"
30
+ "-"
31
+ "~"
32
+ "!"
33
+ "&"
34
+ "->"
35
+ "*"
36
+ "-="
37
+ "+="
38
+ "*="
39
+ "/="
40
+ "%="
41
+ "|="
42
+ "&="
43
+ "^="
44
+ ">>="
45
+ "<<="
46
+ "--"
47
+ "++"
48
+ ] @operator
49
+
50
+ [
51
+ "("
52
+ ")"
53
+ "{"
54
+ "}"
55
+ "["
56
+ "]"
57
+ ] @punctuation.bracket
58
+
59
+ [
60
+ ","
61
+ "."
62
+ ] @punctuation.delimiter
63
+
64
+ [
65
+ "enum"
66
+ "struct"
67
+ "union"
68
+ ] @keyword
69
+
70
+ "sizeof" @keyword.operator
71
+
72
+ [
73
+ "const"
74
+ "volatile"
75
+ ] @type.qualifier
76
+
77
+ ; Operators in command and conditional HLL expressions
78
+ (hll_comma_expression
79
+ "," @operator)
80
+
81
+ (hll_conditional_expression
82
+ [
83
+ "?"
84
+ ":"
85
+ ] @conditional.ternary)
86
+
87
+ ; Strings and others literal types
88
+ (access_class) @constant.builtin
89
+
90
+ [
91
+ (address)
92
+ (bitmask)
93
+ (file_handle)
94
+ (integer)
95
+ (hll_number_literal)
96
+ ] @number
97
+
98
+ [
99
+ (float)
100
+ (frequency)
101
+ (percentage)
102
+ (time)
103
+ ] @float
104
+
105
+ [
106
+ (string)
107
+ (hll_string_literal)
108
+ ] @string
109
+
110
+ (hll_escape_sequence) @string.escape
111
+
112
+ (path) @string.special
113
+
114
+ [
115
+ (character)
116
+ (hll_char_literal)
117
+ ] @character
118
+
119
+ ; Types in HLL expressions
120
+ [
121
+ (hll_type_identifier)
122
+ (hll_type_descriptor)
123
+ ] @type
124
+
125
+ (hll_type_qualifier) @type.qualifier
126
+
127
+ (hll_primitive_type) @type.builtin
128
+
129
+ ; HLL variables
130
+ (identifier) @variable
131
+ (hll_field_identifier) @field
132
+
133
+ ; HLL call expressions
134
+ (hll_call_expression
135
+ function: (identifier) @function.call)
136
+
137
+ (hll_call_expression
138
+ function: (hll_field_expression
139
+ field: (hll_field_identifier) @function.call))
140
+
141
+ ; Commands
142
+ (command_expression command: (identifier) @keyword)
143
+ (macro_definition command: (identifier) @keyword)
144
+
145
+ (call_expression
146
+ function: (identifier) @function.builtin)
147
+
148
+ ; Returns
149
+ (
150
+ (command_expression
151
+ command: (identifier) @keyword.return)
152
+ (#match? @keyword.return "^[eE][nN][dD]([dD][oO])?$")
153
+ )
154
+ (
155
+ (command_expression
156
+ command: (identifier) @keyword.return)
157
+ (#match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$")
158
+ )
159
+
160
+ ; Subroutine calls
161
+ (subroutine_call_expression
162
+ command: (identifier) @keyword
163
+ subroutine: (identifier) @function.call)
164
+
165
+ ; Variables, constants and labels
166
+ (macro) @variable.builtin
167
+
168
+ (symbol) @variable
169
+
170
+ (argument_list
171
+ (identifier) @constant.builtin)
172
+
173
+ (
174
+ (argument_list (identifier) @constant.builtin)
175
+ (#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$")
176
+ )
177
+
178
+ (
179
+ (symbol) @constant
180
+ (#match? @constant "^\\\\\\\\\\\\[^\\\\]*(\\\\\\\\[^\\\\]*)?(\\\\[^\\\\]*)?$")
181
+ )
182
+
183
+ (
184
+ (symbol) @constant
185
+ (#match? @constant "^\\\\\\\\[^\\\\]*(\\\\[^\\\\]*)?$")
186
+ )
187
+
188
+ (
189
+ (command_expression
190
+ command: (identifier) @keyword
191
+ arguments: (argument_list . (identifier) @label))
192
+ (#match? @keyword "^[gG][oO][tT][oO]$")
193
+ )
194
+
195
+ (labeled_expression
196
+ label: (identifier) @label)
197
+
198
+ (option_expression
199
+ (identifier) @constant.builtin)
200
+
201
+ (format_expression
202
+ (identifier) @constant.builtin)
203
+
204
+ ; Subroutine blocks
205
+ (subroutine_block
206
+ command: (identifier) @keyword.function
207
+ subroutine: (identifier) @function)
208
+
209
+ (labeled_expression
210
+ label: (identifier) @function
211
+ (block))
212
+
213
+ ; Parameter declarations
214
+ (parameter_declaration
215
+ command: (identifier) @keyword
216
+ (identifier)? @constant.builtin
217
+ macro: (macro) @variable.parameter)
218
+
219
+ ; Control flow
220
+ (if_block
221
+ command: (identifier) @conditional)
222
+ (elif_block
223
+ command: (identifier) @conditional)
224
+ (else_block
225
+ command: (identifier) @conditional)
226
+
227
+ (while_block
228
+ command: (identifier) @repeat)
229
+ (repeat_block
230
+ command: (identifier) @repeat)
231
+
232
+ (comment) @comment
@@ -0,0 +1,5 @@
1
+ ;;; SPDX-FileCopyrightText: 2022 Christoph Sax <c_sax@mailbox.org>
2
+ ;;;
3
+ ;;; SPDX-License-Identifier: MIT
4
+
5
+ (comment) @comment
@@ -0,0 +1,39 @@
1
+ ;;; SPDX-FileCopyrightText: 2022 Christoph Sax <c_sax@mailbox.org>
2
+ ;;;
3
+ ;;; SPDX-License-Identifier: MIT
4
+
5
+ (block) @local.scope
6
+
7
+ ; Parameter definitions
8
+ (parameter_declaration
9
+ command: (identifier)
10
+ macro: (macro) @local.definition)
11
+
12
+ ; Variable definitions
13
+ (macro_definition
14
+ command: (identifier)
15
+ macro: (macro) @local.definition)
16
+
17
+ (command_expression
18
+ command: (identifier)
19
+ arguments: (argument_list
20
+ declarator: (symbol) @local.definition))
21
+
22
+ ; Function definitions
23
+ (subroutine_block
24
+ command: (identifier)
25
+ subroutine: (identifier) @local.definition)
26
+
27
+ (labeled_expression
28
+ label: (identifier) @local.definition
29
+ (block))
30
+
31
+ ; References
32
+ (subroutine_call_expression
33
+ command: (identifier)
34
+ subroutine: (identifier) @local.reference)
35
+
36
+ [
37
+ (macro)
38
+ (symbol)
39
+ ] @local.reference
@@ -0,0 +1,17 @@
1
+ ;;; SPDX-FileCopyrightText: 2022 Christoph Sax <c_sax@mailbox.org>
2
+ ;;;
3
+ ;;; SPDX-License-Identifier: MIT
4
+
5
+ ; Subroutine definitions
6
+ (subroutine_block
7
+ command: (identifier)
8
+ subroutine: (identifier) @name) @definition.function
9
+
10
+ (labeled_expression
11
+ label: (identifier) @name
12
+ (block)) @definition.function
13
+
14
+ ; Subroutine calls
15
+ (subroutine_call_expression
16
+ command: (identifier)
17
+ subroutine: (identifier) @name) @reference.call
@@ -0,0 +1,458 @@
1
+ Metadata-Version: 2.4
2
+ Name: tree-sitter-t32
3
+ Version: 7.1.3
4
+ Summary: Lauterbach TRACE32® script language grammar for Tree-sitter
5
+ Author-email: Christoph Sax <c_sax@mailbox.org>
6
+ License-Expression: MIT AND BSD-2-Clause
7
+ Project-URL: Homepage, https://codeberg.org/xasc/tree-sitter-t32
8
+ Project-URL: Repository, https://codeberg.org/xasc/tree-sitter-t32.git
9
+ Project-URL: Issues, https://codeberg.org/xasc/tree-sitter-t32/issues
10
+ Project-URL: Changelog, https://codeberg.org/xasc/tree-sitter-t32/src/branch/main/CHANGELOG.md
11
+ Keywords: lexer,incremental,parsing,tree-sitter,trace32,t32,lauterbach,practice
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Compilers
14
+ Classifier: Topic :: Software Development :: Debuggers
15
+ Classifier: Topic :: Text Processing :: Linguistic
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSES/BSD-2-Clause.txt
20
+ License-File: LICENSES/MIT.txt
21
+ Provides-Extra: core
22
+ Requires-Dist: tree-sitter~=0.25; extra == "core"
23
+ Dynamic: license-file
24
+
25
+ <!--
26
+ SPDX-FileCopyrightText: 2022 Christoph Sax <c_sax@mailbox.org>
27
+
28
+ SPDX-License-Identifier: MIT
29
+ -->
30
+
31
+ # tree-sitter-t32
32
+ [![CI Status](https://ci.codeberg.org/api/badges/xasc/tree-sitter-t32/status.svg)](https://ci.codeberg.org/xasc/tree-sitter-t32)
33
+ [![status-badge](https://ci.codeberg.org/api/badges/14550/status.svg?branch=dev)](https://ci.codeberg.org/repos/14550/branches/dev)
34
+
35
+ Lauterbach TRACE32® script language grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
36
+ Support for HLL expressions was adapted from [tree-sitter-c](https://github.com/tree-sitter/tree-sitter-c.git).
37
+
38
+ A demo is available [here](https://xasc.codeberg.page/tree-sitter-t32-playground/).
39
+
40
+ ## Features
41
+
42
+ - Full coverage of the PRACTICE script language including TRACE32® commands & functions
43
+ - Extended support for HLL expressions
44
+
45
+
46
+ ## Quick Start
47
+
48
+ ### Dependencies
49
+
50
+ - [Tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/blob/master/cli/README.md) for generating the parser from the grammar.
51
+ - A C compiler
52
+ - [Make](https://www.gnu.org/software/make/manual) [optional]
53
+ - [Yarn](https://yarnpkg.com/) [optional]
54
+
55
+
56
+ ### Commands
57
+
58
+ #### Generate parser
59
+
60
+ Create and build the tree-sitter parser for the TRACE32® grammar.
61
+ ```bash
62
+ tree-sitter generate
63
+ ```
64
+
65
+ #### Parse TRACE32® Script
66
+
67
+ <details>
68
+
69
+ <summary>Use tree-sitter to parse a TRACE32® script.</summary>
70
+
71
+ Example:
72
+
73
+ ```
74
+ ; --------------------------------------------------------------------------------
75
+ ; @Title: Beautify an existing PRACTICE script
76
+ ; @Description:
77
+ ; Beautifies the script, fixing the CamelCasing and indentation.
78
+ ; @Keywords: PRACTICE, EDIT.FORMAT, CamelCasing, indent, beautify
79
+ ; @Author: MOB
80
+ ; @Copyright: (C) 1989-2020 Lauterbach GmbH, licensed for use with TRACE32(R) only
81
+ ; --------------------------------------------------------------------------------
82
+ ; $Id: beautify.cmm 19661 2022-07-29 15:43:03Z rweiss $
83
+
84
+ PARAMETERS &script
85
+
86
+ IF "&script"==""
87
+ (
88
+ DIALOG.File.open *.cmm
89
+ ENTRY %LINE &script
90
+ )
91
+
92
+ IF FILE.EXIST("&script")
93
+ (
94
+ ECHO %COLOR.GRAY "beautifying: &script"
95
+ SETUP.EDITOR.TYPE PowerView ; required for EDIT.FORMAT
96
+ PEDIT "&script"
97
+ EDIT.FORMAT /Beautify
98
+ EDIT.SAVE "&script"
99
+ EDIT.CLOSE "&script"
100
+ ECHO %COLOR.GREEN "beautified: &script"
101
+ )
102
+ ELSE
103
+ (
104
+ ECHO %ERROR "Error: no such file: &script"
105
+ )
106
+
107
+ ENDDO
108
+ ```
109
+
110
+ </details>
111
+
112
+ ```bash
113
+ tree-sitter parse <path>
114
+ ```
115
+
116
+ <details>
117
+
118
+ <summary>Prints the syntax tree</summary>
119
+
120
+ ```
121
+ (script [0, 0] - [34, 0]
122
+ (comment [0, 0] - [1, 0])
123
+ (comment [1, 0] - [2, 0])
124
+ (comment [2, 0] - [3, 0])
125
+ (comment [3, 0] - [4, 0])
126
+ (comment [4, 0] - [5, 0])
127
+ (comment [5, 0] - [6, 0])
128
+ (comment [6, 0] - [7, 0])
129
+ (comment [7, 0] - [8, 0])
130
+ (comment [8, 0] - [9, 0])
131
+ (parameter_declaration [10, 0] - [11, 0]
132
+ command: (identifier [10, 0] - [10, 10])
133
+ macro: (macro [10, 11] - [10, 18]))
134
+ (if_block [12, 0] - [18, 0]
135
+ command: (identifier [12, 0] - [12, 2])
136
+ condition: (binary_expression [12, 3] - [12, 16]
137
+ left: (string [12, 3] - [12, 12]
138
+ (macro [12, 4] - [12, 11]))
139
+ right: (string [12, 14] - [12, 16]))
140
+ (block [13, 0] - [17, 0]
141
+ (command_expression [14, 2] - [15, 0]
142
+ command: (identifier [14, 2] - [14, 18])
143
+ arguments: (argument_list [14, 18] - [14, 24]
144
+ (path [14, 19] - [14, 24])))
145
+ (parameter_declaration [15, 2] - [16, 0]
146
+ command: (identifier [15, 2] - [15, 7])
147
+ (identifier [15, 8] - [15, 13])
148
+ macro: (macro [15, 14] - [15, 21]))))
149
+ (if_block [18, 0] - [32, 0]
150
+ command: (identifier [18, 0] - [18, 2])
151
+ condition: (call_expression [18, 3] - [18, 24]
152
+ function: (identifier [18, 3] - [18, 13])
153
+ arguments: (argument_list [18, 13] - [18, 24]
154
+ (string [18, 14] - [18, 23]
155
+ (macro [18, 15] - [18, 22]))))
156
+ (block [19, 0] - [28, 0]
157
+ (command_expression [20, 2] - [21, 0]
158
+ command: (identifier [20, 2] - [20, 6])
159
+ arguments: (argument_list [20, 6] - [20, 41]
160
+ (format_expression [20, 7] - [20, 18]
161
+ value: (identifier [20, 8] - [20, 13])
162
+ value: (identifier [20, 14] - [20, 18]))
163
+ (string [20, 19] - [20, 41]
164
+ (macro [20, 33] - [20, 40]))))
165
+ (command_expression [21, 2] - [22, 0]
166
+ command: (identifier [21, 2] - [21, 19])
167
+ arguments: (argument_list [21, 19] - [21, 29]
168
+ (identifier [21, 20] - [21, 29]))
169
+ (comment [21, 29] - [22, 0]))
170
+ (command_expression [22, 2] - [23, 0]
171
+ command: (identifier [22, 2] - [22, 7])
172
+ arguments: (argument_list [22, 7] - [22, 17]
173
+ (string [22, 8] - [22, 17]
174
+ (macro [22, 9] - [22, 16]))))
175
+ (command_expression [23, 2] - [24, 0]
176
+ command: (identifier [23, 2] - [23, 13])
177
+ arguments: (argument_list [23, 13] - [23, 23]
178
+ (option_expression [23, 14] - [23, 23]
179
+ option: (identifier [23, 15] - [23, 23]))))
180
+ (command_expression [24, 2] - [25, 0]
181
+ command: (identifier [24, 2] - [24, 11])
182
+ arguments: (argument_list [24, 11] - [24, 21]
183
+ (string [24, 12] - [24, 21]
184
+ (macro [24, 13] - [24, 20]))))
185
+ (command_expression [25, 2] - [26, 0]
186
+ command: (identifier [25, 2] - [25, 12])
187
+ arguments: (argument_list [25, 12] - [25, 22]
188
+ (string [25, 13] - [25, 22]
189
+ (macro [25, 14] - [25, 21]))))
190
+ (command_expression [26, 2] - [27, 0]
191
+ command: (identifier [26, 2] - [26, 6])
192
+ arguments: (argument_list [26, 6] - [26, 41]
193
+ (format_expression [26, 7] - [26, 19]
194
+ value: (identifier [26, 8] - [26, 13])
195
+ value: (identifier [26, 14] - [26, 19]))
196
+ (string [26, 20] - [26, 41]
197
+ (macro [26, 33] - [26, 40])))))
198
+ (else_block [28, 0] - [32, 0]
199
+ command: (identifier [28, 0] - [28, 4])
200
+ (block [29, 0] - [32, 0]
201
+ (command_expression [30, 2] - [31, 0]
202
+ command: (identifier [30, 2] - [30, 6])
203
+ arguments: (argument_list [30, 6] - [30, 44]
204
+ (format_expression [30, 7] - [30, 13]
205
+ value: (identifier [30, 8] - [30, 13]))
206
+ (string [30, 14] - [30, 44]
207
+ (macro [30, 36] - [30, 43])))))))
208
+ (command_expression [33, 0] - [34, 0]
209
+ command: (identifier [33, 0] - [33, 5])))
210
+ ```
211
+
212
+ </details>
213
+
214
+ #### Highlight TRACE32® Script
215
+
216
+ Use tree-sitter to highlight a TRACE32® script.
217
+ ```bash
218
+ tree-sitter highlight <path>
219
+ ```
220
+
221
+ <details>
222
+
223
+ <summary>Prints the highlighted file</summary>
224
+
225
+ [![asciicast](https://asciinema.org/a/fY05yHO74XYG6vPngFG3zAgUb.svg)](https://asciinema.org/a/fY05yHO74XYG6vPngFG3zAgUb)
226
+
227
+ </details>
228
+
229
+ #### Create Code Navigation Tags
230
+
231
+ <details>
232
+
233
+ <summary>Use tree-sitter to create a tags file from a TRACE32® script.</summary>
234
+
235
+ ```
236
+ ; --------------------------------------------------------------------------------
237
+ ; @Title: Example test case for Unittests
238
+ ; @Description:
239
+ ; This is an example for a test case which can be executed with lbunit.cmm.
240
+ ; @Keywords: lbtest test case
241
+ ; @Author: MOB
242
+ ; @Copyright: (C) 1989-2015 Lauterbach GmbH, licensed for use with TRACE32(R) only
243
+ ; --------------------------------------------------------------------------------
244
+ ; $Id: test_example.cmm 8648 2015-09-03 17:04:05Z mobermeir $
245
+
246
+ ; the following block must be present in the beginning of every test case
247
+ PRIVATE &func &args &result
248
+ ENTRY &func %LINE &args
249
+ GOSUB &func &args // call subroutine and return result
250
+ ENTRY %LINE &result
251
+ ENDDO &result
252
+ ; end of mandatory block
253
+
254
+ ; SetupTestCase will be called once at the beginning of the test case
255
+ ; It can be removed if it is not needed.
256
+ SetupTestCase:
257
+ (
258
+ PRIVATE &date
259
+ &date=DATE.DATE()+" "+DATE.TIME()
260
+ PUTS "test case started at: &date"
261
+ RETURN
262
+ )
263
+
264
+ ; SetupTest will be called just before every test
265
+ ; It can be removed if it is not needed.
266
+ SetupTest:
267
+ (
268
+ ; here can be some setup
269
+ Data.Set VM:0x0--0xFF 0xA
270
+ RETURN
271
+ )
272
+
273
+ ; All tests must start with "Test_"
274
+ Test_MyFirstTest:
275
+ (
276
+ ; Assertions can be used:
277
+ A_FALSE FALSE()
278
+ A_TRUE (1.+1.==2.)
279
+ RETURN
280
+ )
281
+
282
+ Test_MySecondTest:
283
+ (
284
+ A_NUM_EQ 0xA Data.Byte(VM:0x0)
285
+ A_X_PASS Data.Set VM:0x0 0xB
286
+ A_NUM_EQ 0xB Data.Byte(VM:0x0)
287
+ RETURN
288
+ )
289
+
290
+ Test_MyThirdTest:
291
+ (
292
+ ; Tests can return "PASS", "FAIL" or "NOT_EXEC"
293
+ ; (alternatively or in addition to assertions)
294
+ IF (0xA!=Data.Byte(VM:0x0))
295
+ (
296
+ RETURN "FAIL"
297
+ )
298
+ ELSE IF (0xB==Data.Byte(VM:0x0))
299
+ (
300
+ RETURN "NOT_EXEC"
301
+ )
302
+ ELSE
303
+ (
304
+ RETURN "PASS"
305
+ )
306
+ RETURN // same as "PASS"
307
+ )
308
+
309
+ MyHelper:
310
+ (
311
+ A_NUM_EQ 0xA Data.Byte(VM:0x10)
312
+ RETURN
313
+ )
314
+
315
+ Test_MyFourthTest:
316
+ (
317
+ ; tests can call helper functions
318
+ RePeaT 2.
319
+ (
320
+ GOSUB MyHelper
321
+ )
322
+ RETURN
323
+ )
324
+
325
+ DisabledTest_MyFifthTest:
326
+ (
327
+ ; this routine will not be executed since it doesn't start with "Test_"
328
+ RETURN
329
+ )
330
+
331
+ ; TearDownTest will be called just after every test
332
+ ; It can be removed if it is not needed.
333
+ TearDownTest:
334
+ (
335
+ ; here could be some cleanup
336
+ Break.RESet
337
+ RETURN
338
+ )
339
+
340
+ ; TearDownTestCase will be called once at the end of the test case
341
+ ; It can be removed if it is not needed.
342
+ TearDownTestCase:
343
+ (
344
+ PRIVATE &date
345
+ &date=DATE.DATE()+" "+DATE.TIME()
346
+ PUTS "test case ended at: &date"
347
+ RETURN
348
+ )
349
+ ```
350
+
351
+ </details>
352
+
353
+ ```bash
354
+ tree-sitter tags <path>
355
+ ```
356
+
357
+ <details>
358
+
359
+ <summary>Prints a list of tags</summary>
360
+
361
+ ```
362
+ func | call ref (13, 7) - (13, 11) `GOSUB &func &args // call subroutine and return result`
363
+ SetupTestCase | function def (20, 0) - (20, 13) `SetupTestCase:`
364
+ SetupTest | function def (30, 0) - (30, 9) `SetupTest:`
365
+ Test_MyFirstTest | function def (38, 0) - (38, 16) `Test_MyFirstTest:`
366
+ Test_MySecondTest | function def (46, 0) - (46, 17) `Test_MySecondTest:`
367
+ Test_MyThirdTest | function def (54, 0) - (54, 16) `Test_MyThirdTest:`
368
+ MyHelper | function def (73, 0) - (73, 8) `MyHelper:`
369
+ Test_MyFourthTest | function def (79, 0) - (79, 17) `Test_MyFourthTest:`
370
+ MyHelper | call ref (84, 10) - (84, 18) `GOSUB MyHelper`
371
+ DisabledTest_MyFifthTest | function def (89, 0) - (89, 24) `DisabledTest_MyFifthTest:`
372
+ TearDownTest | function def (97, 0) - (97, 12) `TearDownTest:`
373
+ TearDownTestCase | function def (106, 0) - (106, 16) `TearDownTestCase:`
374
+ ```
375
+
376
+ </details>
377
+
378
+
379
+ ## Development
380
+
381
+ There is a makefile to simplify the most common activities. The makefile expects you to have Yarn installed and set up.
382
+
383
+ To build the parser from the grammar:
384
+
385
+ make build
386
+
387
+
388
+ To run all tests:
389
+
390
+ make test-all
391
+
392
+
393
+ ## Editor Support
394
+
395
+ | Editor | Plugin | Syntax Highlighting | Local Variables | Folds | Indents |
396
+ | ------------- | ------------- | :-----------------: | :--------------: | :----: | :------: |
397
+ | [Neovim](https://github.com/neovim/neovim) | [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) | ✓ | ✓ | ✓ | ✓ |
398
+ | [Helix](https://github.com/helix-editor/helix/tree/master) | | ✓ | | | |
399
+
400
+ ### nvim-treesitter
401
+
402
+ Run
403
+ ```vim
404
+ :TSInstall t32
405
+ ```
406
+ to automatically install the supported grammar.
407
+
408
+ ## Limitations
409
+
410
+ - `(symbol)` nodes that represent an unquoted module, like `\module`, cannot be
411
+ differentiated from user-defined TRACE32 internal HLL variables, e.g. `\x`.
412
+ - `(symbol)` nodes that depend on the hex radix mode cannot always be
413
+ kept apart from `(address)` nodes, e.g. `P:A::B:0x800`. To avoid conflicts always add
414
+ the radix mode to the number.
415
+ - Commands from the `Var` command group that contain multiple chained
416
+ `(format_expression) (_hll_expression)` blocks
417
+ - Unquoted `(path)` nodes are not clearly distinguishable from other literal types
418
+ in command argument lists.
419
+ - For HLL expressions used at the top level of commands, the use of spaces is more restricted
420
+ than for nested expressions inside parentheses. The grammar only models the strict behavior.
421
+ - `(recursive_macro_expansion)` nodes are restricted to the left-hand side of assignment
422
+ expressions. In other contexts, recursive PRACTICE macro expansions cannot be distinguished
423
+ from `&&` operators.
424
+
425
+
426
+ ## Packages
427
+
428
+ | Language | Package | Download |
429
+ | ------------- | ----------------------------------------------------- | ----------------------------------------------------- |
430
+ | Node.js | [npm](https://www.npmjs.com/package/tree-sitter-t32) | |
431
+ | Python | [PyPI](https://pypi.org/project/tree-sitter-t32/) | [📦](https://pypi.org/project/tree-sitter-t32/#files) |
432
+ | Rust | [crates.io](https://crates.io/crates/tree-sitter-t32) | |
433
+
434
+
435
+ ## Mirrors
436
+
437
+ This repository is mirrored to https://gitlab.com/xasc/tree-sitter-t32 and https://github.com/xasc/tree-sitter-t32.
438
+ The main repository is https://codeberg.org/xasc/tree-sitter-t32.
439
+
440
+
441
+ ## Contributing
442
+
443
+ For the time being, we are not accepting pull requests.
444
+ However, please feel free to open issues for changes you would like to see.
445
+
446
+
447
+ ## License
448
+
449
+ Distributed under the MIT license.
450
+ [REUSE](https://reuse.software/) is used for managing licensing information throughout the project.
451
+ For more accurate licensing information, please check the individual files.
452
+
453
+
454
+ ## References
455
+
456
+ - [PRACTICE Script Language User’s Guide](https://www.lauterbach.com/pdf/practice_user.pdf)
457
+ - [Training Script Language PRACTICE](https://www.lauterbach.com/pdf/training_practice.pdf)
458
+ - [PowerView User’s Guide](https://www.lauterbach.com/pdf/ide_user.pdf)
@@ -0,0 +1,16 @@
1
+ tree_sitter_t32/__init__.py,sha256=uv_kENJVeIPowj8m8fOnpvhy4zZKSiAwj9vUBg3sF4c,1203
2
+ tree_sitter_t32/__init__.pyi,sha256=Qg9EJ5GkVd0ESHgk7RXdYiDLQY7xmPdePMhXJi_LVfQ,249
3
+ tree_sitter_t32/_binding.pyd,sha256=Suy-5XqQUsGWRqs7tQUTx6RFqfy4-Femtk8kgQhwNdM,737792
4
+ tree_sitter_t32/binding.c,sha256=psljjb2dNqulGu98yTX8Ey_qQHtf-jGq2UGqiS1HZdc,704
5
+ tree_sitter_t32/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ tree_sitter_t32/queries/folds.scm,sha256=YTHnBmC6ZF8rGQu8Eu9zalbFrJQAupU6URAizqCsO3Q,124
7
+ tree_sitter_t32/queries/highlights.scm,sha256=F5gklTmI_V8aynQu6KmAe5n_nwig8OmfkJvLix9QlJQ,3776
8
+ tree_sitter_t32/queries/injections.scm,sha256=A_2BLErD3OPfUnt_xnHQV6BL_6jyFGHe1mpIzc1YY0w,129
9
+ tree_sitter_t32/queries/locals.scm,sha256=UKXaAUdGy5XtWKQDBUsSMavShy5zwtwgfVsvGWKs1Tc,831
10
+ tree_sitter_t32/queries/tags.scm,sha256=RZkMOcIMwQPsqSnaKz1ApFHmshLthpUnbrntRDsukSM,447
11
+ tree_sitter_t32-7.1.3.dist-info/licenses/LICENSES/BSD-2-Clause.txt,sha256=OteYAUji6VQ2fPlBkFnC2Tns6JqM9HLMKFrUBaVGnXE,1276
12
+ tree_sitter_t32-7.1.3.dist-info/licenses/LICENSES/MIT.txt,sha256=1iZ47UxxKksz8EN5DyiwCo10mGw-uk4BsG8bp2fcqrw,1087
13
+ tree_sitter_t32-7.1.3.dist-info/METADATA,sha256=pWK6oALaqqaSRuD2jB7p7J-l22Tyvssw2nX-rSat92E,15255
14
+ tree_sitter_t32-7.1.3.dist-info/WHEEL,sha256=OJ2zpOfp3Fst0GC5jHtFuY8tAf46LLgZ9O920dE4b3c,100
15
+ tree_sitter_t32-7.1.3.dist-info/top_level.txt,sha256=EOrvIcdrNOZfzqM-erCWmOVRF-MtpDsKKCEIEzPI1jo,25
16
+ tree_sitter_t32-7.1.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-abi3-win_amd64
5
+
@@ -0,0 +1,9 @@
1
+ Copyright (c) <year> <owner>
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ _binding
2
+ tree_sitter_t32