Skip to content

Commit

Permalink
Java: Fixed namespace token (#2295)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Apr 9, 2020
1 parent abb800d commit 62e184b
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 159 deletions.
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

0 comments on commit 62e184b

Please sign in to comment.