UNPKG

2.34 kBJavaScriptView Raw
1/*! `wren` grammar compiled for Highlight.js 11.6.0 */
2(()=>{var e=(()=>{"use strict";return e=>{
3const 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={
4relevance:0,match:a.concat(/\b(?!(if|while|for|else|super)\b)/,s,/(?=\s*[({])/),
5className:"title.function"},o={
6match:a.concat(a.either(a.concat(/\b(?!(if|while|for|else|super)\b)/,s),a.either(...r)),/(?=\s*\([^)]+\)\s*\{)/),
7className:"title.function",starts:{contains:[{begin:/\(/,end:/\)/,contains:[{
8relevance:0,scope:"params",match:s}]}]}},l={variants:[{
9match:[/class\s+/,s,/\s+is\s+/,s]},{match:[/class\s+/,s]}],scope:{
102:"title.class",4:"title.class.inherited"},keywords:t},m={relevance:0,
11match:a.either(...r),className:"operator"},b={className:"property",
12begin:a.concat(/\./,a.lookahead(s)),end:s,excludeBegin:!0,relevance:0},h={
13relevance:0,match:a.concat(/\b_/,s),scope:"variable"},p={relevance:0,
14match:/\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:{
171:"title.function",3:"operator",6:"params"}},d=e.COMMENT(/\/\*\*/,/\*\//,{
18contains:[{match:/@[a-z]+/,scope:"doctag"},"self"]}),v={scope:"subst",
19begin:/%\(/,end:/\)/,contains:[u,p,i,h,m]},f={scope:"string",begin:/"/,end:/"/,
20contains:[v,{scope:"char.escape",variants:[{match:/\\\\|\\["0%abefnrtv]/},{
21match:/\\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,
23match:a.concat("\\b(?!",N.join("|"),"\\b)",/[a-zA-Z_]\w*(?:[?!]|\b)/),
24className:"variable"};return{name:"Wren",keywords:{keyword:t,
25"variable.language":n,literal:c},contains:[{scope:"comment",variants:[{
26begin:[/#!?/,/[A-Za-z_]+(?=\()/],beginScope:{},keywords:{literal:c},contains:[],
27end:/\)/},{begin:[/#!?/,/[A-Za-z_]+/],beginScope:{},end:/$/}]},u,f,{
28className:"string",begin:/"""/,end:/"""/
29},d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,l,g,o,i,m,h,b,_]}}})()
30;hljs.registerLanguage("wren",e)})();
\No newline at end of file