1 | (function (Prism) {
|
2 | Prism.languages.flow = Prism.languages.extend('javascript', {});
|
3 |
|
4 | Prism.languages.insertBefore('flow', 'keyword', {
|
5 | 'type': [
|
6 | {
|
7 | pattern: /\b(?:[Nn]umber|[Ss]tring|[Bb]oolean|Function|any|mixed|null|void)\b/,
|
8 | alias: 'tag'
|
9 | }
|
10 | ]
|
11 | });
|
12 | Prism.languages.flow['function-variable'].pattern = /(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=\s*(?:function\b|(?:\([^()]*\)(?:\s*:\s*\w+)?|(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/i;
|
13 | delete Prism.languages.flow['parameter'];
|
14 |
|
15 | Prism.languages.insertBefore('flow', 'operator', {
|
16 | 'flow-punctuation': {
|
17 | pattern: /\{\||\|\}/,
|
18 | alias: 'punctuation'
|
19 | }
|
20 | });
|
21 |
|
22 | if (!Array.isArray(Prism.languages.flow.keyword)) {
|
23 | Prism.languages.flow.keyword = [Prism.languages.flow.keyword];
|
24 | }
|
25 | Prism.languages.flow.keyword.unshift(
|
26 | {
|
27 | pattern: /(^|[^$]\b)(?:type|opaque|declare|Class)\b(?!\$)/,
|
28 | lookbehind: true
|
29 | },
|
30 | {
|
31 | pattern: /(^|[^$]\B)\$(?:await|Diff|Exact|Keys|ObjMap|PropertyType|Shape|Record|Supertype|Subtype|Enum)\b(?!\$)/,
|
32 | lookbehind: true
|
33 | }
|
34 | );
|
35 | }(Prism));
|