提交 de24a902 编写于 作者: M Martin Aeschlimann

[java] update grammar

上级 404e7375
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.", "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." "Once accepted there, we are happy to receive an update request."
], ],
"version": "https://github.com/atom/language-java/commit/2f20bc5a5b07686ec0139e2969431210d81b6991", "version": "https://github.com/atom/language-java/commit/f213dfac7dc3726170046c8f0c174c9e9f13e4ce",
"name": "Java", "name": "Java",
"scopeName": "source.java", "scopeName": "source.java",
"patterns": [ "patterns": [
...@@ -183,6 +183,25 @@ ...@@ -183,6 +183,25 @@
} }
] ]
}, },
"anonymous-block-and-instance-initializer": {
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.block.begin.bracket.curly.java"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.block.end.bracket.curly.java"
}
},
"patterns": [
{
"include": "#code"
}
]
},
"anonymous-classes-and-new": { "anonymous-classes-and-new": {
"begin": "\\bnew\\b", "begin": "\\bnew\\b",
"beginCaptures": { "beginCaptures": {
...@@ -370,36 +389,6 @@ ...@@ -370,36 +389,6 @@
} }
] ]
}, },
"anonymous-block-and-instance-initializer": {
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.block.begin.bracket.curly.java"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.block.end.bracket.curly.java"
}
},
"patterns": [
{
"include": "#code"
}
]
},
"static-initializer": {
"patterns": [
{
"include": "#anonymous-block-and-instance-initializer"
},
{
"match": "static",
"name": "storage.modifier.java"
}
]
},
"code": { "code": {
"patterns": [ "patterns": [
{ {
...@@ -451,13 +440,13 @@ ...@@ -451,13 +440,13 @@
"include": "#function-call" "include": "#function-call"
}, },
{ {
"include": "#objects" "include": "#variables"
}, },
{ {
"include": "#properties" "include": "#objects"
}, },
{ {
"include": "#variables" "include": "#properties"
}, },
{ {
"include": "#strings" "include": "#strings"
...@@ -594,174 +583,83 @@ ...@@ -594,174 +583,83 @@
} }
] ]
}, },
"try-catch-finally": { "constants-and-special-vars": {
"patterns": [ "patterns": [
{ {
"begin": "\\btry\\b", "match": "\\b(true|false|null)\\b",
"beginCaptures": { "name": "constant.language.java"
"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\\s*(?=\\(\\s*[^\\s]+\\s*[^)]+\\))", "match": "\\bthis\\b",
"name": "variable.language.this.java"
},
{
"match": "\\bsuper\\b",
"name": "variable.language.java"
}
]
},
"enums": {
"begin": "^\\s*(enum)\\s+(\\w+)",
"beginCaptures": {
"1": {
"name": "storage.modifier.java"
},
"2": {
"name": "entity.name.type.enum.java"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.enum.end.bracket.curly.java"
}
},
"name": "meta.enum.java",
"patterns": [
{
"begin": "{",
"beginCaptures": { "beginCaptures": {
"1": {
"name": "keyword.control.catch.java"
}
},
"end": "}",
"endCaptures": {
"0": { "0": {
"name": "punctuation.section.catch.end.bracket.curly.java" "name": "punctuation.section.enum.begin.bracket.curly.java"
} }
}, },
"name": "meta.catch.java", "end": "(?=})",
"patterns": [ "patterns": [
{ {
"begin": "\\(", "match": "\\w+",
"beginCaptures": { "name": "constant.other.enum.java"
"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"
},
{
"match": "\\|",
"name": "punctuation.catch.separator.java"
},
{
"match": "([a-zA-Z$_][\\.a-zA-Z0-9$_]*)\\s*(\\w+)?",
"captures": {
"1": {
"name": "storage.type.java"
},
"2": {
"name": "variable.parameter.java"
}
}
}
]
}, },
{ {
"begin": "{", "include": "#class-body"
"beginCaptures": {
"0": {
"name": "punctuation.section.catch.begin.bracket.curly.java"
}
},
"end": "(?=})",
"contentName": "meta.catch.body.java",
"patterns": [
{
"include": "#code"
}
]
} }
] ]
}, },
{ {
"begin": "\\bfinally\\b", "include": "#comments"
"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"
}
]
}
]
} }
] ]
}, },
"constants-and-special-vars": { "function-call": {
"patterns": [ "begin": "([A-Za-z_$][\\w$]*)\\s*(\\()",
{ "beginCaptures": {
"match": "\\b(true|false|null)\\b", "1": {
"name": "constant.language.java" "name": "entity.name.function.java"
},
{
"match": "\\bthis\\b",
"name": "variable.language.this.java"
}, },
"2": {
"name": "punctuation.definition.parameters.begin.bracket.round.java"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.parameters.end.bracket.round.java"
}
},
"name": "meta.function-call.java",
"patterns": [
{ {
"match": "\\bsuper\\b", "include": "#code"
"name": "variable.language.java"
} }
] ]
}, },
...@@ -811,81 +709,17 @@ ...@@ -811,81 +709,17 @@
"name": "punctuation.separator.delimiter.java" "name": "punctuation.separator.delimiter.java"
}, },
{ {
"match": "\\.", "match": "\\.",
"name": "punctuation.separator.period.java" "name": "punctuation.separator.period.java"
},
{
"include": "#parens"
},
{
"include": "#generics"
},
{
"include": "#comments"
}
]
},
"enums": {
"begin": "^\\s*(enum)\\s+(\\w+)",
"beginCaptures": {
"1": {
"name": "storage.modifier.java"
},
"2": {
"name": "entity.name.type.enum.java"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.enum.end.bracket.curly.java"
}
},
"name": "meta.enum.java",
"patterns": [
{
"begin": "{",
"beginCaptures": {
"0": {
"name": "punctuation.section.enum.begin.bracket.curly.java"
}
},
"end": "(?=})",
"patterns": [
{
"match": "\\w+",
"name": "constant.other.enum.java"
},
{
"include": "#class-body"
}
]
},
{
"include": "#comments"
}
]
},
"function-call": {
"begin": "([A-Za-z_$][\\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.function-call.java",
"patterns": [
{ {
"include": "#code" "include": "#parens"
},
{
"include": "#generics"
},
{
"include": "#comments"
} }
] ]
}, },
...@@ -957,6 +791,24 @@ ...@@ -957,6 +791,24 @@
} }
] ]
}, },
"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": { "method-call": {
"begin": "(\\.)\\s*([A-Za-z_$][\\w$]*)\\s*(\\()", "begin": "(\\.)\\s*([A-Za-z_$][\\w$]*)\\s*(\\()",
"beginCaptures": { "beginCaptures": {
...@@ -1129,10 +981,19 @@ ...@@ -1129,10 +981,19 @@
"include": "#generics" "include": "#generics"
}, },
{ {
"begin": "\\b(?:[A-Z]\\w*\\s*(\\.)\\s*)*([A-Z]\\w*)\\s*(?=\\[)", "begin": "\\b((?:[A-Za-z]\\w*\\s*\\.\\s*)*)([A-Z]\\w*)\\s*(?=\\[)",
"beginCaptures": { "beginCaptures": {
"1": { "1": {
"name": "punctuation.separator.period.java" "patterns": [
{
"match": "[A-Za-z]\\w*",
"name": "storage.type.java"
},
{
"match": "\\.",
"name": "punctuation.separator.period.java"
}
]
}, },
"2": { "2": {
"name": "storage.type.object.array.java" "name": "storage.type.object.array.java"
...@@ -1149,28 +1010,36 @@ ...@@ -1149,28 +1010,36 @@
] ]
}, },
{ {
"begin": "\\b((?:[A-Z]\\w*\\s*(\\.)\\s*)*[A-Z]\\w*)\\s*(?=<)", "match": "\\b((?:[A-Za-z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)\\s*(?=<)",
"beginCaptures": { "captures": {
"1": { "1": {
"name": "storage.type.java" "patterns": [
}, {
"2": { "match": "[A-Za-z]\\w*",
"name": "punctuation.separator.period.java" "name": "storage.type.java"
} },
}, {
"end": "(?<=>)|(?!;)", "match": "\\.",
"patterns": [ "name": "punctuation.separator.period.java"
{ }
"include": "#generics" ]
} }
] }
}, },
{ {
"match": "\\b(?:[A-Z]\\w*\\s*(\\.)\\s*)*[A-Z]\\w*\\b((?=\\s*[A-Za-z$_\\n])|(?=\\s*\\.\\.\\.))", "match": "\\b((?:[A-Za-z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)\\b((?=\\s*[A-Za-z$_\\n])|(?=\\s*\\.\\.\\.))",
"name": "storage.type.java",
"captures": { "captures": {
"1": { "1": {
"name": "punctuation.separator.period.java" "patterns": [
{
"match": "[A-Za-z]\\w*",
"name": "storage.type.java"
},
{
"match": "\\.",
"name": "punctuation.separator.period.java"
}
]
} }
} }
} }
...@@ -1352,6 +1221,17 @@ ...@@ -1352,6 +1221,17 @@
} }
] ]
}, },
"static-initializer": {
"patterns": [
{
"include": "#anonymous-block-and-instance-initializer"
},
{
"match": "static",
"name": "storage.modifier.java"
}
]
},
"storage-modifiers": { "storage-modifiers": {
"match": "\\b(public|private|protected|static|final|native|synchronized|abstract|threadsafe|transient|volatile|default|strictfp)\\b", "match": "\\b(public|private|protected|static|final|native|synchronized|abstract|threadsafe|transient|volatile|default|strictfp)\\b",
"name": "storage.modifier.java" "name": "storage.modifier.java"
...@@ -1422,6 +1302,161 @@ ...@@ -1422,6 +1302,161 @@
} }
] ]
}, },
"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\\s*(?=\\(\\s*[^\\s]+\\s*[^)]+\\))",
"beginCaptures": {
"1": {
"name": "keyword.control.catch.java"
}
},
"end": "}",
"endCaptures": {
"0": {
"name": "punctuation.section.catch.end.bracket.curly.java"
}
},
"name": "meta.catch.java",
"patterns": [
{
"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"
},
{
"match": "\\|",
"name": "punctuation.catch.separator.java"
},
{
"match": "([a-zA-Z$_][\\.a-zA-Z0-9$_]*)\\s*(\\w+)?",
"captures": {
"1": {
"name": "storage.type.java"
},
"2": {
"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": { "variables": {
"begin": "(?x)\n(?=\n (\n (void|boolean|byte|char|short|int|float|long|double)\n |\n (?>(\\w+\\.)*[A-Z]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap<Integer, String>`, or `List<java.lang.String>`\n )?\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)", "begin": "(?x)\n(?=\n (\n (void|boolean|byte|char|short|int|float|long|double)\n |\n (?>(\\w+\\.)*[A-Z]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap<Integer, String>`, or `List<java.lang.String>`\n )?\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": "(?=\\=|;)", "end": "(?=\\=|;)",
...@@ -1442,24 +1477,6 @@ ...@@ -1442,24 +1477,6 @@
"include": "#code" "include": "#code"
} }
] ]
},
"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"
}
]
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册