grammars/source.dart.json in github-linguist-5.0.10 vs grammars/source.dart.json in github-linguist-5.0.11

- old
+ new

@@ -1,17 +1,19 @@ { "fileTypes": [ "dart" ], + "foldingStartMarker": "\\{\\s*$", + "foldingStopMarker": "^\\s*\\}", "name": "Dart", "patterns": [ { "match": "^(#!.*)$", "name": "meta.preprocessor.script.dart" }, { - "begin": "^\\s*\\b(library|import|export|part of|part)\\b", + "begin": "^\\w*\\b(library|import|part of|part|export)\\b", "beginCaptures": { "0": { "name": "keyword.other.import.dart" } }, @@ -25,59 +27,63 @@ "patterns": [ { "include": "#strings" }, { - "match": "\\b(as|show|hide|deferred)\\b", + "match": "\\b(as|show|hide)\\b", "name": "keyword.other.import.dart" } ] }, { "include": "#comments" }, { - "include": "#constants-and-special-vars" + "include": "#punctuation" }, { "include": "#annotations" }, { - "include": "#decl-typedef" + "include": "#constants-and-special-vars" }, { - "include": "#decl-class" - }, - { - "include": "#decl-enum" - }, - { - "include": "#decl-function" - }, - { "include": "#keywords" }, { "include": "#strings" } ], "repository": { - "annotations": { + "dartdoc": { "patterns": [ { + "match": "(\\[.*?\\])", "captures": { - "1": { - "name": "annotation.dart" - }, + "0": { + "name": "variable.name.source.dart" + } + } + }, + { + "match": "(`.*?`)", + "captures": { + "0": { + "name": "variable.other.source.dart" + } + } + }, + { + "match": "(\\* (( ).*))$", + "captures": { "2": { - "name": "entity.name.function.annotation.dart" - }, - "3": { - "name": "support.type.dart" + "name": "variable.other.source.dart" } - }, - "match": "^(?:\\s*)((@)([a-zA-Z0-9_]+))" + } + }, + { + "match": "(\\* .*)$" } ] }, "comments": { "patterns": [ @@ -89,465 +95,170 @@ }, "match": "/\\*\\*/", "name": "comment.block.empty.dart" }, { - "include": "#comments-inline" - } - ] - }, - "comments-inline": { - "patterns": [ - { - "begin": "/\\*", - "end": "\\*/", - "name": "comment.block.dart", - "patterns": [ - { - "include": "text.dart-doccomments" - } - ] + "include": "#comments-doc-oldschool" }, { - "begin": "(///)", - "beginCaptures": { - "1": { - "name": "marker.dart" - } - }, - "end": "$", - "name": "comment.line.triple-slash.dart", - "patterns": [ - { - "include": "text.dart-doccomments" - } - ] + "include": "#comments-doc" }, { - "begin": "(//)", - "beginCaptures": { - "1": { - "name": "marker.dart" - } - }, - "end": "$", - "name": "comment.line.double-slash.dart", - "patterns": [ - { - "include": "text.dart-doccomments" - } - ] + "include": "#comments-inline" } ] }, - "constants-and-special-vars": { + "comments-doc-oldschool": { "patterns": [ { - "match": "\\b(true|false|null)\\b", - "name": "constant.language.dart" - }, - { - "match": "\\b(this|super)\\b", - "name": "variable.language.dart" - }, - { - "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b", - "name": "constant.numeric.dart" - } - ] - }, - "decl-class": { - "patterns": [ - { - "begin": "\\bclass\\b", - "beginCaptures": { - "0": { - "name": "keyword.control.new.dart" - } - }, - "end": "(?={)", - "name": "meta.declaration.class.dart", + "begin": "/\\*\\*", + "end": "\\*/", + "name": "comment.block.documentation.dart", "patterns": [ { - "include": "#keywords" - }, - { - "match": "[A-Za-z_][A-Za-z0-9_]*", - "name": "class.name.dart" + "include": "#dartdoc" } ] } ] }, - "decl-enum": { + "comments-doc": { "patterns": [ { - "begin": "\\benum\\b", - "beginCaptures": { - "0": { - "name": "keyword.declaration.dart" - } - }, - "end": "(?={)", - "name": "meta.declaration.enum.dart", - "patterns": [ - { - "include": "#keywords" - }, - { - "match": "[A-Za-z_][A-Za-z0-9_]*", - "name": "enum.name.dart" - } - ] - } - ] - }, - "decl-function": { - "patterns": [ - { + "match": "(///) (.*?)$", "captures": { "1": { - "name": "storage.type.primitive.dart" + "name": "comment.block.triple-slash.dart" }, "2": { - "name": "keyword.declaration.dart" - }, - "3": { - "name": "function.name.dart" + "name": "variable.other.source.dart" } - }, - "comment": "A getter with a primitive return type.", - "match": "^\\s*(?:\\b(void|bool|num|int|double|dynamic|var|String|List|Map)\\b)\\s+(get)\\s+(\\w+)\\s+(?==>)", - "name": "meta.declaration.function.dart" + } }, { + "match": "(///)(.*?)$", "captures": { "1": { - "name": "type.user-defined.dart" + "name": "comment.block.triple-slash.dart" }, "2": { - "name": "keyword.declaration.dart" - }, - "3": { - "name": "function.name.dart" + "name": "comment.block.documentation.dart", + "patterns": [ + { + "include": "#dartdoc" + } + ] } - }, - "comment": "A getter with a user-defined return type or no return type.", - "match": "^\\s*(?:\\b(\\w+)\\b\\s+)?(get)\\s+(\\w+)\\s+(?==>)", - "name": "meta.declaration.function.dart" - }, + } + } + ] + }, + "comments-inline": { + "patterns": [ { - "begin": "^\\s*(set)\\s+(\\w+)(?=\\()", - "beginCaptures": { - "1": { - "name": "keyword.declaration.dart" - }, - "2": { - "name": "function.name.dart" - } - }, - "comment": "A setter.", - "end": "\\)", - "name": "meta.declaration.function.dart", - "patterns": [ - { - "include": "#comments-inline" - }, - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] + "begin": "/\\*", + "end": "\\*/", + "name": "comment.block.dart" }, { - "begin": "^\\s*(?:\\b(void|bool|num|int|double|dynamic|var|String|List|Map)\\b)\\s+(\\w+)(?=\\()", - "beginCaptures": { + "captures": { "1": { - "name": "storage.type.primitive.dart" - }, - "2": { - "name": "function.name.dart" + "name": "comment.line.double-slash.dart" } }, - "comment": "A function with a primitive return type.", - "end": "\\)", - "name": "meta.declaration.function.dart", - "patterns": [ - { - "include": "#comments-inline" - }, - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] - }, + "match": "((//).*)$" + } + ] + }, + "annotations": { + "patterns": [ { - "begin": "^\\s*(?:\\b(return)\\b)\\s+(\\w+)(?=\\()", - "beginCaptures": { - "1": { - "name": "keyword.control.dart" - }, - "2": { - "name": "function.name.dart" - } - }, - "comment": "A function invocation after 'return'", - "end": "\\)", - "name": "meta.invocation.function.dart", - "patterns": [ - { - "include": "#comments-inline" - }, - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] - }, - { - "begin": "^\\s*\\b(new)\\b\\s+(\\w+)(?=\\()", - "beginCaptures": { - "1": { - "name": "keyword.declaration.dart" - }, - "2": { - "name": "function.name.dart" - } - }, - "comment": "A class instantiation after 'new'", - "end": "\\)", - "name": "meta.invocation.function.dart", - "patterns": [ - { - "include": "#comments-inline" - }, - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] + "match": "@[a-zA-Z]+", + "name": "storage.type.annotation.dart" } ] }, - "decl-function-parameter": { + "constants-and-special-vars": { "patterns": [ { - "include": "#constants-and-special-vars" + "match": "\\b(true|false|null)\\b", + "name": "constant.language.dart" }, { - "begin": "(?:\\b(void|bool|num|int|double|dynamic|var|String|List|Map)\\b)\\s+(\\w+)(?=\\()", - "beginCaptures": { - "1": { - "name": "storage.type.primitive.dart" - }, - "2": { - "name": "function.name.dart" - } - }, - "comment": "A function with a primitive return type.", - "end": "\\)", - "name": "meta.parameter.function.dart", - "patterns": [ - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] + "match": "\\b(this|super)\\b", + "name": "variable.language.dart" }, { - "begin": "\\b(new)\\b\\s+(\\w+)(?=\\()", - "beginCaptures": { - "1": { - "name": "keyword.declaration.dart" - }, - "2": { - "name": "function.name.dart" - } - }, - "comment": "A class instantiation after 'new'", - "end": "\\)", - "name": "meta.invocation.function.dart", - "patterns": [ - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] + "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b", + "name": "constant.numeric.dart" }, { - "begin": "(?:\\b(\\w+)\\b)\\s+(\\w+)(?=\\()", - "beginCaptures": { - "1": { - "name": "type.user-defined.dart" - }, - "2": { - "name": "function.name.dart" - } - }, - "comment": "A function with a user-defined return type.", - "end": "\\)", - "name": "meta.parameter.function.dart", - "patterns": [ - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] + "match": "\\b_?[A-Z][a-zA-Z0-9_]+\\b", + "name": "support.class.dart" }, { - "begin": "(\\w+)(?=\\()", - "beginCaptures": { + "match": "(_?[a-z][a-zA-Z0-9_]+)(\\(|\\s+=>)", + "captures": { "1": { - "name": "function.name.dart" + "name": "entity.name.function.dart" } - }, - "comment": "A function with no return type.", - "end": "\\)", - "name": "meta.parameter.function.dart", - "patterns": [ - { - "include": "#decl-function-parameter" - }, - { - "include": "#strings" - }, - { - "include": "#keywords" - } - ] - } - ] - }, - "decl-typedef": { - "patterns": [ + } + }, { - "begin": "typedef", - "beginCaptures": { - "0": { - "name": "keyword.control.new.dart" - } - }, - "end": ";", - "endCaptures": { - "0": { - "name": "punctuation.terminator.dart" - } - }, - "name": "meta.declaration.typedef.dart", - "patterns": [ - { - "captures": { - "1": { - "name": "storage.type.primitive.dart" - }, - "2": { - "name": "typedef.return.dart" - }, - "3": { - "name": "typedef.name.dart" - } - }, - "match": "(?:\\b(void|bool|num|int|double|dynamic|var|String|List|Map)\\b|([a-zA-Z_][a-zA-Z0-9_]*))\\s+([a-zA-Z_][a-zA-Z0-9_]+)" - }, - { - "begin": "\\(", - "end": "\\)", - "name": "typedef.params.dart", - "patterns": [ - { - "include": "#keywords" - } - ] - } - ] + "match": "\\b[A-Z_0-9]+\\b", + "name": "support.constant.dart" } ] }, "keywords": { "patterns": [ { - "match": "\\bassert\\b", - "name": "keyword.control.assert.dart" - }, - { "match": "\\bas\\b", "name": "keyword.cast.dart" }, { - "match": "\\b(try|catch|finally|throw|on|rethrow)\\b", + "match": "\\b(try|on|catch|finally|throw|rethrow)\\b", "name": "keyword.control.catch-exception.dart" }, { - "match": "\\s+\\?\\s+|\\s+:\\s+", - "name": "keyword.control.ternary.dart" + "match": "\\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\\b", + "name": "keyword.control.dart" }, { - "match": "\\b(break|case|continue|default|do|else|for|if|in|return|switch|while)\\b", + "match": "\\b(sync(\\*)?|async(\\*)?|await|yield(\\*)?)\\b", "name": "keyword.control.dart" }, { - "match": "\\b(async\\*|async|await\\*|await|yield)\\b", - "name": "keyword.control.async.dart" + "match": "\\bassert\\b", + "name": "keyword.control.dart" }, { "match": "\\b(new)\\b", "name": "keyword.control.new.dart" }, { - "match": "\\b(abstract|extends|external|factory|implements|with|interface|get|native|operator|set|typedef)\\b", + "match": "\\b(abstract|class|enum|extends|external|factory|implements|interface|get|native|operator|set|typedef|with)\\b", "name": "keyword.declaration.dart" }, { "match": "\\b(is\\!?)\\b", "name": "keyword.operator.dart" }, { + "match": "\\?|:", + "name": "keyword.operator.ternary.dart" + }, + { "match": "(<<|>>>?|~|\\^|\\||&)", "name": "keyword.operator.bitwise.dart" }, { "match": "((&|\\^|\\||<<|>>>?)=)", "name": "keyword.operator.assignment.bitwise.dart" }, { - "match": "(===?|!==?|<=?|>=?)", + "match": "(==|!=|<=?|>=?)", "name": "keyword.operator.comparison.dart" }, { "match": "(([+*/%-]|\\~)=)", "name": "keyword.operator.assignment.arithmetic.dart" @@ -567,113 +278,31 @@ { "match": "(!|&&|\\|\\|)", "name": "keyword.operator.logical.dart" }, { - "match": ";", - "name": "punctuation.terminator.dart" - }, - { "match": "\\b(static|final|const)\\b", "name": "storage.modifier.dart" }, { - "match": "\\b(?:void|bool|num|int|double|dynamic|var|String|List|Map)\\b", + "match": "\\b(?:void|bool|num|int|double|dynamic|var)\\b", "name": "storage.type.primitive.dart" } ] }, - "regexp": { - "patterns": [ - { - "match": "\\\\[^'\"]", - "name": "constant.character.escaped.regex.dart" - }, - { - "begin": "\\(", - "contentName": "meta.capture.regex.dart", - "end": "\\)", - "patterns": [ - { - "match": "\\?(:|=|!)", - "name": "ignore.capture.regex.dart" - }, - { - "include": "#regex.dart" - } - ] - }, - { - "match": "\\*|\\+|\\?|\\.|\\|", - "name": "keyword.other.regex.dart" - }, - { - "match": "\\^|\\$", - "name": "keyword.other.regex.dart" - }, - { - "match": "\\.", - "name": "constant.other.regex.dart" - }, - { - "begin": "\\[(\\^)?", - "beginCaptures": { - "1": { - "name": "keyword.other.negation.regex.dart" - } - }, - "end": "\\]", - "name": "constant.character.range.regex.dart", - "patterns": [ - { - "match": "\\\\[^\"']", - "name": "constant.character.escaped.regex.dart" - } - ] - }, - { - "match": "\\{(?:\\d+)?,(?:\\d+)?\\}", - "name": "keyword.other.regex.dart" - } - ] - }, "string-interp": { "patterns": [ { - "begin": "(\\$)(\\{)", - "beginCaptures": { - "1": { - "name": "keyword.other.dart" - }, - "2": { - "name": "keyword.other.dart" - } - }, - "contentName": "source.dart", - "end": "(\\})", - "endCaptures": { - "1": { - "name": "keyword.other.dart" - } - }, - "name": "interpolation.dart", - "patterns": [ - { - "include": "$self" - } - ] - }, - { "captures": { - "1": { - "name": "keyword.other.dart" - }, "2": { "name": "variable.parameter.dart" + }, + "3": { + "name": "variable.parameter.dart" } }, - "match": "(\\$)(\\w+)" + "match": "\\$((\\w+)|\\{(\\w+)\\})" }, { "match": "\\\\.", "name": "constant.character.escape.dart" } @@ -710,11 +339,11 @@ "begin": "r'''", "end": "'''(?!')", "name": "string.quoted.triple.single.dart" }, { - "begin": "(?<!\\\\|r)\"", + "begin": "(?<!\\|r)\"", "end": "\"", "name": "string.interpolated.double.dart", "patterns": [ { "match": "\\n", @@ -729,35 +358,56 @@ "begin": "r\"", "end": "\"", "name": "string.quoted.double.dart", "patterns": [ { - "include": "#regexp" + "match": "\\n", + "name": "invalid.string.newline" } ] }, { "begin": "(?<!\\|r)'", "end": "'", "name": "string.interpolated.single.dart", "patterns": [ { + "match": "\\n", + "name": "invalid.string.newline" + }, + { "include": "#string-interp" } ] }, { "begin": "r'", "end": "'", "name": "string.quoted.single.dart", "patterns": [ { - "include": "#regexp" + "match": "\\n", + "name": "invalid.string.newline" } ] } ] + }, + "punctuation": { + "patterns": [ + { + "match": ",", + "name": "punctuation.comma.dart" + }, + { + "match": ";", + "name": "punctuation.terminator.dart" + }, + { + "match": "\\.", + "name": "punctuation.dot.dart" + } + ] } }, - "scopeName": "source.dart", - "uuid": "958518BC-799F-477A-99F9-5B28EBF230F6" + "scopeName": "source.dart" } \ No newline at end of file