on master help sign in
Add support for language t32 (#7140)

Co-authored-by: Christoph Sax <christoph.sax@mailbox.org>

commitd324feb07244e0649229b845a92f0d0b8a0ecaf4 authorChristoph Sax <xasc@users.noreply.github.com> dateThu 8 Jun 2023, 01:01 (3 years ago) parent352d157
4 files changed+161
book/src/generated/lang-support.md+1 languages.toml+13 runtime/queries/t32/highlights.scm+145 runtime/queries/t32/injections.scm+2
book/src/generated/lang-support.md+1
@@ -143,6 +143,7 @@
143143| svelte | ✓ | | | `svelteserver` |
144144| sway | ✓ | ✓ | ✓ | `forc` |
145145| swift | ✓ | | | `sourcekit-lsp` |
146+| t32 | ✓ | | | |
146147| tablegen | ✓ | ✓ | ✓ | |
147148| task | ✓ | | | |
148149| tfvars | ✓ | | ✓ | `terraform-ls` |
languages.toml+13
@@ -2605,3 +2605,16 @@ indent = { tab-width = 3, unit = " " }
26052605[[grammar]]
26062606name = "forth"
26072607source = { git = "https://github.com/alexanderbrevig/tree-sitter-forth", rev = "c6fae50a17763af827604627c0fa9e4604aaac0b" }
2608+
2609+[[language]]
2610+name = "t32"
2611+scope = "source.t32"
2612+injection-regex = "t32"
2613+file-types = ["cmm", "t32"]
2614+roots = []
2615+comment-token = ";"
2616+indent = { tab-width = 2, unit = " " }
2617+
2618+[[grammar]]
2619+name = "t32"
2620+source = { git = "https://codeberg.org/xasc/tree-sitter-t32", rev = "1dd98248b01e4a3933c1b85b58bab0875e2ba437" }
runtime/queries/t32/highlights.scmnew file+145
@@ -0,0 +1,145 @@
1+[
2+ "="
3+ "^^"
4+ "||"
5+ "&&"
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+] @operator
32+
33+[
34+ "("
35+ ")"
36+ "{"
37+ "}"
38+ "["
39+ "]"
40+] @punctuation.bracket
41+
42+[
43+ ","
44+ "."
45+ ";"
46+] @punctuation.delimiter
47+
48+; Constants
49+[
50+ (access_class)
51+ (address)
52+ (bitmask)
53+ (file_handle)
54+ (frequency)
55+ (time)
56+] @constant.builtin
57+
58+[
59+ (float)
60+ (percentage)
61+] @constant.numeric.float
62+
63+(integer) @constant.numeric.integer
64+
65+(character) @constant.character
66+
67+; Strings
68+(string) @string
69+
70+(path) @string.special.path
71+
72+(symbol) @string.special.symbol
73+
74+; Returns
75+(
76+ (command_expression
77+ command: (identifier) @keyword.return)
78+ (#match? @keyword.return "^[eE][nN][dD]([dD][oO])?$")
79+)
80+(
81+ (command_expression
82+ command: (identifier) @keyword.return)
83+ (#match? @keyword.return "^[rR][eE][tT][uU][rR][nN]$")
84+)
85+
86+; Subroutine calls
87+(subroutine_call_expression
88+ command: (identifier) @keyword
89+ subroutine: (identifier) @function)
90+
91+; Subroutine blocks
92+(subroutine_block
93+ command: (identifier) @keyword
94+ subroutine: (identifier) @function)
95+
96+(labeled_expression
97+ label: (identifier) @function
98+ (block))
99+
100+; Parameter declarations
101+(parameter_declaration
102+ command: (identifier) @keyword
103+ (identifier)? @constant.builtin
104+ macro: (macro) @variable.parameter)
105+
106+; Variables, constants and labels
107+(macro) @variable
108+(internal_c_variable) @variable
109+
110+(
111+ (command_expression
112+ command: (identifier) @keyword
113+ arguments: (argument_list . (identifier) @label))
114+ (#match? @keyword "^[gG][oO][tT][oO]$")
115+)
116+(labeled_expression
117+ label: (identifier) @label)
118+
119+(
120+ (argument_list (identifier) @constant.builtin)
121+ (#match? @constant.builtin "^[%/][a-zA-Z][a-zA-Z0-9.]*$")
122+)
123+(argument_list
124+ (identifier) @constant)
125+
126+; Commands
127+(command_expression command: (identifier) @keyword)
128+(macro_definition command: (identifier) @keyword)
129+
130+; Control flow
131+(if_block
132+ command: (identifier) @keyword.control.conditional.if)
133+(else_block
134+ command: (identifier) @keyword.control.control.else)
135+
136+(while_block
137+ command: (identifier) @keyword.control.repeat.while)
138+(repeat_block
139+ command: (identifier) @keyword.control.loop)
140+
141+(call_expression
142+ function: (identifier) @function)
143+
144+(type_identifier) @type
145+(comment) @comment
runtime/queries/t32/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))