| { scopeName = 'source.dart'; |
| fileTypes = ( 'dart' ); |
| foldingStartMarker = '\{\s*$'; |
| foldingStopMarker = '^\s*\}'; |
| patterns = ( |
| { name = 'meta.preprocessor.script.dart'; |
| match = '^(#!.*)$'; |
| }, |
| { name = 'meta.declaration.dart'; |
| begin = '#\b(library|import|source|resource)\b'; |
| end = ';'; |
| beginCaptures = { 0 = { name = 'keyword.other.import.dart'; }; }; |
| endCaptures = { 0 = { name = 'punctuation.terminator.dart'; }; }; |
| patterns = ( |
| { include = '#strings'; }, |
| { match = '\b(prefix)\s*:'; |
| captures = { 1 = { name = 'keyword.other.import.dart'; }; }; |
| }, |
| ); |
| }, |
| { include = '#comments'; }, |
| { include = '#constants-and-special-vars'; }, |
| { include = '#keywords'; }, |
| { include = '#strings'; }, |
| ); |
| repository = { |
| comments = { |
| patterns = ( |
| { name = 'comment.block.empty.dart'; |
| match = '/\*\*/'; |
| captures = { 0 = { name = 'punctuation.definition.comment.dart'; }; }; |
| }, |
| { include = 'text.html.javadoc'; }, |
| { include = '#comments-inline'; }, |
| ); |
| }; |
| comments-inline = { |
| patterns = ( |
| { name = 'comment.block.dart'; |
| begin = '/\*'; |
| end = '\*/'; |
| }, |
| { match = '((//).*)$'; |
| captures = { 1 = { name = 'comment.line.double-slash.dart'; }; }; |
| }, |
| ); |
| }; |
| constants-and-special-vars = { |
| patterns = ( |
| { name = 'constant.language.dart'; |
| match = '\b(true|false|null)\b'; |
| }, |
| { name = 'variable.language.dart'; |
| match = '\b(this|super)\b'; |
| }, |
| { name = 'constant.numeric.dart'; |
| match = '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'; |
| }, |
| ); |
| }; |
| keywords = { |
| patterns = ( |
| { name = 'keyword.cast.dart'; |
| match = '\bas\b'; |
| }, |
| { name = 'keyword.control.catch-exception.dart'; |
| match = '\b(try|catch|finally|throw)\b'; |
| }, |
| { name = 'keyword.control.ternary.dart'; |
| match = '\?|:'; |
| }, |
| { name = 'keyword.control.dart'; |
| match = '\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b'; |
| }, |
| { name = 'keyword.control.new.dart'; |
| match = '\b(new)\b'; |
| }, |
| { name = 'keyword.declaration.dart'; |
| match = '\b(abstract|class|extends|external|factory|implements|interface|get|native|operator|set|typedef)\b'; |
| }, |
| { name = 'keyword.operator.dart'; |
| match = '\b(is\!?)\b'; |
| }, |
| { name = 'keyword.operator.bitwise.dart'; |
| match = '(<<|>>>?|~|\^|\||&)'; |
| }, |
| { name = 'keyword.operator.assignment.bitwise.dart'; |
| match = '((&|\^|\||<<|>>>?)=)'; |
| }, |
| { name = 'keyword.operator.comparison.dart'; |
| match = '(===?|!==?|<=?|>=?)'; |
| }, |
| { name = 'keyword.operator.assignment.arithmetic.dart'; |
| match = '(([+*/%-]|\~)=)'; |
| }, |
| { name = 'keyword.operator.assignment.dart'; |
| match = '(=)'; |
| }, |
| { name = 'keyword.operator.increment-decrement.dart'; |
| match = '(\-\-|\+\+)'; |
| }, |
| { name = 'keyword.operator.arithmetic.dart'; |
| match = '(\-|\+|\*|\/|\~\/|%)'; |
| }, |
| { name = 'keyword.operator.logical.dart'; |
| match = '(!|&&|\|\|)'; |
| }, |
| { name = 'punctuation.terminator.dart'; |
| match = ';'; |
| }, |
| { name = 'storage.modifier.dart'; |
| match = '\b(static|final|const)\b'; |
| }, |
| { name = 'storage.type.primitive.dart'; |
| match = '\b(?:void|bool|num|int|double|dynamic|var|String)\b'; |
| }, |
| ); |
| }; |
| string-interp = { |
| patterns = ( |
| { match = '\$((\w+)|\{(\w+)\})'; |
| captures = { |
| 2 = { name = 'variable.parameter.dart'; }; |
| 3 = { name = 'variable.parameter.dart'; }; |
| }; |
| }, |
| { name = 'constant.character.escape.dart'; |
| match = '\\.'; |
| }, |
| ); |
| }; |
| strings = { |
| patterns = ( |
| { name = 'string.interpolated.triple.dart'; |
| begin = '(?<!@)"""'; |
| end = '"""(?!")'; |
| patterns = ( { include = '#string-interp'; } ); |
| }, |
| { name = 'string.quoted.triple.dart'; |
| begin = '@"""'; |
| end = '"""(?!")'; |
| }, |
| { name = 'string.interpolated.double.dart'; |
| begin = '(?<!\\|@)"'; |
| end = '"'; |
| patterns = ( |
| { name = 'invalid.string.newline'; |
| match = '\n'; |
| }, |
| { include = '#string-interp'; }, |
| ); |
| }, |
| { name = 'string.quoted.double.dart'; |
| begin = '@"'; |
| end = '"'; |
| patterns = ( |
| { name = 'invalid.string.newline'; |
| match = '\n'; |
| }, |
| ); |
| }, |
| { name = 'string.interpolated.single.dart'; |
| begin = "(?<!\|@)'"; |
| end = "'"; |
| patterns = ( |
| { name = 'invalid.string.newline'; |
| match = '\n'; |
| }, |
| { include = '#string-interp'; }, |
| ); |
| }, |
| { name = 'string.quoted.single.dart'; |
| begin = "@'"; |
| end = "'"; |
| patterns = ( |
| { name = 'invalid.string.newline'; |
| match = '\n'; |
| }, |
| ); |
| }, |
| ); |
| }; |
| }; |
| } |