1 | Prism.languages.fsharp = Prism.languages.extend('clike', {
|
2 | 'comment': [
|
3 | {
|
4 | pattern: /(^|[^\\])\(\*[\s\S]*?\*\)/,
|
5 | lookbehind: true
|
6 | },
|
7 | {
|
8 | pattern: /(^|[^\\:])\/\/.*/,
|
9 | lookbehind: true
|
10 | }
|
11 | ],
|
12 | 'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
|
13 | 'string': {
|
14 | pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1)B?/,
|
15 | greedy: true
|
16 | },
|
17 | 'number': [
|
18 | /\b0x[\da-fA-F]+(?:un|lf|LF)?\b/,
|
19 | /\b0b[01]+(?:y|uy)?\b/,
|
20 | /(?:\b\d+\.?\d*|\B\.\d+)(?:[fm]|e[+-]?\d+)?\b/i,
|
21 | /\b\d+(?:[IlLsy]|u[lsy]?|UL)?\b/
|
22 | ]
|
23 | });
|
24 | Prism.languages.insertBefore('fsharp', 'keyword', {
|
25 | 'preprocessor': {
|
26 | pattern: /^[^\r\n\S]*#.*/m,
|
27 | alias: 'property',
|
28 | inside: {
|
29 | 'directive': {
|
30 | pattern: /(\s*#)\b(?:else|endif|if|light|line|nowarn)\b/,
|
31 | lookbehind: true,
|
32 | alias: 'keyword'
|
33 | }
|
34 | }
|
35 | }
|
36 | });
|