{ "name": "Babel ES6 JavaScript", "comment": "27Apr15", "scopeName": "source.js.jsx", "foldingStartMarker": "(/\\*|\\{|\\()", "foldingEndMarker": "(\\*/|\\}|\\))", "firstLineMatch": "^#!\\s*/.*\\b(node|js)$\\n?", "fileTypes": [ "js", "es6", "babel", "jsx" ], "patterns": [ { "include": "#core" } ], "repository": { "core": { "patterns": [ { "include": "#literal-function-labels" }, { "include": "#literal-arrow-function-labels" }, { "include": "#literal-labels" }, { "include": "#flowtype-type-aliases" }, { "include": "#flowtype-interface" }, { "include": "#flowtype-declare" }, { "include": "#literal-keywords" }, { "include": "#literal-for" }, { "include": "#literal-switch" }, { "include": "#expression" }, { "include": "#literal-punctuation" } ] }, "expression": { "patterns": [ { "include": "#jsx" }, { "include": "#es7-decorators" }, { "include": "#support" }, { "include": "#literal-function-labels" }, { "include": "#literal-arrow-function-labels" }, { "include": "#literal-function" }, { "include": "#literal-arrow-function" }, { "include": "#literal-prototype", "comment": " after literal-function, which includes some prototype strings" }, { "include": "#literal-regexp", "comment": "before operators to avoid abiguities" }, { "include": "#literal-number" }, { "include": "#literal-quasi" }, { "include": "#literal-string" }, { "include": "#literal-language-constant" }, { "include": "#literal-language-variable" }, { "include": "#literal-method" }, { "include": "#literal-module" }, { "include": "#literal-class" }, { "include": "#literal-constructor" }, { "include": "#literal-method-call" }, { "include": "#literal-function-call" }, { "include": "#comments" }, { "include": "#brackets" }, { "include": "#literal-operators" }, { "include": "#literal-variable" } ] }, "literal-function-labels": { "patterns": [ { "comment": " e.g. play: function(arg1, arg2) { }", "name": "meta.function.json.js", "begin": "\\s*([_$a-zA-Z][$\\w]*)\\s*(:)\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(?:(\\*)\\s*)?\\s*(?=\\(|<)", "end": "(?=\\{)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "punctuation.separator.key-value.js" }, "3": { "name": "storage.type.js" }, "4": { "name": "storage.type.function.js" }, "5": { "name": "keyword.generator.asterisk.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "e.g. 'play': function(arg1, arg2) { }", "name": "meta.function.json.js", "begin": "\\s*(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*(:)\\s*(async)?\\s+(\\bfunction\\b)\\s*(\\*\\s*)?\\s*(?=\\(|<)", "end": "(?=\\{)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "string.quoted.js" }, "2": { "name": "punctuation.definition.string.begin.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "punctuation.definition.string.end.js" }, "5": { "name": "punctuation.separator.key-value.js" }, "6": { "name": "storage.type.js" }, "7": { "name": "storage.type.function.js" }, "8": { "name": "keyword.generator.asterisk.js" } }, "patterns": [ { "include": "#flowtype" } ] } ] }, "literal-arrow-function-labels": { "patterns": [ { "comment": "# e.g. play: async (args) => { }", "name": "meta.function.json.arrow.js", "begin": "\\s*(\\b[_$a-zA-Z][$\\w]*)\\s*(:)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "punctuation.separator.key-value.js" }, "3": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "# e.g. play: arg => { }", "name": "meta.function.json.arrow.js", "begin": "\\s*(\\b[_$a-zA-Z][$\\w]*)\\s*(:)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*([_$a-zA-Z][$\\w]*)\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "punctuation.separator.key-value.js" }, "3": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-variable" } ] }, { "comment": "# e.g. 'play': (args) => { }", "name": "meta.function.json.arrow.js", "begin": "\\s*(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*(:)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "applyEndPatternLast": "1", "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "beginCaptures": { "1": { "name": "string.quoted.js" }, "2": { "name": "punctuation.definition.string.begin.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "punctuation.definition.string.end.js" }, "5": { "name": "punctuation.separator.key-value.js" }, "6": { "name": "storage.type.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "# e.g. 'play': arg => { }", "name": "meta.function.json.arrow.js", "begin": "\\s*(('|\\\")(\\b[_$a-zA-Z][$\\w]*)(\\k<2>))\\s*(:)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*([_$a-zA-Z][$\\w]*)\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "beginCaptures": { "1": { "name": "string.quoted.js" }, "2": { "name": "punctuation.definition.string.begin.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "punctuation.definition.string.end.js" }, "5": { "name": "punctuation.separator.key-value.js" }, "6": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-variable" } ] } ] }, "literal-labels": { "patterns": [ { "begin": "(?))|[^:?]*+(:|$))", "end": "\\)", "beginCaptures": { "2": { "name": "meta.brace.round.js" } }, "endCaptures": { "0": { "name": "meta.brace.round.js" } }, "patterns": [ { "include": "#flowtype-typecast" }, { "include": "#expression" } ] }, { "name": "meta.group.braces.round", "begin": "\\(", "end": "\\)", "endCaptures": { "0": { "name": "meta.brace.round.js" } }, "beginCaptures": { "0": { "name": "meta.brace.round.js" } }, "patterns": [ { "include": "#expression" } ] } ] }, "square-brackets": { "patterns": [ { "name": "meta.group.braces.square", "begin": "\\[", "end": "\\]", "endCaptures": { "0": { "name": "meta.brace.square.js" } }, "beginCaptures": { "0": { "name": "meta.brace.square.js" } }, "patterns": [ { "include": "#expression" } ] } ] }, "curly-brackets": { "patterns": [ { "name": "meta.group.braces.curly", "begin": "\\{", "end": "\\}", "endCaptures": { "0": { "name": "meta.brace.curly.js" } }, "beginCaptures": { "0": { "name": "meta.brace.curly.js" } }, "patterns": [ { "include": "$self" } ] } ] }, "jsdoc": { "patterns": [ { "comment": "common doc @ keywords", "match": "(?)", "captures": { "0": { "name": "punctuation.definition.comment.js" } } }, { "name": "comment.line.double-slash.js", "begin": "(//)", "end": "$", "beginCaptures": { "1": { "name": "punctuation.definition.comment.js" } } }, { "name": "comment.line.shebang.js", "match": "^(#!).*$\\n?", "captures": { "1": { "name": "punctuation.definition.comment.js" } } } ] }, "special-comments-conditional-compilation": { "patterns": [ { "name": "comment.block.conditional.js", "begin": "/\\*(?=@)", "end": "\\*/", "captures": { "0": { "name": "punctuation.definition.comment.js" } }, "endCaptures": { "1": { "name": "keyword.control.conditional.js" }, "2": { "name": "punctuation.definition.keyword.js" } }, "patterns": [ { "name": "punctuation.definition.comment.js", "match": "/\\*" }, { "include": "$self" } ] }, { "name": "keyword.control.conditional.js", "match": "(?!@)(@)(if|elif|else|end|ifdef|endif|cc_on|set)\\b", "captures": { "1": { "name": "punctuation.definition.keyword.js" } } }, { "name": "variable.other.conditional.js", "match": "(?!@)(@)(_win32|_win16|_mac|_alpha|_x86|_mc680x0|_PowerPC|_jscript|_jscript_build|_jscript_version|_debug|_fast|[a-zA-Z]\\w+)", "captures": { "1": { "name": "punctuation.definition.variable.js" } } } ] }, "literal-punctuation": { "patterns": [ { "name": "punctuation.terminator.statement.js", "match": "\\;" }, { "name": "meta.delimiter.comma.js", "match": "," } ] }, "literal-keyword-storage": { "patterns": [ { "comment": "these statements must end in a ; ", "begin": "(?[^{}]+)|\\g<-1>)*\\})\\s*:)", "end": "\\;", "beginCaptures": { "1": { "name": "storage.type.js" } }, "endCaptures": { "0": { "name": "punctuationterminator.statement.js" } }, "patterns": [ { "include": "#flowtype-destruct-lhs" } ] }, { "comment": "these statements must end in a ; ", "begin": "(?[^\\[\\]]+)|\\g<-1>)*\\])\\s*:)", "end": "\\;", "beginCaptures": { "1": { "name": "storage.type.js" } }, "endCaptures": { "0": { "name": "punctuationterminator.statement.js" } }, "patterns": [ { "include": "#flowtype-destruct-lhs" } ] }, { "comment": "var statements that done start with a flow indicator", "name": "storage.type.js", "match": "(?(arg1, arg2) { }", "name": "meta.function.js", "begin": "\\s*(?:\\b(async)\\b\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)", "end": "(?=\\{)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "storage.type.js" }, "2": { "name": "storage.type.function.js" }, "3": { "name": "keyword.generator.asterisk.js" }, "4": { "name": "entity.name.function.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "e.g. play = function(arg1, arg2) { }", "name": "meta.function.js", "begin": "(\\b[_$a-zA-Z][$\\w]*)\\s*=\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)", "end": "(?=\\{)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "storage.type.js" }, "3": { "name": "storage.type.function.js" }, "4": { "name": "keyword.generator.asterisk.js" }, "5": { "name": "entity.name.function.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "e.g. Sound.prototype.play = function(arg1, arg2) { }", "name": "meta.prototype.function.js", "begin": "(\\b_?[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*=\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)", "end": "(?=\\{)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.class.js" }, "2": { "name": "keyword.operator.accessor.js" }, "3": { "name": "variable.language.prototype.js" }, "4": { "name": "keyword.operator.accessor.js" }, "5": { "name": "entity.name.function.js" }, "6": { "name": "storage.type.js" }, "7": { "name": "storage.type.function.js" }, "8": { "name": "keyword.generator.asterisk.js" }, "9": { "name": "entity.name.function.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "e.g. Sound.play = function(arg1, arg2) { }", "name": "meta.function.static.js", "begin": "(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*=\\s*(?:(async)\\s+)?\\s*(\\bfunction\\b)\\s*(\\*?)\\s*([_$a-zA-Z][$\\w]*)?\\s*(?=\\(|<)", "end": "(?=\\{)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.class.js" }, "2": { "name": "keyword.operator.accessor.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "storage.type.js" }, "5": { "name": "storage.type.function.js" }, "6": { "name": "keyword.generator.asterisk.js" }, "7": { "name": "entity.name.function.js" } }, "patterns": [ { "include": "#flowtype" } ] } ] }, "literal-quasi": { "patterns": [ { "name": "string.quasi.js", "begin": "([a-zA-Z$_][\\w$_]*)?(`)", "end": "(?>=|>>>=" }, { "name": "keyword.operator.bitwise.js", "match": "~|<<|>>>|>>|&|\\^|\\|" }, { "name": "keyword.operator.relational.js", "match": "<=|>=|<|>" }, { "name": "keyword.operator.comparison.js", "match": "===|!==|==|!=" }, { "name": "keyword.operator.arithmetic.js", "match": "--|\\+\\+|/|%|\\*|\\+|-" }, { "name": "keyword.operator.ternary.js", "match": "\\?|:" }, { "name": "keyword.operator.spread.js", "match": "(? { }", "name": "meta.function.arrow.js", "begin": "(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "applyEndPatternLast": "1", "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "beginCaptures": { "1": { "name": "storage.type.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "# e.g. arg => { }", "name": "meta.function.arrow.js", "begin": "(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*([_$a-zA-Z][$\\w]*)\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "beginCaptures": { "1": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-variable" } ] }, { "comment": "# e.g. play = (args) => { }", "name": "meta.function.arrow.js", "begin": "(\\b[_$a-zA-Z][$\\w]*)\\s*(=)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "keyword.operator.equals.js" }, "3": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "# e.g. play = arg => { }", "name": "meta.function.arrow.js", "begin": "(\\b[_$a-zA-Z][$\\w]*)\\s*(=)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*([_$a-zA-Z][$\\w]*)\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "beginCaptures": { "1": { "name": "entity.name.function.js" }, "2": { "name": "keyword.operator.equals.js" }, "3": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-variable" } ] }, { "comment": "Sound.prototype.play = (args) => { }", "name": "meta.prototype.function.arrow.js", "begin": "(\\b[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*(=)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.class.js" }, "2": { "name": "keyword.operator.accessor.js" }, "3": { "name": "variable.language.prototype.js" }, "4": { "name": "keyword.operator.accessor.js" }, "5": { "name": "entity.name.function.js" }, "6": { "name": "keyword.operator.equals.js" }, "7": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "# e.g. Sound.prototype.play = arg => { }", "name": "meta.prototype.function.arrow.js", "begin": "(\\b_?[A-Z][$\\w]*)?(\\.)(prototype)(\\.)([_$a-zA-Z][$\\w]*)\\s*(=)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*([_$a-zA-Z][$\\w]*)\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "beginCaptures": { "1": { "name": "entity.name.class.js" }, "2": { "name": "keyword.operator.accessor.js" }, "3": { "name": "variable.language.prototype.js" }, "4": { "name": "keyword.operator.accessor.js" }, "5": { "name": "entity.name.function.js" }, "6": { "name": "keyword.operator.equals.js" }, "7": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-variable" } ] }, { "comment": "e.g. Sound.play = (args) => { }", "name": "meta.function.static.arrow.js", "begin": "(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*(=)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "entity.name.class.js" }, "2": { "name": "keyword.operator.accessor.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "keyword.operator.accessor.js" }, "5": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype" } ] }, { "comment": "# e.g. Sound.play = arg => { }", "name": "meta.function.static.arrow.js", "begin": "(\\b_?[A-Z][$\\w]*)?(\\.)([_$a-zA-Z][$\\w]*)\\s*(=)\\s*(\\basync\\b)?\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?\\s*([_$a-zA-Z][$\\w]*)\\s*(?:\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?)", "end": "\\s*(=>)", "beginCaptures": { "1": { "name": "entity.name.class.js" }, "2": { "name": "keyword.operator.accessor.js" }, "3": { "name": "entity.name.function.js" }, "4": { "name": "keyword.operator.accessor.js" }, "5": { "name": "storage.type.js" } }, "endCaptures": { "1": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-variable" } ] } ] }, "literal-method": { "patterns": [ { "comment": " e.g. play(arg1, arg2): Type { }", "name": "meta.function.method.js", "begin": "(?:\\b(static)\\s+)?(?:\\b(async)\\s+)?(?:(\\*)\\s*)?([_$a-zA-Z][$\\w]*)\\s*(?=(<(?:(?>[^<>]+)|\\g<-1>)*>)?(\\((?:(?>[^()]+)|\\g<-1>)*\\))\\s*(\\s*(:|\\|)(\\s*[$_a-zA-Z0-9]+(<(?:(?>[^<>]+)|\\g<-1>)*>)?|\\s*(\\{(?:(?>[^{}]+)|\\g<-1>)*\\})|\\s*(\\s*([\"']).*?\\k<-1>(?|<=|>=|==|!=|===|!==|\\+|-|\\*|%|\\+\\+|--|<<|>>|>>>|&|\\||\\^|!|~|&&|\\|\\||\\?|:|=|\\+=|-=|\\*=|%=|<<=|>>=|>>>=|&=|\\|=|\\^=|/|/=|\\Wnew|\\Wdelete|\\Wvoid|\\Wtypeof|\\Winstanceof|\\Win|\\Wdo|\\Wreturn|\\Wcase|\\Wthrow|^new|^delete|^void|^typeof|^instanceof|^in|^do|^return|^case|^throw|^)\\s*(/)(?!/|\\*|$)", "end": "(/)([gimy]*)", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.js" } }, "endCaptures": { "1": { "name": "punctuation.definition.string.end.js" }, "2": { "name": "keyword.other.js" } }, "patterns": [ { "include": "source.regexp.babel" } ] } ] }, "literal-string": { "patterns": [ { "name": "string.quoted.single.js", "begin": "\\s*'", "end": "(')|(\\n)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.js" } }, "endCaptures": { "1": { "name": "punctuation.definition.string.end.js" }, "2": { "name": "invalid.illegal.newline.js" } }, "patterns": [ { "include": "#string-content" } ] }, { "name": "string.quoted.double.js", "begin": "\\s*\"", "end": "(\")|(\\n)", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.js" } }, "endCaptures": { "1": { "name": "punctuation.definition.string.end.js" }, "2": { "name": "invalid.illegal.newline.js" } }, "patterns": [ { "include": "#string-content" } ] } ] }, "literal-module": { "patterns": [ { "name": "keyword.control.module.js", "match": "(? and as per the draft. Will anyone use these?", "patterns": [ { "include": "#jsx-tag-element-name" } ] }, "jsx-tag-element-name": { "patterns": [ { "comment": "Tags that end > are trapped in #jsx-tag-termination", "name": "meta.tag.jsx", "begin": "(<)([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}-](?\\t\\n])(?)|(/>)", "beginCaptures": { "1": { "name": "punctuation.definition.tag.jsx" }, "2": { "name": "entity.name.tag.open.jsx" } }, "endCaptures": { "1": { "name": "punctuation.definition.tag.jsx" }, "2": { "name": "entity.name.tag.close.jsx" }, "3": { "name": "punctuation.definition.tag.jsx" }, "4": { "name": "punctuation.definition.tag.jsx" } }, "patterns": [ { "include": "#jsx-tag-termination" }, { "include": "#jsx-tag-attributes" } ] } ] }, "jsx-tag-termination": { "patterns": [ { "comment": "uses non consuming search for ", "begin": ">", "end": "(?=)", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "punctuation.type.flowtype" } }, "patterns": [ { "include": "#flowtype-parse-types" } ] } ] }, "flowtype-variable": { "patterns": [ { "comment": "name of variable spread var or optional ? var with flowtype :", "match": "\\s*((?(?(? type", "begin": "(?<=\\))\\s*=>", "end": "(?=.)", "applyEndPatternLast": "1", "beginCaptures": { "0": { "name": "storage.type.function.arrow.js" } }, "patterns": [ { "include": "#flowtype-parse-types" } ] }, { "comment": "some form of default assignment for func args", "begin": "\\s*=(?!>)", "end": "\\s*(?=,|;|\\))", "beginCaptures": { "0": { "name": "keyword.operator.assignment.js" } }, "patterns": [ { "include": "#expression" } ] } ] }, "flowtype-parse-types": { "patterns": [ { "name": "keyword.operator.flowtype", "match": "\\s*\\btypeof\\b\\s*" }, { "comment": "primitive flowtypes", "match": "\\s*(?:(\\?)?)\\s*\\b((?>any|boolean|mixed|number|string|void))\\b", "captures": { "1": { "name": "punctuation.flowtype" }, "2": { "name": "support.type.builtin.primitve.flowtype" } } }, { "comment": "Built-in Class Types", "match": "\\s*(?:(\\?)?)\\s*\\b((?>Boolean|Function|Number|Object|String))\\b", "captures": { "1": { "name": "punctuation.flowtype" }, "2": { "name": "support.type.builtin.class.flowtype" } } }, { "comment": "custom Class Types e.g. Abc ", "match": "\\s*(?:(\\?)?)\\s*([$_[\\p{Lu}\\p{Lt}\\p{Lm}\\p{Lo}]][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*)", "captures": { "1": { "name": "punctuation.flowtype" }, "2": { "name": "support.type.class.flowtype" } } }, { "comment": "custom primitive/var Types e.g. abc ", "match": "\\s*(?:(\\?)?)\\s*([$_\\p{L}][$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}]*)", "captures": { "1": { "name": "punctuation.flowtype" }, "2": { "name": "support.type.primitive.flowtype" } } }, { "comment": "Type Unions |", "name": "kewyword.operator.union.flowtype", "match": "\\s*\\|" }, { "comment": "intersection of types &", "name": "kewyword.operator.intersection.flowtype", "match": "\\s*\\&" }, { "comment": "as per React declares in flowtype github", "name": "kewyword.operator.existential.flowtype", "match": "\\s*\\*" }, { "include": "#literal-string" }, { "include": "#literal-number" }, { "include": "#flowtype-polymorphs" }, { "include": "#flowtype-bracketed-parameters" }, { "include": "#flowtype-parse-objects" }, { "include": "#flowtype-parse-operators" }, { "include": "#flowtype-parse-array" }, { "include": "#comments" } ] }, "flowtype-bracketed-parameters": { "patterns": [ { "comment": "Get parameters within a function/method call", "begin": "\\s*(\\()", "end": "\\s*(\\))", "beginCaptures": { "1": { "name": "punctuation.definition.parameters.begin.js" } }, "endCaptures": { "1": { "name": "punctuation.definition.parameters.begin.js" } }, "patterns": [ { "include": "#flowtype-variable" } ] } ] }, "flowtype-polymorphs": { "comment": "Support Bounded Polymorphism http://flowtype.org/blog/2015/03/12/Bounded-Polymorphism.html", "patterns": [ { "comment": "Built-in Class Types with elements of type ", "begin": "\\s*\\b((?>Array|Class))\\s*(<)", "end": "\\s*(>)", "beginCaptures": { "1": { "name": "support.type.builtin.flowtype" }, "2": { "name": "punctuation.flowtype" } }, "endCaptures": { "1": { "name": "punctuation.flowtype" } }, "patterns": [ { "match": "\\s*,", "name": "punctuation.type.separator.flowtype" }, { "match": "\\s*:", "name": "punctuation.type.separator.flowtype" }, { "include": "#flowtype-parse-types" } ] }, { "comment": "just the polymorph bit like this (arg,arg)", "begin": "\\s*(<)", "end": "\\s*(>)", "beginCaptures": { "1": { "name": "punctutation.flowtype" } }, "endCaptures": { "1": { "name": "punctutation.flowtype" } }, "patterns": [ { "match": "\\s*,", "name": "punctuation.type.separator.flowtype" }, { "match": "\\s*:", "name": "punctuation.type.separator.flowtype" }, { "include": "#flowtype-parse-types" } ] } ] }, "flowtype-parse-objects": { "comment": "object literal flowtype not be preceded by either : | = symbols", "begin": "(?<=:|\\||\\=)\\s*(\\{)", "end": "\\s*(\\})", "applyEndPatternLast": "1", "beginCaptures": { "1": { "name": "meta.brace.round.open.flowtype" } }, "endCaptures": { "1": { "name": "meta.brace.round.close.flowtype" } }, "patterns": [ { "include": "#flowtype-object-property" } ] }, "flowtype-parse-array": { "comment": "arrays such as [name: string, dob: Date]", "begin": "\\s*(\\[)", "end": "\\s*(\\])", "beginCaptures": { "1": { "name": "meta.brace.square.open.flowtype" } }, "endCaptures": { "1": { "name": "meta.brace.square.end.flowtype" } }, "patterns": [ { "include": "#flowtype-parse-types" } ] }, "flowtype-class-fields": { "comment": "flow supports field names in classe bodies, such as namevar: string", "match": "\\s*(\\bstatic\\b)?\\s*([$_\\p{L}](?:[$.\\p{L}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Nl}\\p{Pc}])*+)\\b\\s*\\??\\s*(:[^;]*)(;|$)", "captures": { "1": { "name": "storage.modifier.static.js" }, "2": { "name": "storage.type.variable.flowtype" }, "3": { "patterns": [ { "include": "#flowtype-parse-types" } ] } } }, "flowtype-type-aliases": { "patterns": [ { "comment": "import for types", "name": "keyword.control.module.js", "match": "(?