2021-05-26 09:52:41 +00:00
|
|
|
{
|
|
|
|
"information_for_contributors": [
|
|
|
|
"This file has been converted from https://github.com/dart-lang/dart-syntax-highlight/blob/master/grammars/dart.json",
|
|
|
|
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
|
|
|
"Once accepted there, we are happy to receive an update request."
|
|
|
|
],
|
2023-02-24 16:22:41 +00:00
|
|
|
"version": "https://github.com/dart-lang/dart-syntax-highlight/commit/b6324bfae2058bc29bb01af6bd2011c3eb35545d",
|
2021-05-26 09:52:41 +00:00
|
|
|
"name": "Dart",
|
|
|
|
"scopeName": "source.dart",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "meta.preprocessor.script.dart",
|
|
|
|
"match": "^(#!.*)$"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "meta.declaration.dart",
|
|
|
|
"begin": "^\\w*\\b(library|import|part of|part|export)\\b",
|
|
|
|
"beginCaptures": {
|
|
|
|
"0": {
|
|
|
|
"name": "keyword.other.import.dart"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"end": ";",
|
|
|
|
"endCaptures": {
|
|
|
|
"0": {
|
|
|
|
"name": "punctuation.terminator.dart"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#strings"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#comments"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.other.import.dart",
|
|
|
|
"match": "\\b(as|show|hide)\\b"
|
2021-07-02 15:01:54 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.control.dart",
|
|
|
|
"match": "\\b(if)\\b"
|
2021-05-26 09:52:41 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#comments"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#punctuation"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#annotations"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#keywords"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#constants-and-special-vars"
|
|
|
|
},
|
2023-01-30 14:27:20 +00:00
|
|
|
{
|
|
|
|
"include": "#operators"
|
|
|
|
},
|
2021-05-26 09:52:41 +00:00
|
|
|
{
|
|
|
|
"include": "#strings"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"repository": {
|
|
|
|
"dartdoc": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"match": "(\\[.*?\\])",
|
|
|
|
"captures": {
|
|
|
|
"0": {
|
|
|
|
"name": "variable.name.source.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"match": "^ {4,}(?![ \\*]).*",
|
|
|
|
"captures": {
|
|
|
|
"0": {
|
|
|
|
"name": "variable.name.source.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"contentName": "variable.other.source.dart",
|
|
|
|
"begin": "```.*?$",
|
|
|
|
"end": "```"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"match": "(`.*?`)",
|
|
|
|
"captures": {
|
|
|
|
"0": {
|
|
|
|
"name": "variable.other.source.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"match": "(`.*?`)",
|
|
|
|
"captures": {
|
|
|
|
"0": {
|
|
|
|
"name": "variable.other.source.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"match": "(\\* (( ).*))$",
|
|
|
|
"captures": {
|
|
|
|
"2": {
|
|
|
|
"name": "variable.other.source.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"comments": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "comment.block.empty.dart",
|
|
|
|
"match": "/\\*\\*/",
|
|
|
|
"captures": {
|
|
|
|
"0": {
|
|
|
|
"name": "punctuation.definition.comment.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#comments-doc-oldschool"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#comments-doc"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#comments-inline"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"comments-doc-oldschool": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "comment.block.documentation.dart",
|
|
|
|
"begin": "/\\*\\*",
|
|
|
|
"end": "\\*/",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#comments-doc-oldschool"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#comments-block"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#dartdoc"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"comments-doc": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "comment.block.documentation.dart",
|
|
|
|
"begin": "///",
|
|
|
|
"while": "^\\s*///",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#dartdoc"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"comments-inline": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#comments-block"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"match": "((//).*)$",
|
|
|
|
"captures": {
|
|
|
|
"1": {
|
|
|
|
"name": "comment.line.double-slash.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"comments-block": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "comment.block.dart",
|
|
|
|
"begin": "/\\*",
|
|
|
|
"end": "\\*/",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#comments-block"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"annotations": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "storage.type.annotation.dart",
|
|
|
|
"match": "@[a-zA-Z]+"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"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(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
2021-11-02 14:27:57 +00:00
|
|
|
"include": "#class-identifier"
|
2021-05-26 09:52:41 +00:00
|
|
|
},
|
|
|
|
{
|
2021-11-02 14:27:57 +00:00
|
|
|
"include": "#function-identifier"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"class-identifier": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
2023-01-30 14:27:20 +00:00
|
|
|
"match": "(?<!\\$)\\b(bool|num|int|double|dynamic)\\b(?!\\$)",
|
|
|
|
"name": "support.class.dart"
|
2022-08-29 12:08:44 +00:00
|
|
|
},
|
|
|
|
{
|
2023-01-30 14:27:20 +00:00
|
|
|
"match": "(?<!\\$)\\bvoid\\b(?!\\$)",
|
|
|
|
"name": "storage.type.primitive.dart"
|
2022-08-29 12:08:44 +00:00
|
|
|
},
|
|
|
|
{
|
2023-01-30 14:27:20 +00:00
|
|
|
"begin": "(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)\\b",
|
|
|
|
"end": "(?!<)",
|
|
|
|
"beginCaptures": {
|
2021-11-02 14:27:57 +00:00
|
|
|
"1": {
|
|
|
|
"name": "support.class.dart"
|
|
|
|
}
|
2023-01-30 14:27:20 +00:00
|
|
|
},
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#type-args"
|
|
|
|
}
|
|
|
|
]
|
2021-11-02 14:27:57 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"function-identifier": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
2023-02-24 16:22:41 +00:00
|
|
|
"match": "([_$]*[a-z][a-zA-Z0-9_$]*)(<(?:[a-zA-Z0-9_$<>?]|,\\s*|\\s+extends\\s+)+>)?[!?]?\\(",
|
2021-05-26 09:52:41 +00:00
|
|
|
"captures": {
|
|
|
|
"1": {
|
|
|
|
"name": "entity.name.function.dart"
|
2021-11-02 14:27:57 +00:00
|
|
|
},
|
|
|
|
"2": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#type-args"
|
|
|
|
}
|
|
|
|
]
|
2021-05-26 09:52:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2021-11-02 14:27:57 +00:00
|
|
|
"type-args": {
|
|
|
|
"begin": "(<)",
|
|
|
|
"end": "(>)",
|
|
|
|
"beginCaptures": {
|
|
|
|
"1": {
|
|
|
|
"name": "other.source.dart"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"endCaptures": {
|
|
|
|
"1": {
|
|
|
|
"name": "other.source.dart"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#class-identifier"
|
|
|
|
},
|
|
|
|
{
|
2023-01-30 14:27:20 +00:00
|
|
|
"match": ","
|
2021-12-07 14:09:32 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.declaration.dart",
|
|
|
|
"match": "extends"
|
2021-11-02 14:27:57 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2021-05-26 09:52:41 +00:00
|
|
|
"keywords": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "keyword.cast.dart",
|
|
|
|
"match": "(?<!\\$)\\bas\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.control.catch-exception.dart",
|
|
|
|
"match": "(?<!\\$)\\b(try|on|catch|finally|throw|rethrow)\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.control.dart",
|
2023-02-24 16:22:41 +00:00
|
|
|
"match": "(?<!\\$)\\b(break|case|continue|default|do|else|for|if|in|return|switch|while|when)\\b(?!\\$)"
|
2021-05-26 09:52:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.control.dart",
|
|
|
|
"match": "(?<!\\$)\\b(sync(\\*)?|async(\\*)?|await|yield(\\*)?)\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.control.dart",
|
|
|
|
"match": "(?<!\\$)\\bassert\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.control.new.dart",
|
|
|
|
"match": "(?<!\\$)\\b(new)\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.declaration.dart",
|
2023-02-24 16:22:41 +00:00
|
|
|
"match": "(?<!\\$)\\b(abstract|sealed|base|interface|class|enum|extends|extension|external|factory|implements|get(?!\\()|mixin|native|operator|set(?!\\()|typedef|with|covariant)\\b(?!\\$)"
|
2021-05-26 09:52:41 +00:00
|
|
|
},
|
2023-01-30 14:27:20 +00:00
|
|
|
{
|
|
|
|
"name": "storage.modifier.dart",
|
|
|
|
"match": "(?<!\\$)\\b(static|final|const|required|late)\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "storage.type.primitive.dart",
|
|
|
|
"match": "(?<!\\$)\\b(?:void|var)\\b(?!\\$)"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"operators": {
|
|
|
|
"patterns": [
|
2021-05-26 09:52:41 +00:00
|
|
|
{
|
|
|
|
"name": "keyword.operator.dart",
|
|
|
|
"match": "(?<!\\$)\\b(is\\!?)\\b(?!\\$)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.operator.ternary.dart",
|
|
|
|
"match": "\\?|:"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.operator.bitwise.dart",
|
|
|
|
"match": "(<<|>>>?|~|\\^|\\||&)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.operator.assignment.bitwise.dart",
|
|
|
|
"match": "((&|\\^|\\||<<|>>>?)=)"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "keyword.operator.closure.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": "(!|&&|\\|\\|)"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"string-interp": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
2021-08-10 14:57:21 +00:00
|
|
|
"match": "\\$([a-zA-Z0-9_]+)",
|
2021-05-26 09:52:41 +00:00
|
|
|
"captures": {
|
2021-08-10 14:57:21 +00:00
|
|
|
"1": {
|
2021-05-26 09:52:41 +00:00
|
|
|
"name": "variable.parameter.dart"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-08-10 14:57:21 +00:00
|
|
|
{
|
|
|
|
"name": "string.interpolated.expression.dart",
|
|
|
|
"begin": "\\$\\{",
|
|
|
|
"end": "\\}",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#constants-and-special-vars",
|
|
|
|
"name": "variable.parameter.dart"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#strings"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "variable.parameter.dart",
|
|
|
|
"match": "[a-zA-Z0-9_]+"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2021-05-26 09:52:41 +00:00
|
|
|
{
|
|
|
|
"name": "constant.character.escape.dart",
|
|
|
|
"match": "\\\\."
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"strings": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "string.interpolated.triple.double.dart",
|
|
|
|
"begin": "(?<!r)\"\"\"",
|
|
|
|
"end": "\"\"\"(?!\")",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#string-interp"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.interpolated.triple.single.dart",
|
|
|
|
"begin": "(?<!r)'''",
|
|
|
|
"end": "'''(?!')",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"include": "#string-interp"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.quoted.triple.double.dart",
|
|
|
|
"begin": "r\"\"\"",
|
|
|
|
"end": "\"\"\"(?!\")"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.quoted.triple.single.dart",
|
|
|
|
"begin": "r'''",
|
|
|
|
"end": "'''(?!')"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.interpolated.double.dart",
|
|
|
|
"begin": "(?<!\\|r)\"",
|
|
|
|
"end": "\"",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "invalid.string.newline",
|
|
|
|
"match": "\\n"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#string-interp"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.quoted.double.dart",
|
|
|
|
"begin": "r\"",
|
|
|
|
"end": "\"",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "invalid.string.newline",
|
|
|
|
"match": "\\n"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.interpolated.single.dart",
|
|
|
|
"begin": "(?<!\\|r)'",
|
|
|
|
"end": "'",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "invalid.string.newline",
|
|
|
|
"match": "\\n"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"include": "#string-interp"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "string.quoted.single.dart",
|
|
|
|
"begin": "r'",
|
|
|
|
"end": "'",
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "invalid.string.newline",
|
|
|
|
"match": "\\n"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"punctuation": {
|
|
|
|
"patterns": [
|
|
|
|
{
|
|
|
|
"name": "punctuation.comma.dart",
|
|
|
|
"match": ","
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "punctuation.terminator.dart",
|
|
|
|
"match": ";"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "punctuation.dot.dart",
|
|
|
|
"match": "\\."
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|