Skip to content

Commit f90a28a

Browse files
authored
highlight: add support for java (#244)
1 parent 704ec38 commit f90a28a

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

highlight/java.v

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Designed for Java 5.0+
2+
module highlight
3+
4+
fn init_java() Lang {
5+
return Lang{
6+
name: 'Java'
7+
lang_extensions: ['java']
8+
line_comments: '//'
9+
mline_comments: ['/*', '*/']
10+
string_start: ['"', "'"]
11+
color: '#f1e05a'
12+
keywords: [
13+
'abstract',
14+
'continue',
15+
'for',
16+
'new',
17+
'switch',
18+
'assert',
19+
'default',
20+
'goto',
21+
'package',
22+
'synchronized',
23+
'boolean',
24+
'do',
25+
'if',
26+
'private',
27+
'this',
28+
'break',
29+
'double',
30+
'implements',
31+
'protected',
32+
'throw',
33+
'byte',
34+
'else',
35+
'import',
36+
'public',
37+
'throws',
38+
'case',
39+
'enum',
40+
'instanceof',
41+
'return',
42+
'transient',
43+
'catch',
44+
'extends',
45+
'int',
46+
'short',
47+
'try',
48+
'char',
49+
'final',
50+
'interface',
51+
'static',
52+
'void',
53+
'class',
54+
'finally',
55+
'long',
56+
'strictfp',
57+
'volatile',
58+
'const',
59+
'float',
60+
'native',
61+
'super',
62+
'while',
63+
]
64+
}
65+
}

highlight/langs.v

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ pub fn extension_to_lang(ext string) !Lang {
3333
}
3434

3535
fn init_langs() []Lang {
36-
mut langs_ := []Lang{cap: 10}
36+
mut langs_ := []Lang{cap: 16}
3737
langs_ << init_c()
3838
langs_ << init_v()
3939
langs_ << init_js()
4040
langs_ << init_lua()
4141
langs_ << init_go()
4242
langs_ << init_cpp()
4343
langs_ << init_d()
44+
langs_ << init_java()
4445
langs_ << init_py()
4546
langs_ << init_ts()
4647
return langs_

0 commit comments

Comments
 (0)