bat/assets/syntaxes/02_Extra/Dart.sublime-syntax

212 lines
6.3 KiB
Text
Raw Normal View History

2018-09-05 06:53:18 +00:00
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
2018-09-05 06:53:18 +00:00
name: Dart
file_extensions:
- dart
scope: source.dart
contexts:
main:
- match: ^(#!.*)$
scope: meta.preprocessor.script.dart
- match: ^\w*\b(library|import|part of|part|export)\b
2018-09-05 06:53:18 +00:00
captures:
0: keyword.other.import.dart
push:
- meta_scope: meta.declaration.dart
- match: ;
captures:
0: punctuation.terminator.dart
pop: true
- include: strings
- include: comments
- match: \b(as|show|hide)\b
2018-09-05 06:53:18 +00:00
scope: keyword.other.import.dart
- include: comments
- include: punctuation
2018-09-05 06:53:18 +00:00
- include: annotations
- include: keywords
- include: constants-and-special-vars
2018-09-05 06:53:18 +00:00
- include: strings
annotations:
- match: '@[a-zA-Z]+'
scope: storage.type.annotation.dart
2018-09-05 06:53:18 +00:00
comments:
- match: /\*\*/
scope: comment.block.empty.dart
captures:
0: punctuation.definition.comment.dart
- include: comments-doc-oldschool
- include: comments-doc
2018-09-05 06:53:18 +00:00
- include: comments-inline
comments-block:
2018-09-05 06:53:18 +00:00
- match: /\*
push:
- meta_scope: comment.block.dart
- match: \*/
pop: true
- include: comments-block
comments-doc:
- match: ///
2018-09-05 06:53:18 +00:00
push:
- meta_scope: comment.block.documentation.dart
- match: .*
2018-09-05 06:53:18 +00:00
pop: true
- include: dartdoc
comments-doc-oldschool:
- match: /\*\*
2018-09-05 06:53:18 +00:00
push:
- meta_scope: comment.block.documentation.dart
- match: \*/
2018-09-05 06:53:18 +00:00
pop: true
- include: comments-doc-oldschool
- include: comments-block
- include: dartdoc
comments-inline:
- include: comments-block
- match: ((//).*)$
captures:
1: comment.line.double-slash.dart
2018-09-05 06:53:18 +00:00
constants-and-special-vars:
- match: (?<!\$)\b(true|false|null)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: constant.language.dart
- match: (?<!\$)\b(this|super)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: variable.language.dart
- match: '(?<!\$)\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b(?!\$)'
2018-09-05 06:53:18 +00:00
scope: constant.numeric.dart
- match: '(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*|bool\b|num\b|int\b|double\b|dynamic\b)'
scope: support.class.dart
- match: '([_$]*[a-z][a-zA-Z0-9_$]*)(<|\(|\s+=>)'
2018-09-05 06:53:18 +00:00
captures:
1: entity.name.function.dart
dartdoc:
- match: '(\[.*?\])'
2018-09-05 06:53:18 +00:00
captures:
0: variable.name.source.dart
- match: '^ {4,}(?![ \*]).*'
2018-09-05 06:53:18 +00:00
captures:
0: variable.name.source.dart
- match: '```.*?$'
2018-09-05 06:53:18 +00:00
push:
- meta_content_scope: variable.other.source.dart
- match: '```'
2018-09-05 06:53:18 +00:00
pop: true
- match: (`.*?`)
2018-09-05 06:53:18 +00:00
captures:
0: variable.other.source.dart
- match: (`.*?`)
2018-09-05 06:53:18 +00:00
captures:
0: variable.other.source.dart
- match: (\* (( ).*))$
2018-09-05 06:53:18 +00:00
captures:
2: variable.other.source.dart
- match: (\* .*)$
2018-09-05 06:53:18 +00:00
keywords:
- match: (?<!\$)\bas\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: keyword.cast.dart
- match: (?<!\$)\b(try|on|catch|finally|throw|rethrow)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: keyword.control.catch-exception.dart
- match: (?<!\$)\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: keyword.control.dart
- match: (?<!\$)\b(sync(\*)?|async(\*)?|await|yield(\*)?)\b(?!\$)
scope: keyword.control.dart
- match: (?<!\$)\bassert\b(?!\$)
scope: keyword.control.dart
- match: (?<!\$)\b(new)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: keyword.control.new.dart
- match: (?<!\$)\b(abstract|class|enum|extends|external|factory|implements|get|mixin|native|operator|set|typedef|with|covariant)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: keyword.declaration.dart
- match: (?<!\$)\b(is\!?)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: keyword.operator.dart
- match: '\?|:'
scope: keyword.operator.ternary.dart
2018-09-05 06:53:18 +00:00
- match: (<<|>>>?|~|\^|\||&)
scope: keyword.operator.bitwise.dart
- match: ((&|\^|\||<<|>>>?)=)
scope: keyword.operator.assignment.bitwise.dart
- match: (=>)
scope: keyword.operator.closure.dart
- match: (==|!=|<=?|>=?)
2018-09-05 06:53:18 +00:00
scope: keyword.operator.comparison.dart
- match: '(([+*/%-]|\~)=)'
scope: keyword.operator.assignment.arithmetic.dart
- match: (=)
scope: keyword.operator.assignment.dart
- match: (\-\-|\+\+)
scope: keyword.operator.increment-decrement.dart
- match: (\-|\+|\*|\/|\~\/|%)
scope: keyword.operator.arithmetic.dart
- match: (!|&&|\|\|)
scope: keyword.operator.logical.dart
- match: (?<!\$)\b(static|final|const)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: storage.modifier.dart
- match: (?<!\$)\b(?:void|var)\b(?!\$)
2018-09-05 06:53:18 +00:00
scope: storage.type.primitive.dart
punctuation:
- match: ','
scope: punctuation.comma.dart
- match: ;
scope: punctuation.terminator.dart
2018-09-05 06:53:18 +00:00
- match: \.
scope: punctuation.dot.dart
2018-09-05 06:53:18 +00:00
string-interp:
- match: '\$((\w+)|\{([^{}]+)\})'
2018-09-05 06:53:18 +00:00
captures:
2: variable.parameter.dart
3: variable.parameter.dart
2018-09-05 06:53:18 +00:00
- match: \\.
scope: constant.character.escape.dart
strings:
- match: (?<!r)"""
push:
- meta_scope: string.interpolated.triple.double.dart
- match: '"""(?!")'
pop: true
- include: string-interp
- match: (?<!r)'''
push:
- meta_scope: string.interpolated.triple.single.dart
- match: '''''''(?!'')'
2018-09-05 06:53:18 +00:00
pop: true
- include: string-interp
- match: r"""
push:
- meta_scope: string.quoted.triple.double.dart
- match: '"""(?!")'
pop: true
- match: r'''
push:
- meta_scope: string.quoted.triple.single.dart
- match: '''''''(?!'')'
2018-09-05 06:53:18 +00:00
pop: true
- match: (?<!\|r)"
2018-09-05 06:53:18 +00:00
push:
- meta_scope: string.interpolated.double.dart
- match: '"'
pop: true
- match: \n
scope: invalid.string.newline
- include: string-interp
- match: r"
push:
- meta_scope: string.quoted.double.dart
- match: '"'
pop: true
- match: \n
scope: invalid.string.newline
2018-09-05 06:53:18 +00:00
- match: (?<!\|r)'
push:
- meta_scope: string.interpolated.single.dart
- match: "'"
pop: true
- match: \n
scope: invalid.string.newline
2018-09-05 06:53:18 +00:00
- include: string-interp
- match: r'
push:
- meta_scope: string.quoted.single.dart
- match: "'"
pop: true
- match: \n
scope: invalid.string.newline