{ "name": "DataWeave", "scopeName": "source.data-weave", "fileTypes": [ "dwl" ], "uuid": "ba6390ae-c50f-4dce-97f1-951dab8fc607", "patterns": [ { "include": "#comments" }, { "include": "#directives" }, { "match": "(---)", "name": "keyword.operator.body-marker.dw" }, { "include": "#expressions" }, { "match": "([^\\s]+)", "name": "invalid" } ], "repository": { "directives": { "patterns": [ { "include": "#dw-directive" }, { "include": "#import-directive" }, { "include": "#type-directive" }, { "include": "#fun-directive" }, { "include": "#var-directive" }, { "include": "#ns-directive" }, { "include": "#input-directive" }, { "include": "#output-directive" } ] }, "function_call": { "name": "function_call", "begin": "\\s*\\(", "end": "\\s*\\)", "patterns": [ { "include": "#punctuation-comma" }, { "include": "#expressions" } ] }, "variable-reference": { "patterns": [ { "name": "variable.other.dw", "match": "\\b(?!(fun|input|output|type|var|ns|import|%dw|private|---)\\b)((\\+\\+|\\-\\-|[A-Za-z])[a-zA-Z0-9_]*)" }, { "name": "invalid", "match": "\\b(fun|input|output|type|var|ns|import|private)\\b" }, { "name": "variable.parameter.dw", "match": "(\\$+)" } ] }, "cast": { "begin": "(?))\\b(?!\\$|\\.)", "beginCaptures": { "1": { "name": "keyword.control.switch.dw" } }, "end": "\\-\\>", "endCaptures": { "0": { "name": "keyword.control.switch.dw" } }, "patterns": [ { "begin": "(?)", "patterns": [ { "include": "#types" } ] }, { "begin": "(?)", "patterns": [ { "include": "#expressions" } ] }, { "begin": "(?)", "patterns": [ { "include": "#expressions" } ] }, { "begin": "(?)", "patterns": [ { "include": "#expressions" } ] }, { "include": "#expressions" } ] }, "comments": { "patterns": [ { "name": "comment.block.dw", "begin": "/\\*", "end": "\\*/", "captures": { "0": { "name": "punctuation.definition.comment.dw" } } }, { "match": "\\s*((//).*$\\n?)", "captures": { "1": { "name": "comment.line.double-slash.dw" }, "2": { "name": "punctuation.definition.comment.dw" } } } ] }, "constants": { "patterns": [ { "name": "constant.language.dw", "match": "\\b(true|false|null)\\b" }, { "name": "constant.numeric.dw", "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\\b" }, { "begin": "\\|", "beginCaptures": { "0": { "name": "constant.numeric.dw" } }, "end": "\\|", "endCaptures": { "0": { "name": "constant.numeric.dw" } }, "patterns": [ { "name": "constant.numeric.dw", "match": "([0-9]+)" }, { "name": "constant.character.escape.dw", "match": "([+:\\-WYMDTHSPZ\\.])" }, { "name": "invalid", "match": "([^\\|])" } ] } ] }, "dw-directive": { "name": "meta.directive.version.dw", "begin": "(?|<|\\-|\\*|:|\\{|case|is|else|not|as|and|or)(?<=[a-zA-Z0-9_$\\}\\])\"'`|/])\\s*(?!(var|match|case|else|fun|input|output|is|as|default|ns|import|null|false|true|using|do|not|and|or)\\s)(\\+\\+|\\-\\-|[a-zA-Z][a-zA-Z_0-9]*)(\\s+|\\s*(?=[\"'/|{]))" }, "expressions": { "name": "expression", "patterns": [ { "name": "keyword.other.dw", "match": "\\b(not)\\s+" }, { "include": "#paren-expression" }, { "include": "#strings" }, { "include": "#constants" }, { "include": "#comments" }, { "include": "#match-statement" }, { "include": "#using-statement" }, { "include": "#do-statement" }, { "include": "#if-statement" }, { "include": "#regex" }, { "include": "#keywords" }, { "include": "#object-literal" }, { "include": "#array-literal" }, { "include": "#cast" }, { "include": "#object-member" }, { "include": "#variable-reference" }, { "include": "#selectors" }, { "include": "#directives" }, { "include": "#infix" } ] }, "generics": { "patterns": [ { "begin": "(:)", "beginCaptures": { "1": { "name": "keyword.operator.declaration.dw" } }, "end": "(?=,|>)", "patterns": [ { "include": "#types" } ] }, { "name": "keyword.operator.extends.dw", "match": "<:" }, { "include": "#keywords" }, { "name": "entity.name.type.parameter.dw", "match": "\\w+" } ] }, "input-directive": { "name": "meta.directive.ns.dw", "begin": "(?=|<|>)" }, { "name": "keyword.operator.assignment.dw", "match": "(=)" }, { "name": "keyword.operator.declaration.dw", "match": "(:)" }, { "name": "keyword.operator.arithmetic.dw", "match": "(\\-|\\+|\\*|\\/)" }, { "name": "keyword.other.dw", "match": "\\b(and|or)\\b" } ] }, "match-block": { "name": "match-block.expr.dw", "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.block.dw" } }, "end": "(?=\\})", "patterns": [ { "include": "#case-clause" }, { "include": "#expressions" } ] }, "match-statement": { "name": "match-statement.expr.dw", "begin": "(?", "patterns": [ { "match": ",", "name": "invalid" }, { "include": "#types" } ] }, { "name": "keyword.operator.declaration.dw", "match": "(&|\\|)" }, { "name": "keyword.operator.declaration.dw", "match": "<:" }, { "name": "support.class.dw", "match": "\\b([A-Z][a-zA-Z0-9_]*)" }, { "begin": "<", "end": ">", "patterns": [ { "include": "#types" }, { "include": "#punctuation-comma" }, { "include": "#comments" } ] }, { "begin": "\\(", "beginCaptures": { "1": { "name": "keyword.operator.tuple.dw" } }, "end": "(\\)\\s*\\-\\>)", "patterns": [ { "include": "#types" }, { "include": "#parameters" } ] }, { "begin": "\\{\\-\\|", "end": "\\|\\-\\}", "patterns": [ { "include": "#punctuation-comma" }, { "include": "#object-member-type" } ] }, { "begin": "\\{\\|", "end": "\\|\\}", "patterns": [ { "include": "#punctuation-comma" }, { "include": "#object-member-type" } ] }, { "begin": "\\{\\-", "end": "\\-\\}", "patterns": [ { "include": "#punctuation-comma" }, { "include": "#object-member-type" } ] }, { "begin": "\\{", "end": "\\}", "patterns": [ { "include": "#punctuation-comma" }, { "include": "#object-member-type" } ] }, { "begin": "\\(", "end": "\\)", "patterns": [ { "include": "#types" } ] }, { "match": "\\b(var|fun|ns)\\b" }, { "name": "invalid", "match": "\\b(input|output|var|ns|import|try|catch|throw|do|for|yield|enum|private|async)\\b" }, { "name": "invalid", "match": "\\b(if|else|while|for|do|using|unless|default|match)\\b" }, { "name": "invalid", "match": "(~=|==|!=|===|!==|<=|>=|<|>|\\$+)" } ] }, "object-member-type": { "patterns": [ { "include": "#comments" }, { "match": "_", "name": "variable.language.dw" }, { "match": "([a-zA-Z0-9]+#)", "name": "variable.language.dw" }, { "match": "\\(\\s*([a-zA-Z][a-zA-Z0-9]*)\\s*\\)", "name": "entity.name.type.dw" }, { "match": "([a-zA-Z][a-zA-Z0-9]*)", "name": "meta.object.member.dw" }, { "include": "#strings" }, { "match": "\\?", "name": "keyword.operator.optional.dw" }, { "match": "\\*", "name": "keyword.operator.optional.dw" }, { "begin": "(\\@\\()", "beginCaptures": { "1": { "name": "keyword.operator.attributes.dw" } }, "end": "(\\))", "endCaptures": { "1": { "name": "keyword.operator.attributes.dw" } }, "patterns": [ { "include": "#punctuation-comma" }, { "include": "#object-member-type" } ] }, { "begin": "(:)", "beginCaptures": { "1": { "name": "keyword.operator.declaration.dw" } }, "end": "(?=,|}|\\)|\\|}|\\-}|\\|\\-})", "patterns": [ { "include": "#types" } ] }, { "match": "([^\\s])", "name": "invalid" } ] }, "type-directive": { "name": "meta.directive.type.dw", "begin": "(\\s*(type)\\s+([a-zA-Z][a-zA-Z0-9]*))", "end": "(?=(fun|input|output|type|var|ns|import|%dw|private|---)\\s)", "beginCaptures": { "2": { "name": "storage.type.dw" }, "3": { "name": "entity.name.type.dw" } }, "patterns": [ { "begin": "<", "end": ">", "patterns": [ { "include": "#generics" } ] }, { "name": "keyword.other.dw", "match": "\\=" }, { "include": "#types" } ] }, "import-directive": { "name": "meta.directive.import.dw", "begin": "(\\s*(import)\\s+)", "end": "(?=(fun|input|output|type|var|ns|import|%dw|private|---)\\s|$)", "beginCaptures": { "2": { "name": "storage.type.dw" } }, "patterns": [ { "include": "#comments" }, { "match": "(,)" }, { "match": "(\\*)" }, { "match": "\\b(from)\\s+", "captures": { "1": { "name": "storage.type.dw" } } }, { "match": "(?:[a-zA-Z][a-zA-Z0-9]*(?:::[a-zA-Z][a-zA-Z0-9]*)*)\n", "name": "entity.name.other.dw" }, { "match": "\\s+(as)\\s+([a-zA-Z][a-zA-Z0-9]*)", "captures": { "1": { "name": "keyword.other.dw" }, "2": { "name": "entity.name.other.dw" } } } ] }, "var-directive": { "name": "meta.directive.var.dw", "begin": "(\\s*(var)\\s+([a-zA-Z][a-zA-Z0-9]*))", "end": "(=)", "beginCaptures": { "2": { "name": "storage.type.dw" }, "3": { "name": "entity.name.variable.dw" } }, "endCaptures": { "0": { "name": "keyword.operator.assignment.dw" } }, "patterns": [ { "begin": "<", "end": ">", "patterns": [ { "include": "#generics" } ] }, { "begin": "(:)", "beginCaptures": { "1": { "name": "keyword.operator.declaration.dw" } }, "end": "(?==|$)", "patterns": [ { "include": "#comments" }, { "include": "#types" } ] } ] }, "fun-directive": { "name": "meta.directive.fun.dw", "begin": "(\\s*(fun)\\s+([a-zA-Z][a-zA-Z0-9]*))", "end": "(=)", "beginCaptures": { "2": { "name": "storage.type.dw" }, "3": { "name": "entity.name.function.dw" } }, "endCaptures": { "0": { "name": "keyword.operator.assignment.dw" } }, "patterns": [ { "begin": "<", "end": ">", "patterns": [ { "include": "#generics" } ] }, { "begin": "\\(", "end": "\\)", "patterns": [ { "include": "#parameters" } ] }, { "begin": "(:)", "beginCaptures": { "1": { "name": "keyword.operator.declaration.dw" } }, "end": "(?==)", "patterns": [ { "include": "#types" } ] } ] }, "array-literal": { "name": "meta.array.literal.dw", "begin": "(?|and|or|\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\])+\\/(?![\\/*])(?!\\s*[a-zA-Z0-9_$]))", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.dw" } }, "end": "(/)", "endCaptures": { "1": { "name": "punctuation.definition.string.end.dw" } }, "patterns": [ { "include": "#regexp" } ] }, { "name": "string.regexp.dw", "begin": "(?