wren.min.js 2.3 KB

123456789101112131415161718192021222324252627282930
  1. /*! `wren` grammar compiled for Highlight.js 11.7.0 */
  2. var hljsGrammar=(()=>{"use strict";return e=>{
  3. const a=e.regex,s=/[a-zA-Z]\w*/,t=["as","break","class","construct","continue","else","for","foreign","if","import","in","is","return","static","var","while"],c=["true","false","null"],n=["this","super"],r=["-","~",/\*/,"%",/\.\.\./,/\.\./,/\+/,"<<",">>",">=","<=","<",">",/\^/,/!=/,/!/,/\bis\b/,"==","&&","&",/\|\|/,/\|/,/\?:/,"="],i={
  4. relevance:0,match:a.concat(/\b(?!(if|while|for|else|super)\b)/,s,/(?=\s*[({])/),
  5. className:"title.function"},o={
  6. match:a.concat(a.either(a.concat(/\b(?!(if|while|for|else|super)\b)/,s),a.either(...r)),/(?=\s*\([^)]+\)\s*\{)/),
  7. className:"title.function",starts:{contains:[{begin:/\(/,end:/\)/,contains:[{
  8. relevance:0,scope:"params",match:s}]}]}},l={variants:[{
  9. match:[/class\s+/,s,/\s+is\s+/,s]},{match:[/class\s+/,s]}],scope:{
  10. 2:"title.class",4:"title.class.inherited"},keywords:t},m={relevance:0,
  11. match:a.either(...r),className:"operator"},b={className:"property",
  12. begin:a.concat(/\./,a.lookahead(s)),end:s,excludeBegin:!0,relevance:0},h={
  13. relevance:0,match:a.concat(/\b_/,s),scope:"variable"},p={relevance:0,
  14. match:/\b[A-Z]+[a-z]+([A-Z]+[a-z]+)*/,scope:"title.class",keywords:{
  15. _:["Bool","Class","Fiber","Fn","List","Map","Null","Num","Object","Range","Sequence","String","System"]
  16. }},u=e.C_NUMBER_MODE,g={match:[s,/\s*/,/=/,/\s*/,/\(/,s,/\)\s*\{/],scope:{
  17. 1:"title.function",3:"operator",6:"params"}},d=e.COMMENT(/\/\*\*/,/\*\//,{
  18. contains:[{match:/@[a-z]+/,scope:"doctag"},"self"]}),v={scope:"subst",
  19. begin:/%\(/,end:/\)/,contains:[u,p,i,h,m]},f={scope:"string",begin:/"/,end:/"/,
  20. contains:[v,{scope:"char.escape",variants:[{match:/\\\\|\\["0%abefnrtv]/},{
  21. match:/\\x[0-9A-F]{2}/},{match:/\\u[0-9A-F]{4}/},{match:/\\U[0-9A-F]{8}/}]}]}
  22. ;v.contains.push(f);const N=[...t,...n,...c],_={relevance:0,
  23. match:a.concat("\\b(?!",N.join("|"),"\\b)",/[a-zA-Z_]\w*(?:[?!]|\b)/),
  24. className:"variable"};return{name:"Wren",keywords:{keyword:t,
  25. "variable.language":n,literal:c},contains:[{scope:"comment",variants:[{
  26. begin:[/#!?/,/[A-Za-z_]+(?=\()/],beginScope:{},keywords:{literal:c},contains:[],
  27. end:/\)/},{begin:[/#!?/,/[A-Za-z_]+/],beginScope:{},end:/$/}]},u,f,{
  28. className:"string",begin:/"""/,end:/"""/
  29. },d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,l,g,o,i,m,h,b,_]}}})()
  30. ;export default hljsGrammar;