forked from zonyitoo/sublime-f2j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
F2J.YAML-tmLanguage
303 lines (286 loc) · 9.25 KB
/
F2J.YAML-tmLanguage
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: F2J
scopeName: source.f2j
fileTypes: ["sf"]
uuid: 571d3901-a922-4ea8-a839-4da85c1b28d0
patterns:
- comment: Comments
name: comment.line.f2j
match: "(--).*$\\n?"
- comment: Block comments
name: comment.block.f2j
begin: "{-"
end: "-}"
patterns:
- match: .
- include: $self
- begin: "{"
end: "}"
- include: '#controlKeywords'
- comment: Seperator
name: keyword.other.f2j
match: (\||/\\|->|:)
- comment: Terminator
name: punctuation.terminator.f2j
match: (;)
- comment: Constants
name: constant.language.f2j
match: (\b(True|False)\b|((\s|^)\(\)))
- comment: Lambda
begin: (\\)
beginCaptures:
'0': { name: keyword.operator.lambda.header.f2j }
end: (->)
endCaptures:
'0': { name: keyword.operator.lambda.body.f2j }
patterns:
- include: '#functionParameter'
- include: '#lineComment'
- include: '#blockComment'
- comment: Strings
name: string.quoted.double.f2j
begin: '"'
beginCaptures:
'0': { name: punctuation.definition.string.begin.c }
end: '"'
endCaptures:
'0': { name: punctuation.definition.string.end.c }
patterns:
- begin: "\\\\{"
beginCaptures:
'0': { name: punctuation.section.embedded.begin.f2j }
end: "\\}"
endCaptures:
'0': { name: punctuation.section.embedded.end.f2j }
'1': { name: source.f2j }
contentName: source.f2j
name: meta.embedded.line.f2j
# match: .
patterns:
- include: $self
- begin: "\\{"
end: "\\}"
# match: .
- match: \\[btnfr\"'\\]
name: constant.character.escape.f2j
- match: (\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})
name: constant.character.escape.unicode.f2j
- match: \\x[0-9A-Fa-f]{2}
name: constant.character.escape.numeric.f2j
# - match: ([0123]?[0-7]{1,2})
# name: constant.character.escape.octal.f2j
- comment: Char
name: string.quoted.single.f2j
match: "(')(\\\\[btnfr\"'\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8}|\\\\x[0-9A-Fa-f]{2}|[0123]?[0-7]{1,2}|.)(')"
captures:
'1': { name: punctuation.definition.string.begin.c }
'2': { name: constant.character.escape.f2j }
'3': { name: constant.character.escape.unicode.f2j }
'4': { name: constant.character.escape.unicode.f2j }
'5': { name: constant.character.escape.numeric.f2j }
'6': { name: constant.character.escape.octal.f2j }
'7': { name: punctuation.definition.string.end.c }
- comment: Storage Type
name: storage.type.f2j
match: \b(Int|String|Bool|Char|Float|Double|Unit)\b
- comment: Numeric
name: constant.numeric.f2j
match: \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b
- comment: Data definition
# begin: \b(data)\s+([A-Z][a-zA-Z0-9_]*)\s*
# beginCaptures:
# '2': { name: storage.type.f2j }
# end: (=)
begin: \b(data)\b
beginCaptures:
'1': { name: keyword.other.f2j }
# '2': { name: entity.name.type.f2j }
end: (;)
endCaptures:
'0': { name: punctuation.terminator.f2j }
patterns:
- match: \b(rec)\b
captures:
'0': { name: keyword.other.f2j }
- match: \b(and)\b
captures:
'0': { name: keyword.other.f2j }
- match: (=|\|)
captures:
'0': { name: keyword.other.f2j }
- include: '#typeParameter'
- include: '#lineComment'
- include: '#blockComment'
- include: '#preludeClasses'
- comment: Type definition
begin: \b(type)\b
beginCaptures:
'1': { name: keyword.other.f2j }
# '2': { name: storage.type.f2j }
end: (=)
endCaptures:
'0': { name: keyword.other.f2j }
patterns:
- match: ([A-Z][a-zA-Z0-9_]*)
- include: '#typeParameter'
- include: '#lineComment'
- include: '#blockComment'
- include: '#preludeClasses'
- comment: Let
begin: \b(let)\b
beginCaptures:
'1': { name: keyword.control.f2j }
end: (=)
endCaptures:
'0': { name: keyword.other.f2j }
patterns:
- match: \b(rec)\b
captures:
'0': { name: keyword.control.f2j }
- match: ([a-z][a-zA-Z0-9_]*|\((\+|-|\*|~|\^|<|>|\||&|\$|!|#|%|\.|/|\?|@|\\|=)+\))
captures:
'0': { name: entity.name.function.f2j }
- match: (:)
captures:
'0': { name: keyword.other.f2j }
- include: '#functionParameter'
- include: '#typeParameterBinding'
- include: '#preludeClasses'
- include: '#typeName'
- include: '#lineComment'
- include: '#blockComment'
- comment: And
begin: \b(and|def)\b
beginCaptures:
'1': { name: keyword.control.f2j }
end: (=)
endCaptures:
'0': { name: keyword.other.f2j }
patterns:
- include: '#functionParameter'
- include: '#typeParameter'
- include: '#preludeClasses'
- include: '#typeName'
- include: '#lineComment'
- include: '#blockComment'
- match: ([a-z][a-zA-Z0-9_]*\b|\((\+|-|\*|~|\^|<|>|\||&|\$|!|#|%|\.|/|\?|@|\\|=)+\))
captures:
'0': { name: entity.name.function.f2j }
- match: ':'
captures:
'0': { name: keyword.other.f2j }
- comment: Type parameter
name: entity.name.type.f2j
# name: variable.other.generic-type.f2j
begin: \[
beginCaptures:
# '0': { name: entity.name.type.f2j }
'0': { name: variable.other.generic-type }
end: \]
endCaptures:
# '0': { name: entity.name.type.f2j }
'0': { name: variable.other.generic-type }
patterns:
- include: $self
- match: (,|\(|\))
captures:
'0': { name: variable.other.generic-type.separator.comma.f2j }
- comment: Operators
name: keyword.operator.f2j
match: ((\+|-|\*|~|\^|<|>|\||&|\$|!|#|%|\.|/|\?|@|\\|=)+)
- comment: Infix operator
name: keyword.operator.function.infix.f2j
begin: (`)
end: (`)
patterns:
- match: (->)
captures:
'0': { name: keyword.other.f2j }
- include: "#preludeClasses"
- include: "#identifier"
- include: "#typeName"
repository:
controlKeywords:
comment: Control keywords
name: keyword.control.f2j
match: \b(module|then|else|if|in|case|of|new|forall)\b
typeName:
match: \b[A-Z][a-zA-Z0-9_]*\b
# name: storage.type.f2j
typeParameter:
# name: variable.other.generic-type
name: entity.name.type.f2j
begin: \[
beginCaptures:
'0': { name: variable.other.generic-type.begin.f2j }
end: \]
endCaptures:
'0': { name: variable.other.generic-type.end.f2j }
patterns:
# - include: "#typeName"
- match: (->)
captures:
'0': { name: keyword.other.f2j }
- match: (,)
captures:
'0': { name: variable.other.generic-type.separator.comma.f2j }
- include: '#typeParameter'
- include: '#preludeClasses'
typeParameterBinding:
# name: variable.other.generic-type
name: entity.name.type.f2j
begin: \[
beginCaptures:
'0': { name: variable.other.generic-type.begin.f2j }
end: \]
endCaptures:
'0': { name: variable.other.generic-type.end.f2j }
patterns:
# - include: "#typeName"
- match: (->)
captures:
'0': { name: keyword.other.f2j }
- match: (,)
captures:
'0': { name: variable.other.generic-type.separator.comma.f2j }
- include: '#typeParameterBinding'
- include: '#preludeClasses'
identifier:
match: \b[a-zA-Z][a-zA-Z0-9_]*\b
functionParameter:
begin: \(
end: \)
patterns:
- match: (:)
captures:
# '1': { name: variable.parameter.f2j }
'0': { name: keyword.other.f2j }
- include: '#typeParameter'
- include: '#preludeClasses'
- include: '#typeName'
- match: (->)
captures:
'0': { name: keyword.other.f2j }
functionDefName:
match: ([a-z][a-zA-Z0-9_]*\b|\((\+|-|\*|~|\^|<|>|\||&|\$|!|#|%|\.|/|\?|@|\\|=)+\))
captures:
'0': { name: entity.name.function.f2j }
preludeClasses:
match: \b(Int|String|Bool|Char|Float|Double|Unit)\b
name: storage.type.f2j
lineComment:
comment: Comments
name: comment.line.f2j
match: "(--).*$\\n?"
blockComment:
comment: Block comments
name: comment.block.f2j
begin: "{-"
end: "-}"
patterns:
- match: .
- include: $self
- begin: "{"
end: "}"
...