Add more syntaxes
This commit is contained in:
parent
d2177df838
commit
04b27d5923
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
## 0.2.1 (unreleased)
|
## 0.2.1 (unreleased)
|
||||||
|
|
||||||
- Fix `base-url` arg to `gutenberg build` being called `base`
|
- Fix `base-url` argument to `gutenberg build` being called `base`
|
||||||
|
- Add syntaxes: Crystal, Elixir, Kotlin
|
||||||
|
|
||||||
## 0.2.0 (2017-10-05)
|
## 0.2.0 (2017-10-05)
|
||||||
|
|
||||||
|
|
1036
sublime_syntaxes/Crystal.sublime-syntax
Normal file
1036
sublime_syntaxes/Crystal.sublime-syntax
Normal file
File diff suppressed because it is too large
Load diff
525
sublime_syntaxes/Elixir.sublime-syntax
Normal file
525
sublime_syntaxes/Elixir.sublime-syntax
Normal file
|
@ -0,0 +1,525 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Elixir
|
||||||
|
comment: Textmate bundle for Elixir Programming Language.
|
||||||
|
file_extensions:
|
||||||
|
- ex
|
||||||
|
- exs
|
||||||
|
first_line_match: ^#!/.*\belixir
|
||||||
|
scope: source.elixir
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: \b(fn)\b(?!.*->)
|
||||||
|
captures:
|
||||||
|
1: keyword.control.elixir
|
||||||
|
push:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: core_syntax
|
||||||
|
- match: \b(fn)\b(?=.*->)
|
||||||
|
captures:
|
||||||
|
1: keyword.control.elixir
|
||||||
|
push:
|
||||||
|
- match: (?>(->)|(when)|(\)))
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.other.elixir
|
||||||
|
2: keyword.control.elixir
|
||||||
|
3: punctuation.definition.parameters.elixir
|
||||||
|
pop: true
|
||||||
|
- include: core_syntax
|
||||||
|
- include: core_syntax
|
||||||
|
- match: '^(?=.*->)((?![^"'']*("|'')[^"'']*->)|(?=.*->[^"'']*("|'')[^"'']*->))((?!.*\([^\)]*->)|(?=[^\(\)]*->)|(?=\s*\(.*\).*->))((?!.*\b(fn)\b)|(?=.*->.*\bfn\b))'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.elixir
|
||||||
|
push:
|
||||||
|
- match: (?>(->)|(when)|(\)))
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.other.elixir
|
||||||
|
2: keyword.control.elixir
|
||||||
|
3: punctuation.definition.parameters.elixir
|
||||||
|
pop: true
|
||||||
|
- include: core_syntax
|
||||||
|
core_syntax:
|
||||||
|
- match: ^\s*(defmodule)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.control.module.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.module.elixir
|
||||||
|
- match: \b(do)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.control.module.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '\b[A-Z]\w*\b'
|
||||||
|
scope: entity.name.class.elixir
|
||||||
|
- match: ^\s*(defprotocol)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.control.protocol.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.protocol_declaration.elixir
|
||||||
|
- match: \b(do)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.control.protocol.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '\b[A-Z]\w*\b'
|
||||||
|
scope: entity.name.protocol.elixir
|
||||||
|
- match: ^\s*(defimpl)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.control.protocol.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.protocol_implementation.elixir
|
||||||
|
- match: \b(do)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.control.protocol.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '\b[A-Z]\w*\b'
|
||||||
|
scope: entity.name.protocol.elixir
|
||||||
|
- match: '^\s*(def|defmacro)\s+((?>[a-zA-Z_]\w*(?>\.|::))?(?>[a-zA-Z_]\w*(?>[?!]|=(?!>))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?))((\()|\s*)'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.module.elixir
|
||||||
|
2: entity.name.function.public.elixir
|
||||||
|
4: punctuation.definition.parameters.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function.public.elixir
|
||||||
|
- match: (\bdo:)|(\bdo\b)|(?=\s+(def|defmacro)\b)
|
||||||
|
captures:
|
||||||
|
1: constant.other.keywords.elixir
|
||||||
|
2: keyword.control.module.elixir
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: \s(\\\\)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.other.elixir
|
||||||
|
push:
|
||||||
|
- match: ',|\)|$'
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: \b(is_atom|is_binary|is_bitstring|is_boolean|is_float|is_function|is_integer|is_list|is_map|is_nil|is_number|is_pid|is_port|is_record|is_reference|is_tuple|is_exception|abs|bit_size|byte_size|div|elem|hd|length|map_size|node|rem|round|tl|trunc|tuple_size)\b
|
||||||
|
scope: keyword.control.elixir
|
||||||
|
- match: '^\s*(defp|defmacrop)\s+((?>[a-zA-Z_]\w*(?>\.|::))?(?>[a-zA-Z_]\w*(?>[?!]|=(?!>))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?))((\()|\s*)'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.module.elixir
|
||||||
|
2: entity.name.function.private.elixir
|
||||||
|
4: punctuation.definition.parameters.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function.private.elixir
|
||||||
|
- match: (\bdo:)|(\bdo\b)|(?=\s+(defp|defmacrop)\b)
|
||||||
|
captures:
|
||||||
|
1: constant.other.keywords.elixir
|
||||||
|
2: keyword.control.module.elixir
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: \s(\\\\)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.other.elixir
|
||||||
|
push:
|
||||||
|
- match: ',|\)|$'
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: \b(is_atom|is_binary|is_bitstring|is_boolean|is_float|is_function|is_integer|is_list|is_map|is_nil|is_number|is_pid|is_port|is_record|is_reference|is_tuple|is_exception|abs|bit_size|byte_size|div|elem|hd|length|map_size|node|rem|round|tl|trunc|tuple_size)\b
|
||||||
|
scope: keyword.control.elixir
|
||||||
|
- match: '@(module|type)?doc (~[a-z])?"""'
|
||||||
|
comment: "@doc with heredocs is treated as documentation"
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.documentation.heredoc
|
||||||
|
- match: \s*"""
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '@(module|type)?doc ~[A-Z]"""'
|
||||||
|
comment: "@doc with heredocs is treated as documentation"
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.documentation.heredoc
|
||||||
|
- match: \s*"""
|
||||||
|
pop: true
|
||||||
|
- match: "@(module|type)?doc (~[a-z])?'''"
|
||||||
|
comment: "@doc with heredocs is treated as documentation"
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.documentation.heredoc
|
||||||
|
- match: \s*'''
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: "@(module|type)?doc ~[A-Z]'''"
|
||||||
|
comment: "@doc with heredocs is treated as documentation"
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.documentation.heredoc
|
||||||
|
- match: \s*'''
|
||||||
|
pop: true
|
||||||
|
- match: "@(module|type)?doc false"
|
||||||
|
comment: "@doc false is treated as documentation"
|
||||||
|
scope: comment.documentation.false
|
||||||
|
- match: '@(module|type)?doc "'
|
||||||
|
comment: "@doc with string is treated as documentation"
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.documentation.string
|
||||||
|
- match: '"'
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: (::)
|
||||||
|
captures:
|
||||||
|
0: punctuation.binary.elixir
|
||||||
|
push:
|
||||||
|
- match: (,|>>|$)
|
||||||
|
captures:
|
||||||
|
0: punctuation.binary.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '\b[a-z]\w*\b'
|
||||||
|
scope: support.type.binary.elixir
|
||||||
|
- match: '\b(0x[0-9A-Fa-f](?>_?[0-9A-Fa-f])*|\d(?>_?\d)*(\.(?![^[:space:][:digit:]])(?>_?\d)*)?([eE][-+]?\d(?>_?\d)*)?|0b[01]+|0o[0-7]+)\b'
|
||||||
|
scope: constant.numeric.elixir
|
||||||
|
- match: '(?<!\.)\b(do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super|with)\b(?![?!:])'
|
||||||
|
scope: keyword.control.elixir
|
||||||
|
- match: (?<!\.)\b(and|not|or|when|xor|in)\b
|
||||||
|
comment: as above, just doesn't need a 'end' and does a logic operation
|
||||||
|
scope: keyword.operator.elixir
|
||||||
|
- match: '\b[A-Z]\w*\b'
|
||||||
|
scope: entity.name.class.elixir
|
||||||
|
- match: '\b(nil|true|false)\b(?![?!])'
|
||||||
|
scope: constant.language.elixir
|
||||||
|
- match: '\b(__(CALLER|ENV|MODULE|DIR)__)\b(?![?!])'
|
||||||
|
scope: variable.language.elixir
|
||||||
|
- match: '(@)[a-zA-Z_]\w*'
|
||||||
|
scope: variable.other.readwrite.module.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.variable.elixir
|
||||||
|
- match: (&)\d+
|
||||||
|
scope: variable.other.anonymous.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.variable.elixir
|
||||||
|
- match: '\^[a-z_]\w*'
|
||||||
|
scope: variable.other.capture.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.variable.elixir
|
||||||
|
- match: '\b(0x[0-9A-Fa-f](?>_?[0-9A-Fa-f])*|\d(?>_?\d)*(\.(?![^[:space:][:digit:]])(?>_?\d)*)?([eE][-+]?\d(?>_?\d)*)?|0b[01]+|0o[0-7]+)\b'
|
||||||
|
scope: constant.numeric.elixir
|
||||||
|
- match: ":'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.constant.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: constant.other.symbol.single-quoted.elixir
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.constant.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: ':"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.constant.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: constant.other.symbol.double-quoted.elixir
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.constant.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: (?>''')
|
||||||
|
comment: Single-quoted heredocs
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.heredoc.elixir
|
||||||
|
- match: ^\s*'''
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: "'"
|
||||||
|
comment: single quoted string (allows for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.elixir
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: (?>""")
|
||||||
|
comment: Double-quoted heredocs
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.heredoc.elixir
|
||||||
|
- match: ^\s*"""
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '"'
|
||||||
|
comment: double quoted string (allows for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.elixir
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[a-z](?>""")'
|
||||||
|
comment: Double-quoted heredocs sigils
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.heredoc.elixir
|
||||||
|
- match: ^\s*"""
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[a-z]\{'
|
||||||
|
comment: sigil (allow for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.elixir
|
||||||
|
- match: '\}[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[a-z]\['
|
||||||
|
comment: sigil (allow for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.elixir
|
||||||
|
- match: '\][a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[a-z]\<'
|
||||||
|
comment: sigil (allow for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.elixir
|
||||||
|
- match: '\>[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[a-z]\('
|
||||||
|
comment: sigil (allow for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.elixir
|
||||||
|
- match: '\)[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[a-z]([^\w])'
|
||||||
|
comment: sigil (allow for interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.elixir
|
||||||
|
- match: '\1[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '~[A-Z](?>""")'
|
||||||
|
comment: Double-quoted heredocs sigils
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.literal.upper.elixir
|
||||||
|
- match: ^\s*"""
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '~[A-Z]\{'
|
||||||
|
comment: sigil (without interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.literal.upper.elixir
|
||||||
|
- match: '\}[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '~[A-Z]\['
|
||||||
|
comment: sigil (without interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.literal.upper.elixir
|
||||||
|
- match: '\][a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '~[A-Z]\<'
|
||||||
|
comment: sigil (without interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.literal.upper.elixir
|
||||||
|
- match: '\>[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '~[A-Z]\('
|
||||||
|
comment: sigil (without interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.literal.upper.elixir
|
||||||
|
- match: '\)[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '~[A-Z]([^\w])'
|
||||||
|
comment: sigil (without interpolation)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.literal.upper.elixir
|
||||||
|
- match: '\1[a-z]*'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.elixir
|
||||||
|
pop: true
|
||||||
|
- match: '(?<!:)(:)(?>[a-zA-Z_][\w@]*(?>[?!]|=(?![>=]))?|\<\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\-|\|>|=>|=~|=|/|\\\\|\*\*?|\.\.?\.?|>=?|<=?|&&?&?|\+\+?|\-\-?|\|\|?\|?|\!|@|\%?\{\}|%|\[\]|\^(\^\^)?)'
|
||||||
|
comment: symbols
|
||||||
|
scope: constant.other.symbol.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.constant.elixir
|
||||||
|
- match: '(?>[a-zA-Z_][\w@]*(?>[?!])?)(:)(?!:)'
|
||||||
|
comment: symbols
|
||||||
|
scope: constant.other.keywords.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.constant.elixir
|
||||||
|
- match: ^\s*(##).*$\n?
|
||||||
|
scope: comment.line.section.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.elixir
|
||||||
|
- match: '(?:^[ \t]+)?(#).*$\n?'
|
||||||
|
scope: comment.line.number-sign.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.elixir
|
||||||
|
- match: '(?<!\w)\?(\\(x[0-9A-Fa-f]{1,2}(?![0-9A-Fa-f])\b|[^xMC])|[^\s\\])'
|
||||||
|
comment: |
|
||||||
|
matches questionmark-letters.
|
||||||
|
|
||||||
|
examples (1st alternation = hex):
|
||||||
|
?\x1 ?\x61
|
||||||
|
|
||||||
|
examples (2rd alternation = escaped):
|
||||||
|
?\n ?\b
|
||||||
|
|
||||||
|
examples (3rd alternation = normal):
|
||||||
|
?a ?A ?0
|
||||||
|
?* ?" ?(
|
||||||
|
?. ?#
|
||||||
|
|
||||||
|
the negative lookbehind prevents against matching
|
||||||
|
p(42.tainted?)
|
||||||
|
scope: constant.numeric.elixir
|
||||||
|
- match: "===?|!==?|<=?|>=?"
|
||||||
|
scope: keyword.operator.comparison.elixir
|
||||||
|
- match: (\|\|\||&&&|^^^|<<<|>>>|~~~)
|
||||||
|
scope: keyword.operator.bitwise.elixir
|
||||||
|
- match: '(?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\bxor\b'
|
||||||
|
scope: keyword.operator.logical.elixir
|
||||||
|
- match: (\*|\+|\-|/)
|
||||||
|
scope: keyword.operator.arithmetic.elixir
|
||||||
|
- match: \||\+\+|\-\-|\*\*|\\\\|\<\-|\<\>|\<\<|\>\>|\:\:|\.\.|\|>|~|=>|&
|
||||||
|
scope: keyword.operator.other.elixir
|
||||||
|
- match: "="
|
||||||
|
scope: keyword.operator.assignment.elixir
|
||||||
|
- match: ":"
|
||||||
|
scope: punctuation.separator.other.elixir
|
||||||
|
- match: \;
|
||||||
|
scope: punctuation.separator.statement.elixir
|
||||||
|
- match: ","
|
||||||
|
scope: punctuation.separator.object.elixir
|
||||||
|
- match: \.
|
||||||
|
scope: punctuation.separator.method.elixir
|
||||||
|
- match: '\{|\}'
|
||||||
|
scope: punctuation.section.scope.elixir
|
||||||
|
- match: '\[|\]'
|
||||||
|
scope: punctuation.section.array.elixir
|
||||||
|
- match: \(|\)
|
||||||
|
scope: punctuation.section.function.elixir
|
||||||
|
escaped_char:
|
||||||
|
- match: '\\(x[\da-fA-F]{1,2}|.)'
|
||||||
|
scope: constant.character.escaped.elixir
|
||||||
|
interpolated_elixir:
|
||||||
|
- match: '#\{(\})'
|
||||||
|
scope: source.elixir.embedded.source
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.elixir
|
||||||
|
1: source.elixir.embedded.source.empty
|
||||||
|
- match: '#\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: source.elixir.embedded.source
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.embedded.elixir
|
||||||
|
pop: true
|
||||||
|
- include: nest_curly_and_self
|
||||||
|
- include: main
|
||||||
|
nest_curly_and_self:
|
||||||
|
- match: '\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.scope.elixir
|
||||||
|
push:
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.scope.elixir
|
||||||
|
pop: true
|
||||||
|
- include: nest_curly_and_self
|
||||||
|
- include: main
|
||||||
|
regex_sub:
|
||||||
|
- include: interpolated_elixir
|
||||||
|
- include: escaped_char
|
||||||
|
- match: '(\{)\d+(,\d+)?(\})'
|
||||||
|
scope: string.regexp.arbitrary-repitition.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.arbitrary-repitition.elixir
|
||||||
|
3: punctuation.definition.arbitrary-repitition.elixir
|
||||||
|
- match: '\[(?:\^?\])?'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.character-class.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.regexp.character-class.elixir
|
||||||
|
- match: '\]'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.character-class.elixir
|
||||||
|
pop: true
|
||||||
|
- include: escaped_char
|
||||||
|
- match: \(
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.group.elixir
|
||||||
|
push:
|
||||||
|
- meta_scope: string.regexp.group.elixir
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.group.elixir
|
||||||
|
pop: true
|
||||||
|
- include: regex_sub
|
||||||
|
- match: '(?<=^|\s)(#)\s[[a-zA-Z0-9,. \t?!-][^\x{00}-\x{7F}]]*$'
|
||||||
|
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.
|
||||||
|
scope: comment.line.number-sign.elixir
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.elixir
|
389
sublime_syntaxes/Kotlin.sublime-syntax
Normal file
389
sublime_syntaxes/Kotlin.sublime-syntax
Normal file
|
@ -0,0 +1,389 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Kotlin
|
||||||
|
file_extensions:
|
||||||
|
- kt
|
||||||
|
- kts
|
||||||
|
scope: source.Kotlin
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- include: comments
|
||||||
|
- match: '^\s*(package)\b(?:\s*([^ ;$]+)\s*)?'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.kotlin
|
||||||
|
2: entity.name.package.kotlin
|
||||||
|
- include: imports
|
||||||
|
- include: statements
|
||||||
|
classes:
|
||||||
|
- match: (?=\s*(?:companion|class|object|interface))
|
||||||
|
push:
|
||||||
|
- match: "}|(?=$)"
|
||||||
|
pop: true
|
||||||
|
- match: \b(companion\s*)?(class|object|interface)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.other.kotlin
|
||||||
|
push:
|
||||||
|
- match: '(?=<|{|\(|:)'
|
||||||
|
pop: true
|
||||||
|
- match: \b(object)\b
|
||||||
|
scope: keyword.other.kotlin
|
||||||
|
- match: \w+
|
||||||
|
scope: entity.name.type.class.kotlin
|
||||||
|
- match: <
|
||||||
|
push:
|
||||||
|
- match: ">"
|
||||||
|
pop: true
|
||||||
|
- include: generics
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: parameters
|
||||||
|
- match: (:)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.declaration.kotlin
|
||||||
|
push:
|
||||||
|
- match: "(?={|$)"
|
||||||
|
pop: true
|
||||||
|
- match: \w+
|
||||||
|
scope: entity.other.inherited-class.kotlin
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- match: '\{'
|
||||||
|
push:
|
||||||
|
- match: '\}'
|
||||||
|
pop: true
|
||||||
|
- include: statements
|
||||||
|
comments:
|
||||||
|
- match: /\*
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.kotlin
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.kotlin
|
||||||
|
- match: \*/
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.kotlin
|
||||||
|
pop: true
|
||||||
|
- match: \s*((//).*$\n?)
|
||||||
|
captures:
|
||||||
|
1: comment.line.double-slash.kotlin
|
||||||
|
2: punctuation.definition.comment.kotlin
|
||||||
|
constants:
|
||||||
|
- match: \b(true|false|null|this|super)\b
|
||||||
|
scope: constant.language.kotlin
|
||||||
|
- match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\b'
|
||||||
|
scope: constant.numeric.kotlin
|
||||||
|
- match: '\b([A-Z][A-Z0-9_]+)\b'
|
||||||
|
scope: constant.other.kotlin
|
||||||
|
expressions:
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- include: types
|
||||||
|
- include: strings
|
||||||
|
- include: constants
|
||||||
|
- include: comments
|
||||||
|
- include: keywords
|
||||||
|
functions:
|
||||||
|
- match: (?=\s*(?:fun))
|
||||||
|
push:
|
||||||
|
- match: "}|(?=$)"
|
||||||
|
pop: true
|
||||||
|
- match: \b(fun)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.other.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=\()
|
||||||
|
pop: true
|
||||||
|
- match: <
|
||||||
|
push:
|
||||||
|
- match: ">"
|
||||||
|
pop: true
|
||||||
|
- include: generics
|
||||||
|
- match: '([\.<\?>\w]+\.)?(\w+)'
|
||||||
|
captures:
|
||||||
|
2: entity.name.function.kotlin
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: parameters
|
||||||
|
- match: (:)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.declaration.kotlin
|
||||||
|
push:
|
||||||
|
- match: "(?={|=|$)"
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- match: '\{'
|
||||||
|
push:
|
||||||
|
- match: '(?=\})'
|
||||||
|
pop: true
|
||||||
|
- include: statements
|
||||||
|
- match: (=)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.assignment.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=$)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
generics:
|
||||||
|
- match: (:)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.declaration.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=,|>)
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- include: keywords
|
||||||
|
- match: \w+
|
||||||
|
scope: storage.type.generic.kotlin
|
||||||
|
getters-and-setters:
|
||||||
|
- match: \b(get)\b\s*\(\s*\)
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.kotlin
|
||||||
|
push:
|
||||||
|
- match: '\}|(?=\bset\b)|$'
|
||||||
|
pop: true
|
||||||
|
- match: (=)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.assignment.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=$|\bset\b)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- match: '\{'
|
||||||
|
push:
|
||||||
|
- match: '\}'
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- match: \b(set)\b\s*(?=\()
|
||||||
|
captures:
|
||||||
|
1: entity.name.function.kotlin
|
||||||
|
push:
|
||||||
|
- match: '\}|(?=\bget\b)|$'
|
||||||
|
pop: true
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: parameters
|
||||||
|
- match: (=)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.assignment.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=$|\bset\b)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- match: '\{'
|
||||||
|
push:
|
||||||
|
- match: '\}'
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
imports:
|
||||||
|
- match: '^\s*(import)\s+[^ $]+\s+(as)?'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.kotlin
|
||||||
|
2: keyword.other.kotlin
|
||||||
|
keywords:
|
||||||
|
- match: \b(var|val|public|private|protected|abstract|final|enum|open|attribute|annotation|override|inline|var|val|vararg|lazy|in|out|internal|data|tailrec|operator|infix|const|yield|typealias|typeof)\b
|
||||||
|
scope: storage.modifier.kotlin
|
||||||
|
- match: \b(try|catch|finally|throw)\b
|
||||||
|
scope: keyword.control.catch-exception.kotlin
|
||||||
|
- match: \b(if|else|while|for|do|return|when|where|break|continue)\b
|
||||||
|
scope: keyword.control.kotlin
|
||||||
|
- match: \b(in|is|as|assert)\b
|
||||||
|
scope: keyword.operator.kotlin
|
||||||
|
- match: (==|!=|===|!==|<=|>=|<|>)
|
||||||
|
scope: keyword.operator.comparison.kotlin
|
||||||
|
- match: (=)
|
||||||
|
scope: keyword.operator.assignment.kotlin
|
||||||
|
- match: (:)
|
||||||
|
scope: keyword.operator.declaration.kotlin
|
||||||
|
- match: (\.)
|
||||||
|
scope: keyword.operator.dot.kotlin
|
||||||
|
- match: (\-\-|\+\+)
|
||||||
|
scope: keyword.operator.increment-decrement.kotlin
|
||||||
|
- match: (\-|\+|\*|\/|%)
|
||||||
|
scope: keyword.operator.arithmetic.kotlin
|
||||||
|
- match: (\+=|\-=|\*=|\/=)
|
||||||
|
scope: keyword.operator.arithmetic.assign.kotlin
|
||||||
|
- match: (!|&&|\|\|)
|
||||||
|
scope: keyword.operator.logical.kotlin
|
||||||
|
- match: (\.\.)
|
||||||
|
scope: keyword.operator.range.kotlin
|
||||||
|
- match: (;)
|
||||||
|
scope: punctuation.terminator.kotlin
|
||||||
|
namespaces:
|
||||||
|
- match: \b(namespace)\b
|
||||||
|
scope: keyword.other.kotlin
|
||||||
|
- match: '\{'
|
||||||
|
push:
|
||||||
|
- match: '\}'
|
||||||
|
pop: true
|
||||||
|
- include: statements
|
||||||
|
parameters:
|
||||||
|
- match: (:)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.declaration.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=,|\)|=)
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- match: (=)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.declaration.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=,|\))
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- include: keywords
|
||||||
|
- match: \w+
|
||||||
|
scope: variable.parameter.function.kotlin
|
||||||
|
statements:
|
||||||
|
- include: namespaces
|
||||||
|
- include: typedefs
|
||||||
|
- include: classes
|
||||||
|
- include: functions
|
||||||
|
- include: variables
|
||||||
|
- include: getters-and-setters
|
||||||
|
- include: expressions
|
||||||
|
strings:
|
||||||
|
- match: '"""'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.kotlin
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.third.kotlin
|
||||||
|
- match: '"""'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.kotlin
|
||||||
|
pop: true
|
||||||
|
- match: '(\$\w+|\$\{[^\}]+\})'
|
||||||
|
scope: variable.parameter.template.kotlin
|
||||||
|
- match: \\.
|
||||||
|
scope: constant.character.escape.kotlin
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.kotlin
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.kotlin
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.kotlin
|
||||||
|
pop: true
|
||||||
|
- match: '(\$\w+|\$\{[^\}]+\})'
|
||||||
|
scope: variable.parameter.template.kotlin
|
||||||
|
- match: \\.
|
||||||
|
scope: constant.character.escape.kotlin
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.kotlin
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.kotlin
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.kotlin
|
||||||
|
pop: true
|
||||||
|
- match: \\.
|
||||||
|
scope: constant.character.escape.kotlin
|
||||||
|
- match: "`"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.kotlin
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.kotlin
|
||||||
|
- match: "`"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.kotlin
|
||||||
|
pop: true
|
||||||
|
typedefs:
|
||||||
|
- match: (?=\s*(?:type))
|
||||||
|
push:
|
||||||
|
- match: (?=$)
|
||||||
|
pop: true
|
||||||
|
- match: \b(type)\b
|
||||||
|
scope: keyword.other.kotlin
|
||||||
|
- match: <
|
||||||
|
push:
|
||||||
|
- match: ">"
|
||||||
|
pop: true
|
||||||
|
- include: generics
|
||||||
|
- include: expressions
|
||||||
|
types:
|
||||||
|
- match: \b(Any|Unit|String|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\b
|
||||||
|
scope: storage.type.buildin.kotlin
|
||||||
|
- match: \b(IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray)\b
|
||||||
|
scope: storage.type.buildin.array.kotlin
|
||||||
|
- match: \b(Array|List|Map)<\b
|
||||||
|
captures:
|
||||||
|
1: storage.type.buildin.collection.kotlin
|
||||||
|
push:
|
||||||
|
- match: ">"
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- include: keywords
|
||||||
|
- match: \w+<
|
||||||
|
push:
|
||||||
|
- match: ">"
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- include: keywords
|
||||||
|
- match: (#)\(
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.tuple.kotlin
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- match: '\{'
|
||||||
|
push:
|
||||||
|
- match: '\}'
|
||||||
|
pop: true
|
||||||
|
- include: statements
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- match: (->)
|
||||||
|
scope: keyword.operator.declaration.kotlin
|
||||||
|
variables:
|
||||||
|
- match: (?=\s*(?:var|val))
|
||||||
|
push:
|
||||||
|
- match: (?=:|=|$)
|
||||||
|
pop: true
|
||||||
|
- match: \b(var|val)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.other.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=:|=|$)
|
||||||
|
pop: true
|
||||||
|
- match: <
|
||||||
|
push:
|
||||||
|
- match: ">"
|
||||||
|
pop: true
|
||||||
|
- include: generics
|
||||||
|
- match: '([\.<\?>\w]+\.)?(\w+)'
|
||||||
|
captures:
|
||||||
|
2: entity.name.variable.kotlin
|
||||||
|
- match: (:)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.declaration.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?==|$)
|
||||||
|
pop: true
|
||||||
|
- include: types
|
||||||
|
- include: getters-and-setters
|
||||||
|
- match: (=)
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.assignment.kotlin
|
||||||
|
push:
|
||||||
|
- match: (?=$)
|
||||||
|
pop: true
|
||||||
|
- include: expressions
|
||||||
|
- include: getters-and-setters
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1b2067847ab557d74f41685eace343354dc2c198
|
Subproject commit 928a7a618d99631ea424c45e74fb01d1fb6f6853
|
|
@ -1 +1 @@
|
||||||
Subproject commit eb57cebd62d0c2ea2c17d222c8c1c3cefa40f31b
|
Subproject commit 79bf8ddfb8a05a2b104f3937cd91b6f2afbbb943
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue