Skip to content

Commit 62e184b

Browse files
Java: Fixed namespace token (#2295)
1 parent abb800d commit 62e184b

File tree

5 files changed

+167
-159
lines changed

5 files changed

+167
-159
lines changed

components/prism-java.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
lookbehind: true
4545
},
4646
'namespace': {
47-
pattern: /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(?:\.[a-z]\w*)+/,
47+
pattern: RegExp(
48+
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
49+
.source.replace(/<keyword>/g, function () { return keywords.source; })),
4850
lookbehind: true,
4951
inside: {
5052
'punctuation': /\./,

components/prism-java.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/languages/java/module_feature.test

+124-145
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,135 @@
11
module com.js.prism {
2-
exports java.net.http;
3-
exports jdk.internal.editor.spi to jdk.jshell;
2+
exports java.net.http;
3+
exports jdk.internal.editor.spi to jdk.jshell;
44

5-
requires java.base;
6-
requires transitive java.xml;
5+
requires java.base;
6+
requires transitive java.xml;
77

8-
uses java.net.ContentHandlerFactory;
8+
uses java.net.ContentHandlerFactory;
99

10-
opens java.time.DateTime;
11-
opens java.time.LocalDateTime to java.logging;
12-
13-
provides com.modules.hello.HelloInterface with com.modules.hello.HelloModules;
10+
opens java.time.DateTime;
11+
opens java.time.LocalDateTime to java.logging;
1412

13+
provides com.modules.hello.HelloInterface with com.modules.hello.HelloModules;
1514
}
1615

17-
1816
----------------------------------------------------
19-
[
20-
["keyword", "module"],
21-
["namespace",
22-
["com",
23-
["punctuation", "."],
24-
"js",
25-
["punctuation", "."],
26-
"prism"
27-
]
28-
],
29-
["punctuation", "{"],
30-
31-
["keyword", "exports"],
32-
["namespace",
33-
[
34-
"java",
35-
["punctuation", "."],
36-
"net",
37-
["punctuation", "."],
38-
"http"
39-
]
40-
],
41-
["punctuation", ";"],
42-
43-
["keyword", "exports"],
44-
["namespace",
45-
[
46-
"jdk",
47-
["punctuation", "."],
48-
"internal",
49-
["punctuation", "."],
50-
"editor",
51-
["punctuation", "."],
52-
"spi"
53-
]
54-
],
55-
["keyword", "to"],
56-
["namespace",
57-
[
58-
"jdk",
59-
["punctuation", "."],
60-
"jshell"
61-
]
62-
],
63-
["punctuation", ";"],
64-
65-
["keyword", "requires"],
66-
["namespace",
67-
[
68-
"java",
69-
["punctuation", "."],
70-
"base"
71-
]
72-
],
73-
["punctuation", ";"],
74-
75-
["keyword", "requires"],
76-
["keyword", "transitive"],
77-
["namespace",
78-
[
79-
"java",
80-
["punctuation", "."],
81-
"xml"
82-
]
83-
],
84-
["punctuation", ";"],
85-
86-
["keyword", "uses"],
87-
["namespace",
88-
[
89-
"java",
90-
["punctuation", "."],
91-
"net"
92-
]
93-
],
94-
["punctuation", "."],
95-
["class-name", "ContentHandlerFactory"],
96-
["punctuation", ";"],
97-
98-
["keyword", "opens"],
99-
["namespace",
100-
[
101-
"java",
102-
["punctuation", "."],
103-
"time"
104-
]
105-
],
106-
["punctuation", "."],
107-
["class-name", "DateTime"],
108-
["punctuation", ";"],
109-
["keyword", "opens"],
110-
["namespace",
111-
[
112-
"java",
113-
["punctuation", "."],
114-
"time"
115-
]
116-
],
117-
["punctuation", "."],
118-
["class-name", "LocalDateTime"],
119-
["keyword", "to"],
120-
["namespace",
121-
[
122-
"java",
123-
["punctuation", "."],
124-
"logging"
125-
]
126-
],
127-
["punctuation", ";"],
128-
["keyword", "provides"],
129-
["namespace",
130-
[
131-
"com",
132-
["punctuation", "."],
133-
"modules",
134-
["punctuation", "."],
135-
"hello"
136-
]
137-
],
138-
["punctuation", "."],
139-
["class-name", "HelloInterface"],
140-
["keyword", "with"],
141-
["namespace",
142-
[
143-
"com",
144-
["punctuation", "."],
145-
"modules",
146-
["punctuation", "."],
147-
"hello"
148-
]
149-
],
150-
["punctuation", "."],
151-
["class-name", "HelloModules"],
152-
["punctuation", ";"],
153-
["punctuation", "}"]
17+
18+
[
19+
["keyword", "module"],
20+
["namespace", [
21+
"com",
22+
["punctuation", "."],
23+
"js",
24+
["punctuation", "."],
25+
"prism"
26+
]],
27+
["punctuation", "{"],
28+
29+
["keyword", "exports"],
30+
["namespace", [
31+
"java",
32+
["punctuation", "."],
33+
"net",
34+
["punctuation", "."],
35+
"http"
36+
]],
37+
["punctuation", ";"],
38+
39+
["keyword", "exports"],
40+
["namespace", [
41+
"jdk",
42+
["punctuation", "."],
43+
"internal",
44+
["punctuation", "."],
45+
"editor",
46+
["punctuation", "."],
47+
"spi"
48+
]],
49+
["keyword", "to"],
50+
["namespace", [
51+
"jdk",
52+
["punctuation", "."],
53+
"jshell"
54+
]],
55+
["punctuation", ";"],
56+
57+
["keyword", "requires"],
58+
["namespace", [
59+
"java",
60+
["punctuation", "."],
61+
"base"
62+
]],
63+
["punctuation", ";"],
64+
65+
["keyword", "requires"],
66+
["keyword", "transitive"],
67+
["namespace", [
68+
"java",
69+
["punctuation", "."],
70+
"xml"
71+
]],
72+
["punctuation", ";"],
73+
74+
["keyword", "uses"],
75+
["namespace", [
76+
"java",
77+
["punctuation", "."],
78+
"net",
79+
["punctuation", "."]
80+
]],
81+
["class-name", "ContentHandlerFactory"],
82+
["punctuation", ";"],
83+
84+
["keyword", "opens"],
85+
["namespace", [
86+
"java",
87+
["punctuation", "."],
88+
"time",
89+
["punctuation", "."]
90+
]],
91+
["class-name", "DateTime"],
92+
["punctuation", ";"],
93+
94+
["keyword", "opens"],
95+
["namespace", [
96+
"java",
97+
["punctuation", "."],
98+
"time",
99+
["punctuation", "."]
100+
]],
101+
["class-name", "LocalDateTime"],
102+
["keyword", "to"],
103+
["namespace", [
104+
"java",
105+
["punctuation", "."],
106+
"logging"
107+
]],
108+
["punctuation", ";"],
109+
110+
["keyword", "provides"],
111+
["namespace", [
112+
"com",
113+
["punctuation", "."],
114+
"modules",
115+
["punctuation", "."],
116+
"hello",
117+
["punctuation", "."]
118+
]],
119+
["class-name", "HelloInterface"],
120+
["keyword", "with"],
121+
["namespace", [
122+
"com",
123+
["punctuation", "."],
124+
"modules",
125+
["punctuation", "."],
126+
"hello",
127+
["punctuation", "."]
128+
]],
129+
["class-name", "HelloModules"],
130+
["punctuation", ";"],
131+
132+
["punctuation", "}"]
154133
]
155134

156135
----------------------------------------------------

0 commit comments

Comments
 (0)