mirror of
https://github.com/writeas/writefreely
synced 2024-12-08 22:46:00 +01:00
1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
|
hljs.registerLanguage("reasonml",function(r){function e(r){return r.map(function(r){return r.split("").map(function(r){return"\\"+r}).join("")}).join("|")}var n="~?[a-z$_][0-9a-zA-Z$_]*",t="`?[A-Z$_][0-9a-zA-Z$_]*",c="'?[a-z$_][0-9a-z$_]*",i="s*:s*[a-z$_][0-9a-z$_]*((s*("+c+"s*(,"+c+")*)?s*))?",a=n+"("+i+")?("+i+")?",s="("+e(["||","&&","++","**","+.","*","/","*.","/.","...","|>"])+"|==|===)",o="\\s+"+s+"\\s+",b={keyword:"and as asr assert begin class constraint do done downto else end exception externalfor fun function functor if in include inherit initializerland lazy let lor lsl lsr lxor match method mod module mutable new nonrecobject of open or private rec sig struct then to try type val virtual when while with",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ",literal:"true false"},l="\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",u={cN:"number",r:0,v:[{b:l},{b:"\\(\\-"+l+"\\)"}]},N={cN:"operator",r:0,b:s},d=[{cN:"identifier",r:0,b:n},N,u],f=[r.QSM,N,{cN:"module",b:"\\b"+t,rB:!0,e:".",c:[{cN:"identifier",b:t,r:0}]}],m=[{cN:"module",b:"\\b"+t,rB:!0,e:".",r:0,c:[{cN:"identifier",b:t,r:0}]}],p={b:n,e:"(,|\\n|\\))",r:0,c:[N,{cN:"typing",b:":",e:"(,|\\n)",rB:!0,r:0,c:m}]},_={cN:"function",r:0,k:b,v:[{b:"\\s(\\(\\.?.*?\\)|"+n+")\\s*=>",e:"\\s*=>",rB:!0,r:0,c:[{cN:"params",v:[{b:n},{b:a},{b:/\(\s*\)/}]}]},{b:"\\s\\(\\.?[^;\\|]*\\)\\s*=>",e:"\\s=>",rB:!0,r:0,c:[{cN:"params",r:0,v:[p]}]},{b:"\\(\\.\\s"+n+"\\)\\s*=>"}]};f.push(_);var h={cN:"constructor",b:t+"\\(",e:"\\)",i:"\\n",k:b,c:[r.QSM,N,{cN:"params",b:"\\b"+n}]},v={cN:"pattern-match",b:"\\|",rB:!0,k:b,e:"=>",r:0,c:[h,N,{r:0,cN:"constructor",b:t}]},z={cN:"module-access",k:b,rB:!0,v:[{b:"\\b("+t+"\\.)+"+n},{b:"\\b("+t+"\\.)+\\(",e:"\\)",rB:!0,c:[_,{b:"\\(",e:"\\)",skip:!0}].concat(f)},{b:"\\b("+t+"\\.)+{",e:"}"}],c:f};return m.push(z),{aliases:["re"],k:b,i:"(:\\-|:=|\\${|\\+=)",c:[r.C("/\\*","\\*/",{i:"^(\\#,\\/\\/)"}),{cN:"character",b:"'(\\\\[^']+|[^'])'",i:"\\n",r:0},r.QSM,{cN:"literal",b:"\\(\\)",r:0},{cN:"literal",b:"\\[\\|",e:"\\|\\]",r:0,c:d},{cN:"literal",b:"\\[",e:"\\]",r:0,c:d},h,{cN:"operator",b:o,i:"\\-\\->",r:0},u,r.CLCM,v,_,{cN:"module-def",b:"\\bmodule\\s+"+n+"\\s+"+t+"\\s+=\\s+{",e:"}",rB:!0,k:b,r:0,c:[{cN:"module",r:0,b:t},{b:"{",e:"}",skip:!0}].concat(f)},z]}});
|