Elffuss BraidHub

kikocis/continue public

main · 14.6 KiBRawPermalink
1{
2 "scopeName": "source.go",
3 "name": "Go",
4 "comment": "Go language",
5 "fileTypes": ["go"],
6 "foldingStartMarker": "({|\\()\\s*$",
7 "foldingStopMarker": "(}|\\))\\s*$",
8 "patterns": [
9 {
10 "comment": "Block comments",
11 "begin": "/\\*",
12 "end": "\\*/",
13 "captures": {
14 "0": {
15 "name": "punctuation.definition.comment.go"
16 }
17 },
18 "name": "comment.block.go"
19 },
20 {
21 "comment": "Line comments",
22 "begin": "//",
23 "beginCaptures": {
24 "0": {
25 "name": "punctuation.definition.comment.go"
26 }
27 },
28 "end": "$",
29 "name": "comment.line.double-slash.go"
30 },
31 {
32 "comment": "Interpreted string literals",
33 "begin": "\"",
34 "beginCaptures": {
35 "0": {
36 "name": "punctuation.definition.string.begin.go"
37 }
38 },
39 "end": "\"",
40 "endCaptures": {
41 "0": {
42 "name": "punctuation.definition.string.end.go"
43 }
44 },
45 "name": "string.quoted.double.go",
46 "patterns": [
47 {
48 "include": "#string_escaped_char"
49 },
50 {
51 "include": "#string_placeholder"
52 }
53 ]
54 },
55 {
56 "comment": "Raw string literals",
57 "begin": "`",
58 "beginCaptures": {
59 "0": {
60 "name": "punctuation.definition.string.begin.go"
61 }
62 },
63 "end": "`",
64 "endCaptures": {
65 "0": {
66 "name": "punctuation.definition.string.end.go"
67 }
68 },
69 "name": "string.quoted.raw.go",
70 "patterns": [
71 {
72 "include": "#string_placeholder"
73 }
74 ]
75 },
76 {
77 "comment": "Syntax error receiving channels",
78 "match": "<\\-([\\t ]+)chan\\b",
79 "captures": {
80 "1": {
81 "name": "invalid.illegal.receive-channel.go"
82 }
83 }
84 },
85 {
86 "comment": "Syntax error sending channels",
87 "match": "\\bchan([\\t ]+)<-",
88 "captures": {
89 "1": {
90 "name": "invalid.illegal.send-channel.go"
91 }
92 }
93 },
94 {
95 "comment": "Syntax error using slices",
96 "match": "\\[\\](\\s+)",
97 "captures": {
98 "1": {
99 "name": "invalid.illegal.slice.go"
100 }
101 }
102 },
103 {
104 "comment": "Syntax error numeric literals",
105 "match": "\\b0[0-7]*[89]\\d*\\b",
106 "name": "invalid.illegal.numeric.go"
107 },
108 {
109 "comment": "Built-in functions",
110 "match": "\\b(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\\b(?=\\()",
111 "name": "support.function.builtin.go"
112 },
113 {
114 "comment": "Function declarations",
115 "match": "^(\\bfunc\\b)(?:\\s+(\\([^\\)]+\\)\\s+)?([a-zA-Z_]\\w*)(?=\\())?",
116 "captures": {
117 "1": {
118 "name": "keyword.function.go"
119 },
120 "2": {
121 "patterns": [
122 {
123 "include": "#brackets"
124 },
125 {
126 "include": "#operators"
127 }
128 ]
129 },
130 "3": {
131 "name": "entity.name.function"
132 }
133 }
134 },
135 {
136 "comment": "Functions",
137 "match": "(\\bfunc\\b)|([a-zA-Z_]\\w*)(?=\\()",
138 "captures": {
139 "1": {
140 "name": "keyword.function.go"
141 },
142 "2": {
143 "name": "support.function.go"
144 }
145 }
146 },
147 {
148 "comment": "Floating-point literals",
149 "match": "(\\.\\d+([Ee][-+]\\d+)?i?)\\b|\\b\\d+\\.\\d*(([Ee][-+]\\d+)?i?\\b)?",
150 "name": "constant.numeric.floating-point.go"
151 },
152 {
153 "comment": "Integers",
154 "match": "\\b((0x[0-9a-fA-F]+)|(0[0-7]+i?)|(\\d+([Ee]\\d+)?i?)|(\\d+[Ee][-+]\\d+i?))\\b",
155 "name": "constant.numeric.integer.go"
156 },
157 {
158 "comment": "Language constants",
159 "match": "\\b(true|false|nil|iota)\\b",
160 "name": "constant.language.go"
161 },
162 {
163 "comment": "Package declarations",
164 "match": "(?<=package)\\s+([a-zA-Z_]\\w*)",
165 "captures": {
166 "1": {
167 "name": "entity.name.package.go"
168 }
169 }
170 },
171 {
172 "comment": "Single line import declarations",
173 "match": "(?<=import)(\\s+((?!\\s+\")[^\\s]*)?\\s*)((\")([^\"]*)(\"))",
174 "captures": {
175 "2": {
176 "name": "entity.alias.import.go"
177 },
178 "3": {
179 "name": "string.quoted.double.go"
180 },
181 "4": {
182 "name": "punctuation.definition.string.begin.go"
183 },
184 "5": {
185 "name": "entity.name.import.go"
186 },
187 "6": {
188 "name": "punctuation.definition.string.end.go"
189 }
190 }
191 },
192 {
193 "comment": "Multiline import declarations",
194 "begin": "(?<=import)\\s+(\\()",
195 "beginCaptures": {
196 "1": {
197 "name": "punctuation.other.bracket.round.go"
198 }
199 },
200 "patterns": [
201 {
202 "match": "((?!\\s+\")[^\\s]*)?\\s+((\")([^\"]*)(\"))",
203 "captures": {
204 "1": {
205 "name": "entity.alias.import.go"
206 },
207 "2": {
208 "name": "string.quoted.double.go"
209 },
210 "3": {
211 "name": "punctuation.definition.string.begin.go"
212 },
213 "4": {
214 "name": "entity.name.import.go"
215 },
216 "5": {
217 "name": "punctuation.definition.string.end.go"
218 }
219 }
220 }
221 ],
222 "end": "\\)",
223 "endCaptures": {
224 "0": {
225 "name": "punctuation.other.bracket.round.go"
226 }
227 }
228 },
229 {
230 "comment": "Type declarations",
231 "match": "(?<=type)\\s+([a-zA-Z_]\\w*)",
232 "captures": {
233 "1": {
234 "name": "entity.name.type.go"
235 }
236 }
237 },
238 {
239 "comment": "Shorthand variable declaration and assignments",
240 "match": "[a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*(?=\\s*:=)",
241 "captures": {
242 "0": {
243 "patterns": [
244 {
245 "match": "[a-zA-Z_]\\w*",
246 "name": "variable.other.assignment.go"
247 },
248 {
249 "include": "#delimiters"
250 }
251 ]
252 }
253 }
254 },
255 {
256 "comment": "Assignments to existing variables",
257 "match": "(?<!var )\\s*([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)(?=\\s*=[^=])",
258 "captures": {
259 "1": {
260 "patterns": [
261 {
262 "match": "[a-zA-Z_]\\w*",
263 "name": "variable.other.assignment.go"
264 },
265 {
266 "include": "#delimiters"
267 }
268 ]
269 }
270 }
271 },
272 {
273 "comment": "Single line variable declarations/assignments",
274 "match": "(?<=var)\\s+(.*)$",
275 "captures": {
276 "1": {
277 "patterns": [
278 {
279 "include": "#variables"
280 }
281 ]
282 }
283 }
284 },
285 {
286 "comment": "Multiline variable declarations/assignments",
287 "begin": "(\\bvar\\b)\\s+(\\()",
288 "beginCaptures": {
289 "1": {
290 "name": "keyword.var.go"
291 },
292 "2": {
293 "name": "punctuation.other.bracket.round.go"
294 }
295 },
296 "end": "\\)",
297 "endCaptures": {
298 "0": {
299 "name": "punctuation.other.bracket.round.go"
300 }
301 },
302 "patterns": [
303 {
304 "include": "#variables"
305 },
306 {
307 "include": "$self"
308 }
309 ]
310 },
311 {
312 "comment": "Terminators",
313 "match": ";",
314 "name": "punctuation.terminator.go"
315 },
316 {
317 "include": "#brackets"
318 },
319 {
320 "include": "#delimiters"
321 },
322 {
323 "include": "#keywords"
324 },
325 {
326 "include": "#operators"
327 },
328 {
329 "include": "#runes"
330 },
331 {
332 "include": "#storage_types"
333 }
334 ],
335 "repository": {
336 "brackets": {
337 "patterns": [
338 {
339 "match": "\\{|\\}",
340 "name": "punctuation.other.bracket.curly.go"
341 },
342 {
343 "match": "\\(|\\)",
344 "name": "punctuation.other.bracket.round.go"
345 },
346 {
347 "match": "\\[|\\]",
348 "name": "punctuation.other.bracket.square.go"
349 }
350 ]
351 },
352 "delimiters": {
353 "patterns": [
354 {
355 "match": ",",
356 "name": "punctuation.other.comma.go"
357 },
358 {
359 "match": "\\.(?!\\.\\.)",
360 "name": "punctuation.other.period.go"
361 },
362 {
363 "match": ":(?!=)",
364 "name": "punctuation.other.colon.go"
365 }
366 ]
367 },
368 "keywords": {
369 "patterns": [
370 {
371 "comment": "Flow control keywords",
372 "match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b",
373 "name": "keyword.control.go"
374 },
375 {
376 "match": "\\bchan\\b",
377 "name": "keyword.channel.go"
378 },
379 {
380 "match": "\\bconst\\b",
381 "name": "keyword.const.go"
382 },
383 {
384 "match": "\\bfunc\\b",
385 "name": "keyword.function.go"
386 },
387 {
388 "match": "\\binterface\\b",
389 "name": "keyword.interface.go"
390 },
391 {
392 "match": "\\bimport\\b",
393 "name": "keyword.import.go"
394 },
395 {
396 "match": "\\bmap\\b",
397 "name": "keyword.map.go"
398 },
399 {
400 "match": "\\bpackage\\b",
401 "name": "keyword.package.go"
402 },
403 {
404 "match": "\\bstruct\\b",
405 "name": "keyword.struct.go"
406 },
407 {
408 "match": "\\btype\\b",
409 "name": "keyword.type.go"
410 },
411 {
412 "match": "\\bvar\\b",
413 "name": "keyword.var.go"
414 }
415 ]
416 },
417 "operators": {
418 "comment": "Note that the order here is very important!",
419 "patterns": [
420 {
421 "match": "(\\*|&)(?=\\w)",
422 "name": "keyword.operator.address.go"
423 },
424 {
425 "match": "<\\-",
426 "name": "keyword.operator.channel.go"
427 },
428 {
429 "match": "\\-\\-",
430 "name": "keyword.operator.decrement.go"
431 },
432 {
433 "match": "\\+\\+",
434 "name": "keyword.operator.increment.go"
435 },
436 {
437 "match": "(==|!=|<=|>=|<[^<]|>[^>])",
438 "name": "keyword.operator.comparison.go"
439 },
440 {
441 "match": "(&&|\\|\\||!)",
442 "name": "keyword.operator.logical.go"
443 },
444 {
445 "match": "(=|\\+=|\\-=|\\|=|\\^=|\\*=|/=|:=|%=|<<=|>>=|&\\^=|&=)",
446 "name": "keyword.operator.assignment.go"
447 },
448 {
449 "match": "(\\+|\\-|\\*|/|%)",
450 "name": "keyword.operator.arithmetic.go"
451 },
452 {
453 "match": "(&(?!\\^)|\\||\\^|&\\^|<<|>>)",
454 "name": "keyword.operator.arithmetic.bitwise.go"
455 },
456 {
457 "match": "\\.\\.\\.",
458 "name": "keyword.operator.ellipsis.go"
459 }
460 ]
461 },
462 "runes": {
463 "patterns": [
464 {
465 "match": "\\'(\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})|\\p{Any})\\'",
466 "name": "constant.other.rune.go"
467 },
468 {
469 "match": "\\'.*\\'",
470 "name": "invalid.illegal.unknown-rune.go"
471 }
472 ]
473 },
474 "storage_types": {
475 "patterns": [
476 {
477 "match": "\\bbool\\b",
478 "name": "storage.type.boolean.go"
479 },
480 {
481 "match": "\\bbyte\\b",
482 "name": "storage.type.byte.go"
483 },
484 {
485 "match": "\\berror\\b",
486 "name": "storage.type.error.go"
487 },
488 {
489 "match": "\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\b",
490 "name": "storage.type.numeric.go"
491 },
492 {
493 "match": "\\brune\\b",
494 "name": "storage.type.rune.go"
495 },
496 {
497 "match": "\\bstring\\b",
498 "name": "storage.type.string.go"
499 },
500 {
501 "match": "\\buintptr\\b",
502 "name": "storage.type.uintptr.go"
503 }
504 ]
505 },
506 "string_escaped_char": {
507 "patterns": [
508 {
509 "match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})",
510 "name": "constant.character.escape.go"
511 },
512 {
513 "match": "\\\\[^0-7xuUabfnrtv\\'\"]",
514 "name": "invalid.illegal.unknown-escape.go"
515 }
516 ]
517 },
518 "string_placeholder": {
519 "patterns": [
520 {
521 "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]",
522 "name": "constant.other.placeholder.go"
523 }
524 ]
525 },
526 "variables": {
527 "comment": "First add tests and make sure existing tests still pass when changing anything here!",
528 "patterns": [
529 {
530 "match": "([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)\\s*(=.*)",
531 "captures": {
532 "1": {
533 "patterns": [
534 {
535 "match": "[a-zA-Z_]\\w*",
536 "name": "variable.other.assignment.go"
537 },
538 {
539 "include": "#delimiters"
540 }
541 ]
542 },
543 "2": {
544 "patterns": [
545 {
546 "include": "$self"
547 }
548 ]
549 }
550 }
551 },
552 {
553 "match": "([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)(\\s+[\\*]?[a-zA-Z_]\\w*\\s*)(=.*)",
554 "captures": {
555 "1": {
556 "patterns": [
557 {
558 "match": "[a-zA-Z_]\\w*",
559 "name": "variable.other.assignment.go"
560 },
561 {
562 "include": "#delimiters"
563 }
564 ]
565 },
566 "2": {
567 "patterns": [
568 {
569 "include": "$self"
570 }
571 ]
572 },
573 "3": {
574 "patterns": [
575 {
576 "include": "$self"
577 }
578 ]
579 }
580 }
581 },
582 {
583 "match": "([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)(\\s+[\\[\\]\\*]{0,3}[a-zA-Z_]\\w*\\s*[^=].*)",
584 "captures": {
585 "1": {
586 "patterns": [
587 {
588 "match": "[a-zA-Z_]\\w*",
589 "name": "variable.other.declaration.go"
590 },
591 {
592 "include": "#delimiters"
593 }
594 ]
595 },
596 "2": {
597 "patterns": [
598 {
599 "include": "$self"
600 }
601 ]
602 }
603 }
604 }
605 ]
606 }
607 },
608 "version": "https://github.com/atom/language-go/commit/d941ce3155b500e65b4d7fbc53ea51b9c92ec1cb"
609}