{ "information_for_contributors": [ "This file has been converted from https://github.com/atom/language-java/blob/master/grammars/java.cson", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/atom/language-java/commit/2e179ceac423403eb5bf0eff26884093c3edba6f", "name": "Java", "scopeName": "source.java", "patterns": [ { "begin": "\\b(package)\\b\\s*", "beginCaptures": { "1": { "name": "keyword.other.package.java" } }, "end": "\\s*(;)", "endCaptures": { "1": { "name": "punctuation.terminator.java" } }, "name": "meta.package.java", "contentName": "storage.modifier.package.java", "patterns": [ { "include": "#comments" }, { "match": "(?<=\\.)\\s*\\.|\\.(?=\\s*;)", "name": "invalid.illegal.character_not_allowed_here.java" }, { "match": "(?", "endCaptures": { "0": { "name": "punctuation.bracket.angle.java" } }, "patterns": [ { "match": "\\b(extends|super)\\b", "name": "storage.modifier.$1.java" }, { "match": "(?>>?|~|\\^)", "name": "keyword.operator.bitwise.java" }, { "match": "((&|\\^|\\||<<|>>>?)=)", "name": "keyword.operator.assignment.bitwise.java" }, { "match": "(===?|!=|<=|>=|<>|<|>)", "name": "keyword.operator.comparison.java" }, { "match": "([+*/%-]=)", "name": "keyword.operator.assignment.arithmetic.java" }, { "match": "(=)", "name": "keyword.operator.assignment.java" }, { "match": "(\\-\\-|\\+\\+)", "name": "keyword.operator.increment-decrement.java" }, { "match": "(\\-|\\+|\\*|\\/|%)", "name": "keyword.operator.arithmetic.java" }, { "match": "(!|&&|\\|\\|)", "name": "keyword.operator.logical.java" }, { "match": "(\\||&)", "name": "keyword.operator.bitwise.java" }, { "match": "\\b(const|goto)\\b", "name": "keyword.reserved.java" } ] }, "lambda-expression": { "patterns": [ { "match": "->", "name": "storage.type.function.arrow.java" } ] }, "member-variables": { "begin": "(?=private|protected|public|native|synchronized|abstract|threadsafe|transient|static|final)", "end": "(?=\\=|;)", "patterns": [ { "include": "#storage-modifiers" }, { "include": "#variables" }, { "include": "#primitive-arrays" }, { "include": "#object-types" } ] }, "method-call": { "begin": "(\\.)\\s*([A-Za-z_$][\\w$]*)\\s*(\\()", "beginCaptures": { "1": { "name": "punctuation.separator.period.java" }, "2": { "name": "entity.name.function.java" }, "3": { "name": "punctuation.definition.parameters.begin.bracket.round.java" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.bracket.round.java" } }, "name": "meta.method-call.java", "patterns": [ { "include": "#code" } ] }, "methods": { "begin": "(?!new)(?=[\\w<].*\\s+)(?=([^=/]|/(?!/))+\\()", "end": "(})|(?=;)", "endCaptures": { "1": { "name": "punctuation.section.method.end.bracket.curly.java" } }, "name": "meta.method.java", "patterns": [ { "include": "#storage-modifiers" }, { "begin": "(\\w+)\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.java" }, "2": { "name": "punctuation.definition.parameters.begin.bracket.round.java" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.bracket.round.java" } }, "name": "meta.method.identifier.java", "patterns": [ { "include": "#parameters" }, { "include": "#parens" }, { "include": "#comments" } ] }, { "include": "#generics" }, { "begin": "(?=\\w.*\\s+\\w+\\s*\\()", "end": "(?=\\s+\\w+\\s*\\()", "name": "meta.method.return-type.java", "patterns": [ { "include": "#all-types" }, { "include": "#parens" }, { "include": "#comments" } ] }, { "include": "#throws" }, { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.method.begin.bracket.curly.java" } }, "end": "(?=})", "contentName": "meta.method.body.java", "patterns": [ { "include": "#code" } ] }, { "include": "#comments" } ] }, "module": { "begin": "((open)\\s)?(module)\\s+(\\w+)", "end": "}", "beginCaptures": { "1": { "name": "storage.modifier.java" }, "3": { "name": "storage.modifier.java" }, "4": { "name": "entity.name.type.module.java" } }, "endCaptures": { "0": { "name": "punctuation.section.module.end.bracket.curly.java" } }, "name": "meta.module.java", "patterns": [ { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.module.begin.bracket.curly.java" } }, "end": "(?=})", "contentName": "meta.module.body.java", "patterns": [ { "match": "\\b(requires|transitive|exports|opens|to|uses|provides|with)\\b", "name": "keyword.module.java" } ] } ] }, "numbers": { "patterns": [ { "match": "(?x)\n\\b(?)?(\\()", "beginCaptures": { "1": { "name": "storage.modifier.java" }, "2": { "name": "entity.name.type.record.java" }, "3": { "patterns": [ { "include": "#generics" } ] }, "4": { "name": "punctuation.definition.parameters.begin.bracket.round.java" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.bracket.round.java" } }, "name": "meta.record.identifier.java", "patterns": [ { "include": "#code" } ] }, { "begin": "(implements)\\s", "beginCaptures": { "1": { "name": "storage.modifier.implements.java" } }, "end": "(?=\\s*\\{)", "name": "meta.definition.class.implemented.interfaces.java", "patterns": [ { "include": "#object-types-inherited" }, { "include": "#comments" } ] }, { "include": "#record-body" } ] }, "record-body": { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.class.begin.bracket.curly.java" } }, "end": "(?=})", "name": "meta.record.body.java", "patterns": [ { "include": "#record-constructor" }, { "include": "#class-body" } ] }, "record-constructor": { "begin": "(?!new)(?=[\\w<].*\\s+)(?=([^\\(=/]|/(?!/))+(?={))", "end": "(})|(?=;)", "endCaptures": { "1": { "name": "punctuation.section.method.end.bracket.curly.java" } }, "name": "meta.method.java", "patterns": [ { "include": "#storage-modifiers" }, { "begin": "(\\w+)", "beginCaptures": { "1": { "name": "entity.name.function.java" } }, "end": "(?=\\s*{)", "name": "meta.method.identifier.java", "patterns": [ { "include": "#comments" } ] }, { "include": "#comments" }, { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.method.begin.bracket.curly.java" } }, "end": "(?=})", "contentName": "meta.method.body.java", "patterns": [ { "include": "#code" } ] } ] }, "static-initializer": { "patterns": [ { "include": "#anonymous-block-and-instance-initializer" }, { "match": "static", "name": "storage.modifier.java" } ] }, "storage-modifiers": { "match": "\\b(public|private|protected|static|final|native|synchronized|abstract|threadsafe|transient|volatile|default|strictfp)\\b", "name": "storage.modifier.java" }, "strings": { "patterns": [ { "begin": "\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.java" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.java" } }, "name": "string.quoted.double.java", "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.java" } ] }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.java" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.java" } }, "name": "string.quoted.single.java", "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.java" } ] } ] }, "throws": { "begin": "throws", "beginCaptures": { "0": { "name": "storage.modifier.java" } }, "end": "(?={|;)", "name": "meta.throwables.java", "patterns": [ { "match": ",", "name": "punctuation.separator.delimiter.java" }, { "match": "[a-zA-Z$_][\\.a-zA-Z0-9$_]*", "name": "storage.type.java" } ] }, "try-catch-finally": { "patterns": [ { "begin": "\\btry\\b", "beginCaptures": { "0": { "name": "keyword.control.try.java" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.section.try.end.bracket.curly.java" } }, "name": "meta.try.java", "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.section.try.resources.begin.bracket.round.java" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.try.resources.end.bracket.round.java" } }, "name": "meta.try.resources.java", "patterns": [ { "include": "#code" } ] }, { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.try.begin.bracket.curly.java" } }, "end": "(?=})", "contentName": "meta.try.body.java", "patterns": [ { "include": "#code" } ] } ] }, { "begin": "\\b(catch)\\b", "beginCaptures": { "1": { "name": "keyword.control.catch.java" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.section.catch.end.bracket.curly.java" } }, "name": "meta.catch.java", "patterns": [ { "include": "#comments" }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.parameters.begin.bracket.round.java" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.end.bracket.round.java" } }, "contentName": "meta.catch.parameters.java", "patterns": [ { "include": "#comments" }, { "include": "#storage-modifiers" }, { "begin": "[a-zA-Z$_][\\.a-zA-Z0-9$_]*", "beginCaptures": { "0": { "name": "storage.type.java" } }, "end": "(\\|)|(?=\\))", "endCaptures": { "1": { "name": "punctuation.catch.separator.java" } }, "patterns": [ { "include": "#comments" }, { "match": "\\w+", "captures": { "0": { "name": "variable.parameter.java" } } } ] } ] }, { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.catch.begin.bracket.curly.java" } }, "end": "(?=})", "contentName": "meta.catch.body.java", "patterns": [ { "include": "#code" } ] } ] }, { "begin": "\\bfinally\\b", "beginCaptures": { "0": { "name": "keyword.control.finally.java" } }, "end": "}", "endCaptures": { "0": { "name": "punctuation.section.finally.end.bracket.curly.java" } }, "name": "meta.finally.java", "patterns": [ { "begin": "{", "beginCaptures": { "0": { "name": "punctuation.section.finally.begin.bracket.curly.java" } }, "end": "(?=})", "contentName": "meta.finally.body.java", "patterns": [ { "include": "#code" } ] } ] } ] }, "variables": { "begin": "(?x)\n(?=\n (\n \\b(void|boolean|byte|char|short|int|float|long|double)\\b\n |\n (?>(\\w+\\.)*[A-Z_]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n \\s*\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap`, or `List`\n )?\n \\s*\n (\n (\\[\\])* # int[][]\n )?\n \\s+\n [A-Za-z_$][\\w$]* # At least one identifier after space\n ([\\w\\[\\],$][\\w\\[\\],\\s]*)? # possibly primitive array or additional identifiers\n \\s*(=|:|;)\n)", "end": "(?=\\=|:|;)", "name": "meta.definition.variable.java", "patterns": [ { "match": "([A-Za-z$_][\\w$]*)(?=\\s*(\\[\\])*\\s*(;|:|=|,))", "captures": { "1": { "name": "variable.other.definition.java" } } }, { "include": "#all-types" }, { "include": "#code" } ] }, "variables-local": { "begin": "(?=\\b(var)\\b\\s+[A-Za-z_$][\\w$]*\\s*(=|:|;))", "end": "(?=\\=|:|;)", "name": "meta.definition.variable.local.java", "patterns": [ { "match": "\\bvar\\b", "name": "storage.type.local.java" }, { "match": "([A-Za-z$_][\\w$]*)(?=\\s*(\\[\\])*\\s*(=|:|;))", "captures": { "1": { "name": "variable.other.definition.java" } } }, { "include": "#code" } ] } } }