Manually convert Crystal.sublime-syntax

This commit is contained in:
sharkdp 2019-12-09 23:38:57 +01:00 committed by David Peter
parent 8baa76aa8f
commit d43431d8f1

View File

@ -131,9 +131,9 @@ contexts:
scope: keyword.control.pseudo-method.crystal scope: keyword.control.pseudo-method.crystal
- match: '\b(nil|true|false)\b(?![?!])' - match: '\b(nil|true|false)\b(?![?!])'
scope: constant.language.crystal scope: constant.language.crystal
- match: '\b(__(DIR|FILE|LINE)__|self)\b(?![?!])' - match: '\b(__(DIR|FILE|LINE|END_LINE)__|self)\b(?![?!])'
scope: variable.language.crystal scope: variable.language.crystal
- 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[!?]?' - match: '\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|context|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn|annotation|verbatim)\b[!?]?'
comment: everything being a method but having a special function is a.. comment: everything being a method but having a special function is a..
scope: keyword.control.special-method.crystal scope: keyword.control.special-method.crystal
- match: \b(require)\b - match: \b(require)\b
@ -180,7 +180,7 @@ contexts:
(?<=^|\s)(def)\s+ # the def keyword (?<=^|\s)(def)\s+ # the def keyword
( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\x{80}-\x{10FFFF}\w]*(?>\.|::))? # a method name prefix ( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\x{80}-\x{10FFFF}\w]*(?>\.|::))? # a method name prefix
(?>[a-zA-Z_\x{80}-\x{10FFFF}][\x{80}-\x{10FFFF}\w]*(?>[?!]|=(?!>))? # the method name (?>[a-zA-Z_\x{80}-\x{10FFFF}][\x{80}-\x{10FFFF}\w]*(?>[?!]|=(?!>))? # the method name
|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\](?:=|\?)?) ) # …or an operator method
\s*(\() # the openning parenthesis for arguments \s*(\() # the openning parenthesis for arguments
comment: the method pattern comes from the symbol pattern, see there for a explaination comment: the method pattern comes from the symbol pattern, see there for a explaination
captures: captures:
@ -201,7 +201,7 @@ contexts:
(?<=^|\s)(def)\s+ # the def keyword (?<=^|\s)(def)\s+ # the def keyword
( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>\.|::))? # a method name prefix ( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>\.|::))? # a method name prefix
(?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!]|=(?!>))? # the method name (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!]|=(?!>))? # the method name
|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\](?:=|\?)?) ) # …or an operator method
[ \t] # the space separating the arguments [ \t] # the space separating the arguments
(?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow (?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow
comment: same as the previous rule, but without parentheses around the arguments comment: same as the previous rule, but without parentheses around the arguments
@ -221,7 +221,7 @@ contexts:
( \s+ # an optional group of whitespace followed by… ( \s+ # an optional group of whitespace followed by…
( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>\.|::))? # a method name prefix ( (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>\.|::))? # a method name prefix
(?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!]|=(?!>))? # the method name (?>[a-zA-Z_\x{80}-\x{10FFFF}][\w\x{80}-\x{10FFFF}]*(?>[?!]|=(?!>))? # the method name
|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\](?:=|\?)?) ) )? # …or an operator method
comment: the optional name is just to catch the def also without a method-name comment: the optional name is just to catch the def also without a method-name
scope: meta.function.method.without-arguments.crystal scope: meta.function.method.without-arguments.crystal
captures: captures:
@ -588,7 +588,7 @@ contexts:
pop: true pop: true
- match: \\. - match: \\.
comment: Cant be named because its not neccesarily an escape. comment: Cant be named because its not neccesarily an escape.
- 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}]*)' - 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}]*|!=?(?![?!]))'
comment: symbols comment: symbols
scope: constant.other.symbol.crystal scope: constant.other.symbol.crystal
captures: captures:
@ -713,14 +713,14 @@ contexts:
captures: captures:
0: punctuation.definition.string.begin.crystal 0: punctuation.definition.string.begin.crystal
push: push:
- meta_scope: string.unquoted.embedded.js.jquery.crystal - meta_scope: string.unquoted.embedded.js.crystal
- meta_content_scope: text.js.jquery.embedded.crystal - meta_content_scope: text.js.embedded.crystal
- match: \s*\2$ - match: \s*\2$
captures: captures:
0: punctuation.definition.string.end.crystal 0: punctuation.definition.string.end.crystal
pop: true pop: true
- include: heredoc - include: heredoc
- include: scope:source.js.jquery - include: scope:source.js
- include: interpolated_crystal - include: interpolated_crystal
- include: escaped_char - include: escaped_char
- match: '(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)' - match: '(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)'