@@ -0,0 +1,1036 @@
3+# http://www.sublimetext.com/docs/3/syntax.html
6+ TODO: unresolved issues
13+ not recognized as a heredoc
15+ there is no way to distinguish perfectly between the << operator and the start
16+ of a heredoc. Currently, we require assignment to recognize a heredoc. More
17+ refinement is possible.
18+ • Heredocs with indented terminators (<<-) are always distinguishable, however.
19+ • Nested heredocs are not really supportable at present
23+ This is single quoted.
24+ The above used #{Time.now}
27+ From Programming Ruby p306; should be a non-interpolated heredoc.
32+ '\332' is not recognized as slash3.. which should be octal 332.
34+ plain regexp.. should be easy.
40+ ':p' is recognized as a symbol.. its 2 things ':' and 'p'.
41+ :'b' has same problem.
43+ ternary operator rule, precedence stuff, symbol rule.
44+ but also consider 'a.b?(:c)' ??
47+first_line_match: ^#!/.*\bcrystal
61+ [.A-Z_:\x{80}-\x{10FFFF}][.\w:\x{80}-\x{10FFFF}]*
62+ (\(([,\s.a-zA-Z0-9_:\x{80}-\x{10FFFF}]+)\))?
65+ [.:A-Z\x{80}-\x{10FFFF}][.:\w\x{80}-\x{10FFFF}]*
66+ (\(([.a-zA-Z0-9_:]+\s,)\))?
71+ [.A-Z0-9_:\x{80}-\x{10FFFF}]+
74+ scope: meta.class.crystal
76+ 1: keyword.control.class.crystal
77+ 2: keyword.control.class.crystal
78+ 3: entity.name.type.class.crystal
79+ 5: punctuation.separator.crystal
80+ 6: support.class.other.type-param.crystal
81+ 7: entity.other.inherited-class.crystal
82+ 8: punctuation.separator.crystal
83+ 9: punctuation.separator.crystal
84+ 10: support.class.other.type-param.crystal
85+ 11: punctuation.definition.variable.crystal
86+ - 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}]*)'
87+ scope: meta.module.crystal
89+ 1: keyword.control.module.crystal
90+ 2: entity.name.type.module.crystal
91+ 3: entity.other.inherited-class.module.first.crystal
92+ 4: punctuation.separator.inheritance.crystal
93+ 5: entity.other.inherited-class.module.second.crystal
94+ 6: punctuation.separator.inheritance.crystal
95+ 7: entity.other.inherited-class.module.third.crystal
96+ 8: punctuation.separator.inheritance.crystal
97+ - match: '^\s*(lib)\s+(([A-Z]\w*(::))?([A-Z]\w*(::))?([A-Z]\w*(::))*[A-Z]\w*)'
98+ scope: meta.lib.crystal
100+ 1: keyword.control.lib.crystal
101+ 2: entity.name.type.lib.crystal
102+ 3: entity.other.inherited-class.lib.first.crystal
103+ 4: punctuation.separator.inheritance.crystal
104+ 5: entity.other.inherited-class.lib.second.crystal
105+ 6: punctuation.separator.inheritance.crystal
106+ 7: entity.other.inherited-class.lib.third.crystal
107+ 8: punctuation.separator.inheritance.crystal
108+ - match: (?<!\.)\belse(\s)+if\b
109+ comment: else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want.
110+ scope: invalid.deprecated.crystal
111+ - match: '(?<!\.)\b(BEGIN|alias|as|begin|case|select|abstract|class|END|ensure|for|fun|if|ifdef|in|lib|module|of|out|private|protected|rescue|struct|with|union|enum|macro|then|type|unless|until|while)\b(?![?!])'
112+ comment: everything being a reserved word, not a value and needing a 'end' is a..
113+ scope: keyword.control.primary.crystal
114+ - match: '(?<!\.)\b(when|else|elsif)\b(?![?!])'
115+ comment: everything being a reserved word, not a value and needing a 'end' is a..
116+ scope: keyword.control.secondary.crystal
117+ - match: '(?<!\.)\b(end)\b(?![?!])'
118+ comment: Give the end keyword an additional scope
119+ scope: keyword.control.secondary.end.crystal
120+ - match: (?<!\.)\bdo\b\s*
121+ comment: contextual smart pair support for block parameters
122+ scope: keyword.control.start-block.crystal
123+ - match: '(?<=\{)(\s+)'
124+ comment: contextual smart pair support
125+ scope: meta.syntax.crystal.start-block
126+ - match: (?<!\.)\b(and|not|or)\b
127+ comment: as above, just doesn't need a 'end' and does a logic operation
128+ scope: keyword.operator.logical.crystal
129+ - match: '(?<!\.)\b(alias|alias_method|break|next|pointerof|typeof|sizeof|instance_sizeof|return|super|yield|uninitialized|forall)\b(?![?!])'
130+ comment: just as above but being not a logical operation
131+ scope: keyword.control.pseudo-method.crystal
132+ - match: '\b(nil|true|false)\b(?![?!])'
133+ scope: constant.language.crystal
134+ - match: '\b(__(DIR|FILE|LINE)__|self)\b(?![?!])'
135+ scope: variable.language.crystal
136+ - match: '\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn)\b[!?]?'
137+ comment: everything being a method but having a special function is a..
138+ scope: keyword.control.special-method.crystal
139+ - match: \b(require)\b
141+ 1: keyword.control.special-method.crystal
143+ - meta_scope: meta.require.crystal
146+ 1: keyword.control.special-method.crystal
149+ - match: '(@)[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*[?!=]?'
150+ scope: variable.other.readwrite.instance.crystal
152+ 1: punctuation.definition.variable.crystal
153+ - match: '(@@)[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*[?!=]?'
154+ scope: variable.other.readwrite.class.crystal
156+ 1: punctuation.definition.variable.crystal
157+ - match: '(\$)[a-zA-Z_]\w*'
158+ scope: variable.other.readwrite.global.crystal
160+ 1: punctuation.definition.variable.crystal
161+ - match: '(\$)(!|@|&|`|''|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpv])'
162+ scope: variable.other.readwrite.global.pre-defined.crystal
164+ 1: punctuation.definition.variable.crystal
165+ - match: '\b(ENV)\['
167+ 1: variable.other.constant.crystal
169+ - meta_scope: meta.environment-variable.crystal
173+ - match: '\b[A-Z\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*'
174+ scope: support.class.crystal
175+ - match: '\b[A-Z\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*\b'
176+ scope: variable.other.constant.crystal
179+ (?=def\b) # an optimization to help Oniguruma fail fast
180+ (?<=^|\s)(def)\s+ # the def keyword
181+ ( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\x{80}-\x{10FFFF}\w]*(?>\.|::))? # a method name prefix
182+ (?>[a-zA-Z_\x{80}-\x{10FFFF}][\x{80}-\x{10FFFF}\w]*(?>[?!]|=(?!>))? # the method name
183+ |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method
184+ \s*(\() # the openning parenthesis for arguments
185+ comment: the method pattern comes from the symbol pattern, see there for a explaination
187+ 1: keyword.control.def.crystal
188+ 2: entity.name.function.crystal
189+ 3: punctuation.definition.parameters.crystal
191+ - meta_scope: meta.function.method.with-arguments.crystal
192+ - meta_content_scope: variable.parameter.function.crystal
193+ - match: \)\s*$|\)\s*:|\)\s*;
195+ 0: punctuation.definition.parameters.crystal
200+ (?=def\b) # an optimization to help Oniguruma fail fast
201+ (?<=^|\s)(def)\s+ # the def keyword
202+ ( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>\.|::))? # a method name prefix
203+ (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!]|=(?!>))? # the method name
204+ |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method
205+ [ \t] # the space separating the arguments
206+ (?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow
207+ comment: same as the previous rule, but without parentheses around the arguments
209+ 1: keyword.control.def.crystal
210+ 2: entity.name.function.crystal
212+ - meta_scope: meta.function.method.with-arguments.crystal
213+ - meta_content_scope: variable.parameter.function.crystal
219+ (?=def\b) # an optimization to help Oniguruma fail fast
220+ (?<=^|\s)(def)\b # the def keyword
221+ ( \s+ # an optional group of whitespace followed by…
222+ ( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>\.|::))? # a method name prefix
223+ (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!]|=(?!>))? # the method name
224+ |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method
225+ comment: the optional name is just to catch the def also without a method-name
226+ scope: meta.function.method.without-arguments.crystal
228+ 1: keyword.control.def.crystal
229+ 3: entity.name.function.crystal
230+ - match: '\b(0[xX]\h(?>_?\h)*|\d(?>_?\d)*(\.(?![^[:space:][:digit:]])(?>_?\d)*)?([eE][-+]?\d(?>_?\d)*)?|0[bB][01]+|0o[0-7]+)(_?(u8|u16|u32|u64|i8|i16|i32|i64|f32|f64))?\b'
231+ scope: constant.numeric.crystal
234+ 0: punctuation.definition.constant.crystal
236+ - meta_scope: constant.other.symbol.single-quoted.crystal
239+ 0: punctuation.definition.constant.crystal
242+ scope: constant.character.escape.crystal
245+ 0: punctuation.definition.constant.crystal
247+ - meta_scope: constant.other.symbol.double-quoted.crystal
250+ 0: punctuation.definition.constant.crystal
252+ - include: interpolated_crystal
253+ - include: escaped_char
255+ comment: Needs higher precidence than regular expressions.
256+ scope: keyword.operator.assignment.augmented.crystal
258+ comment: single quoted string (does not allow interpolation)
260+ 0: punctuation.definition.string.begin.crystal
262+ - meta_scope: string.quoted.single.crystal
265+ 0: punctuation.definition.string.end.crystal
268+ scope: constant.character.escape.crystal
270+ comment: double quoted string (allows for interpolation)
272+ 0: punctuation.definition.string.begin.crystal
274+ - meta_scope: string.quoted.double.crystal
277+ 0: punctuation.definition.string.end.crystal
279+ - include: interpolated_crystal
280+ - include: escaped_char
282+ comment: execute string (allows for interpolation)
284+ 0: punctuation.definition.string.begin.crystal
286+ - meta_scope: string.interpolated.crystal
289+ 0: punctuation.definition.string.end.crystal
291+ - include: interpolated_crystal
292+ - include: escaped_char
294+ comment: execute string (allow for interpolation)
296+ 0: punctuation.definition.string.begin.crystal
298+ - meta_scope: string.interpolated.crystal
301+ 0: punctuation.definition.string.end.crystal
303+ - include: interpolated_crystal
304+ - include: escaped_char
305+ - include: nest_curly_i
307+ comment: execute string (allow for interpolation)
309+ 0: punctuation.definition.string.begin.crystal
311+ - meta_scope: string.interpolated.crystal
314+ 0: punctuation.definition.string.end.crystal
316+ - include: interpolated_crystal
317+ - include: escaped_char
318+ - include: nest_brackets_i
320+ comment: execute string (allow for interpolation)
322+ 0: punctuation.definition.string.begin.crystal
324+ - meta_scope: string.interpolated.crystal
327+ 0: punctuation.definition.string.end.crystal
329+ - include: interpolated_crystal
330+ - include: escaped_char
331+ - include: nest_ltgt_i
333+ comment: execute string (allow for interpolation)
335+ 0: punctuation.definition.string.begin.crystal
337+ - meta_scope: string.interpolated.crystal
340+ 0: punctuation.definition.string.end.crystal
342+ - include: interpolated_crystal
343+ - include: escaped_char
344+ - include: nest_parens_i
345+ - match: '%x([^\w])'
346+ comment: execute string (allow for interpolation)
348+ 0: punctuation.definition.string.begin.crystal
350+ - meta_scope: string.interpolated.crystal
353+ 0: punctuation.definition.string.end.crystal
355+ - include: interpolated_crystal
356+ - include: escaped_char
360+ ^ # beginning of line
361+ | (?<= # or look-behind on:
363+ | [\s;]if\s # keywords
368+ | [\s;]assert_match\s
369+ | [\s;]or\s # boolean opperators
372+ | [\s.]index\s # methods
380+ | (?<= # or a look-behind with line anchor:
381+ ^when\s # duplication necessary due to limits of regex
390+ regular expressions (normal)
391+ we only start a regexp if the character before it (excluding whitespace)
392+ is what we think is before a regexp
394+ 1: string.regexp.classic.crystal
395+ 2: punctuation.definition.string.crystal
397+ - meta_content_scope: string.regexp.classic.crystal
398+ - match: "((/[eimnosux]*))"
400+ 1: string.regexp.classic.crystal
401+ 2: punctuation.definition.string.crystal
403+ - include: regex_sub
405+ comment: regular expressions (literal)
407+ 0: punctuation.definition.string.begin.crystal
409+ - meta_scope: string.regexp.mod-r.crystal
410+ - match: '\}[eimnosux]*'
412+ 0: punctuation.definition.string.end.crystal
414+ - include: regex_sub
415+ - include: nest_curly_r
417+ comment: regular expressions (literal)
419+ 0: punctuation.definition.string.begin.crystal
421+ - meta_scope: string.regexp.mod-r.crystal
422+ - match: '\][eimnosux]*'
424+ 0: punctuation.definition.string.end.crystal
426+ - include: regex_sub
427+ - include: nest_brackets_r
429+ comment: regular expressions (literal)
431+ 0: punctuation.definition.string.begin.crystal
433+ - meta_scope: string.regexp.mod-r.crystal
434+ - match: '\)[eimnosux]*'
436+ 0: punctuation.definition.string.end.crystal
438+ - include: regex_sub
439+ - include: nest_parens_r
441+ comment: regular expressions (literal)
443+ 0: punctuation.definition.string.begin.crystal
445+ - meta_scope: string.regexp.mod-r.crystal
446+ - match: '\>[eimnosux]*'
448+ 0: punctuation.definition.string.end.crystal
450+ - include: regex_sub
451+ - include: nest_ltgt_r
452+ - match: '%r([^\w])'
453+ comment: regular expressions (literal)
455+ 0: punctuation.definition.string.begin.crystal
457+ - meta_scope: string.regexp.mod-r.crystal
458+ - match: '\1[eimnosux]*'
460+ 0: punctuation.definition.string.end.crystal
462+ - include: regex_sub
463+ - match: '%[QWSR]?\('
464+ comment: literal capable of interpolation ()
466+ 0: punctuation.definition.string.begin.crystal
468+ - meta_scope: string.quoted.other.literal.upper.crystal
471+ 0: punctuation.definition.string.end.crystal
473+ - include: interpolated_crystal
474+ - include: escaped_char
475+ - include: nest_parens_i
476+ - match: '%[QWSR]?\['
477+ comment: "literal capable of interpolation []"
479+ 0: punctuation.definition.string.begin.crystal
481+ - meta_scope: string.quoted.other.literal.upper.crystal
484+ 0: punctuation.definition.string.end.crystal
486+ - include: interpolated_crystal
487+ - include: escaped_char
488+ - include: nest_brackets_i
489+ - match: '%[QWSR]?\<'
490+ comment: literal capable of interpolation <>
492+ 0: punctuation.definition.string.begin.crystal
494+ - meta_scope: string.quoted.other.literal.upper.crystal
497+ 0: punctuation.definition.string.end.crystal
499+ - include: interpolated_crystal
500+ - include: escaped_char
501+ - include: nest_ltgt_i
502+ - match: '%[QWSR]?\{'
503+ comment: "literal capable of interpolation -- {}"
505+ 0: punctuation.definition.string.begin.crystal
507+ - meta_scope: string.quoted.double.crystal.mod
510+ 0: punctuation.definition.string.end.crystal
512+ - include: interpolated_crystal
513+ - include: escaped_char
514+ - include: nest_curly_i
515+ - match: '%[QWSR]([^\w])'
516+ comment: literal capable of interpolation -- wildcard
518+ 0: punctuation.definition.string.begin.crystal
520+ - meta_scope: string.quoted.other.literal.upper.crystal
523+ 0: punctuation.definition.string.end.crystal
525+ - include: interpolated_crystal
526+ - include: escaped_char
528+ comment: literal incapable of interpolation -- ()
530+ 0: punctuation.definition.string.begin.crystal
532+ - meta_scope: string.quoted.other.literal.lower.crystal
535+ 0: punctuation.definition.string.end.crystal
538+ scope: constant.character.escape.crystal
539+ - include: nest_parens
541+ comment: literal incapable of interpolation -- <>
543+ 0: punctuation.definition.string.begin.crystal
545+ - meta_scope: string.quoted.other.literal.lower.crystal
548+ 0: punctuation.definition.string.end.crystal
551+ scope: constant.character.escape.crystal
552+ - include: nest_ltgt
554+ comment: "literal incapable of interpolation -- []"
556+ 0: punctuation.definition.string.begin.crystal
558+ - meta_scope: string.quoted.other.literal.lower.crystal
561+ 0: punctuation.definition.string.end.crystal
563+ - match: '\\\]|\\\\'
564+ scope: constant.character.escape.crystal
565+ - include: nest_brackets
567+ comment: "literal incapable of interpolation -- {}"
569+ 0: punctuation.definition.string.begin.crystal
571+ - meta_scope: string.quoted.other.literal.lower.crystal
574+ 0: punctuation.definition.string.end.crystal
576+ - match: '\\\}|\\\\'
577+ scope: constant.character.escape.crystal
578+ - include: nest_curly
579+ - match: '%[qws]([^\w])'
580+ comment: literal incapable of interpolation -- wildcard
582+ 0: punctuation.definition.string.begin.crystal
584+ - meta_scope: string.quoted.other.literal.lower.crystal
587+ 0: punctuation.definition.string.end.crystal
590+ comment: Cant be named because its not neccesarily an escape.
591+ - 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}]*)'
593+ scope: constant.other.symbol.crystal
595+ 1: punctuation.definition.constant.crystal
596+ - match: '(?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!])?)(:)(?!:)'
598+ scope: constant.other.symbol.crystal.19syntax
600+ 1: punctuation.definition.constant.crystal
601+ - match: '(?:^[ \t]+)?(#).*$\n?'
602+ scope: comment.line.number-sign.crystal
604+ 1: punctuation.definition.comment.crystal
606+ comment: __END__ marker
608+ 0: string.unquoted.program-block.crystal
610+ - meta_content_scope: text.plain
611+ - match: (?=not)impossible
613+ 0: string.unquoted.program-block.crystal
615+ - match: (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b))
617+ - meta_scope: text.html.embedded.crystal
618+ - match: (?=not)impossible
620+ - include: scope:text.html.basic
621+ - match: '(?><<-("?)((?:[_\w]+_|)HTML)\b\1)'
622+ comment: heredoc with embedded HTML and indented terminator
624+ 0: punctuation.definition.string.begin.crystal
626+ - meta_scope: string.unquoted.embedded.html.crystal
627+ - meta_content_scope: text.html.embedded.crystal
630+ 0: punctuation.definition.string.end.crystal
633+ - include: scope:text.html.basic
634+ - include: interpolated_crystal
635+ - include: escaped_char
636+ - match: '(?><<-("?)((?:[_\w]+_|)SQL)\b\1)'
637+ comment: heredoc with embedded SQL and indented terminator
639+ 0: punctuation.definition.string.begin.crystal
641+ - meta_scope: string.unquoted.embedded.sql.crystal
642+ - meta_content_scope: text.sql.embedded.crystal
645+ 0: punctuation.definition.string.end.crystal
648+ - include: scope:source.sql
649+ - include: interpolated_crystal
650+ - include: escaped_char
651+ - match: '(?><<-("?)((?:[_\w]+_|)CSS)\b\1)'
652+ comment: heredoc with embedded css and intented terminator
654+ 0: punctuation.definition.string.begin.crystal
656+ - meta_scope: string.unquoted.embedded.css.crystal
657+ - meta_content_scope: text.css.embedded.crystal
660+ 0: punctuation.definition.string.end.crystal
663+ - include: scope:source.css
664+ - include: interpolated_crystal
665+ - include: escaped_char
666+ - match: '(?><<-("?)((?:[_\w]+_|)CPP)\b\1)'
667+ comment: heredoc with embedded c++ and intented terminator
669+ 0: punctuation.definition.string.begin.crystal
671+ - meta_scope: string.unquoted.embedded.cplusplus.crystal
672+ - meta_content_scope: text.c++.embedded.crystal
675+ 0: punctuation.definition.string.end.crystal
678+ - include: scope:source.c++
679+ - include: interpolated_crystal
680+ - include: escaped_char
681+ - match: '(?><<-("?)((?:[_\w]+_|)C)\b\1)'
682+ comment: heredoc with embedded c++ and intented terminator
684+ 0: punctuation.definition.string.begin.crystal
686+ - meta_scope: string.unquoted.embedded.c.crystal
687+ - meta_content_scope: text.c.embedded.crystal
690+ 0: punctuation.definition.string.end.crystal
693+ - include: scope:source.c
694+ - include: interpolated_crystal
695+ - include: escaped_char
696+ - match: '(?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)'
697+ comment: heredoc with embedded javascript and intented terminator
699+ 0: punctuation.definition.string.begin.crystal
701+ - meta_scope: string.unquoted.embedded.js.crystal
702+ - meta_content_scope: text.js.embedded.crystal
705+ 0: punctuation.definition.string.end.crystal
708+ - include: scope:source.js
709+ - include: interpolated_crystal
710+ - include: escaped_char
711+ - match: '(?><<-("?)((?:[_\w]+_|)JQUERY)\b\1)'
712+ comment: heredoc with embedded javascript and intented terminator
714+ 0: punctuation.definition.string.begin.crystal
716+ - meta_scope: string.unquoted.embedded.js.jquery.crystal
717+ - meta_content_scope: text.js.jquery.embedded.crystal
720+ 0: punctuation.definition.string.end.crystal
723+ - include: scope:source.js.jquery
724+ - include: interpolated_crystal
725+ - include: escaped_char
726+ - match: '(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)'
727+ comment: heredoc with embedded shell and intented terminator
729+ 0: punctuation.definition.string.begin.crystal
731+ - meta_scope: string.unquoted.embedded.shell.crystal
732+ - meta_content_scope: text.shell.embedded.crystal
735+ 0: punctuation.definition.string.end.crystal
738+ - include: scope:source.shell
739+ - include: interpolated_crystal
740+ - include: escaped_char
741+ - match: '(?><<-("?)((?:[_\w]+_|)RUBY)\b\1)'
742+ comment: heredoc with embedded crystal and intented terminator
744+ 0: punctuation.definition.string.begin.crystal
746+ - meta_scope: string.unquoted.embedded.crystal.crystal
747+ - meta_content_scope: text.crystal.embedded.crystal
750+ 0: punctuation.definition.string.end.crystal
753+ - include: scope:source.crystal
754+ - include: interpolated_crystal
755+ - include: escaped_char
756+ - match: (?>\=\s*<<(\w+))
758+ 0: punctuation.definition.string.begin.crystal
760+ - meta_scope: string.unquoted.heredoc.crystal
763+ 0: punctuation.definition.string.end.crystal
766+ - include: interpolated_crystal
767+ - include: escaped_char
768+ - match: (?><<-(\w+))
769+ comment: heredoc with indented terminator
771+ 0: punctuation.definition.string.begin.crystal
773+ - meta_scope: string.unquoted.heredoc.crystal
776+ 0: punctuation.definition.string.end.crystal
779+ - include: interpolated_crystal
780+ - include: escaped_char
781+ - match: '(?<=\{|do|\{\s|do\s)(\|)'
783+ 1: punctuation.separator.variable.crystal
787+ 1: punctuation.separator.variable.crystal
789+ - match: "[_a-zA-Z][_a-zA-Z0-9]*"
790+ scope: variable.other.block.crystal
792+ scope: punctuation.separator.variable.crystal
794+ scope: punctuation.separator.key-value
795+ - match: '<<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<<'
796+ scope: keyword.operator.assignment.augmented.crystal
797+ - match: '<=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\?'
798+ scope: keyword.operator.comparison.crystal
799+ - match: '(?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\^'
800+ scope: keyword.operator.logical.crystal
801+ - match: '(\{\%|\%\}|\{\{|\}\})'
802+ scope: keyword.operator.macro.crystal
803+ - match: (%|&|\*\*|\*|\+|\-|/)
804+ scope: keyword.operator.arithmetic.crystal
806+ scope: keyword.operator.assignment.crystal
808+ scope: keyword.operator.other.crystal
810+ scope: punctuation.separator.other.crystal
812+ scope: punctuation.separator.statement.crystal
814+ scope: punctuation.separator.object.crystal
816+ scope: punctuation.separator.method.crystal
818+ scope: punctuation.section.scope.crystal
820+ scope: punctuation.section.array.crystal
822+ scope: punctuation.section.function.crystal
824+ - match: '\\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.)'
825+ scope: constant.character.escape.crystal
832+ interpolated_crystal:
834+ scope: source.crystal.embedded.source
836+ 0: punctuation.section.embedded.crystal
837+ 1: source.crystal.embedded.source.empty
840+ 0: punctuation.section.embedded.crystal
842+ - meta_scope: source.crystal.embedded.source
845+ 0: punctuation.section.embedded.crystal
847+ - include: nest_curly_and_self
849+ - match: '(#@)[a-zA-Z_]\w*'
850+ scope: variable.other.readwrite.instance.crystal
852+ 1: punctuation.definition.variable.crystal
853+ - match: '(#@@)[a-zA-Z_]\w*'
854+ scope: variable.other.readwrite.class.crystal
856+ 1: punctuation.definition.variable.crystal
857+ - match: '(#\$)[a-zA-Z_]\w*'
858+ scope: variable.other.readwrite.global.crystal
860+ 1: punctuation.definition.variable.crystal
864+ 0: punctuation.section.scope.crystal
868+ 0: punctuation.section.scope.crystal
870+ - include: nest_brackets
874+ 0: punctuation.section.scope.crystal
878+ 0: punctuation.section.scope.crystal
880+ - include: interpolated_crystal
881+ - include: escaped_char
882+ - include: nest_brackets_i
886+ 0: punctuation.section.scope.crystal
890+ 0: punctuation.section.scope.crystal
892+ - include: regex_sub
893+ - include: nest_brackets_r
897+ 0: punctuation.section.scope.crystal
901+ 0: punctuation.section.scope.crystal
903+ - include: nest_curly
904+ nest_curly_and_self:
907+ 0: punctuation.section.scope.crystal
911+ 0: punctuation.section.scope.crystal
913+ - include: nest_curly_and_self
918+ 0: punctuation.section.scope.crystal
922+ 0: punctuation.section.scope.crystal
924+ - include: interpolated_crystal
925+ - include: escaped_char
926+ - include: nest_curly_i
930+ 0: punctuation.section.scope.crystal
934+ 0: punctuation.section.scope.crystal
936+ - include: regex_sub
937+ - include: nest_curly_r
941+ 0: punctuation.section.scope.crystal
945+ 0: punctuation.section.scope.crystal
947+ - include: nest_ltgt
951+ 0: punctuation.section.scope.crystal
955+ 0: punctuation.section.scope.crystal
957+ - include: interpolated_crystal
958+ - include: escaped_char
959+ - include: nest_ltgt_i
963+ 0: punctuation.section.scope.crystal
967+ 0: punctuation.section.scope.crystal
969+ - include: regex_sub
970+ - include: nest_ltgt_r
974+ 0: punctuation.section.scope.crystal
978+ 0: punctuation.section.scope.crystal
980+ - include: nest_parens
984+ 0: punctuation.section.scope.crystal
988+ 0: punctuation.section.scope.crystal
990+ - include: interpolated_crystal
991+ - include: escaped_char
992+ - include: nest_parens_i
996+ 0: punctuation.section.scope.crystal
1000+ 0: punctuation.section.scope.crystal
1002+ - include: regex_sub
1003+ - include: nest_parens_r
1005+ - include: interpolated_crystal
1006+ - include: escaped_char
1007+ - match: '(\{)\d+(,\d+)?(\})'
1008+ scope: string.regexp.arbitrary-repitition.crystal
1010+ 1: punctuation.definition.arbitrary-repitition.crystal
1011+ 3: punctuation.definition.arbitrary-repitition.crystal
1012+ - match: '\[(?:\^?\])?'
1014+ 0: punctuation.definition.character-class.crystal
1016+ - meta_scope: string.regexp.character-class.crystal
1019+ 0: punctuation.definition.character-class.crystal
1021+ - include: escaped_char
1024+ 0: punctuation.definition.group.crystal
1026+ - meta_scope: string.regexp.group.crystal
1029+ 0: punctuation.definition.group.crystal
1031+ - include: regex_sub
1032+ - match: '(?<=^|\s)(#)\s[[a-zA-Z0-9,. \t?!-][^\x{00}-\x{7F}]]*$'
1033+ 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.
1034+ scope: comment.line.number-sign.crystal
1036+ 1: punctuation.definition.comment.crystal