Build 589089stable
Module 61083
3,989 characters · in 32bb091e67a290ef.jsDependencies
Source Raw
function(e){function t(e){return RegExp(e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")}function a(e){return e?"string"==typeof e?e:e.source:null}function n(e){return r("(?=",e,")")}function r(...e){return e.map(e=>a(e)).join("")}function i(...e){let t;return"("+(("object"==typeof(t=e[e.length-1])&&t.constructor===Object?(e.splice(e.length-1,1),t):{}).capture?"":"?:")+e.map(e=>a(e)).join("|")+")"}e.exports=function(e){let a={scope:"keyword",match:/\b(yield|return|let|do|match|use)!/},o=["bool","byte","sbyte","int8","int16","int32","uint8","uint16","uint32","int","uint","int64","uint64","nativeint","unativeint","decimal","float","double","float32","single","char","string","unit","bigint","option","voption","list","array","seq","byref","exn","inref","nativeptr","obj","outref","voidptr","Result"],s={keyword:["abstract","and","as","assert","base","begin","class","default","delegate","do","done","downcast","downto","elif","else","end","exception","extern","finally","fixed","for","fun","function","global","if","in","inherit","inline","interface","internal","lazy","let","match","member","module","mutable","namespace","new","of","open","or","override","private","public","rec","return","static","struct","then","to","try","type","upcast","use","val","void","when","while","with","yield"],literal:["true","false","null","Some","None","Ok","Error","infinity","infinityf","nan","nanf"],built_in:["not","ref","raise","reraise","dict","readOnlyDict","set","get","enum","sizeof","typeof","typedefof","nameof","nullArg","invalidArg","invalidOp","id","fst","snd","ignore","lock","using","box","unbox","tryUnbox","printf","printfn","sprintf","eprintf","eprintfn","fprintf","fprintfn","failwith","failwithf"],"variable.constant":["__LINE__","__SOURCE_DIRECTORY__","__SOURCE_FILE__"]},l={variants:[e.COMMENT(/\(\*(?!\))/,/\*\)/,{contains:["self"]}),e.C_LINE_COMMENT_MODE]},c={scope:"variable",begin:/``/,end:/``/},_=/\B('|\^)/,d={scope:"symbol",variants:[{match:r(_,/``.*?``/)},{match:r(_,e.UNDERSCORE_IDENT_RE)}],relevance:0},m=function({includeEqual:e}){let a=r("[",...Array.from(e?"!%&*+-/<=>@^|~?":"!%&*+-/<>@^|~?").map(t),"]"),o=i(a,/\./),s=r(o,n(o)),l=i(r(s,o,"*"),r(a,"+"));return{scope:"operator",match:i(l,/:\?>/,/:\?/,/:>/,/:=/,/::?/,/\$/),relevance:0}},p=m({includeEqual:!0}),u=m({includeEqual:!1}),g=function(t,a){return{begin:r(t,n(r(/\s*/,i(/\w/,/'/,/\^/,/#/,/``/,/\(/,/{\|/)))),beginScope:a,end:n(i(/\n/,/=/)),relevance:0,keywords:e.inherit(s,{type:o}),contains:[l,d,e.inherit(c,{scope:null}),u]}},E=g(/:/,"operator"),S=g(/\bof\b/,"keyword"),b={begin:[/(^|\s+)/,/type/,/\s+/,/[a-zA-Z_](\w|')*/],beginScope:{2:"keyword",4:"title.class"},end:n(/\(|=|$/),keywords:s,contains:[l,e.inherit(c,{scope:null}),d,{scope:"operator",match:/<|>/},E]},T={scope:"computation-expression",match:/\b[_a-z]\w*(?=\s*\{)/},f={begin:[/^\s*/,r(/#/,i("if","else","endif","line","nowarn","light","r","i","I","load","time","help","quit")),/\b/],beginScope:{2:"meta"},end:n(/\s|$/)},C={variants:[e.BINARY_NUMBER_MODE,e.C_NUMBER_MODE]},R={scope:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]},N={scope:"string",begin:/@"/,end:/"/,contains:[{match:/""/},e.BACKSLASH_ESCAPE]},h={scope:"string",begin:/"""/,end:/"""/,relevance:2},O={scope:"subst",begin:/\{/,end:/\}/,keywords:s},v={scope:"string",begin:/\$"/,end:/"/,contains:[{match:/\{\{/},{match:/\}\}/},e.BACKSLASH_ESCAPE,O]},y={scope:"string",begin:/(\$@|@\$)"/,end:/"/,contains:[{match:/\{\{/},{match:/\}\}/},{match:/""/},e.BACKSLASH_ESCAPE,O]},A={scope:"string",match:r(/'/,i(/[^\\']/,/\\(?:.|\d{3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|U[a-fA-F\d]{8})/),/'/)};return O.contains=[y,v,N,R,A,a,l,c,E,T,f,C,d,p],{name:"F#",aliases:["fs","f#"],keywords:s,illegal:/\/\*/,classNameAliases:{"computation-expression":"keyword"},contains:[a,{variants:[{scope:"string",begin:/\$"""/,end:/"""/,contains:[{match:/\{\{/},{match:/\}\}/},O],relevance:2},y,v,h,N,R,A]},l,c,b,{scope:"meta",begin:/\[</,end:/>\]/,relevance:2,contains:[c,h,N,R,A,C]},S,E,T,f,C,d,p]}}}