Skip to content

Commit

Permalink
highlight: add support for java (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacamera authored Sep 18, 2024
1 parent 704ec38 commit f90a28a
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
65 changes: 65 additions & 0 deletions highlight/java.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Designed for Java 5.0+
module highlight

fn init_java() Lang {
return Lang{
name: 'Java'
lang_extensions: ['java']
line_comments: '//'
mline_comments: ['/*', '*/']
string_start: ['"', "'"]
color: '#f1e05a'
keywords: [
'abstract',
'continue',
'for',
'new',
'switch',
'assert',
'default',
'goto',
'package',
'synchronized',
'boolean',
'do',
'if',
'private',
'this',
'break',
'double',
'implements',
'protected',
'throw',
'byte',
'else',
'import',
'public',
'throws',
'case',
'enum',
'instanceof',
'return',
'transient',
'catch',
'extends',
'int',
'short',
'try',
'char',
'final',
'interface',
'static',
'void',
'class',
'finally',
'long',
'strictfp',
'volatile',
'const',
'float',
'native',
'super',
'while',
]
}
}
3 changes: 2 additions & 1 deletion highlight/langs.v
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ pub fn extension_to_lang(ext string) !Lang {
}

fn init_langs() []Lang {
mut langs_ := []Lang{cap: 10}
mut langs_ := []Lang{cap: 16}
langs_ << init_c()
langs_ << init_v()
langs_ << init_js()
langs_ << init_lua()
langs_ << init_go()
langs_ << init_cpp()
langs_ << init_d()
langs_ << init_java()
langs_ << init_py()
langs_ << init_ts()
return langs_
Expand Down

0 comments on commit f90a28a

Please sign in to comment.