{ "name": "apex", "scopeName": "source.apex", "fileTypes": ["apex", "cls", "trigger"], "uuid": "F5FC6824-F257-43B1-B53A-14E1CCD18631", "patterns": [ { "include": "#javadoc-comment" }, { "include": "#comment" }, { "include": "#directives" }, { "include": "#declarations" }, { "include": "#script-top-level" } ], "repository": { "directives": { "patterns": [ { "include": "#punctuation-semicolon" } ] }, "declarations": { "patterns": [ { "include": "#type-declarations" }, { "include": "#punctuation-semicolon" } ] }, "script-top-level": { "patterns": [ { "include": "#method-declaration" }, { "include": "#statement" }, { "include": "#punctuation-semicolon" } ] }, "type-declarations": { "patterns": [ { "include": "#javadoc-comment" }, { "include": "#comment" }, { "include": "#annotation-declaration" }, { "include": "#storage-modifier" }, { "include": "#sharing-modifier" }, { "include": "#class-declaration" }, { "include": "#enum-declaration" }, { "include": "#interface-declaration" }, { "include": "#trigger-declaration" }, { "include": "#punctuation-semicolon" } ] }, "class-or-trigger-members": { "patterns": [ { "include": "#javadoc-comment" }, { "include": "#comment" }, { "include": "#storage-modifier" }, { "include": "#sharing-modifier" }, { "include": "#type-declarations" }, { "include": "#field-declaration" }, { "include": "#property-declaration" }, { "include": "#indexer-declaration" }, { "include": "#variable-initializer" }, { "include": "#constructor-declaration" }, { "include": "#method-declaration" }, { "include": "#punctuation-semicolon" } ] }, "interface-members": { "patterns": [ { "include": "#javadoc-comment" }, { "include": "#comment" }, { "include": "#property-declaration" }, { "include": "#indexer-declaration" }, { "include": "#method-declaration" }, { "include": "#punctuation-semicolon" } ] }, "statement": { "patterns": [ { "include": "#comment" }, { "include": "#while-statement" }, { "include": "#do-statement" }, { "include": "#for-statement" }, { "include": "#switch-statement" }, { "include": "#when-else-statement" }, { "include": "#when-sobject-statement" }, { "include": "#when-statement" }, { "include": "#when-multiple-statement" }, { "include": "#if-statement" }, { "include": "#else-part" }, { "include": "#goto-statement" }, { "include": "#return-statement" }, { "include": "#break-or-continue-statement" }, { "include": "#throw-statement" }, { "include": "#try-statement" }, { "include": "#soql-query-expression" }, { "include": "#local-declaration" }, { "include": "#block" }, { "include": "#expression" }, { "include": "#punctuation-semicolon" } ] }, "expression": { "patterns": [ { "include": "#comment" }, { "include": "#merge-expression" }, { "include": "#support-expression" }, { "include": "#throw-expression" }, { "include": "#this-expression" }, { "include": "#trigger-context-declaration" }, { "include": "#conditional-operator" }, { "include": "#expression-operators" }, { "include": "#soql-query-expression" }, { "include": "#object-creation-expression" }, { "include": "#array-creation-expression" }, { "include": "#invocation-expression" }, { "include": "#member-access-expression" }, { "include": "#element-access-expression" }, { "include": "#cast-expression" }, { "include": "#literal" }, { "include": "#parenthesized-expression" }, { "include": "#initializer-expression" }, { "include": "#identifier" } ] }, "annotation-declaration": { "begin": "([@][_[:alpha:]]+)\\b", "beginCaptures": { "1": { "name": "storage.type.annotation.apex" } }, "end": "(?<=\\)|$)", "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.parenthesis.open.apex" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.parenthesis.close.apex" } }, "patterns": [ { "include": "#expression" } ] }, { "include": "#statement" } ] }, "support-expression": { "begin": "(?x)\n(ApexPages|Database|DMLException|Exception|PageReference|Savepoint|SchedulableContext|Schema|SObject|System|Test)(?=\\.|\\s) # supported apex namespaces", "beginCaptures": { "1": { "name": "support.class.apex" } }, "end": "(?<=\\)|$)|(?=\\})|(?=;)|(?=\\)|(?=\\]))|(?=\\,)", "patterns": [ { "include": "#support-type" }, { "match": "(?:(\\.))([[:alpha:]]*)(?=\\()", "captures": { "1": { "name": "punctuation.accessor.apex" }, "2": { "name": "support.function.apex" } } }, { "match": "(?:(\\.))([[:alpha:]]+)", "captures": { "1": { "name": "punctuation.accessor.apex" }, "2": { "name": "support.type.apex" } } }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.parenthesis.open.apex" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.parenthesis.close.apex" } }, "patterns": [ { "include": "#expression" }, { "include": "#punctuation-comma" } ] }, { "include": "#comment" }, { "include": "#statement" } ] }, "support-type": { "name": "support.apex", "patterns": [ { "include": "#comment" }, { "include": "#support-class" }, { "include": "#support-functions" }, { "include": "#support-name" } ] }, "support-class": { "match": "\\b(ApexPages|Database|DMLException|Exception|PageReference|Savepoint|SchedulableContext|Schema|SObject|System|Test)\\b", "captures": { "1": { "name": "support.class.apex" } } }, "support-functions": { "match": "\\b(delete|execute|finish|insert|start|undelete|update|upsert)\\b", "captures": { "1": { "name": "support.function.apex" } } }, "support-name": { "patterns": [ { "match": "(\\.)\\s*([[:alpha:]]*)(?=\\()", "captures": { "1": { "name": "punctuation.accessor.apex" }, "2": { "name": "support.function.apex" } } }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.parenthesis.open.apex" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.parenthesis.close.apex" } }, "patterns": [ { "include": "#expression" }, { "include": "#punctuation-comma" } ] }, { "match": "(\\.)\\s*([_[:alpha:]]*)", "captures": { "1": { "name": "punctuation.accessor.apex" }, "2": { "name": "support.type.apex" } } } ] }, "support-arguments": { "begin": "<", "beginCaptures": { "0": { "name": "punctuation.definition.typeparameters.begin.apex" } }, "end": ">", "endCaptures": { "0": { "name": "punctuation.definition.typeparameters.end.apex" } }, "patterns": [ { "include": "#comment" }, { "include": "#support-type" }, { "include": "#punctuation-comma" } ] }, "merge-expression": { "begin": "(merge)\\b\\s+", "beginCaptures": { "1": { "name": "support.function.apex" } }, "end": "(?<=\\;)", "patterns": [ { "include": "#object-creation-expression" }, { "include": "#merge-type-statement" }, { "include": "#expression" }, { "include": "#punctuation-semicolon" } ] }, "merge-type-statement": { "match": "([_[:alpha:]]*)\\b\\s+([_[:alpha:]]*)\\b\\s*(\\;)", "captures": { "1": { "name": "variable.other.readwrite.apex" }, "2": { "name": "variable.other.readwrite.apex" }, "3": { "name": "punctuation.terminator.statement.apex" } } }, "sharing-modifier": { "name": "sharing.modifier.apex", "match": "(?", "endCaptures": { "0": { "name": "punctuation.definition.typeparameters.end.apex" } }, "patterns": [ { "match": "(@?[_[:alpha:]][_[:alnum:]]*)\\b", "captures": { "1": { "name": "entity.name.type.type-parameter.apex" } } }, { "include": "#comment" }, { "include": "#punctuation-comma" } ] }, "field-declaration": { "begin": "(?x)\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+\n(\\g)\\s* # first field name\n(?!=>|==)(?=,|;|=|$)", "beginCaptures": { "1": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] }, "5": { "name": "entity.name.variable.field.apex" } }, "end": "(?=;)", "patterns": [ { "name": "entity.name.variable.field.apex", "match": "@?[_[:alpha:]][_[:alnum:]]*" }, { "include": "#punctuation-comma" }, { "include": "#comment" }, { "include": "#variable-initializer" }, { "include": "#class-or-trigger-members" } ] }, "property-declaration": { "begin": "(?x)\n(?!.*\\b(?:class|interface|enum)\\b)\\s*\n(?\n (?\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(?\\g)\\s*\n(?=\\{|=>|$)", "beginCaptures": { "1": { "patterns": [ { "include": "#type" } ] }, "6": { "patterns": [ { "include": "#type" }, { "include": "#punctuation-accessor" } ] }, "7": { "name": "entity.name.variable.property.apex" } }, "end": "(?<=\\})|(?=;)", "patterns": [ { "include": "#comment" }, { "include": "#property-accessors" }, { "include": "#expression-body" }, { "include": "#variable-initializer" }, { "include": "#class-or-trigger-members" } ] }, "indexer-declaration": { "begin": "(?x)\n(?\n (?\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(?this)\\s*\n(?=\\[)", "beginCaptures": { "1": { "patterns": [ { "include": "#type" } ] }, "6": { "patterns": [ { "include": "#type" }, { "include": "#punctuation-accessor" } ] }, "7": { "name": "keyword.other.this.apex" } }, "end": "(?<=\\})|(?=;)", "patterns": [ { "include": "#comment" }, { "include": "#property-accessors" }, { "include": "#expression-body" }, { "include": "#variable-initializer" } ] }, "property-accessors": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.curlybrace.open.apex" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.curlybrace.close.apex" } }, "patterns": [ { "name": "storage.modifier.apex", "match": "\\b(private|protected)\\b" }, { "name": "keyword.other.get.apex", "match": "\\b(get)\\b" }, { "name": "keyword.other.set.apex", "match": "\\b(set)\\b" }, { "include": "#comment" }, { "include": "#expression-body" }, { "include": "#block" }, { "include": "#punctuation-semicolon" } ] }, "method-declaration": { "begin": "(?x)\n(?\n (?\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\\s+\n)\n(?\\g\\s*\\.\\s*)?\n(\\g)\\s*\n(<([^<>]+)>)?\\s*\n(?=\\()", "beginCaptures": { "1": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] }, "6": { "patterns": [ { "include": "#type" }, { "include": "#punctuation-accessor" } ] }, "7": { "patterns": [ { "include": "#support-type" }, { "include": "#method-name-custom" } ] }, "8": { "patterns": [ { "include": "#type-parameter-list" } ] } }, "end": "(?<=\\})|(?=;)", "patterns": [ { "include": "#comment" }, { "include": "#parenthesized-parameter-list" }, { "include": "#expression-body" }, { "include": "#block" } ] }, "method-name-custom": { "name": "entity.name.function.apex", "match": "@?[_[:alpha:]][_[:alnum:]]*" }, "constructor-declaration": { "begin": "(?=@?[_[:alpha:]][_[:alnum:]]*\\s*\\()", "end": "(?<=\\})|(?=;)", "patterns": [ { "match": "(@?[_[:alpha:]][_[:alnum:]]*)\\b", "captures": { "1": { "name": "entity.name.function.apex" } } }, { "begin": "(:)", "beginCaptures": { "1": { "name": "punctuation.separator.colon.apex" } }, "end": "(?=\\{|=>)", "patterns": [ { "include": "#constructor-initializer" } ] }, { "include": "#parenthesized-parameter-list" }, { "include": "#comment" }, { "include": "#expression-body" }, { "include": "#block" } ] }, "constructor-initializer": { "begin": "\\b(?:(this))\\b\\s*(?=\\()", "beginCaptures": { "1": { "name": "keyword.other.this.apex" } }, "end": "(?<=\\))", "patterns": [ { "include": "#argument-list" } ] }, "block": { "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.curlybrace.open.apex" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.curlybrace.close.apex" } }, "patterns": [ { "include": "#statement" } ] }, "variable-initializer": { "begin": "(?)", "beginCaptures": { "1": { "name": "keyword.operator.assignment.apex" } }, "end": "(?=[,\\)\\];}])", "patterns": [ { "include": "#expression" } ] }, "expression-body": { "begin": "=>", "beginCaptures": { "0": { "name": "keyword.operator.arrow.apex" } }, "end": "(?=[,\\);}])", "patterns": [ { "include": "#expression" } ] }, "goto-statement": { "begin": "(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?:(\\g)\\b)?", "captures": { "1": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] }, "5": { "name": "entity.name.variable.local.apex" } } } ] }, { "include": "#comment" }, { "include": "#block" } ] }, "local-declaration": { "patterns": [ { "include": "#local-constant-declaration" }, { "include": "#local-variable-declaration" } ] }, "local-variable-declaration": { "begin": "(?x)\n(?:\n (?:(\\bref)\\s+)?(\\bvar\\b)| # ref local\n (?\n (?:\n (?:ref\\s+)? # ref local\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n )\n)\\s+\n(\\g)\\s*\n(?=,|;|=|\\))", "beginCaptures": { "1": { "name": "storage.modifier.apex" }, "2": { "name": "keyword.other.var.apex" }, "3": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] }, "7": { "name": "entity.name.variable.local.apex" } }, "end": "(?=;|\\))", "patterns": [ { "name": "entity.name.variable.local.apex", "match": "@?[_[:alpha:]][_[:alnum:]]*" }, { "include": "#punctuation-comma" }, { "include": "#comment" }, { "include": "#variable-initializer" } ] }, "local-constant-declaration": { "begin": "(?x)\n(?\\b(?:const)\\b)\\s*\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+\n(\\g)\\s*\n(?=,|;|=)", "beginCaptures": { "1": { "name": "storage.modifier.apex" }, "2": { "patterns": [ { "include": "#type" } ] }, "6": { "name": "entity.name.variable.local.apex" } }, "end": "(?=;)", "patterns": [ { "name": "entity.name.variable.local.apex", "match": "@?[_[:alpha:]][_[:alnum:]]*" }, { "include": "#punctuation-comma" }, { "include": "#comment" }, { "include": "#variable-initializer" } ] }, "throw-expression": { "match": "(?>=|\\|=" }, { "name": "keyword.operator.bitwise.shift.apex", "match": "<<|>>" }, { "name": "keyword.operator.comparison.apex", "match": "==|!=" }, { "name": "keyword.operator.relational.apex", "match": "<=|>=|<|>" }, { "name": "keyword.operator.logical.apex", "match": "\\!|&&|\\|\\|" }, { "name": "keyword.operator.bitwise.apex", "match": "\\&|~|\\^|\\|" }, { "name": "keyword.operator.assignment.apex", "match": "\\=" }, { "name": "keyword.operator.decrement.apex", "match": "--" }, { "name": "keyword.operator.increment.apex", "match": "\\+\\+" }, { "name": "keyword.operator.arithmetic.apex", "match": "%|\\*|/|-|\\+" } ] }, "conditional-operator": { "begin": "(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(\\))(?=\\s*@?[_[:alnum:]\\(])", "captures": { "1": { "name": "punctuation.parenthesis.open.apex" }, "2": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] }, "6": { "name": "punctuation.parenthesis.close.apex" } } }, "this-expression": { "match": "\\b(?:(this))\\b", "captures": { "1": { "name": "keyword.other.this.apex" } } }, "invocation-expression": { "begin": "(?x)\n(?:(\\??\\.)\\s*)? # safe navigator or accessor\n(@?[_[:alpha:]][_[:alnum:]]*)\\s* # method name\n(?\\s*<([^<>]|\\g)+>\\s*)?\\s* # type arguments\n(?=\\() # open paren of argument list", "beginCaptures": { "1": { "patterns": [ { "include": "#punctuation-accessor" }, { "include": "#operator-safe-navigation" } ] }, "2": { "name": "entity.name.function.apex" }, "3": { "patterns": [ { "include": "#type-arguments" } ] } }, "end": "(?<=\\))", "patterns": [ { "include": "#argument-list" } ] }, "element-access-expression": { "begin": "(?x)\n(?:(\\??\\.)\\s*)? # safe navigator or accessor\n(?:(@?[_[:alpha:]][_[:alnum:]]*)\\s*)? # property name\n(?:(\\?)\\s*)? # null-conditional operator?\n(?=\\[) # open bracket of argument list", "beginCaptures": { "1": { "patterns": [ { "include": "#punctuation-accessor" }, { "include": "#operator-safe-navigation" } ] }, "2": { "name": "variable.other.object.property.apex" }, "3": { "name": "keyword.operator.null-conditional.apex" } }, "end": "(?<=\\])(?!\\s*\\[)", "patterns": [ { "include": "#bracketed-argument-list" } ] }, "member-access-expression": { "patterns": [ { "match": "(?x)\n(\\??\\.)\\s* # safe navigator or accessor\n(@?[_[:alpha:]][_[:alnum:]]*)\\s* # property name\n(?![_[:alnum:]]|\\(|(\\?)?\\[|<) # next character is not alpha-numeric, nor a (, [, or <. Also, test for ?[", "captures": { "1": { "patterns": [ { "include": "#punctuation-accessor" }, { "include": "#operator-safe-navigation" } ] }, "2": { "name": "variable.other.object.property.apex" } } }, { "match": "(?x)\n(\\??\\.)?\\s*\n(@?[_[:alpha:]][_[:alnum:]]*)\n(?\\s*<([^<>]|\\g)+>\\s*)\n(?=\n (\\s*\\?)?\n \\s*\\.\\s*@?[_[:alpha:]][_[:alnum:]]*\n)", "captures": { "1": { "patterns": [ { "include": "#punctuation-accessor" }, { "include": "#operator-safe-navigation" } ] }, "2": { "name": "variable.other.object.apex" }, "3": { "patterns": [ { "include": "#type-arguments" } ] } } }, { "match": "(?x)\n(@?[_[:alpha:]][_[:alnum:]]*)\n(?=\n (\\s*\\?)?\n \\s*\\.\\s*@?[_[:alpha:]][_[:alnum:]]*\n)", "captures": { "1": { "name": "variable.other.object.apex" } } } ] }, "object-creation-expression": { "patterns": [ { "include": "#object-creation-expression-with-parameters" }, { "include": "#object-creation-expression-with-no-parameters" }, { "include": "#punctuation-comma" } ] }, "object-creation-expression-with-parameters": { "begin": "(?x)\n(delete|insert|undelete|update|upsert)?\n\\s*(new)\\s+\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?=\\()", "beginCaptures": { "1": { "name": "support.function.apex" }, "2": { "name": "keyword.control.new.apex" }, "3": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] } }, "end": "(?<=\\))", "patterns": [ { "include": "#argument-list" } ] }, "object-creation-expression-with-no-parameters": { "match": "(?x)\n(delete|insert|undelete|update|upsert)?\n\\s*(new)\\s+\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s*\n(?=\\{|$)", "captures": { "1": { "name": "support.function.apex" }, "2": { "name": "keyword.control.new.apex" }, "3": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] } } }, "array-creation-expression": { "begin": "(?x)\n\\b(new)\\b\\s*\n(?\n (?:\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)?\\s*\n(?=\\[)", "beginCaptures": { "1": { "name": "keyword.control.new.apex" }, "2": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] } }, "end": "(?<=\\])", "patterns": [ { "include": "#bracketed-argument-list" } ] }, "parenthesized-parameter-list": { "begin": "(\\()", "beginCaptures": { "0": { "name": "punctuation.parenthesis.open.apex" } }, "end": "(\\))", "endCaptures": { "0": { "name": "punctuation.parenthesis.close.apex" } }, "patterns": [ { "include": "#comment" }, { "include": "#parameter" }, { "include": "#punctuation-comma" }, { "include": "#variable-initializer" } ] }, "parameter": { "match": "(?x)\n(?:(?:\\b(this)\\b)\\s+)?\n(?\n (?:\n (?:ref\\s+)? # ref return\n (?:\n (?:(?@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (? # identifier + type arguments (if any)\n \\g\\s*\n (?\\s*<(?:[^<>]|\\g)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g)*\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+\n(\\g)", "captures": { "1": { "name": "storage.modifier.apex" }, "2": { "patterns": [ { "include": "#support-type" }, { "include": "#type" } ] }, "6": { "name": "entity.name.variable.parameter.apex" } } }, "argument-list": { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.parenthesis.open.apex" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.parenthesis.close.apex" } }, "patterns": [ { "include": "#named-argument" }, { "include": "#expression" }, { "include": "#punctuation-comma" } ] }, "bracketed-argument-list": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.squarebracket.open.apex" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.squarebracket.close.apex" } }, "patterns": [ { "include": "#soql-query-expression" }, { "include": "#named-argument" }, { "include": "#expression" }, { "include": "#punctuation-comma" } ] }, "named-argument": { "begin": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(:)", "beginCaptures": { "1": { "name": "entity.name.variable.parameter.apex" }, "2": { "name": "punctuation.separator.colon.apex" } }, "end": "(?=(,|\\)|\\]))", "patterns": [ { "include": "#expression" } ] }, "type": { "name": "meta.type.apex", "patterns": [ { "include": "#comment" }, { "include": "#type-builtin" }, { "include": "#type-name" }, { "include": "#type-arguments" }, { "include": "#type-array-suffix" }, { "include": "#type-nullable-suffix" } ] }, "type-builtin": { "match": "\\b(Blob|Boolean|byte|Date|Datetime|Decimal|Double|ID|Integer|Long|Object|String|Time|void)\\b", "captures": { "1": { "name": "keyword.type.apex" } } }, "type-name": { "patterns": [ { "match": "(@?[_[:alpha:]][_[:alnum:]]*)\\s*(\\.)", "captures": { "1": { "name": "storage.type.apex" }, "2": { "name": "punctuation.accessor.apex" } } }, { "match": "(\\.)\\s*(@?[_[:alpha:]][_[:alnum:]]*)", "captures": { "1": { "name": "punctuation.accessor.apex" }, "2": { "name": "storage.type.apex" } } }, { "name": "storage.type.apex", "match": "@?[_[:alpha:]][_[:alnum:]]*" } ] }, "type-arguments": { "begin": "<", "beginCaptures": { "0": { "name": "punctuation.definition.typeparameters.begin.apex" } }, "end": ">", "endCaptures": { "0": { "name": "punctuation.definition.typeparameters.end.apex" } }, "patterns": [ { "include": "#comment" }, { "include": "#support-type" }, { "include": "#type" }, { "include": "#punctuation-comma" } ] }, "type-array-suffix": { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.squarebracket.open.apex" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.squarebracket.close.apex" } }, "patterns": [ { "include": "#punctuation-comma" } ] }, "type-nullable-suffix": { "match": "\\?", "captures": { "0": { "name": "punctuation.separator.question-mark.apex" } } }, "operator-assignment": { "name": "keyword.operator.assignment.apex", "match": "(?)", "endCaptures": { "1": { "name": "punctuation.definition.tag.apex" } }, "patterns": [ { "include": "#xml-attribute" } ] }, "xml-attribute": { "patterns": [ { "match": "(?x)\n(?:^|\\s+)\n(\n (?:\n ([-_[:alnum:]]+)\n (:)\n )?\n ([-_[:alnum:]]+)\n)\n(=)", "captures": { "1": { "name": "entity.other.attribute-name.apex" }, "2": { "name": "entity.other.attribute-name.namespace.apex" }, "3": { "name": "punctuation.separator.colon.apex" }, "4": { "name": "entity.other.attribute-name.localname.apex" }, "5": { "name": "punctuation.separator.equals.apex" } } }, { "include": "#xml-string" } ] }, "xml-cdata": { "name": "string.unquoted.cdata.apex", "begin": "", "endCaptures": { "0": { "name": "punctuation.definition.string.end.apex" } } }, "xml-string": { "patterns": [ { "name": "string.quoted.single.apex", "begin": "\\'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.apex" } }, "end": "\\'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.apex" } }, "patterns": [ { "include": "#xml-character-entity" } ] }, { "name": "string.quoted.double.apex", "begin": "\\\"", "beginCaptures": { "0": { "name": "punctuation.definition.stringdoublequote.begin.apex" } }, "end": "\\\"", "endCaptures": { "0": { "name": "punctuation.definition.stringdoublequote.end.apex" } }, "patterns": [ { "include": "#xml-character-entity" } ] } ] }, "xml-character-entity": { "patterns": [ { "name": "constant.character.entity.apex", "match": "(?x)\n(&)\n(\n (?:[[:alpha:]:_][[:alnum:]:_.-]*)|\n (?:\\#[[:digit:]]+)|\n (?:\\#x[[:xdigit:]]+)\n)\n(;)", "captures": { "1": { "name": "punctuation.definition.constant.apex" }, "3": { "name": "punctuation.definition.constant.apex" } } }, { "name": "invalid.illegal.bad-ampersand.apex", "match": "&" } ] }, "xml-comment": { "name": "comment.block.apex", "begin": "", "endCaptures": { "0": { "name": "punctuation.definition.comment.apex" } } } } }