Merge branch '5.2' into 5.3
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / 3rdParty / prism / components / prism-fsharp.js
1 define(["prism/prism","prism/components/prism-clike"], function () {
2 Prism.languages.fsharp = Prism.languages.extend('clike', {
3 'comment': [
4 {
5 pattern: /(^|[^\\])\(\*[\s\S]*?\*\)/,
6 lookbehind: true
7 },
8 {
9 pattern: /(^|[^\\:])\/\/.*/,
10 lookbehind: true
11 }
12 ],
13 'string': {
14 pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?|'(?:[^\\']|\\(?:.|\d{3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|U[a-fA-F\d]{8}))'B?/,
15 greedy: true
16 },
17 'class-name': {
18 pattern: /(\b(?:exception|inherit|interface|new|of|type)\s+|\w\s*:\s*|\s:\??>\s*)[.\w]+\b(?:\s*(?:->|\*)\s*[.\w]+\b)*(?!\s*[:.])/,
19 lookbehind: true,
20 inside: {
21 'operator': /->|\*/,
22 'punctuation': /\./
23 }
24 },
25 '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/,
26 'number': [
27 /\b0x[\da-fA-F]+(?:un|lf|LF)?\b/,
28 /\b0b[01]+(?:y|uy)?\b/,
29 /(?:\b\d+\.?\d*|\B\.\d+)(?:[fm]|e[+-]?\d+)?\b/i,
30 /\b\d+(?:[IlLsy]|u[lsy]?|UL)?\b/
31 ],
32 'operator': /([<>~&^])\1\1|([*.:<>&])\2|<-|->|[!=:]=|<?\|{1,3}>?|\??(?:<=|>=|<>|[-+*/%=<>])\??|[!?^&]|~[+~-]|:>|:\?>?/
33 });
34 Prism.languages.insertBefore('fsharp', 'keyword', {
35 'preprocessor': {
36 pattern: /^[^\r\n\S]*#.*/m,
37 alias: 'property',
38 inside: {
39 'directive': {
40 pattern: /(\s*#)\b(?:else|endif|if|light|line|nowarn)\b/,
41 lookbehind: true,
42 alias: 'keyword'
43 }
44 }
45 }
46 });
47 Prism.languages.insertBefore('fsharp', 'punctuation', {
48 'computation-expression': {
49 pattern: /[_a-z]\w*(?=\s*\{)/i,
50 alias: 'keyword'
51 }
52 });
53 Prism.languages.insertBefore('fsharp', 'string', {
54 'annotation': {
55 pattern: /\[<.+?>\]/,
56 inside: {
57 'punctuation': /^\[<|>\]$/,
58 'class-name': {
59 pattern: /^\w+$|(^|;\s*)[A-Z]\w*(?=\()/,
60 lookbehind: true
61 },
62 'annotation-content': {
63 pattern: /[\s\S]+/,
64 inside: Prism.languages.fsharp
65 }
66 }
67 }
68 });
69
70 return Prism; })