Path: blob/main/extensions/dart/syntaxes/dart.tmLanguage.json
3314 views
{1"information_for_contributors": [2"This file has been converted from https://github.com/dart-lang/dart-syntax-highlight/blob/master/grammars/dart.json",3"If you want to provide a fix or improvement, please create a pull request against the original repository.",4"Once accepted there, we are happy to receive an update request."5],6"version": "https://github.com/dart-lang/dart-syntax-highlight/commit/e1ac5c446c2531343393adbe8fff9d45d8a7c412",7"name": "Dart",8"scopeName": "source.dart",9"patterns": [10{11"name": "meta.preprocessor.script.dart",12"match": "^(#!.*)$"13},14{15"name": "meta.declaration.dart",16"begin": "^\\w*\\b(augment\\s+library|library|import\\s+augment|import|part\\s+of|part|export)\\b",17"beginCaptures": {18"0": {19"name": "keyword.other.import.dart"20}21},22"end": ";",23"endCaptures": {24"0": {25"name": "punctuation.terminator.dart"26}27},28"patterns": [29{30"include": "#strings"31},32{33"include": "#comments"34},35{36"name": "keyword.other.import.dart",37"match": "\\b(as|show|hide)\\b"38},39{40"name": "keyword.control.dart",41"match": "\\b(if)\\b"42}43]44},45{46"include": "#comments"47},48{49"include": "#punctuation"50},51{52"include": "#annotations"53},54{55"include": "#keywords"56},57{58"include": "#constants-and-special-vars"59},60{61"include": "#operators"62},63{64"include": "#strings"65}66],67"repository": {68"dartdoc-codeblock-triple": {69"begin": "^\\s*///\\s*(?!\\s*```)",70"end": "\n",71"contentName": "variable.other.source.dart"72},73"dartdoc-codeblock-block": {74"begin": "^\\s*\\*\\s*(?!(\\s*```|/))",75"end": "\n",76"contentName": "variable.other.source.dart"77},78"dartdoc": {79"patterns": [80{81"match": "(\\[.*?\\])",82"captures": {83"0": {84"name": "variable.name.source.dart"85}86}87},88{89"begin": "^\\s*///\\s*(```)",90"end": "^\\s*///\\s*(```)|^(?!\\s*///)",91"patterns": [92{93"include": "#dartdoc-codeblock-triple"94}95]96},97{98"begin": "^\\s*\\*\\s*(```)",99"end": "^\\s*\\*\\s*(```)|^(?=\\s*\\*/)",100"patterns": [101{102"include": "#dartdoc-codeblock-block"103}104]105},106{107"match": "`[^`\n]+`",108"name": "variable.other.source.dart"109},110{111"match": "(?:\\*|\\/\\/)\\s{4,}(.*?)(?=($|\\*\\/))",112"captures": {113"1": {114"name": "variable.other.source.dart"115}116}117}118]119},120"comments": {121"patterns": [122{123"name": "comment.block.empty.dart",124"match": "/\\*\\*/",125"captures": {126"0": {127"name": "punctuation.definition.comment.dart"128}129}130},131{132"include": "#comments-doc-oldschool"133},134{135"include": "#comments-doc"136},137{138"include": "#comments-inline"139}140]141},142"comments-doc-oldschool": {143"patterns": [144{145"name": "comment.block.documentation.dart",146"begin": "/\\*\\*",147"end": "\\*/",148"patterns": [149{150"include": "#comments-doc-oldschool"151},152{153"include": "#comments-block"154},155{156"include": "#dartdoc"157}158]159}160]161},162"comments-doc": {163"patterns": [164{165"name": "comment.block.documentation.dart",166"begin": "///",167"end": "^(?!\\s*///)",168"patterns": [169{170"include": "#dartdoc"171}172]173}174]175},176"comments-inline": {177"patterns": [178{179"include": "#comments-block"180},181{182"match": "((//).*)$",183"captures": {184"1": {185"name": "comment.line.double-slash.dart"186}187}188}189]190},191"comments-block": {192"patterns": [193{194"name": "comment.block.dart",195"begin": "/\\*",196"end": "\\*/",197"patterns": [198{199"include": "#comments-block"200}201]202}203]204},205"annotations": {206"patterns": [207{208"name": "storage.type.annotation.dart",209"match": "@[a-zA-Z]+"210}211]212},213"constants-and-special-vars": {214"patterns": [215{216"name": "constant.language.dart",217"match": "(?<!\\$)\\b(true|false|null)\\b(?!\\$)"218},219{220"name": "variable.language.dart",221"match": "(?<!\\$)\\b(this|super|augmented)\\b(?!\\$)"222},223{224"name": "constant.numeric.dart",225"match": "(?<!\\$)\\b((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(([0-9][0-9_]*\\.?[0-9_]*)|(\\.[0-9][0-9_]*))((e|E)(\\+|-)?[0-9][0-9_]*)?)\\b(?!\\$)"226},227{228"include": "#class-identifier"229},230{231"include": "#function-identifier"232}233]234},235"class-identifier": {236"patterns": [237{238"match": "(?<!\\$)\\b(bool|num|int|double|dynamic)\\b(?!\\$)",239"name": "support.class.dart"240},241{242"match": "(?<!\\$)\\bvoid\\b(?!\\$)",243"name": "storage.type.primitive.dart"244},245{246"begin": "(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)\\b",247"end": "(?!<)",248"beginCaptures": {249"1": {250"name": "support.class.dart"251}252},253"patterns": [254{255"include": "#type-args"256}257]258}259]260},261"function-identifier": {262"patterns": [263{264"match": "([_$]*[a-z][a-zA-Z0-9_$]*)(<(?:[a-zA-Z0-9_$<>?]|,\\s*|\\s+extends\\s+)+>)?[!?]?\\(",265"captures": {266"1": {267"name": "entity.name.function.dart"268},269"2": {270"patterns": [271{272"include": "#type-args"273}274]275}276}277}278]279},280"type-args": {281"begin": "(<)",282"end": "(>)",283"beginCaptures": {284"1": {285"name": "other.source.dart"286}287},288"endCaptures": {289"1": {290"name": "other.source.dart"291}292},293"patterns": [294{295"include": "#class-identifier"296},297{298"match": ","299},300{301"name": "keyword.declaration.dart",302"match": "extends"303},304{305"include": "#comments"306}307]308},309"keywords": {310"patterns": [311{312"name": "keyword.cast.dart",313"match": "(?<!\\$)\\bas\\b(?!\\$)"314},315{316"name": "keyword.control.catch-exception.dart",317"match": "(?<!\\$)\\b(try|on|catch|finally|throw|rethrow)\\b(?!\\$)"318},319{320"name": "keyword.control.dart",321"match": "(?<!\\$)\\b(break|case|continue|default|do|else|for|if|in|switch|while|when)\\b(?!\\$)"322},323{324"name": "keyword.control.dart",325"match": "(?<!\\$)\\b(sync(\\*)?|async(\\*)?|await|yield(\\*)?)\\b(?!\\$)"326},327{328"name": "keyword.control.dart",329"match": "(?<!\\$)\\bassert\\b(?!\\$)"330},331{332"name": "keyword.control.new.dart",333"match": "(?<!\\$)\\b(new)\\b(?!\\$)"334},335{336"name": "keyword.control.return.dart",337"match": "(?<!\\$)\\b(return)\\b(?!\\$)"338},339{340"name": "keyword.declaration.dart",341"match": "(?<!\\$)\\b(abstract|sealed|base|interface|class|enum|extends|extension\\s+type|extension|external|factory|implements|get(?![(<])|mixin|native|operator|set(?![(<])|typedef|with|covariant)\\b(?!\\$)"342},343{344"name": "storage.modifier.dart",345"match": "(?<!\\$)\\b(macro|augment|static|final|const|required|late)\\b(?!\\$)"346},347{348"name": "storage.type.primitive.dart",349"match": "(?<!\\$)\\b(?:void|var)\\b(?!\\$)"350}351]352},353"operators": {354"patterns": [355{356"name": "keyword.operator.dart",357"match": "(?<!\\$)\\b(is\\!?)\\b(?!\\$)"358},359{360"name": "keyword.operator.ternary.dart",361"match": "\\?|:"362},363{364"name": "keyword.operator.bitwise.dart",365"match": "(<<|>>>?|~|\\^|\\||&)"366},367{368"name": "keyword.operator.assignment.bitwise.dart",369"match": "((&|\\^|\\||<<|>>>?)=)"370},371{372"name": "keyword.operator.closure.dart",373"match": "(=>)"374},375{376"name": "keyword.operator.comparison.dart",377"match": "(==|!=|<=?|>=?)"378},379{380"name": "keyword.operator.assignment.arithmetic.dart",381"match": "(([+*/%-]|\\~)=)"382},383{384"name": "keyword.operator.assignment.dart",385"match": "(=)"386},387{388"name": "keyword.operator.increment-decrement.dart",389"match": "(\\-\\-|\\+\\+)"390},391{392"name": "keyword.operator.arithmetic.dart",393"match": "(\\-|\\+|\\*|\\/|\\~\\/|%)"394},395{396"name": "keyword.operator.logical.dart",397"match": "(!|&&|\\|\\|)"398}399]400},401"expression": {402"patterns": [403{404"include": "#constants-and-special-vars"405},406{407"include": "#strings"408},409{410"name": "variable.parameter.dart",411"match": "[a-zA-Z0-9_]+"412},413{414"begin": "\\{",415"end": "\\}",416"patterns": [417{418"include": "#expression"419}420]421}422]423},424"string-interp": {425"patterns": [426{427"name": "meta.embedded.expression.dart",428"match": "\\$([a-zA-Z0-9_]+)",429"captures": {430"1": {431"name": "variable.parameter.dart"432}433}434},435{436"name": "meta.embedded.expression.dart",437"begin": "\\$\\{",438"end": "\\}",439"patterns": [440{441"include": "#expression"442}443]444},445{446"name": "constant.character.escape.dart",447"match": "\\\\."448}449]450},451"strings": {452"patterns": [453{454"name": "string.interpolated.triple.double.dart",455"begin": "(?<!r)\"\"\"",456"end": "\"\"\"(?!\")",457"patterns": [458{459"include": "#string-interp"460}461]462},463{464"name": "string.interpolated.triple.single.dart",465"begin": "(?<!r)'''",466"end": "'''(?!')",467"patterns": [468{469"include": "#string-interp"470}471]472},473{474"name": "string.quoted.triple.double.dart",475"begin": "r\"\"\"",476"end": "\"\"\"(?!\")"477},478{479"name": "string.quoted.triple.single.dart",480"begin": "r'''",481"end": "'''(?!')"482},483{484"name": "string.interpolated.double.dart",485"begin": "(?<!\\|r)\"",486"end": "\"",487"patterns": [488{489"name": "invalid.string.newline",490"match": "\\n"491},492{493"include": "#string-interp"494}495]496},497{498"name": "string.quoted.double.dart",499"begin": "r\"",500"end": "\"",501"patterns": [502{503"name": "invalid.string.newline",504"match": "\\n"505}506]507},508{509"name": "string.interpolated.single.dart",510"begin": "(?<!\\|r)'",511"end": "'",512"patterns": [513{514"name": "invalid.string.newline",515"match": "\\n"516},517{518"include": "#string-interp"519}520]521},522{523"name": "string.quoted.single.dart",524"begin": "r'",525"end": "'",526"patterns": [527{528"name": "invalid.string.newline",529"match": "\\n"530}531]532}533]534},535"punctuation": {536"patterns": [537{538"name": "punctuation.comma.dart",539"match": ","540},541{542"name": "punctuation.terminator.dart",543"match": ";"544},545{546"name": "punctuation.dot.dart",547"match": "\\."548}549]550}551}552}553554