PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.2
Code Block Pro – Beautiful Syntax Highlighting v1.27.2
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.27.2, at build/shiki/languages/crystal.tmLanguage.json

1,869 lines 48.4 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 "0": {
488 "name": "punctuation.definition.string.begin.crystal"
489 }
490 },
491 "comment": "execute string (allow for interpolation)",
492 "end": "\\}",
493 "endCaptures": {
494 "0": {
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 "0": {
515 "name": "punctuation.definition.string.begin.crystal"
516 }
517 },
518 "comment": "execute string (allow for interpolation)",
519 "end": "\\]",
520 "endCaptures": {
521 "0": {
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 "0": {
542 "name": "punctuation.definition.string.begin.crystal"
543 }
544 },
545 "comment": "execute string (allow for interpolation)",
546 "end": "\\>",
547 "endCaptures": {
548 "0": {
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 "0": {
569 "name": "punctuation.definition.string.begin.crystal"
570 }
571 },
572 "comment": "execute string (allow for interpolation)",
573 "end": "\\)",
574 "endCaptures": {
575 "0": {
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 "0": {
596 "name": "punctuation.definition.string.begin.crystal"
597 }
598 },
599 "comment": "execute string (allow for interpolation)",
600 "end": "\\|",
601 "endCaptures": {
602 "0": {
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 "0": {
639 "name": "punctuation.definition.string.begin.crystal"
640 }
641 },
642 "comment": "regular expressions (literal)",
643 "end": "\\}[imsx]*",
644 "endCaptures": {
645 "0": {
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 "0": {
663 "name": "punctuation.definition.string.begin.crystal"
664 }
665 },
666 "comment": "regular expressions (literal)",
667 "end": "\\][imsx]*",
668 "endCaptures": {
669 "0": {
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 "0": {
687 "name": "punctuation.definition.string.begin.crystal"
688 }
689 },
690 "comment": "regular expressions (literal)",
691 "end": "\\)[imsx]*",
692 "endCaptures": {
693 "0": {
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 "0": {
711 "name": "punctuation.definition.string.begin.crystal"
712 }
713 },
714 "comment": "regular expressions (literal)",
715 "end": "\\>[imsx]*",
716 "endCaptures": {
717 "0": {
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 "0": {
735 "name": "punctuation.definition.string.begin.crystal"
736 }
737 },
738 "comment": "regular expressions (literal)",
739 "end": "\\|[imsx]*",
740 "endCaptures": {
741 "0": {
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 "0": {
756 "name": "punctuation.definition.string.begin.crystal"
757 }
758 },
759 "comment": "literal capable of interpolation ()",
760 "end": "\\)",
761 "endCaptures": {
762 "0": {
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 "0": {
783 "name": "punctuation.definition.string.begin.crystal"
784 }
785 },
786 "comment": "literal capable of interpolation []",
787 "end": "\\]",
788 "endCaptures": {
789 "0": {
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 "0": {
810 "name": "punctuation.definition.string.begin.crystal"
811 }
812 },
813 "comment": "literal capable of interpolation <>",
814 "end": "\\>",
815 "endCaptures": {
816 "0": {
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 "0": {
837 "name": "punctuation.definition.string.begin.crystal"
838 }
839 },
840 "comment": "literal capable of interpolation -- {}",
841 "end": "\\}",
842 "endCaptures": {
843 "0": {
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 "0": {
864 "name": "punctuation.definition.string.begin.crystal"
865 }
866 },
867 "comment": "literal capable of interpolation -- ||",
868 "end": "\\|",
869 "endCaptures": {
870 "0": {
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 "0": {
888 "name": "punctuation.definition.string.begin.crystal"
889 }
890 },
891 "comment": "literal incapable of interpolation -- ()",
892 "end": "\\)",
893 "endCaptures": {
894 "0": {
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 "0": {
913 "name": "punctuation.definition.string.begin.crystal"
914 }
915 },
916 "comment": "literal incapable of interpolation -- <>",
917 "end": "\\>",
918 "endCaptures": {
919 "0": {
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 "0": {
938 "name": "punctuation.definition.string.begin.crystal"
939 }
940 },
941 "comment": "literal incapable of interpolation -- []",
942 "end": "\\]",
943 "endCaptures": {
944 "0": {
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 "0": {
963 "name": "punctuation.definition.string.begin.crystal"
964 }
965 },
966 "comment": "literal incapable of interpolation -- {}",
967 "end": "\\}",
968 "endCaptures": {
969 "0": {
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 "0": {
988 "name": "punctuation.definition.string.begin.crystal"
989 }
990 },
991 "comment": "literal incapable of interpolation -- ||",
992 "end": "\\|",
993 "endCaptures": {
994 "0": {
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 "match": "\\b_([\\w]+[?!]?)",
1037 "name": "comment.unused.crystal"
1038 },
1039 {
1040 "begin": "(?><<-('?)((?:[_\\w]+_|)HTML)\\b\\1)",
1041 "beginCaptures": {
1042 "0": {
1043 "name": "punctuation.definition.string.begin.crystal"
1044 }
1045 },
1046 "comment": "heredoc with embedded HTML and indented terminator",
1047 "contentName": "text.html.embedded.crystal",
1048 "end": "\\s*\\2\\b",
1049 "endCaptures": {
1050 "0": {
1051 "name": "punctuation.definition.string.end.crystal"
1052 }
1053 },
1054 "name": "string.unquoted.embedded.html.crystal",
1055 "patterns": [
1056 {
1057 "include": "#heredoc"
1058 },
1059 {
1060 "include": "text.html.basic"
1061 },
1062 {
1063 "include": "#interpolated_crystal"
1064 },
1065 {
1066 "include": "#escaped_char"
1067 }
1068 ]
1069 },
1070 {
1071 "begin": "(?><<-('?)((?:[_\\w]+_|)SQL)\\b\\1)",
1072 "beginCaptures": {
1073 "0": {
1074 "name": "punctuation.definition.string.begin.crystal"
1075 }
1076 },
1077 "comment": "heredoc with embedded SQL and indented terminator",
1078 "contentName": "text.sql.embedded.crystal",
1079 "end": "\\s*\\2\\b",
1080 "endCaptures": {
1081 "0": {
1082 "name": "punctuation.definition.string.end.crystal"
1083 }
1084 },
1085 "name": "string.unquoted.embedded.sql.crystal",
1086 "patterns": [
1087 {
1088 "include": "#heredoc"
1089 },
1090 {
1091 "include": "source.sql"
1092 },
1093 {
1094 "include": "#interpolated_crystal"
1095 },
1096 {
1097 "include": "#escaped_char"
1098 }
1099 ]
1100 },
1101 {
1102 "begin": "(?><<-('?)((?:[_\\w]+_|)CSS)\\b\\1)",
1103 "beginCaptures": {
1104 "0": {
1105 "name": "punctuation.definition.string.begin.crystal"
1106 }
1107 },
1108 "comment": "heredoc with embedded css and intented terminator",
1109 "contentName": "text.css.embedded.crystal",
1110 "end": "\\s*\\2\\b",
1111 "endCaptures": {
1112 "0": {
1113 "name": "punctuation.definition.string.end.crystal"
1114 }
1115 },
1116 "name": "string.unquoted.embedded.css.crystal",
1117 "patterns": [
1118 {
1119 "include": "#heredoc"
1120 },
1121 {
1122 "include": "source.css"
1123 },
1124 {
1125 "include": "#interpolated_crystal"
1126 },
1127 {
1128 "include": "#escaped_char"
1129 }
1130 ]
1131 },
1132 {
1133 "begin": "(?><<-('?)((?:[_\\w]+_|)CPP)\\b\\1)",
1134 "beginCaptures": {
1135 "0": {
1136 "name": "punctuation.definition.string.begin.crystal"
1137 }
1138 },
1139 "comment": "heredoc with embedded c++ and intented terminator",
1140 "contentName": "text.c++.embedded.crystal",
1141 "end": "\\s*\\2\\b",
1142 "endCaptures": {
1143 "0": {
1144 "name": "punctuation.definition.string.end.crystal"
1145 }
1146 },
1147 "name": "string.unquoted.embedded.cplusplus.crystal",
1148 "patterns": [
1149 {
1150 "include": "#heredoc"
1151 },
1152 {
1153 "include": "source.c++"
1154 },
1155 {
1156 "include": "#interpolated_crystal"
1157 },
1158 {
1159 "include": "#escaped_char"
1160 }
1161 ]
1162 },
1163 {
1164 "begin": "(?><<-('?)((?:[_\\w]+_|)C)\\b\\1)",
1165 "beginCaptures": {
1166 "0": {
1167 "name": "punctuation.definition.string.begin.crystal"
1168 }
1169 },
1170 "comment": "heredoc with embedded c++ and intented terminator",
1171 "contentName": "text.c.embedded.crystal",
1172 "end": "\\s*\\2\\b",
1173 "endCaptures": {
1174 "0": {
1175 "name": "punctuation.definition.string.end.crystal"
1176 }
1177 },
1178 "name": "string.unquoted.embedded.c.crystal",
1179 "patterns": [
1180 {
1181 "include": "#heredoc"
1182 },
1183 {
1184 "include": "source.c"
1185 },
1186 {
1187 "include": "#interpolated_crystal"
1188 },
1189 {
1190 "include": "#escaped_char"
1191 }
1192 ]
1193 },
1194 {
1195 "begin": "(?><<-('?)((?:[_\\w]+_|)(?:JS|JAVASCRIPT))\\b\\1)",
1196 "beginCaptures": {
1197 "0": {
1198 "name": "punctuation.definition.string.begin.crystal"
1199 }
1200 },
1201 "comment": "heredoc with embedded javascript and intented terminator",
1202 "contentName": "text.js.embedded.crystal",
1203 "end": "\\s*\\2\\b",
1204 "endCaptures": {
1205 "0": {
1206 "name": "punctuation.definition.string.end.crystal"
1207 }
1208 },
1209 "name": "string.unquoted.embedded.js.crystal",
1210 "patterns": [
1211 {
1212 "include": "#heredoc"
1213 },
1214 {
1215 "include": "source.js"
1216 },
1217 {
1218 "include": "#interpolated_crystal"
1219 },
1220 {
1221 "include": "#escaped_char"
1222 }
1223 ]
1224 },
1225 {
1226 "begin": "(?><<-('?)((?:[_\\w]+_|)JQUERY)\\b\\1)",
1227 "beginCaptures": {
1228 "0": {
1229 "name": "punctuation.definition.string.begin.crystal"
1230 }
1231 },
1232 "comment": "heredoc with embedded javascript and intented terminator",
1233 "contentName": "text.js.jquery.embedded.crystal",
1234 "end": "\\s*\\2\\b",
1235 "endCaptures": {
1236 "0": {
1237 "name": "punctuation.definition.string.end.crystal"
1238 }
1239 },
1240 "name": "string.unquoted.embedded.js.jquery.crystal",
1241 "patterns": [
1242 {
1243 "include": "#heredoc"
1244 },
1245 {
1246 "include": "source.js.jquery"
1247 },
1248 {
1249 "include": "#interpolated_crystal"
1250 },
1251 {
1252 "include": "#escaped_char"
1253 }
1254 ]
1255 },
1256 {
1257 "begin": "(?><<-('?)((?:[_\\w]+_|)(?:SH|SHELL))\\b\\1)",
1258 "beginCaptures": {
1259 "0": {
1260 "name": "punctuation.definition.string.begin.crystal"
1261 }
1262 },
1263 "comment": "heredoc with embedded shell and intented terminator",
1264 "contentName": "text.shell.embedded.crystal",
1265 "end": "\\s*\\2\\b",
1266 "endCaptures": {
1267 "0": {
1268 "name": "punctuation.definition.string.end.crystal"
1269 }
1270 },
1271 "name": "string.unquoted.embedded.shell.crystal",
1272 "patterns": [
1273 {
1274 "include": "#heredoc"
1275 },
1276 {
1277 "include": "source.shell"
1278 },
1279 {
1280 "include": "#interpolated_crystal"
1281 },
1282 {
1283 "include": "#escaped_char"
1284 }
1285 ]
1286 },
1287 {
1288 "begin": "(?><<-('?)((?:[_\\w]+_|)CRYSTAL)\\b\\1)",
1289 "beginCaptures": {
1290 "0": {
1291 "name": "punctuation.definition.string.begin.crystal"
1292 }
1293 },
1294 "comment": "heredoc with embedded crystal and intented terminator",
1295 "contentName": "text.crystal.embedded.crystal",
1296 "end": "\\s*\\2\\b",
1297 "endCaptures": {
1298 "0": {
1299 "name": "punctuation.definition.string.end.crystal"
1300 }
1301 },
1302 "name": "string.unquoted.embedded.crystal.crystal",
1303 "patterns": [
1304 {
1305 "include": "#heredoc"
1306 },
1307 {
1308 "include": "source.crystal"
1309 },
1310 {
1311 "include": "#interpolated_crystal"
1312 },
1313 {
1314 "include": "#escaped_char"
1315 }
1316 ]
1317 },
1318 {
1319 "begin": "(?><<-'(\\w+)')",
1320 "beginCaptures": {
1321 "0": {
1322 "name": "punctuation.definition.string.begin.crystal"
1323 }
1324 },
1325 "comment": "heredoc with indented terminator",
1326 "end": "\\s*\\1\\b",
1327 "endCaptures": {
1328 "0": {
1329 "name": "punctuation.definition.string.end.crystal"
1330 }
1331 },
1332 "name": "string.unquoted.heredoc.crystal",
1333 "patterns": [
1334 {
1335 "include": "#heredoc"
1336 },
1337 {
1338 "include": "#escaped_char"
1339 }
1340 ]
1341 },
1342 {
1343 "begin": "(?><<-(\\w+)\\b)",
1344 "beginCaptures": {
1345 "0": {
1346 "name": "punctuation.definition.string.begin.crystal"
1347 }
1348 },
1349 "comment": "heredoc with indented terminator",
1350 "end": "\\s*\\1\\b",
1351 "endCaptures": {
1352 "0": {
1353 "name": "punctuation.definition.string.end.crystal"
1354 }
1355 },
1356 "name": "string.unquoted.heredoc.crystal",
1357 "patterns": [
1358 {
1359 "include": "#heredoc"
1360 },
1361 {
1362 "include": "#interpolated_crystal"
1363 },
1364 {
1365 "include": "#escaped_char"
1366 }
1367 ]
1368 },
1369 {
1370 "begin": "(?<={|{\\s|[^A-Za-z0-9_]do|^do|[^A-Za-z0-9_]do\\s|^do\\s)(\\|)",
1371 "captures": {
1372 "1": {
1373 "name": "punctuation.separator.variable.crystal"
1374 }
1375 },
1376 "end": "(?<!\\|)(\\|)(?!\\|)",
1377 "patterns": [
1378 {
1379 "include": "source.crystal"
1380 },
1381 {
1382 "match": "[_a-zA-Z][_a-zA-Z0-9]*",
1383 "name": "variable.other.block.crystal"
1384 },
1385 {
1386 "match": ",",
1387 "name": "punctuation.separator.variable.crystal"
1388 }
1389 ]
1390 },
1391 {
1392 "match": "=>",
1393 "name": "punctuation.separator.key-value"
1394 },
1395 {
1396 "match": "->",
1397 "name": "support.function.kernel.crystal"
1398 },
1399 {
1400 "match": "<<=|%=|&{1,2}=|\\*=|\\*\\*=|\\+=|-=|\\^=|\\|{1,2}=|<<",
1401 "name": "keyword.operator.assignment.augmented.crystal"
1402 },
1403 {
1404 "match": "<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \\t])\\?",
1405 "name": "keyword.operator.comparison.crystal"
1406 },
1407 {
1408 "match": "(?<=^|[ \\t])!|&&|\\|\\||\\^",
1409 "name": "keyword.operator.logical.crystal"
1410 },
1411 {
1412 "match": "(\\{\\%|\\%\\}|\\{\\{|\\}\\})",
1413 "name": "keyword.operator.macro.crystal"
1414 },
1415 {
1416 "comment": "Safe navigation operator",
1417 "match": "(&\\.)\\s*(?![A-Z])",
1418 "captures": {
1419 "1": {
1420 "name": "punctuation.separator.method.crystal"
1421 }
1422 }
1423 },
1424 {
1425 "match": "(%|&|\\*\\*|\\*|\\+|\\-|/)",
1426 "name": "keyword.operator.arithmetic.crystal"
1427 },
1428 {
1429 "match": "=",
1430 "name": "keyword.operator.assignment.crystal"
1431 },
1432 {
1433 "match": "\\||~|>>",
1434 "name": "keyword.operator.other.crystal"
1435 },
1436 {
1437 "match": ":",
1438 "name": "punctuation.separator.other.crystal"
1439 },
1440 {
1441 "match": "\\;",
1442 "name": "punctuation.separator.statement.crystal"
1443 },
1444 {
1445 "match": ",",
1446 "name": "punctuation.separator.object.crystal"
1447 },
1448 {
1449 "match": "\\.|::",
1450 "name": "punctuation.separator.method.crystal"
1451 },
1452 {
1453 "match": "\\{|\\}",
1454 "name": "punctuation.section.scope.crystal"
1455 },
1456 {
1457 "match": "\\[|\\]",
1458 "name": "punctuation.section.array.crystal"
1459 },
1460 {
1461 "match": "\\(|\\)",
1462 "name": "punctuation.section.function.crystal"
1463 },
1464 {
1465 "begin": "(?=[a-zA-Z0-9_!?]+\\()",
1466 "end": "(?<=\\))",
1467 "name": "meta.function-call.crystal",
1468 "patterns": [
1469 {
1470 "match": "([a-zA-Z0-9_!?]+)(?=\\()",
1471 "name": "entity.name.function.crystal"
1472 },
1473 {
1474 "include": "$self"
1475 }
1476 ]
1477 },
1478 {
1479 "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",
1480 "match": "((?<=\\W)\\b|^)\\w+\\b(?=\\s*([\\]\\)\\}\\=\\+\\-\\*\\/\\^\\$\\,\\.]|<\\s|<<[\\s|\\.]))",
1481 "name": "variable.other.crystal"
1482 }
1483 ],
1484 "repository": {
1485 "escaped_char": {
1486 "comment": "https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html",
1487 "match": "\\\\(?:[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\\{[a-fA-F0-9 ]+\\}|.)",
1488 "name": "constant.character.escape.crystal"
1489 },
1490 "heredoc": {
1491 "begin": "^<<-?\\w+",
1492 "end": "$",
1493 "patterns": [
1494 {
1495 "include": "$self"
1496 }
1497 ]
1498 },
1499 "interpolated_crystal": {
1500 "patterns": [
1501 {
1502 "begin": "#\\{",
1503 "beginCaptures": {
1504 "0": {
1505 "name": "punctuation.section.embedded.begin.crystal"
1506 }
1507 },
1508 "contentName": "source.crystal",
1509 "end": "(\\})",
1510 "endCaptures": {
1511 "0": {
1512 "name": "punctuation.section.embedded.end.crystal"
1513 },
1514 "1": {
1515 "name": "source.crystal"
1516 }
1517 },
1518 "name": "meta.embedded.line.crystal",
1519 "patterns": [
1520 {
1521 "include": "#nest_curly_and_self"
1522 },
1523 {
1524 "include": "$self"
1525 }
1526 ],
1527 "repository": {
1528 "nest_curly_and_self": {
1529 "patterns": [
1530 {
1531 "begin": "\\{",
1532 "captures": {
1533 "0": {
1534 "name": "punctuation.section.scope.crystal"
1535 }
1536 },
1537 "end": "\\}",
1538 "patterns": [
1539 {
1540 "include": "#nest_curly_and_self"
1541 }
1542 ]
1543 },
1544 {
1545 "include": "$self"
1546 }
1547 ]
1548 }
1549 }
1550 },
1551 {
1552 "captures": {
1553 "1": {
1554 "name": "punctuation.definition.variable.crystal"
1555 }
1556 },
1557 "match": "(#@)[a-zA-Z_]\\w*",
1558 "name": "variable.other.readwrite.instance.crystal"
1559 },
1560 {
1561 "captures": {
1562 "1": {
1563 "name": "punctuation.definition.variable.crystal"
1564 }
1565 },
1566 "match": "(#@@)[a-zA-Z_]\\w*",
1567 "name": "variable.other.readwrite.class.crystal"
1568 },
1569 {
1570 "captures": {
1571 "1": {
1572 "name": "punctuation.definition.variable.crystal"
1573 }
1574 },
1575 "match": "(#\\$)[a-zA-Z_]\\w*",
1576 "name": "variable.other.readwrite.global.crystal"
1577 }
1578 ]
1579 },
1580 "nest_brackets": {
1581 "begin": "\\[",
1582 "captures": {
1583 "0": {
1584 "name": "punctuation.section.scope.crystal"
1585 }
1586 },
1587 "end": "\\]",
1588 "patterns": [
1589 {
1590 "include": "#nest_brackets"
1591 }
1592 ]
1593 },
1594 "nest_brackets_i": {
1595 "begin": "\\[",
1596 "captures": {
1597 "0": {
1598 "name": "punctuation.section.scope.crystal"
1599 }
1600 },
1601 "end": "\\]",
1602 "patterns": [
1603 {
1604 "include": "#interpolated_crystal"
1605 },
1606 {
1607 "include": "#escaped_char"
1608 },
1609 {
1610 "include": "#nest_brackets_i"
1611 }
1612 ]
1613 },
1614 "nest_brackets_r": {
1615 "begin": "\\[",
1616 "captures": {
1617 "0": {
1618 "name": "punctuation.section.scope.crystal"
1619 }
1620 },
1621 "end": "\\]",
1622 "patterns": [
1623 {
1624 "include": "#regex_sub"
1625 },
1626 {
1627 "include": "#nest_brackets_r"
1628 }
1629 ]
1630 },
1631 "nest_curly": {
1632 "begin": "\\{",
1633 "captures": {
1634 "0": {
1635 "name": "punctuation.section.scope.crystal"
1636 }
1637 },
1638 "end": "\\}",
1639 "patterns": [
1640 {
1641 "include": "#nest_curly"
1642 }
1643 ]
1644 },
1645 "nest_curly_and_self": {
1646 "patterns": [
1647 {
1648 "begin": "\\{",
1649 "captures": {
1650 "0": {
1651 "name": "punctuation.section.scope.crystal"
1652 }
1653 },
1654 "end": "\\}",
1655 "patterns": [
1656 {
1657 "include": "#nest_curly_and_self"
1658 }
1659 ]
1660 },
1661 {
1662 "include": "$self"
1663 }
1664 ]
1665 },
1666 "nest_curly_i": {
1667 "begin": "\\{",
1668 "captures": {
1669 "0": {
1670 "name": "punctuation.section.scope.crystal"
1671 }
1672 },
1673 "end": "\\}",
1674 "patterns": [
1675 {
1676 "include": "#interpolated_crystal"
1677 },
1678 {
1679 "include": "#escaped_char"
1680 },
1681 {
1682 "include": "#nest_curly_i"
1683 }
1684 ]
1685 },
1686 "nest_curly_r": {
1687 "begin": "\\{",
1688 "captures": {
1689 "0": {
1690 "name": "punctuation.section.scope.crystal"
1691 }
1692 },
1693 "end": "\\}",
1694 "patterns": [
1695 {
1696 "include": "#regex_sub"
1697 },
1698 {
1699 "include": "#nest_curly_r"
1700 }
1701 ]
1702 },
1703 "nest_ltgt": {
1704 "begin": "\\<",
1705 "captures": {
1706 "0": {
1707 "name": "punctuation.section.scope.crystal"
1708 }
1709 },
1710 "end": "\\>",
1711 "patterns": [
1712 {
1713 "include": "#nest_ltgt"
1714 }
1715 ]
1716 },
1717 "nest_ltgt_i": {
1718 "begin": "\\<",
1719 "captures": {
1720 "0": {
1721 "name": "punctuation.section.scope.crystal"
1722 }
1723 },
1724 "end": "\\>",
1725 "patterns": [
1726 {
1727 "include": "#interpolated_crystal"
1728 },
1729 {
1730 "include": "#escaped_char"
1731 },
1732 {
1733 "include": "#nest_ltgt_i"
1734 }
1735 ]
1736 },
1737 "nest_ltgt_r": {
1738 "begin": "\\<",
1739 "captures": {
1740 "0": {
1741 "name": "punctuation.section.scope.crystal"
1742 }
1743 },
1744 "end": "\\>",
1745 "patterns": [
1746 {
1747 "include": "#regex_sub"
1748 },
1749 {
1750 "include": "#nest_ltgt_r"
1751 }
1752 ]
1753 },
1754 "nest_parens": {
1755 "begin": "\\(",
1756 "captures": {
1757 "0": {
1758 "name": "punctuation.section.scope.crystal"
1759 }
1760 },
1761 "end": "\\)",
1762 "patterns": [
1763 {
1764 "include": "#nest_parens"
1765 }
1766 ]
1767 },
1768 "nest_parens_i": {
1769 "begin": "\\(",
1770 "captures": {
1771 "0": {
1772 "name": "punctuation.section.scope.crystal"
1773 }
1774 },
1775 "end": "\\)",
1776 "patterns": [
1777 {
1778 "include": "#interpolated_crystal"
1779 },
1780 {
1781 "include": "#escaped_char"
1782 },
1783 {
1784 "include": "#nest_parens_i"
1785 }
1786 ]
1787 },
1788 "nest_parens_r": {
1789 "begin": "\\(",
1790 "captures": {
1791 "0": {
1792 "name": "punctuation.section.scope.crystal"
1793 }
1794 },
1795 "end": "\\)",
1796 "patterns": [
1797 {
1798 "include": "#regex_sub"
1799 },
1800 {
1801 "include": "#nest_parens_r"
1802 }
1803 ]
1804 },
1805 "regex_sub": {
1806 "patterns": [
1807 {
1808 "include": "#interpolated_crystal"
1809 },
1810 {
1811 "include": "#escaped_char"
1812 },
1813 {
1814 "captures": {
1815 "1": {
1816 "name": "punctuation.definition.arbitrary-repetition.crystal"
1817 },
1818 "3": {
1819 "name": "punctuation.definition.arbitrary-repetition.crystal"
1820 }
1821 },
1822 "match": "({)\\d+(,\\d+)?(})",
1823 "name": "string.regexp.arbitrary-repetition.crystal"
1824 },
1825 {
1826 "begin": "\\[(?:\\^?])?",
1827 "captures": {
1828 "0": {
1829 "name": "punctuation.definition.character-class.crystal"
1830 }
1831 },
1832 "end": "]",
1833 "name": "string.regexp.character-class.crystal",
1834 "patterns": [
1835 {
1836 "include": "#escaped_char"
1837 }
1838 ]
1839 },
1840 {
1841 "begin": "\\(",
1842 "captures": {
1843 "0": {
1844 "name": "punctuation.definition.group.crystal"
1845 }
1846 },
1847 "end": "\\)",
1848 "name": "string.regexp.group.crystal",
1849 "patterns": [
1850 {
1851 "include": "#regex_sub"
1852 }
1853 ]
1854 },
1855 {
1856 "captures": {
1857 "1": {
1858 "name": "punctuation.definition.comment.crystal"
1859 }
1860 },
1861 "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.",
1862 "match": "(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$",
1863 "name": "comment.line.number-sign.crystal"
1864 }
1865 ]
1866 }
1867 }
1868 }
1869