mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2024-12-21 07:33:54 +01:00
35 lines
2.7 KiB
JavaScript
35 lines
2.7 KiB
JavaScript
hljs.registerLanguage("java",(()=>{"use strict"
|
|
;var e="\\.([0-9](_*[0-9])*)",n="[0-9a-fA-F](_*[0-9a-fA-F])*",a={
|
|
className:"number",variants:[{
|
|
begin:`(\\b([0-9](_*[0-9])*)((${e})|\\.)?|(${e}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b`
|
|
},{begin:`\\b([0-9](_*[0-9])*)((${e})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{
|
|
begin:`(${e})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{
|
|
begin:`\\b0[xX]((${n})\\.?|(${n})?\\.(${n}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b`
|
|
},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${n})[lL]?\\b`},{
|
|
begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],
|
|
relevance:0};return e=>{
|
|
var n="false synchronized int abstract float private char boolean var static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s={
|
|
className:"meta",begin:"@[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",
|
|
contains:[{begin:/\(/,end:/\)/,contains:["self"]}]};const r=a;return{
|
|
name:"Java",aliases:["jsp"],keywords:n,illegal:/<\/|#/,
|
|
contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,
|
|
relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{
|
|
begin:/import java\.[a-z]+\./,keywords:"import",relevance:2
|
|
},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{
|
|
className:"class",beginKeywords:"class interface enum",end:/[{;=]/,
|
|
excludeEnd:!0,relevance:1,keywords:"class interface enum",illegal:/[:"\[\]]/,
|
|
contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{
|
|
beginKeywords:"new throw return else",relevance:0},{className:"class",
|
|
begin:"record\\s+"+e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,excludeEnd:!0,
|
|
end:/[{;=]/,keywords:n,contains:[{beginKeywords:"record"},{
|
|
begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,
|
|
contains:[e.UNDERSCORE_TITLE_MODE]},{className:"params",begin:/\(/,end:/\)/,
|
|
keywords:n,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE]
|
|
},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"function",
|
|
begin:"([\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*(<[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*(\\s*,\\s*[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*)*>)?\\s+)+"+e.UNDERSCORE_IDENT_RE+"\\s*\\(",
|
|
returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:n,contains:[{
|
|
begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,
|
|
contains:[e.UNDERSCORE_TITLE_MODE]},{className:"params",begin:/\(/,end:/\)/,
|
|
keywords:n,relevance:0,
|
|
contains:[s,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.C_BLOCK_COMMENT_MODE]
|
|
},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},r,s]}}})()); |