-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarget.sublime-syntax
executable file
·275 lines (236 loc) · 9.08 KB
/
target.sublime-syntax
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- tmc
- tmh
- ttm
scope: source.tmc
name: T.A.R.G.E.T. Script
comment: I don't really know what I'm doing in here but it seems to work. -- Zander
first_line_match: include '"'target.tmh'"'
variables:
reservedFunctions: '(?:Configure|Init|EventHandle|SetKBRate|SetKBLayout|DefaultMapping|MapAxis|MapKey|MapKeyIO|MapKeyUMD|MapKeyIOUMD|MapKeyR|MapKeyRIO|MapKeyRUMD|MapKeyRIOUMD|RotateDXAxis|ActKey|KeyAxis|LockAxis|SetShiftButton|SetSCurve|SetJCurve|SetCustomCurve|TrimDXAxis|printf|DeferCall)'
reservedSubFunctions: '(?:LED|TEMPO|CHAIN|D|SEQ|LIST|AXIS|SET|AXMAP1|AXMAP2)'
reference: '(?:Joystick|JoystickF18|HCougar|JoystickF18|T16000|T16000L|Throttle|TWCSThrottle|TFRPHARudder|TFRPRudder|LMFD|RMFD)'
definedDirectX: '(?:DX_X_AXIS|DX_Y_AXIS|DX_Z_AXIS|DX_XROT_AXIS|DX_YROT_AXIS|DX_ZROT_AXIS|DX_SLIDER_AXIS|DX_THROTTLE_AXIS|DXHATUP|DXHATUPRIGHT|DXHATRIGHT|DXHATDOWNRIGHT|DXHATDOWN|DXHATDOWNLEFT|DXHATLEFT|DXHATUPLEFT)'
defined: '(?:JOYX|JOYY|MOUSE_X_AXIS|MOUSE_Y_AXIS|AXIS_NORMAL|AXIS_REVERSED|MAP_ABSOLUTE|MAP_RELATIVE|LED_ONOFF|LED_INTENSITY)'
definedKeys: '(?:L_CTL|R_CTL|L_SHIFT|R_SHIFT|L_ALT|R_ALT|L_WIN|R_WIN|ESC|PRNTSCRN|SCRLCK|BRK|BSP|TAB|ENT|SPC|INS|HOME|PGUP|DEL|END|PGDN|UARROW|DARROW|LARROW|RARROW|NUML|KPENT|})'
definedA10: '(?:THR_LEFT|THR_RIGHT|SCX|SCY|THR_FC|TG1|TG2|S1|S2|S3|S4|H1U|H1D|H1L|H1R|H2U|H2D|H2L|H2R|H3U|H3D|H3L|H3R|H4P|H4U|H4D|H4L|H4R|FLAPU|FLAPM|FLAPD|EACON|EACOFF|RDRNRM|RDRDIS|APENG|APDIS|APPAT|APAH|APALT|LDGH|EOLIGN|EORIGN|EOLNORM|EORNORM|EOLMOTOR|EORMOTOR|EFLNORM|EFRNORM|EFLOVER|EFROVER|CHF|CHM|CHB|BSF|BSM|BSB|SPDF|SPDM|SPDB|MSP|MSU|MSD|MSL|MSR|CSU|CSD|CSL|CSR|SC|LTB|PSF|PSM|PSB|APUON|APUOFF|IDLELON|IDLERON|IDLELOFF|IDLEROFF)'
definedF16: '(?:RUDDER|THROTTLE|RDR_X|RDR_Y|MAN_RNG|ANT_ELEV)'
definedT16000M: '(?:RUDDER|THROTTLE)'
definedOther: '(?:MODE_EXCLUDED|KB_ENG)'
basic_types: 'asm|__asm__|auto|bool|_Bool|char|_Complex|double|float|_Imaginary|int|long|short|signed|unsigned|void|alias'
control_keywords: 'break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while'
tm_keywords: 'PULSE|KEYON|LOCK|DOWN|UP|LED_CURRENT|CURRENT|IOTOGGLE|UDTOGGLE|MODE_EXCLUDED'
identifier: \b[[:alpha:]_][[:alnum:]_]*\b # upper and lowercase
before_tag: 'struct|union|enum'
contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
- include: comment
main:
# The main context is the initial starting point of our syntax.
# Include other contexts from here (or specify them directly).
- include: keyword
- include: number
- include: late-expressions
- include: operators
- include: access-illegal
- include: types
- include: variables
- include: block
- match: \'
push: character
scope: punctuation.definition.character.begin
# TODO: The EXEC function should have standard C++ syntax within its parenthesis.
- match: EXEC\(\"
scope: constant.language.tmc
embed: main
escape: \"\)
escape_captures:
0: constant.language.tmc
- match: (REXEC\()(\d),\s*(\d+),\s*(\")
captures:
1: constant.language.tmc
2: constant.language.tmc
3: constant.language.tmc
4: constant.language.tmc
5: constant.language.tmc
embed: main
escape: \"\)
escape_captures:
0: constant.language.tmc
- match: system\(\"
scope: constant.language.tmc
push: Packages/Batch File/Batch File.sublime-syntax
with_prototype:
- match: \"\)
scope: constant.language.tmc
pop: true
- match: \b({{reservedFunctions}})\b
scope: variable.function.tmc
- match: \b({{reservedSubFunctions}})\b
scope: variable.language.tmc
- match: \b({{definedKeys}}|{{definedDirectX}})\b|F[1-1][0-2]|F[1-9]|DX[3-3][0-2]|DX[1-2][0-9]|DX[1-9]|KP[0-9]
scope: variable.parameter.tmc
- match: USB\[0x([0-9]|[A-F])([0-9]|[A-F])\]
scope: variable.parameter.tmc
- match: \b({{defined}}|{{definedA10}}|{{definedF16}}|{{definedT16000M}}|{{definedOther}})\b|LED[1-5]
scope: storage.type.struct.tmc
- match: \b({{reference}})\b
scope: variable.language.tmc
- match: \"
push: string
scope: punctuation.definition.string.begin
- match: \(
push: parenthesis
scope: punctuation.section.group.begin.tmc
- match: \)
scope: invalid.illegal.stray-bracket-end
- match: \[
push: brackets
scope: punctuation.section.bracket.begin.tmc
- match: \]
scope: invalid.illegal.stray-bracket-end
- match: \{
push: braces
scope: punctuation.section.block.begin.tmc
- match: \}
scope: invalid.illegal.stray-bracket-end
- match: \<
push: tribracket
scope: punctuation.section.tribracket.end.tmc
- match: \>
scope: invalid.illegal.stray-bracket-end
- match: "\\b(include)\\b|\\b(define)\\b"
scope: keyword.control.include.tmc
keyword:
# Keywords are if, else for and while.
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\b({{control_keywords}}|{{tm_keywords}})\b'
scope: keyword.control.tmc
number:
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.tmc
string:
- meta_scope: string.quoted.double.tmc
- match: \\xa|\\.
scope: constant.character.escape.tmc
- meta_include_prototype: false
- match: \"
scope: punctuation.definition.string.end
pop: true
character:
# Characters begin and end with single quotes
- meta_scope: string.quoted.single.tmc
- meta_include_prototype: false
- match: \'
scope: punctuation.definition.character.end
pop: true
comment:
- match: ^/\* =(\s*.*?)\s*= \*/$\n?
scope: comment.block.tmc
captures:
1: meta.toc-list.banner.block.tmc
- match: /\*
scope: punctuation.definition.comment.begin
push:
- meta_scope: comment.block.tmc
- match: \*/
scope: punctuation.definition.comment.end
pop: true
- match: \*/(?!\*)
scope: invalid.illegal.stray-comment-end.tmc
- match: ^// =(\s*.*?)\s*=\s*$\n?
scope: comment.line.banner.tmc
captures:
1: meta.toc-list.banner.line.tmc
- match: //
scope: punctuation.definition.comment.tmc
push:
- meta_scope: comment.line.double-slash.tmc
- match: '(\\)$\n'
captures:
1: punctuation.separator.continuation.tmc
- match: \n
pop: true
late-expressions:
- match: ';'
scope: punctuation.terminator.tmc
operators:
- match: <<|>>|&|\|
scope: keyword.operator.arithmetic.tmc
- match: <\=|>\=|\=\=|<|>|\!\=
scope: keyword.operator.comparison.tmc
- match: \+|\-|/|%|\||\^|!
scope: keyword.operator.arithmetic.tmc
# This operator can be both arithmetic and pointer/address related
- match: \&
scope: keyword.operator.tmc
- match: \=
scope: keyword.operator.assignment.tmc
access-illegal:
- match: \.\.(?!\.)
scope: invalid.illegal.syntax.tmc
types:
- match: \b({{basic_types}})\b
scope: storage.type.tcm
parenthesis:
- match: \)
scope: punctuation.section.group.end.tmc
pop: true
- include: main
brackets:
- match: \]
scope: punctuation.section.bracket.end.tmc
pop: true
- include: main
braces:
- match: \}
scope: punctuation.section.block.end.tmc
pop: true
- include: main
tribracket:
- match: \>
scope: punctuation.section.tribracket.end.tmc
pop: true
- include: main
expressions:
- include: early-expressions
- include: late-expressions
early-expressions:
- include: comment
- include: case-default
- include: keywords
- include: numbers
- include: operators
- include: parenthesis
- include: variables
- match: ','
scope: punctuation.separator.tmc
- match: '\)|\}'
scope: invalid.illegal.stray-bracket-end.tmc
case-default:
- match: '\b(default|case)\b'
scope: keyword.control.tmc
push:
- match: ':'
scope: punctuation.separator.tmc
pop: true
- include: expressions
numbers:
- match: '\b((0(x|X)[0-9a-fA-F]*(\.[0-9a-fA-F]+p-?\d+)?)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([fF]|(l{1,2}|L{1,2})[uU]?|[uU](l{0,2}|L{0,2}))?\b'
scope: constant.numeric.tmc
statements:
- include: label
- include: expressions
variables:
- match: '\bg[A-Z]\w*\b'
scope: variable.other.readwrite.global.mac-classic.c
- match: '\bs[A-Z]\w*\b'
scope: variable.other.readwrite.static.mac-classic.c