PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.11.0
Code Block Pro – Beautiful Syntax Highlighting v1.11.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / crystal.tmLanguage.json

crystal.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.11.0, at build/shiki/languages/crystal.tmLanguage.json

1,871 lines 48.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "information_for_contributors": [
3 "This file is based on https://github.com/Microsoft/vscode/blob/master/extensions/ruby/syntaxes/ruby.tmLanguage.json"
4 ],
5 "version": "https://github.com/Microsoft/vscode/blob/3f1f36333d3453f67a36b6bfb1206e9159e9c4f0/extensions/ruby/syntaxes/ruby.tmLanguage.json",
6 "name": "crystal",
7 "scopeName": "source.crystal",
8 "fileTypes": ["cr"],
9 "firstLineMatch": "^#!/.*\\bcrystal",
10 "foldingStartMarker": "(?x)^(\\s*+(annotation|module|class|struct|union|enum|def(?!.*\\bend\\s*$)|unless|if|case|begin|for|while|until|^=begin|(\"(\\\\.|[^\"])*+\"|'(\\\\.|[^'])*+'|[^#\"'])*(\\s(do|begin|case)|(?<!\\$)[-+=&|*/~%^<>~]\\s*+(if|unless)))\\b(?![^;]*+;.*?\\bend\\b)|(\"(\\\\.|[^\"])*+\"|'(\\\\.|[^'])*+'|[^#\"'])*(\\{(?![^}]*+\\})|\\[(?![^\\]]*+\\]))).*$|[#].*?\\(fold\\)\\s*+$",
11 "foldingStopMarker": "(?x)((^|;)\\s*+end\\s*+([#].*)?$|(^|;)\\s*+end\\..*$|^\\s*+[}\\]] ,?\\s*+([#].*)?$|[#].*?\\(end\\)\\s*+$|^=end)",
12 "keyEquivalent": "^~R",
13 "patterns": [
14 {
15 "captures": {
16 "1": {
17 "name": "keyword.control.class.crystal"
18 },
19 "2": {
20 "name": "keyword.control.class.crystal"
21 },
22 "3": {
23 "name": "entity.name.type.class.crystal"
24 },
25 "5": {
26 "name": "punctuation.separator.crystal"
27 },
28 "6": {
29 "name": "support.class.other.type-param.crystal"
30 },
31 "7": {
32 "name": "entity.other.inherited-class.crystal"
33 },
34 "8": {
35 "name": "punctuation.separator.crystal"
36 },
37 "9": {
38 "name": "punctuation.separator.crystal"
39 },
40 "10": {
41 "name": "support.class.other.type-param.crystal"
42 },
43 "11": {
44 "name": "punctuation.definition.variable.crystal"
45 }
46 },
47 "match": "(?x)^\\s*(abstract)?\\s*(class|struct|union|annotation|enum)\\s+(([.A-Z_:\\x{80}-\\x{10FFFF}][.\\w:\\x{80}-\\x{10FFFF}]*(\\(([,\\s.a-zA-Z0-9_:\\x{80}-\\x{10FFFF}]+)\\))?(\\s*(<)\\s*[.:A-Z\\x{80}-\\x{10FFFF}][.:\\w\\x{80}-\\x{10FFFF}]*(\\(([.a-zA-Z0-9_:]+\\s,)\\))?)?)|((<<)\\s*[.A-Z0-9_:\\x{80}-\\x{10FFFF}]+))",
48 "name": "meta.class.crystal"
49 },
50 {
51 "captures": {
52 "1": {
53 "name": "keyword.control.module.crystal"
54 },
55 "2": {
56 "name": "entity.name.type.module.crystal"
57 },
58 "3": {
59 "name": "entity.other.inherited-class.module.first.crystal"
60 },
61 "4": {
62 "name": "punctuation.separator.inheritance.crystal"
63 },
64 "5": {
65 "name": "entity.other.inherited-class.module.second.crystal"
66 },
67 "6": {
68 "name": "punctuation.separator.inheritance.crystal"
69 },
70 "7": {
71 "name": "entity.other.inherited-class.module.third.crystal"
72 },
73 "8": {
74 "name": "punctuation.separator.inheritance.crystal"
75 }
76 },
77 "match": "^\\s*(module)\\s+(([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))?([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))?([A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(::))*[A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*)",
78 "name": "meta.module.crystal"
79 },
80 {
81 "captures": {
82 "1": {
83 "name": "keyword.control.lib.crystal"
84 },
85 "2": {
86 "name": "entity.name.type.lib.crystal"
87 },
88 "3": {
89 "name": "entity.other.inherited-class.lib.first.crystal"
90 },
91 "4": {
92 "name": "punctuation.separator.inheritance.crystal"
93 },
94 "5": {
95 "name": "entity.other.inherited-class.lib.second.crystal"
96 },
97 "6": {
98 "name": "punctuation.separator.inheritance.crystal"
99 },
100 "7": {
101 "name": "entity.other.inherited-class.lib.third.crystal"
102 },
103 "8": {
104 "name": "punctuation.separator.inheritance.crystal"
105 }
106 },
107 "match": "^\\s*(lib)\\s+(([A-Z]\\w*(::))?([A-Z]\\w*(::))?([A-Z]\\w*(::))*[A-Z]\\w*)",
108 "name": "meta.lib.crystal"
109 },
110 {
111 "captures": {
112 "1": {
113 "name": "keyword.control.lib.type.crystal"
114 },
115 "2": {
116 "name": "entity.name.lib.type.crystal"
117 },
118 "3": {
119 "name": "keyword.control.lib.crystal"
120 },
121 "4": {
122 "name": "entity.name.lib.type.value.crystal"
123 }
124 },
125 "comment": "type in lib",
126 "match": "(?<!\\.)\\b(type)\\s+([A-Z]\\w+)\\s*(=)\\s*(.+)",
127 "name": "meta.lib.type.crystal"
128 },
129 {
130 "comment": "everything being a reserved word, not a value and needing a 'end' is a..",
131 "match": "(?<!\\.)\\b(fun|begin|case|class|else|elsif|end|ensure|enum|for|if|macro|module|rescue|struct|then|union|unless|until|when|while)\\b(?![?!:])",
132 "name": "keyword.control.crystal"
133 },
134 {
135 "comment": "everything being a reserved word, not a value and not needing a 'end' is a..",
136 "match": "(?<!\\.)\\b(abstract|alias|asm|break|extend|in|include|next|of|private|protected|struct|return|select|super|with|yield)\\b(?![?!:])",
137 "name": "keyword.control.primary.crystal"
138 },
139 {
140 "comment": "contextual smart pair support for block parameters",
141 "match": "(?<!\\.)\\bdo\\b\\s*",
142 "name": "keyword.control.start-block.crystal"
143 },
144 {
145 "comment": "contextual smart pair support",
146 "match": "(?<=\\{)(\\s+)",
147 "name": "meta.syntax.crystal.start-block"
148 },
149 {
150 "comment": "Just as above but being not a logical operation",
151 "match": "(?<!\\.)\\b(pointerof|typeof|sizeof|instance_sizeof|offsetof|previous_def|forall|out|uninitialized)\\b(?![?!:])|\\.(is_a\\?|nil\\?|responds_to\\?|as\\?|as\b)",
152 "name": "keyword.control.pseudo-method.crystal"
153 },
154 {
155 "match": "\\bnil\\b(?![?!:])",
156 "name": "constant.language.nil.crystal"
157 },
158 {
159 "match": "\\b(true|false)\\b(?![?!:])",
160 "name": "constant.language.boolean.crystal"
161 },
162 {
163 "match": "\\b(__(DIR|FILE|LINE|END_LINE)__)\\b(?![?!:])",
164 "name": "variable.language.crystal"
165 },
166 {
167 "match": "\\b(self)\\b(?![?!:])",
168 "name": "variable.language.self.crystal"
169 },
170 {
171 "comment": "https://crystal-lang.org/api/0.36.1/Object.html#macro-summary",
172 "match": "(?<!\\.)\\b(((class_)?((getter|property)\\b[!?]?|setter\\b))|(def_(clone|equals|equals_and_hash|hash)|delegate|forward_missing_to)\\b)(?![?!:])",
173 "name": "support.function.kernel.crystal"
174 },
175 {
176 "begin": "\\b(require)\\b",
177 "captures": {
178 "1": {
179 "name": "keyword.other.special-method.crystal"
180 }
181 },
182 "end": "$|(?=#)",
183 "name": "meta.require.crystal",
184 "patterns": [
185 {
186 "include": "$self"
187 }
188 ]
189 },
190 {
191 "captures": {
192 "1": {
193 "name": "punctuation.definition.variable.crystal"
194 }
195 },
196 "match": "(@)[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*[?!=]?",
197 "name": "variable.other.readwrite.instance.crystal"
198 },
199 {
200 "captures": {
201 "1": {
202 "name": "punctuation.definition.variable.crystal"
203 }
204 },
205 "match": "(@@)[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*[?!=]?",
206 "name": "variable.other.readwrite.class.crystal"
207 },
208 {
209 "captures": {
210 "1": {
211 "name": "punctuation.definition.variable.crystal"
212 }
213 },
214 "match": "(\\$)[a-zA-Z_]\\w*",
215 "name": "variable.other.readwrite.global.crystal"
216 },
217 {
218 "captures": {
219 "1": {
220 "name": "punctuation.definition.variable.crystal"
221 }
222 },
223 "match": "(?!%[Qxrqwi]?[\\(\\[\\{\\<\\|])%([a-zA-Z_]\\w*\\.)*[a-zA-Z_]\\w*",
224 "name": "variable.other.readwrite.fresh.crystal"
225 },
226 {
227 "captures": {
228 "1": {
229 "name": "punctuation.definition.variable.crystal"
230 }
231 },
232 "match": "(\\$)(!|@|&|`|'|\\+|\\d+|~|=|/|\\\\|,|;|\\.|<|>|_|\\*|\\$|\\?|:|\"|-[0adFiIlpv])",
233 "name": "variable.other.readwrite.global.pre-defined.crystal"
234 },
235 {
236 "begin": "\\b(ENV)\\[",
237 "beginCaptures": {
238 "1": {
239 "name": "variable.other.constant.crystal"
240 }
241 },
242 "end": "\\]",
243 "name": "meta.environment-variable.crystal",
244 "patterns": [
245 {
246 "include": "$self"
247 }
248 ]
249 },
250 {
251 "match": "\\b[A-Z\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*",
252 "name": "support.class.crystal",
253 "comment": "Literals name of Crystal"
254 },
255 {
256 "match": "(?<!\\.)\\b(abort|at_exit|caller|exit|gets|loop|main|p|pp|print|printf|puts|raise|rand|read_line|sleep|spawn|sprintf|system|debugger|record|spawn)\\b(?![?!:])",
257 "name": "support.function.kernel.crystal",
258 "comment": "Fetch from https://crystal-lang.org/api/0.36.1/toplevel.html"
259 },
260 {
261 "match": "\\b[_A-Z]+\\b",
262 "name": "variable.other.constant.crystal",
263 "comment": "Constant name in any where"
264 },
265 {
266 "begin": "(?x)\n(?=def\\b) # optimization to help Oniguruma fail fast\n(?<=^|\\s)(def)\\s+\n(\n (?>[a-zA-Z_]\\w*(?>\\.|::))? # method prefix\n (?> # method name\n [a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n |\n \\^|===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[][?=]?|\\[]=?\n )\n)\n\\s*(\\()",
267 "beginCaptures": {
268 "1": {
269 "name": "keyword.control.def.crystal"
270 },
271 "2": {
272 "name": "entity.name.function.crystal"
273 },
274 "3": {
275 "name": "punctuation.definition.parameters.crystal"
276 }
277 },
278 "comment": "The method pattern comes from the symbol pattern. See there for an explanation.",
279 "end": "\\)",
280 "endCaptures": {
281 "0": {
282 "name": "punctuation.definition.parameters.crystal"
283 }
284 },
285 "name": "meta.function.method.with-arguments.crystal",
286 "patterns": [
287 {
288 "begin": "(?![\\s,)])",
289 "end": "(?=,|\\)\\s*$)",
290 "patterns": [
291 {
292 "captures": {
293 "1": {
294 "name": "storage.type.variable.crystal"
295 },
296 "2": {
297 "name": "constant.other.symbol.hashkey.parameter.function.crystal"
298 },
299 "3": {
300 "name": "punctuation.definition.constant.hashkey.crystal"
301 },
302 "4": {
303 "name": "variable.parameter.function.crystal"
304 }
305 },
306 "match": "\\G([&*]?)(?:([_a-zA-Z]\\w*(:))|([_a-zA-Z]\\w*))"
307 },
308 {
309 "include": "$self"
310 }
311 ]
312 }
313 ]
314 },
315 {
316 "captures": {
317 "1": {
318 "name": "keyword.control.def.crystal"
319 },
320 "3": {
321 "name": "entity.name.function.crystal"
322 }
323 },
324 "comment": " the optional name is just to catch the def also without a method-name",
325 "match": "(?x)\n(?=def\\b) # optimization to help Oniguruma fail fast\n(?<=^|\\s)(def)\\b\n(\n \\s+\n (\n (?>[a-zA-Z_]\\w*(?>\\.|::))? # method prefix\n (?> # method name\n [a-zA-Z_]\\w*(?>[?!]|=(?!>))?\n |\n \\^|===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[][?=]?|\\[]=?\n )\n )\n)?",
326 "name": "meta.function.method.without-arguments.crystal"
327 },
328 {
329 "comment": "Floating point literal (fraction)",
330 "name": "constant.numeric.float.crystal",
331 "match": "\\b[0-9][0-9_]*\\.[0-9][0-9_]*([eE][+-]?[0-9_]+)?(f32|f64)?\\b"
332 },
333 {
334 "comment": "Floating point literal (exponent)",
335 "name": "constant.numeric.float.crystal",
336 "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?[eE][+-]?[0-9_]+(f32|f64)?\\b"
337 },
338 {
339 "comment": "Floating point literal (typed)",
340 "name": "constant.numeric.float.crystal",
341 "match": "\\b[0-9][0-9_]*(\\.[0-9][0-9_]*)?([eE][+-]?[0-9_]+)?(f32|f64)\\b"
342 },
343 {
344 "comment": "Integer literal (decimal)",
345 "name": "constant.numeric.integer.decimal.crystal",
346 "match": "\\b(?!0[0-9])[0-9][0-9_]*([ui](8|16|32|64|128))?\\b"
347 },
348 {
349 "comment": "Integer literal (hexadecimal)",
350 "name": "constant.numeric.integer.hexadecimal.crystal",
351 "match": "\\b0x[a-fA-F0-9_]+([ui](8|16|32|64|128))?\\b"
352 },
353 {
354 "comment": "Integer literal (octal)",
355 "name": "constant.numeric.integer.octal.crystal",
356 "match": "\\b0o[0-7_]+([ui](8|16|32|64|128))?\\b"
357 },
358 {
359 "comment": "Integer literal (binary)",
360 "name": "constant.numeric.integer.binary.crystal",
361 "match": "\\b0b[01_]+([ui](8|16|32|64|128))?\\b"
362 },
363 {
364 "begin": ":'",
365 "beginCaptures": {
366 "0": {
367 "name": "punctuation.definition.symbol.begin.crystal"
368 }
369 },
370 "comment": "symbol literal with '' delimiter",
371 "end": "'",
372 "endCaptures": {
373 "0": {
374 "name": "punctuation.definition.symbol.end.crystal"
375 }
376 },
377 "name": "constant.other.symbol.crystal",
378 "patterns": [
379 {
380 "match": "\\\\['\\\\]",
381 "name": "constant.character.escape.crystal"
382 }
383 ]
384 },
385 {
386 "begin": ":\"",
387 "beginCaptures": {
388 "0": {
389 "name": "punctuation.section.symbol.begin.crystal"
390 }
391 },
392 "comment": "symbol literal with \"\" delimiter",
393 "end": "\"",
394 "endCaptures": {
395 "0": {
396 "name": "punctuation.section.symbol.end.crystal"
397 }
398 },
399 "name": "constant.other.symbol.interpolated.crystal",
400 "patterns": [
401 {
402 "include": "#interpolated_crystal"
403 },
404 {
405 "include": "#escaped_char"
406 }
407 ]
408 },
409 {
410 "comment": "Needs higher precedence than regular expressions.",
411 "match": "(?<!\\()/=",
412 "name": "keyword.operator.assignment.augmented.crystal"
413 },
414 {
415 "begin": "'",
416 "beginCaptures": {
417 "0": {
418 "name": "punctuation.definition.string.begin.crystal"
419 }
420 },
421 "comment": "string literal with '' delimiter",
422 "end": "'",
423 "endCaptures": {
424 "0": {
425 "name": "punctuation.definition.string.end.crystal"
426 }
427 },
428 "name": "string.quoted.single.crystal",
429 "patterns": [
430 {
431 "match": "\\\\'|\\\\\\\\",
432 "name": "constant.character.escape.crystal"
433 }
434 ]
435 },
436 {
437 "begin": "\"",
438 "beginCaptures": {
439 "0": {
440 "name": "punctuation.definition.string.begin.crystal"
441 }
442 },
443 "comment": "string literal with interpolation and \"\" delimiter",
444 "end": "\"",
445 "endCaptures": {
446 "0": {
447 "name": "punctuation.definition.string.end.crystal"
448 }
449 },
450 "name": "string.quoted.double.interpolated.crystal",
451 "patterns": [
452 {
453 "include": "#interpolated_crystal"
454 },
455 {
456 "include": "#escaped_char"
457 }
458 ]
459 },
460 {
461 "begin": "`",
462 "beginCaptures": {
463 "0": {
464 "name": "punctuation.definition.string.begin.crystal"
465 }
466 },
467 "comment": "execute string (allows for interpolation)",
468 "end": "`",
469 "endCaptures": {
470 "0": {
471 "name": "punctuation.definition.string.end.crystal"
472 }
473 },
474 "name": "string.interpolated.crystal",
475 "patterns": [
476 {
477 "include": "#interpolated_crystal"
478 },
479 {
480 "include": "#escaped_char"
481 }
482 ]
483 },
484 {
485 "begin": "%x\\{",
486 "beginCaptures": [
487 {
488 "name": "punctuation.definition.string.begin.crystal"
489 }
490 ],
491 "comment": "execute string (allow for interpolation)",
492 "end": "\\}",
493 "endCaptures": [
494 {
495 "name": "punctuation.definition.string.end.crystal"
496 }
497 ],
498 "name": "string.interpolated.crystal",
499 "patterns": [
500 {
501 "include": "#interpolated_crystal"
502 },
503 {
504 "include": "#escaped_char"
505 },
506 {
507 "include": "#nest_curly_i"
508 }
509 ]
510 },
511 {
512 "begin": "%x\\[",
513 "beginCaptures": [
514 {
515 "name": "punctuation.definition.string.begin.crystal"
516 }
517 ],
518 "comment": "execute string (allow for interpolation)",
519 "end": "\\]",
520 "endCaptures": [
521 {
522 "name": "punctuation.definition.string.end.crystal"
523 }
524 ],
525 "name": "string.interpolated.crystal",
526 "patterns": [
527 {
528 "include": "#interpolated_crystal"
529 },
530 {
531 "include": "#escaped_char"
532 },
533 {
534 "include": "#nest_brackets_i"
535 }
536 ]
537 },
538 {
539 "begin": "%x\\<",
540 "beginCaptures": [
541 {
542 "name": "punctuation.definition.string.begin.crystal"
543 }
544 ],
545 "comment": "execute string (allow for interpolation)",
546 "end": "\\>",
547 "endCaptures": [
548 {
549 "name": "punctuation.definition.string.end.crystal"
550 }
551 ],
552 "name": "string.interpolated.crystal",
553 "patterns": [
554 {
555 "include": "#interpolated_crystal"
556 },
557 {
558 "include": "#escaped_char"
559 },
560 {
561 "include": "#nest_ltgt_i"
562 }
563 ]
564 },
565 {
566 "begin": "%x\\(",
567 "beginCaptures": [
568 {
569 "name": "punctuation.definition.string.begin.crystal"
570 }
571 ],
572 "comment": "execute string (allow for interpolation)",
573 "end": "\\)",
574 "endCaptures": [
575 {
576 "name": "punctuation.definition.string.end.crystal"
577 }
578 ],
579 "name": "string.interpolated.crystal",
580 "patterns": [
581 {
582 "include": "#interpolated_crystal"
583 },
584 {
585 "include": "#escaped_char"
586 },
587 {
588 "include": "#nest_parens_i"
589 }
590 ]
591 },
592 {
593 "begin": "%x\\|",
594 "beginCaptures": [
595 {
596 "name": "punctuation.definition.string.begin.crystal"
597 }
598 ],
599 "comment": "execute string (allow for interpolation)",
600 "end": "\\|",
601 "endCaptures": [
602 {
603 "name": "punctuation.definition.string.end.crystal"
604 }
605 ],
606 "name": "string.interpolated.crystal",
607 "patterns": [
608 {
609 "include": "#interpolated_crystal"
610 },
611 {
612 "include": "#escaped_char"
613 }
614 ]
615 },
616 {
617 "begin": "(?x) (?: ^| (?<=[=>~(?:\\[,|&;] | [\\s;]if\\s| [\\s;]elsif\\s | [\\s;]while\\s | [\\s;]unless\\s | [\\s;]when\\s | [\\s;]assert_match\\s | [\\s;]or\\s| [\\s;]and\\s | [\\s;]not\\s | [\\s.]index\\s| [\\s.]scan\\s | [\\s.]sub\\s | [\\s.]sub!\\s | [\\s.]gsub\\s | [\\s.]gsub!\\s | [\\s.]match\\s ) | (?<=^when\\s| ^if\\s | ^elsif\\s | ^while\\s | ^unless\\s ) ) \\s*((/))(?![*+{}?])",
618 "captures": {
619 "1": {
620 "name": "string.regexp.classic.crystal"
621 },
622 "2": {
623 "name": "punctuation.definition.string.crystal"
624 }
625 },
626 "comment": "regular expressions (normal) we only start a regexp if the character before it (excluding whitespace) is what we think is before a regexp",
627 "contentName": "string.regexp.classic.crystal",
628 "end": "((/[imsx]*))",
629 "patterns": [
630 {
631 "include": "#regex_sub"
632 }
633 ]
634 },
635 {
636 "begin": "%r\\{",
637 "beginCaptures": [
638 {
639 "name": "punctuation.definition.string.begin.crystal"
640 }
641 ],
642 "comment": "regular expressions (literal)",
643 "end": "\\}[imsx]*",
644 "endCaptures": [
645 {
646 "name": "punctuation.definition.string.end.crystal"
647 }
648 ],
649 "name": "string.regexp.mod-r.crystal",
650 "patterns": [
651 {
652 "include": "#regex_sub"
653 },
654 {
655 "include": "#nest_curly_r"
656 }
657 ]
658 },
659 {
660 "begin": "%r\\[",
661 "beginCaptures": [
662 {
663 "name": "punctuation.definition.string.begin.crystal"
664 }
665 ],
666 "comment": "regular expressions (literal)",
667 "end": "\\][imsx]*",
668 "endCaptures": [
669 {
670 "name": "punctuation.definition.string.end.crystal"
671 }
672 ],
673 "name": "string.regexp.mod-r.crystal",
674 "patterns": [
675 {
676 "include": "#regex_sub"
677 },
678 {
679 "include": "#nest_brackets_r"
680 }
681 ]
682 },
683 {
684 "begin": "%r\\(",
685 "beginCaptures": [
686 {
687 "name": "punctuation.definition.string.begin.crystal"
688 }
689 ],
690 "comment": "regular expressions (literal)",
691 "end": "\\)[imsx]*",
692 "endCaptures": [
693 {
694 "name": "punctuation.definition.string.end.crystal"
695 }
696 ],
697 "name": "string.regexp.mod-r.crystal",
698 "patterns": [
699 {
700 "include": "#regex_sub"
701 },
702 {
703 "include": "#nest_parens_r"
704 }
705 ]
706 },
707 {
708 "begin": "%r\\<",
709 "beginCaptures": [
710 {
711 "name": "punctuation.definition.string.begin.crystal"
712 }
713 ],
714 "comment": "regular expressions (literal)",
715 "end": "\\>[imsx]*",
716 "endCaptures": [
717 {
718 "name": "punctuation.definition.string.end.crystal"
719 }
720 ],
721 "name": "string.regexp.mod-r.crystal",
722 "patterns": [
723 {
724 "include": "#regex_sub"
725 },
726 {
727 "include": "#nest_ltgt_r"
728 }
729 ]
730 },
731 {
732 "begin": "%r\\|",
733 "beginCaptures": [
734 {
735 "name": "punctuation.definition.string.begin.crystal"
736 }
737 ],
738 "comment": "regular expressions (literal)",
739 "end": "\\|[imsx]*",
740 "endCaptures": [
741 {
742 "name": "punctuation.definition.string.end.crystal"
743 }
744 ],
745 "name": "string.regexp.mod-r.crystal",
746 "patterns": [
747 {
748 "include": "#regex_sub"
749 }
750 ]
751 },
752 {
753 "begin": "%Q?\\(",
754 "beginCaptures": [
755 {
756 "name": "punctuation.definition.string.begin.crystal"
757 }
758 ],
759 "comment": "literal capable of interpolation ()",
760 "end": "\\)",
761 "endCaptures": [
762 {
763 "name": "punctuation.definition.string.end.crystal"
764 }
765 ],
766 "name": "string.quoted.other.literal.upper.crystal",
767 "patterns": [
768 {
769 "include": "#interpolated_crystal"
770 },
771 {
772 "include": "#escaped_char"
773 },
774 {
775 "include": "#nest_parens_i"
776 }
777 ]
778 },
779 {
780 "begin": "%Q?\\[",
781 "beginCaptures": [
782 {
783 "name": "punctuation.definition.string.begin.crystal"
784 }
785 ],
786 "comment": "literal capable of interpolation []",
787 "end": "\\]",
788 "endCaptures": [
789 {
790 "name": "punctuation.definition.string.end.crystal"
791 }
792 ],
793 "name": "string.quoted.other.literal.upper.crystal",
794 "patterns": [
795 {
796 "include": "#interpolated_crystal"
797 },
798 {
799 "include": "#escaped_char"
800 },
801 {
802 "include": "#nest_brackets_i"
803 }
804 ]
805 },
806 {
807 "begin": "%Q?\\<",
808 "beginCaptures": [
809 {
810 "name": "punctuation.definition.string.begin.crystal"
811 }
812 ],
813 "comment": "literal capable of interpolation <>",
814 "end": "\\>",
815 "endCaptures": [
816 {
817 "name": "punctuation.definition.string.end.crystal"
818 }
819 ],
820 "name": "string.quoted.other.literal.upper.crystal",
821 "patterns": [
822 {
823 "include": "#interpolated_crystal"
824 },
825 {
826 "include": "#escaped_char"
827 },
828 {
829 "include": "#nest_ltgt_i"
830 }
831 ]
832 },
833 {
834 "begin": "%Q?\\{",
835 "beginCaptures": [
836 {
837 "name": "punctuation.definition.string.begin.crystal"
838 }
839 ],
840 "comment": "literal capable of interpolation -- {}",
841 "end": "\\}",
842 "endCaptures": [
843 {
844 "name": "punctuation.definition.string.end.crystal"
845 }
846 ],
847 "name": "string.quoted.double.crystal.mod",
848 "patterns": [
849 {
850 "include": "#interpolated_crystal"
851 },
852 {
853 "include": "#escaped_char"
854 },
855 {
856 "include": "#nest_curly_i"
857 }
858 ]
859 },
860 {
861 "begin": "%Q\\|",
862 "beginCaptures": [
863 {
864 "name": "punctuation.definition.string.begin.crystal"
865 }
866 ],
867 "comment": "literal capable of interpolation -- ||",
868 "end": "\\|",
869 "endCaptures": [
870 {
871 "name": "punctuation.definition.string.end.crystal"
872 }
873 ],
874 "name": "string.quoted.other.literal.upper.crystal",
875 "patterns": [
876 {
877 "include": "#interpolated_crystal"
878 },
879 {
880 "include": "#escaped_char"
881 }
882 ]
883 },
884 {
885 "begin": "%[qwi]\\(",
886 "beginCaptures": [
887 {
888 "name": "punctuation.definition.string.begin.crystal"
889 }
890 ],
891 "comment": "literal incapable of interpolation -- ()",
892 "end": "\\)",
893 "endCaptures": [
894 {
895 "name": "punctuation.definition.string.end.crystal"
896 }
897 ],
898 "name": "string.quoted.other.literal.lower.crystal",
899 "patterns": [
900 {
901 "match": "\\\\\\)|\\\\\\\\",
902 "name": "constant.character.escape.crystal"
903 },
904 {
905 "include": "#nest_parens"
906 }
907 ]
908 },
909 {
910 "begin": "%[qwi]\\<",
911 "beginCaptures": [
912 {
913 "name": "punctuation.definition.string.begin.crystal"
914 }
915 ],
916 "comment": "literal incapable of interpolation -- <>",
917 "end": "\\>",
918 "endCaptures": [
919 {
920 "name": "punctuation.definition.string.end.crystal"
921 }
922 ],
923 "name": "string.quoted.other.literal.lower.crystal",
924 "patterns": [
925 {
926 "match": "\\\\\\>|\\\\\\\\",
927 "name": "constant.character.escape.crystal"
928 },
929 {
930 "include": "#nest_ltgt"
931 }
932 ]
933 },
934 {
935 "begin": "%[qwi]\\[",
936 "beginCaptures": [
937 {
938 "name": "punctuation.definition.string.begin.crystal"
939 }
940 ],
941 "comment": "literal incapable of interpolation -- []",
942 "end": "\\]",
943 "endCaptures": [
944 {
945 "name": "punctuation.definition.string.end.crystal"
946 }
947 ],
948 "name": "string.quoted.other.literal.lower.crystal",
949 "patterns": [
950 {
951 "match": "\\\\\\]|\\\\\\\\",
952 "name": "constant.character.escape.crystal"
953 },
954 {
955 "include": "#nest_brackets"
956 }
957 ]
958 },
959 {
960 "begin": "%[qwi]\\{",
961 "beginCaptures": [
962 {
963 "name": "punctuation.definition.string.begin.crystal"
964 }
965 ],
966 "comment": "literal incapable of interpolation -- {}",
967 "end": "\\}",
968 "endCaptures": [
969 {
970 "name": "punctuation.definition.string.end.crystal"
971 }
972 ],
973 "name": "string.quoted.other.literal.lower.crystal",
974 "patterns": [
975 {
976 "match": "\\\\\\}|\\\\\\\\",
977 "name": "constant.character.escape.crystal"
978 },
979 {
980 "include": "#nest_curly"
981 }
982 ]
983 },
984 {
985 "begin": "%[qwi]\\|",
986 "beginCaptures": [
987 {
988 "name": "punctuation.definition.string.begin.crystal"
989 }
990 ],
991 "comment": "literal incapable of interpolation -- ||",
992 "end": "\\|",
993 "endCaptures": [
994 {
995 "name": "punctuation.definition.string.end.crystal"
996 }
997 ],
998 "name": "string.quoted.other.literal.lower.crystal",
999 "patterns": [
1000 {
1001 "comment": "Cant be named because its not necessarily an escape.",
1002 "match": "\\\\."
1003 }
1004 ]
1005 },
1006 {
1007 "captures": {
1008 "1": {
1009 "name": "punctuation.definition.constant.crystal"
1010 }
1011 },
1012 "comment": "symbols",
1013 "match": "(?<!:)(:)(?>[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[\\][?=]?|@@?[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*)",
1014 "name": "constant.other.symbol.crystal"
1015 },
1016 {
1017 "captures": {
1018 "1": {
1019 "name": "punctuation.definition.constant.crystal"
1020 }
1021 },
1022 "comment": "symbols",
1023 "match": "(?>[a-zA-Z_\\x{80}-\\x{10FFFF}][\\w\\x{80}-\\x{10FFFF}]*(?>[?!])?)(:)(?!:)",
1024 "name": "constant.other.symbol.crystal.19syntax"
1025 },
1026 {
1027 "captures": {
1028 "1": {
1029 "name": "punctuation.definition.comment.crystal"
1030 }
1031 },
1032 "match": "(?:^[ \\t]+)?(#).*$\\n?",
1033 "name": "comment.line.number-sign.crystal"
1034 },
1035 {
1036 "begin": "(?><<-('?)((?:[_\\w]+_|)HTML)\\b\\1)",
1037 "beginCaptures": [
1038 {
1039 "name": "punctuation.definition.string.begin.crystal"
1040 }
1041 ],
1042 "comment": "heredoc with embedded HTML and indented terminator",
1043 "contentName": "text.html.embedded.crystal",
1044 "end": "\\s*\\2\\b",
1045 "endCaptures": [
1046 {
1047 "name": "punctuation.definition.string.end.crystal"
1048 }
1049 ],
1050 "name": "string.unquoted.embedded.html.crystal",
1051 "patterns": [
1052 {
1053 "include": "#heredoc"
1054 },
1055 {
1056 "include": "text.html.basic"
1057 },
1058 {
1059 "include": "#interpolated_crystal"
1060 },
1061 {
1062 "include": "#escaped_char"
1063 }
1064 ]
1065 },
1066 {
1067 "begin": "(?><<-('?)((?:[_\\w]+_|)SQL)\\b\\1)",
1068 "beginCaptures": [
1069 {
1070 "name": "punctuation.definition.string.begin.crystal"
1071 }
1072 ],
1073 "comment": "heredoc with embedded SQL and indented terminator",
1074 "contentName": "text.sql.embedded.crystal",
1075 "end": "\\s*\\2\\b",
1076 "endCaptures": [
1077 {
1078 "name": "punctuation.definition.string.end.crystal"
1079 }
1080 ],
1081 "name": "string.unquoted.embedded.sql.crystal",
1082 "patterns": [
1083 {
1084 "include": "#heredoc"
1085 },
1086 {
1087 "include": "source.sql"
1088 },
1089 {
1090 "include": "#interpolated_crystal"
1091 },
1092 {
1093 "include": "#escaped_char"
1094 }
1095 ]
1096 },
1097 {
1098 "begin": "(?><<-('?)((?:[_\\w]+_|)CSS)\\b\\1)",
1099 "beginCaptures": [
1100 {
1101 "name": "punctuation.definition.string.begin.crystal"
1102 }
1103 ],
1104 "comment": "heredoc with embedded css and intented terminator",
1105 "contentName": "text.css.embedded.crystal",
1106 "end": "\\s*\\2\\b",
1107 "endCaptures": [
1108 {
1109 "name": "punctuation.definition.string.end.crystal"
1110 }
1111 ],
1112 "name": "string.unquoted.embedded.css.crystal",
1113 "patterns": [
1114 {
1115 "include": "#heredoc"
1116 },
1117 {
1118 "include": "source.css"
1119 },
1120 {
1121 "include": "#interpolated_crystal"
1122 },
1123 {
1124 "include": "#escaped_char"
1125 }
1126 ]
1127 },
1128 {
1129 "begin": "(?><<-('?)((?:[_\\w]+_|)CPP)\\b\\1)",
1130 "beginCaptures": [
1131 {
1132 "name": "punctuation.definition.string.begin.crystal"
1133 }
1134 ],
1135 "comment": "heredoc with embedded c++ and intented terminator",
1136 "contentName": "text.c++.embedded.crystal",
1137 "end": "\\s*\\2\\b",
1138 "endCaptures": [
1139 {
1140 "name": "punctuation.definition.string.end.crystal"
1141 }
1142 ],
1143 "name": "string.unquoted.embedded.cplusplus.crystal",
1144 "patterns": [
1145 {
1146 "include": "#heredoc"
1147 },
1148 {
1149 "include": "source.c++"
1150 },
1151 {
1152 "include": "#interpolated_crystal"
1153 },
1154 {
1155 "include": "#escaped_char"
1156 }
1157 ]
1158 },
1159 {
1160 "begin": "(?><<-('?)((?:[_\\w]+_|)C)\\b\\1)",
1161 "beginCaptures": [
1162 {
1163 "name": "punctuation.definition.string.begin.crystal"
1164 }
1165 ],
1166 "comment": "heredoc with embedded c++ and intented terminator",
1167 "contentName": "text.c.embedded.crystal",
1168 "end": "\\s*\\2\\b",
1169 "endCaptures": [
1170 {
1171 "name": "punctuation.definition.string.end.crystal"
1172 }
1173 ],
1174 "name": "string.unquoted.embedded.c.crystal",
1175 "patterns": [
1176 {
1177 "include": "#heredoc"
1178 },
1179 {
1180 "include": "source.c"
1181 },
1182 {
1183 "include": "#interpolated_crystal"
1184 },
1185 {
1186 "include": "#escaped_char"
1187 }
1188 ]
1189 },
1190 {
1191 "begin": "(?><<-('?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1)",
1192 "beginCaptures": [
1193 {
1194 "name": "punctuation.definition.string.begin.crystal"
1195 }
1196 ],
1197 "comment": "heredoc with embedded javascript and intented terminator",
1198 "contentName": "text.js.embedded.crystal",
1199 "end": "\\s*\\2\\b",
1200 "endCaptures": [
1201 {
1202 "name": "punctuation.definition.string.end.crystal"
1203 }
1204 ],
1205 "name": "string.unquoted.embedded.js.crystal",
1206 "patterns": [
1207 {
1208 "include": "#heredoc"
1209 },
1210 {
1211 "include": "source.js"
1212 },
1213 {
1214 "include": "#interpolated_crystal"
1215 },
1216 {
1217 "include": "#escaped_char"
1218 }
1219 ]
1220 },
1221 {
1222 "begin": "(?><<-('?)((?:[_\\w]+_|)JQUERY)\\b\\1)",
1223 "beginCaptures": [
1224 {
1225 "name": "punctuation.definition.string.begin.crystal"
1226 }
1227 ],
1228 "comment": "heredoc with embedded javascript and intented terminator",
1229 "contentName": "text.js.jquery.embedded.crystal",
1230 "end": "\\s*\\2\\b",
1231 "endCaptures": [
1232 {
1233 "name": "punctuation.definition.string.end.crystal"
1234 }
1235 ],
1236 "name": "string.unquoted.embedded.js.jquery.crystal",
1237 "patterns": [
1238 {
1239 "include": "#heredoc"
1240 },
1241 {
1242 "include": "source.js.jquery"
1243 },
1244 {
1245 "include": "#interpolated_crystal"
1246 },
1247 {
1248 "include": "#escaped_char"
1249 }
1250 ]
1251 },
1252 {
1253 "begin": "(?><<-('?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1)",
1254 "beginCaptures": [
1255 {
1256 "name": "punctuation.definition.string.begin.crystal"
1257 }
1258 ],
1259 "comment": "heredoc with embedded shell and intented terminator",
1260 "contentName": "text.shell.embedded.crystal",
1261 "end": "\\s*\\2\\b",
1262 "endCaptures": [
1263 {
1264 "name": "punctuation.definition.string.end.crystal"
1265 }
1266 ],
1267 "name": "string.unquoted.embedded.shell.crystal",
1268 "patterns": [
1269 {
1270 "include": "#heredoc"
1271 },
1272 {
1273 "include": "source.shell"
1274 },
1275 {
1276 "include": "#interpolated_crystal"
1277 },
1278 {
1279 "include": "#escaped_char"
1280 }
1281 ]
1282 },
1283 {
1284 "begin": "(?><<-('?)((?:[_\\w]+_|)CRYSTAL)\\b\\1)",
1285 "beginCaptures": [
1286 {
1287 "name": "punctuation.definition.string.begin.crystal"
1288 }
1289 ],
1290 "comment": "heredoc with embedded crystal and intented terminator",
1291 "contentName": "text.crystal.embedded.crystal",
1292 "end": "\\s*\\2\\b",
1293 "endCaptures": [
1294 {
1295 "name": "punctuation.definition.string.end.crystal"
1296 }
1297 ],
1298 "name": "string.unquoted.embedded.crystal.crystal",
1299 "patterns": [
1300 {
1301 "include": "#heredoc"
1302 },
1303 {
1304 "include": "source.crystal"
1305 },
1306 {
1307 "include": "#interpolated_crystal"
1308 },
1309 {
1310 "include": "#escaped_char"
1311 }
1312 ]
1313 },
1314 {
1315 "begin": "(?><<-'(\\w+)')",
1316 "beginCaptures": [
1317 {
1318 "name": "punctuation.definition.string.begin.crystal"
1319 }
1320 ],
1321 "comment": "heredoc with indented terminator",
1322 "end": "\\s*\\1\\b",
1323 "endCaptures": [
1324 {
1325 "name": "punctuation.definition.string.end.crystal"
1326 }
1327 ],
1328 "name": "string.unquoted.heredoc.crystal",
1329 "patterns": [
1330 {
1331 "include": "#heredoc"
1332 },
1333 {
1334 "include": "#escaped_char"
1335 }
1336 ]
1337 },
1338 {
1339 "begin": "(?><<-(\\w+)\\b)",
1340 "beginCaptures": [
1341 {
1342 "name": "punctuation.definition.string.begin.crystal"
1343 }
1344 ],
1345 "comment": "heredoc with indented terminator",
1346 "end": "\\s*\\1\\b",
1347 "endCaptures": [
1348 {
1349 "name": "punctuation.definition.string.end.crystal"
1350 }
1351 ],
1352 "name": "string.unquoted.heredoc.crystal",
1353 "patterns": [
1354 {
1355 "include": "#heredoc"
1356 },
1357 {
1358 "include": "#interpolated_crystal"
1359 },
1360 {
1361 "include": "#escaped_char"
1362 }
1363 ]
1364 },
1365 {
1366 "begin": "(?<={|{\\s|[^A-Za-z0-9_]do|^do|[^A-Za-z0-9_]do\\s|^do\\s)(\\|)",
1367 "captures": {
1368 "1": {
1369 "name": "punctuation.separator.variable.crystal"
1370 }
1371 },
1372 "end": "(?<!\\|)(\\|)(?!\\|)",
1373 "patterns": [
1374 {
1375 "include": "source.crystal"
1376 },
1377 {
1378 "match": "[_a-zA-Z][_a-zA-Z0-9]*",
1379 "name": "variable.other.block.crystal"
1380 },
1381 {
1382 "match": ",",
1383 "name": "punctuation.separator.variable.crystal"
1384 }
1385 ]
1386 },
1387 {
1388 "match": "=>",
1389 "name": "punctuation.separator.key-value"
1390 },
1391 {
1392 "match": "->",
1393 "name": "support.function.kernel.crystal"
1394 },
1395 {
1396 "match": "<<=|%=|&{1,2}=|\\*=|\\*\\*=|\\+=|-=|\\^=|\\|{1,2}=|<<",
1397 "name": "keyword.operator.assignment.augmented.crystal"
1398 },
1399 {
1400 "match": "<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \\t])\\?",
1401 "name": "keyword.operator.comparison.crystal"
1402 },
1403 {
1404 "match": "(?<=^|[ \\t])!|&&|\\|\\||\\^",
1405 "name": "keyword.operator.logical.crystal"
1406 },
1407 {
1408 "match": "(\\{\\%|\\%\\}|\\{\\{|\\}\\})",
1409 "name": "keyword.operator.macro.crystal"
1410 },
1411 {
1412 "comment": "Safe navigation operator",
1413 "match": "(&\\.)\\s*(?![A-Z])",
1414 "captures": {
1415 "1": {
1416 "name": "punctuation.separator.method.crystal"
1417 }
1418 }
1419 },
1420 {
1421 "match": "(%|&|\\*\\*|\\*|\\+|\\-|/)",
1422 "name": "keyword.operator.arithmetic.crystal"
1423 },
1424 {
1425 "match": "=",
1426 "name": "keyword.operator.assignment.crystal"
1427 },
1428 {
1429 "match": "\\||~|>>",
1430 "name": "keyword.operator.other.crystal"
1431 },
1432 {
1433 "match": ":",
1434 "name": "punctuation.separator.other.crystal"
1435 },
1436 {
1437 "match": "\\;",
1438 "name": "punctuation.separator.statement.crystal"
1439 },
1440 {
1441 "match": ",",
1442 "name": "punctuation.separator.object.crystal"
1443 },
1444 {
1445 "match": "\\.|::",
1446 "name": "punctuation.separator.method.crystal"
1447 },
1448 {
1449 "match": "\\{|\\}",
1450 "name": "punctuation.section.scope.crystal"
1451 },
1452 {
1453 "match": "\\[|\\]",
1454 "name": "punctuation.section.array.crystal"
1455 },
1456 {
1457 "match": "\\(|\\)",
1458 "name": "punctuation.section.function.crystal"
1459 },
1460 {
1461 "begin": "(?=[a-zA-Z0-9_!?]+\\()",
1462 "end": "(?<=\\))",
1463 "name": "meta.function-call.crystal",
1464 "patterns": [
1465 {
1466 "include": "#nest_function_parens"
1467 },
1468 {
1469 "include": "#known_function_names"
1470 },
1471 {
1472 "match": "([a-zA-Z0-9_!?]+)(?=\\()",
1473 "name": "entity.name.function.crystal"
1474 },
1475 {
1476 "include": "$self"
1477 }
1478 ]
1479 },
1480 {
1481 "comment": "This is kindof experimental. There really is no way to perfectly match all regular variables, but you can pretty well assume that any normal word in certain curcumstances that havnt already been scoped as something else are probably variables, and the advantages beat the potential errors",
1482 "match": "((?<=\\W)\\b|^)\\w+\\b(?=\\s*([\\]\\)\\}\\=\\+\\-\\*\\/\\^\\$\\,\\.]|<\\s|<<[\\s|\\.]))",
1483 "name": "variable.other.crystal"
1484 }
1485 ],
1486 "repository": {
1487 "escaped_char": {
1488 "comment": "https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html",
1489 "match": "\\\\(?:[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\\{[a-fA-F0-9 ]+\\}|.)",
1490 "name": "constant.character.escape.crystal"
1491 },
1492 "heredoc": {
1493 "begin": "^<<-?\\w+",
1494 "end": "$",
1495 "patterns": [
1496 {
1497 "include": "$self"
1498 }
1499 ]
1500 },
1501 "interpolated_crystal": {
1502 "patterns": [
1503 {
1504 "begin": "#\\{",
1505 "beginCaptures": {
1506 "0": {
1507 "name": "punctuation.section.embedded.begin.crystal"
1508 }
1509 },
1510 "contentName": "source.crystal",
1511 "end": "(\\})",
1512 "endCaptures": {
1513 "0": {
1514 "name": "punctuation.section.embedded.end.crystal"
1515 },
1516 "1": {
1517 "name": "source.crystal"
1518 }
1519 },
1520 "name": "meta.embedded.line.crystal",
1521 "patterns": [
1522 {
1523 "include": "#nest_curly_and_self"
1524 },
1525 {
1526 "include": "$self"
1527 }
1528 ],
1529 "repository": {
1530 "nest_curly_and_self": {
1531 "patterns": [
1532 {
1533 "begin": "\\{",
1534 "captures": {
1535 "0": {
1536 "name": "punctuation.section.scope.crystal"
1537 }
1538 },
1539 "end": "\\}",
1540 "patterns": [
1541 {
1542 "include": "#nest_curly_and_self"
1543 }
1544 ]
1545 },
1546 {
1547 "include": "$self"
1548 }
1549 ]
1550 }
1551 }
1552 },
1553 {
1554 "captures": {
1555 "1": {
1556 "name": "punctuation.definition.variable.crystal"
1557 }
1558 },
1559 "match": "(#@)[a-zA-Z_]\\w*",
1560 "name": "variable.other.readwrite.instance.crystal"
1561 },
1562 {
1563 "captures": {
1564 "1": {
1565 "name": "punctuation.definition.variable.crystal"
1566 }
1567 },
1568 "match": "(#@@)[a-zA-Z_]\\w*",
1569 "name": "variable.other.readwrite.class.crystal"
1570 },
1571 {
1572 "captures": {
1573 "1": {
1574 "name": "punctuation.definition.variable.crystal"
1575 }
1576 },
1577 "match": "(#\\$)[a-zA-Z_]\\w*",
1578 "name": "variable.other.readwrite.global.crystal"
1579 }
1580 ]
1581 },
1582 "nest_brackets": {
1583 "begin": "\\[",
1584 "captures": [
1585 {
1586 "name": "punctuation.section.scope.crystal"
1587 }
1588 ],
1589 "end": "\\]",
1590 "patterns": [
1591 {
1592 "include": "#nest_brackets"
1593 }
1594 ]
1595 },
1596 "nest_brackets_i": {
1597 "begin": "\\[",
1598 "captures": [
1599 {
1600 "name": "punctuation.section.scope.crystal"
1601 }
1602 ],
1603 "end": "\\]",
1604 "patterns": [
1605 {
1606 "include": "#interpolated_crystal"
1607 },
1608 {
1609 "include": "#escaped_char"
1610 },
1611 {
1612 "include": "#nest_brackets_i"
1613 }
1614 ]
1615 },
1616 "nest_brackets_r": {
1617 "begin": "\\[",
1618 "captures": [
1619 {
1620 "name": "punctuation.section.scope.crystal"
1621 }
1622 ],
1623 "end": "\\]",
1624 "patterns": [
1625 {
1626 "include": "#regex_sub"
1627 },
1628 {
1629 "include": "#nest_brackets_r"
1630 }
1631 ]
1632 },
1633 "nest_curly": {
1634 "begin": "\\{",
1635 "captures": [
1636 {
1637 "name": "punctuation.section.scope.crystal"
1638 }
1639 ],
1640 "end": "\\}",
1641 "patterns": [
1642 {
1643 "include": "#nest_curly"
1644 }
1645 ]
1646 },
1647 "nest_curly_and_self": {
1648 "patterns": [
1649 {
1650 "begin": "\\{",
1651 "captures": [
1652 {
1653 "name": "punctuation.section.scope.crystal"
1654 }
1655 ],
1656 "end": "\\}",
1657 "patterns": [
1658 {
1659 "include": "#nest_curly_and_self"
1660 }
1661 ]
1662 },
1663 {
1664 "include": "$self"
1665 }
1666 ]
1667 },
1668 "nest_curly_i": {
1669 "begin": "\\{",
1670 "captures": [
1671 {
1672 "name": "punctuation.section.scope.crystal"
1673 }
1674 ],
1675 "end": "\\}",
1676 "patterns": [
1677 {
1678 "include": "#interpolated_crystal"
1679 },
1680 {
1681 "include": "#escaped_char"
1682 },
1683 {
1684 "include": "#nest_curly_i"
1685 }
1686 ]
1687 },
1688 "nest_curly_r": {
1689 "begin": "\\{",
1690 "captures": [
1691 {
1692 "name": "punctuation.section.scope.crystal"
1693 }
1694 ],
1695 "end": "\\}",
1696 "patterns": [
1697 {
1698 "include": "#regex_sub"
1699 },
1700 {
1701 "include": "#nest_curly_r"
1702 }
1703 ]
1704 },
1705 "nest_ltgt": {
1706 "begin": "\\<",
1707 "captures": [
1708 {
1709 "name": "punctuation.section.scope.crystal"
1710 }
1711 ],
1712 "end": "\\>",
1713 "patterns": [
1714 {
1715 "include": "#nest_ltgt"
1716 }
1717 ]
1718 },
1719 "nest_ltgt_i": {
1720 "begin": "\\<",
1721 "captures": [
1722 {
1723 "name": "punctuation.section.scope.crystal"
1724 }
1725 ],
1726 "end": "\\>",
1727 "patterns": [
1728 {
1729 "include": "#interpolated_crystal"
1730 },
1731 {
1732 "include": "#escaped_char"
1733 },
1734 {
1735 "include": "#nest_ltgt_i"
1736 }
1737 ]
1738 },
1739 "nest_ltgt_r": {
1740 "begin": "\\<",
1741 "captures": [
1742 {
1743 "name": "punctuation.section.scope.crystal"
1744 }
1745 ],
1746 "end": "\\>",
1747 "patterns": [
1748 {
1749 "include": "#regex_sub"
1750 },
1751 {
1752 "include": "#nest_ltgt_r"
1753 }
1754 ]
1755 },
1756 "nest_parens": {
1757 "begin": "\\(",
1758 "captures": [
1759 {
1760 "name": "punctuation.section.scope.crystal"
1761 }
1762 ],
1763 "end": "\\)",
1764 "patterns": [
1765 {
1766 "include": "#nest_parens"
1767 }
1768 ]
1769 },
1770 "nest_parens_i": {
1771 "begin": "\\(",
1772 "captures": [
1773 {
1774 "name": "punctuation.section.scope.crystal"
1775 }
1776 ],
1777 "end": "\\)",
1778 "patterns": [
1779 {
1780 "include": "#interpolated_crystal"
1781 },
1782 {
1783 "include": "#escaped_char"
1784 },
1785 {
1786 "include": "#nest_parens_i"
1787 }
1788 ]
1789 },
1790 "nest_parens_r": {
1791 "begin": "\\(",
1792 "captures": [
1793 {
1794 "name": "punctuation.section.scope.crystal"
1795 }
1796 ],
1797 "end": "\\)",
1798 "patterns": [
1799 {
1800 "include": "#regex_sub"
1801 },
1802 {
1803 "include": "#nest_parens_r"
1804 }
1805 ]
1806 },
1807 "regex_sub": {
1808 "patterns": [
1809 {
1810 "include": "#interpolated_crystal"
1811 },
1812 {
1813 "include": "#escaped_char"
1814 },
1815 {
1816 "captures": {
1817 "1": {
1818 "name": "punctuation.definition.arbitrary-repetition.crystal"
1819 },
1820 "3": {
1821 "name": "punctuation.definition.arbitrary-repetition.crystal"
1822 }
1823 },
1824 "match": "({)\\d+(,\\d+)?(})",
1825 "name": "string.regexp.arbitrary-repetition.crystal"
1826 },
1827 {
1828 "begin": "\\[(?:\\^?])?",
1829 "captures": {
1830 "0": {
1831 "name": "punctuation.definition.character-class.crystal"
1832 }
1833 },
1834 "end": "]",
1835 "name": "string.regexp.character-class.crystal",
1836 "patterns": [
1837 {
1838 "include": "#escaped_char"
1839 }
1840 ]
1841 },
1842 {
1843 "begin": "\\(",
1844 "captures": [
1845 {
1846 "name": "punctuation.definition.group.crystal"
1847 }
1848 ],
1849 "end": "\\)",
1850 "name": "string.regexp.group.crystal",
1851 "patterns": [
1852 {
1853 "include": "#regex_sub"
1854 }
1855 ]
1856 },
1857 {
1858 "captures": {
1859 "1": {
1860 "name": "punctuation.definition.comment.crystal"
1861 }
1862 },
1863 "comment": "We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.",
1864 "match": "(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$",
1865 "name": "comment.line.number-sign.crystal"
1866 }
1867 ]
1868 }
1869 }
1870 }
1871