discourse/vendor/assets/javascripts/highlightjs/languages/reasonml.min.js
Joffrey JAFFEUX f3dee5863f
FIX: pins down highlight.js to the last commit of the v9 tree (#9921)
The 10+ version has actually a bug with bash. We will wait a little bit before upgrading to 10, we should also make sure any of the breaking changes listed here https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_BREAKING_CHANGES.md are not impacting us.
2020-05-29 10:21:21 +02:00

1 line
2.6 KiB
JavaScript

hljs.registerLanguage("reasonml",function(e){var a="~?[a-z$_][0-9a-zA-Z$_]*",r="`?[A-Z$_][0-9a-zA-Z$_]*",c="("+["||","&&","++","**","+.","*","/","*.","/.","...","|>"].map(function(e){return e.split("").map(function(e){return"\\"+e}).join("")}).join("|")+"|==|===)",n="\\s+"+c+"\\s+",l={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"},t="\\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_]+)?)?)",i={cN:"number",relevance:0,v:[{b:t},{b:"\\(\\-"+t+"\\)"}]},s={cN:"operator",relevance:0,b:c},b=[{cN:"identifier",relevance:0,b:a},s,i],o=[e.QSM,s,{cN:"module",b:"\\b"+r,rB:!0,e:".",c:[{cN:"identifier",b:r,relevance:0}]}],v=[{cN:"module",b:"\\b"+r,rB:!0,e:".",relevance:0,c:[{cN:"identifier",b:r,relevance:0}]}],u={cN:"function",relevance:0,k:l,v:[{b:"\\s(\\(\\.?.*?\\)|"+a+")\\s*=>",e:"\\s*=>",rB:!0,relevance:0,c:[{cN:"params",v:[{b:a},{b:"~?[a-z$_][0-9a-zA-Z$_]*(s*:s*[a-z$_][0-9a-z$_]*((s*('?[a-z$_][0-9a-z$_]*s*(,'?[a-z$_][0-9a-z$_]*)*)?s*))?)?(s*:s*[a-z$_][0-9a-z$_]*((s*('?[a-z$_][0-9a-z$_]*s*(,'?[a-z$_][0-9a-z$_]*)*)?s*))?)?"},{b:/\(\s*\)/}]}]},{b:"\\s\\(\\.?[^;\\|]*\\)\\s*=>",e:"\\s=>",rB:!0,relevance:0,c:[{cN:"params",relevance:0,v:[{b:a,e:"(,|\\n|\\))",relevance:0,c:[s,{cN:"typing",b:":",e:"(,|\\n)",rB:!0,relevance:0,c:v}]}]}]},{b:"\\(\\.\\s"+a+"\\)\\s*=>"}]};o.push(u);var _={cN:"constructor",b:r+"\\(",e:"\\)",i:"\\n",k:l,c:[e.QSM,s,{cN:"params",b:"\\b"+a}]},N={cN:"pattern-match",b:"\\|",rB:!0,k:l,e:"=>",relevance:0,c:[_,s,{relevance:0,cN:"constructor",b:r}]},d={cN:"module-access",k:l,rB:!0,v:[{b:"\\b("+r+"\\.)+"+a},{b:"\\b("+r+"\\.)+\\(",e:"\\)",rB:!0,c:[u,{b:"\\(",e:"\\)",skip:!0}].concat(o)},{b:"\\b("+r+"\\.)+{",e:"}"}],c:o};return v.push(d),{aliases:["re"],k:l,i:"(:\\-|:=|\\${|\\+=)",c:[e.C("/\\*","\\*/",{i:"^(\\#,\\/\\/)"}),{cN:"character",b:"'(\\\\[^']+|[^'])'",i:"\\n",relevance:0},e.QSM,{cN:"literal",b:"\\(\\)",relevance:0},{cN:"literal",b:"\\[\\|",e:"\\|\\]",relevance:0,c:b},{cN:"literal",b:"\\[",e:"\\]",relevance:0,c:b},_,{cN:"operator",b:n,i:"\\-\\->",relevance:0},i,e.CLCM,N,u,{cN:"module-def",b:"\\bmodule\\s+"+a+"\\s+"+r+"\\s+=\\s+{",e:"}",rB:!0,k:l,relevance:0,c:[{cN:"module",relevance:0,b:r},{b:"{",e:"}",skip:!0}].concat(o)},d]}});