Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Fixed namespace token #2295

Merged
merged 3 commits into from Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/prism-java.js
Expand Up @@ -44,7 +44,9 @@
lookbehind: true
},
'namespace': {
pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(?:\.[a-z]\w*)+/,
pattern: RegExp(
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
.source.replace(/<keyword>/g, function () { return keywords.source; })),
lookbehind: true,
inside: {
'punctuation': /\./,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-java.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

269 changes: 124 additions & 145 deletions tests/languages/java/module_feature.test
@@ -1,156 +1,135 @@
module com.js.prism {
exports java.net.http;
exports jdk.internal.editor.spi to jdk.jshell;
exports java.net.http;
exports jdk.internal.editor.spi to jdk.jshell;

requires java.base;
requires transitive java.xml;
requires java.base;
requires transitive java.xml;

uses java.net.ContentHandlerFactory;
uses java.net.ContentHandlerFactory;

opens java.time.DateTime;
opens java.time.LocalDateTime to java.logging;

provides com.modules.hello.HelloInterface with com.modules.hello.HelloModules;
opens java.time.DateTime;
opens java.time.LocalDateTime to java.logging;

provides com.modules.hello.HelloInterface with com.modules.hello.HelloModules;
}


----------------------------------------------------
[
["keyword", "module"],
["namespace",
["com",
["punctuation", "."],
"js",
["punctuation", "."],
"prism"
]
],
["punctuation", "{"],

["keyword", "exports"],
["namespace",
[
"java",
["punctuation", "."],
"net",
["punctuation", "."],
"http"
]
],
["punctuation", ";"],

["keyword", "exports"],
["namespace",
[
"jdk",
["punctuation", "."],
"internal",
["punctuation", "."],
"editor",
["punctuation", "."],
"spi"
]
],
["keyword", "to"],
["namespace",
[
"jdk",
["punctuation", "."],
"jshell"
]
],
["punctuation", ";"],

["keyword", "requires"],
["namespace",
[
"java",
["punctuation", "."],
"base"
]
],
["punctuation", ";"],

["keyword", "requires"],
["keyword", "transitive"],
["namespace",
[
"java",
["punctuation", "."],
"xml"
]
],
["punctuation", ";"],

["keyword", "uses"],
["namespace",
[
"java",
["punctuation", "."],
"net"
]
],
["punctuation", "."],
["class-name", "ContentHandlerFactory"],
["punctuation", ";"],

["keyword", "opens"],
["namespace",
[
"java",
["punctuation", "."],
"time"
]
],
["punctuation", "."],
["class-name", "DateTime"],
["punctuation", ";"],
["keyword", "opens"],
["namespace",
[
"java",
["punctuation", "."],
"time"
]
],
["punctuation", "."],
["class-name", "LocalDateTime"],
["keyword", "to"],
["namespace",
[
"java",
["punctuation", "."],
"logging"
]
],
["punctuation", ";"],
["keyword", "provides"],
["namespace",
[
"com",
["punctuation", "."],
"modules",
["punctuation", "."],
"hello"
]
],
["punctuation", "."],
["class-name", "HelloInterface"],
["keyword", "with"],
["namespace",
[
"com",
["punctuation", "."],
"modules",
["punctuation", "."],
"hello"
]
],
["punctuation", "."],
["class-name", "HelloModules"],
["punctuation", ";"],
["punctuation", "}"]

[
["keyword", "module"],
["namespace", [
"com",
["punctuation", "."],
"js",
["punctuation", "."],
"prism"
]],
["punctuation", "{"],

["keyword", "exports"],
["namespace", [
"java",
["punctuation", "."],
"net",
["punctuation", "."],
"http"
]],
["punctuation", ";"],

["keyword", "exports"],
["namespace", [
"jdk",
["punctuation", "."],
"internal",
["punctuation", "."],
"editor",
["punctuation", "."],
"spi"
]],
["keyword", "to"],
["namespace", [
"jdk",
["punctuation", "."],
"jshell"
]],
["punctuation", ";"],

["keyword", "requires"],
["namespace", [
"java",
["punctuation", "."],
"base"
]],
["punctuation", ";"],

["keyword", "requires"],
["keyword", "transitive"],
["namespace", [
"java",
["punctuation", "."],
"xml"
]],
["punctuation", ";"],

["keyword", "uses"],
["namespace", [
"java",
["punctuation", "."],
"net",
["punctuation", "."]
]],
["class-name", "ContentHandlerFactory"],
["punctuation", ";"],

["keyword", "opens"],
["namespace", [
"java",
["punctuation", "."],
"time",
["punctuation", "."]
]],
["class-name", "DateTime"],
["punctuation", ";"],

["keyword", "opens"],
["namespace", [
"java",
["punctuation", "."],
"time",
["punctuation", "."]
]],
["class-name", "LocalDateTime"],
["keyword", "to"],
["namespace", [
"java",
["punctuation", "."],
"logging"
]],
["punctuation", ";"],

["keyword", "provides"],
["namespace", [
"com",
["punctuation", "."],
"modules",
["punctuation", "."],
"hello",
["punctuation", "."]
]],
["class-name", "HelloInterface"],
["keyword", "with"],
["namespace", [
"com",
["punctuation", "."],
"modules",
["punctuation", "."],
"hello",
["punctuation", "."]
]],
["class-name", "HelloModules"],
["punctuation", ";"],

["punctuation", "}"]
]

----------------------------------------------------
Expand Down