tangled
alpha
login
or
join now
dunkirk.sh
/
zera
5
fork
atom
the home site for me: also iteration 3 or 4 of my site
5
fork
atom
overview
issues
pulls
pipelines
feat: add gleam support
dunkirk.sh
4 months ago
64339192
67835392
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+244
2 changed files
expand all
collapse all
unified
split
config.toml
syntaxes
gleam.sublime-syntax
+1
config.toml
···
18
18
19
19
highlight_code = true
20
20
highlight_theme = "css"
21
21
+
extra_syntaxes_and_themes = ["syntaxes"]
21
22
22
23
[slugify]
23
24
paths = "on"
+243
syntaxes/gleam.sublime-syntax
···
1
1
+
%YAML 1.2
2
2
+
---
3
3
+
version: 2
4
4
+
5
5
+
file_extensions:
6
6
+
- gleam
7
7
+
8
8
+
scope: source.gleam
9
9
+
10
10
+
variables:
11
11
+
lower_ident: '[[:lower:]][[:word:]]*'
12
12
+
upper_ident: '[[:upper:]][[:word:]]*'
13
13
+
14
14
+
contexts:
15
15
+
main:
16
16
+
- include: base
17
17
+
base:
18
18
+
- include: attribute
19
19
+
- include: bitstring
20
20
+
- include: block
21
21
+
- include: comment
22
22
+
- include: constant_def
23
23
+
- include: function_def
24
24
+
- include: keyword
25
25
+
- include: function_call
26
26
+
- include: record
27
27
+
- include: import
28
28
+
- include: number
29
29
+
- include: operator
30
30
+
- include: punctuation
31
31
+
- include: string
32
32
+
- include: unused_name
33
33
+
- include: type_name
34
34
+
35
35
+
# Attributes (annotations)
36
36
+
attribute:
37
37
+
- match: ^\s*(@{{lower_ident}})\(
38
38
+
captures:
39
39
+
1: variable.other.constant.gleam
40
40
+
push:
41
41
+
- include: arguments
42
42
+
- meta_scope: meta.annotation.gleam
43
43
+
- match: ^\s*(@{{lower_ident}})
44
44
+
scope: meta.annotation.gleam
45
45
+
captures:
46
46
+
1: variable.other.constant.gleam
47
47
+
48
48
+
# Arguments (to a function call, record constructor, or attribute)
49
49
+
arguments:
50
50
+
- include: bitstring
51
51
+
- include: block
52
52
+
- include: comment
53
53
+
- include: function_def
54
54
+
- include: function_call
55
55
+
- include: record
56
56
+
- include: number
57
57
+
- include: operator
58
58
+
- include: punctuation
59
59
+
- include: string
60
60
+
- include: unused_name
61
61
+
- include: type_name
62
62
+
- match: '\b{{lower_ident}}:'
63
63
+
scope: constant.other.gleam
64
64
+
- match: \)
65
65
+
pop: true
66
66
+
67
67
+
# Bitstrings
68
68
+
bitstring:
69
69
+
- match: '<<'
70
70
+
scope: punctuation.definition.generic.begin.gleam
71
71
+
push:
72
72
+
- include: number
73
73
+
- include: string
74
74
+
- match: \b(bytes|int|float|bits|utf8|utf16|utf32|utf8_codepoint|utf16_codepoint|utf32_codepoint|signed|unsigned|big|little|native|unit|size)\b
75
75
+
scope: keyword.other.gleam
76
76
+
- match: '>>'
77
77
+
scope: punctuation.definition.generic.end.gleam
78
78
+
pop: true
79
79
+
80
80
+
# Blocks
81
81
+
block:
82
82
+
- match: '{'
83
83
+
scope: punctuation.section.block.begin.gleam
84
84
+
push: base
85
85
+
- match: '}'
86
86
+
scope: punctuation.section.block.end.gleam
87
87
+
pop: true
88
88
+
89
89
+
# Comments
90
90
+
comment:
91
91
+
- match: ///?/?
92
92
+
scope: punctuation.definition.comment.line.gleam
93
93
+
push:
94
94
+
- meta_scope: comment.line.gleam
95
95
+
- match: $
96
96
+
pop: true
97
97
+
98
98
+
# Constant definitions
99
99
+
constant_def:
100
100
+
- match: \b(const)\s+({{lower_ident}})\b
101
101
+
captures:
102
102
+
1: keyword.other.gleam
103
103
+
2: entity.name.constant.gleam
104
104
+
105
105
+
# Function calls
106
106
+
function_call:
107
107
+
- match: \b(?:{{lower_ident}}\.)*({{lower_ident}})\(
108
108
+
captures:
109
109
+
1: variable.function.gleam
110
110
+
push: arguments
111
111
+
112
112
+
# Function definitions
113
113
+
function_def:
114
114
+
- match: \b(fn)(?:[[:space:]]+({{lower_ident}}))?[[:space:]]*\(
115
115
+
captures:
116
116
+
1: storage.type.function.gleam
117
117
+
2: entity.name.function.gleam
118
118
+
push: function_def_args
119
119
+
120
120
+
# Function arguments
121
121
+
function_def_args:
122
122
+
- include: function_def
123
123
+
- include: punctuation
124
124
+
- include: type_name
125
125
+
- include: unused_name
126
126
+
- match: ->
127
127
+
scope: keyword.operator.gleam
128
128
+
- match: \b(?:({{lower_ident}})[[:space:]]+)?({{lower_ident}}:)
129
129
+
captures:
130
130
+
1: constant.other.gleam
131
131
+
2: variable.parameter.gleam
132
132
+
- match: \(
133
133
+
push: function_def_args
134
134
+
- match: \)
135
135
+
pop: true
136
136
+
137
137
+
# Imports
138
138
+
import:
139
139
+
- match: ^import\b
140
140
+
scope: keyword.control.import.gleam
141
141
+
push:
142
142
+
- match: \bas\b
143
143
+
scope: keyword.control.import.gleam
144
144
+
- match: \b(?:{{lower_ident}}/)*{{lower_ident}}\b
145
145
+
scope: entity.name.namespace.gleam
146
146
+
- match: (\.)({)
147
147
+
captures:
148
148
+
1: punctuation.accessor.gleam
149
149
+
2: punctuation.definition.generic.begin.gleam
150
150
+
push:
151
151
+
- include: punctuation
152
152
+
- include: type_name
153
153
+
- match: \bas\b
154
154
+
scope: keyword.control.import.gleam
155
155
+
- match: \btype\b
156
156
+
scope: storage.type.gleam
157
157
+
- match: '}'
158
158
+
scope: punctuation.definition.generic.end.gleam
159
159
+
pop: true
160
160
+
- match: $
161
161
+
pop: true
162
162
+
163
163
+
# Keywords
164
164
+
keyword:
165
165
+
- match: \b(as|assert|case|const|echo|if|let|panic|todo|use)\b
166
166
+
scope: keyword.other.gleam
167
167
+
- match: \b(opaque|pub)\b
168
168
+
scope: storage.modifier.gleam
169
169
+
- match: \btype\b
170
170
+
scope: storage.type.gleam
171
171
+
- match: \bfn\b
172
172
+
scope: storage.type.function.gleam
173
173
+
# Reserved for future use
174
174
+
- match: \b(auto|delegate|derive|else|implement|macro|test)\b
175
175
+
scope: invalid.illegal.gleam
176
176
+
177
177
+
# Numbers
178
178
+
number:
179
179
+
- match: \b0b[01][01_]*\b
180
180
+
scope: constant.numeric.binary.gleam
181
181
+
- match: \b0o[0-7][0-7_]*\b
182
182
+
scope: constant.numeric.octal.gleam
183
183
+
- match: \b[0-9][0-9_]*(\.[0-9_]*(e-?[0-9][0-9_]*)?)?\b
184
184
+
scope: constant.numeric.decimal.gleam
185
185
+
- match: \b0x[[:xdigit:]][[:xdigit:]_]*\b
186
186
+
scope: constant.numeric.hexadecimal.gleam
187
187
+
188
188
+
# Operators
189
189
+
operator:
190
190
+
- match: <-
191
191
+
scope: keyword.operator.assignment.gleam
192
192
+
- match: (\|>|\.\.|<=\.|>=\.|==\.|!=\.|<\.|>\.|<=|>=|==|!=|<|>|<>)
193
193
+
scope: keyword.operator.gleam
194
194
+
- match: '='
195
195
+
scope: keyword.operator.assignment.gleam
196
196
+
- match: ->
197
197
+
scope: keyword.operator.gleam
198
198
+
- match: (\+\.|\-\.|/\.|\*\.|%\.|\+|\-|/|\*|%)
199
199
+
scope: keyword.operator.arithmetic.gleam
200
200
+
- match: (&&|\|\|)
201
201
+
scope: keyword.operator.logical.gleam
202
202
+
- match: \|
203
203
+
scope: keyword.operator.gleam
204
204
+
205
205
+
# Punctuation (separators, accessors)
206
206
+
punctuation:
207
207
+
- match: \.
208
208
+
scope: punctuation.accessor.gleam
209
209
+
- match: ','
210
210
+
scope: punctuation.separator.gleam
211
211
+
212
212
+
# Records (constructors with arguments)
213
213
+
record:
214
214
+
- match: \b((?:{{lower_ident}}\.)*{{upper_ident}})\(
215
215
+
captures:
216
216
+
1: entity.name.type.gleam
217
217
+
push: arguments
218
218
+
219
219
+
# Strings
220
220
+
string:
221
221
+
- match: '"'
222
222
+
scope: punctuation.definition.string.begin.gleam
223
223
+
push:
224
224
+
- meta_scope: string.quoted.double.gleam
225
225
+
- match: \\[fnrt"\\]
226
226
+
scope: constant.character.escape.gleam
227
227
+
- match: \\u\{[[:xdigit:]]{1,6}\}
228
228
+
scope: constant.character.escape.gleam
229
229
+
- match: \\
230
230
+
scope: invalid.illegal.gleam
231
231
+
- match: '"'
232
232
+
scope: punctuation.definition.string.end.gleam
233
233
+
pop: true
234
234
+
235
235
+
# Types and constructors
236
236
+
type_name:
237
237
+
- match: \b(?:{{lower_ident}}\.)*{{upper_ident}}\b
238
238
+
scope: entity.name.type.gleam
239
239
+
240
240
+
# Unused bindings
241
241
+
unused_name:
242
242
+
- match: \b_{{lower_ident}}\b
243
243
+
scope: comment.line.gleam