java.min.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*! `java` grammar compiled for Highlight.js 11.7.0 */
  2. var hljsGrammar=(()=>{"use strict"
  3. ;var e="\\.([0-9](_*[0-9])*)",a="[0-9a-fA-F](_*[0-9a-fA-F])*",n={
  4. className:"number",variants:[{
  5. begin:`(\\b([0-9](_*[0-9])*)((${e})|\\.)?|(${e}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b`
  6. },{begin:`\\b([0-9](_*[0-9])*)((${e})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{
  7. begin:`(${e})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{
  8. begin:`\\b0[xX]((${a})\\.?|(${a})?\\.(${a}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b`
  9. },{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${a})[lL]?\\b`},{
  10. begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],
  11. relevance:0};function s(e,a,n){return-1===n?"":e.replace(a,(t=>s(e,a,n-1)))}
  12. return e=>{
  13. const a=e.regex,t="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",r=t+s("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),i={
  14. keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"],
  15. literal:["false","true","null"],
  16. type:["char","boolean","long","float","int","byte","short","double"],
  17. built_in:["super","this"]},l={className:"meta",begin:"@"+t,contains:[{
  18. begin:/\(/,end:/\)/,contains:["self"]}]},c={className:"params",begin:/\(/,
  19. end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0}
  20. ;return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/,
  21. contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,
  22. relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{
  23. begin:/import java\.[a-z]+\./,keywords:"import",relevance:2
  24. },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,
  25. className:"string",contains:[e.BACKSLASH_ESCAPE]
  26. },e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{
  27. match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{
  28. 1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{
  29. begin:[a.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type",
  30. 3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword",
  31. 3:"title.class"},contains:[c,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{
  32. beginKeywords:"new throw return else",relevance:0},{
  33. begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{
  34. 2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/,
  35. end:/\)/,keywords:i,relevance:0,
  36. contains:[l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,n,e.C_BLOCK_COMMENT_MODE]
  37. },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},n,l]}}})()
  38. ;export default hljsGrammar;