main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | 'use strict'
|
---|
2 |
|
---|
3 | module.exports = flow
|
---|
4 | flow.displayName = 'flow'
|
---|
5 | flow.aliases = []
|
---|
6 | function flow(Prism) {
|
---|
7 | ;(function (Prism) {
|
---|
8 | Prism.languages.flow = Prism.languages.extend('javascript', {})
|
---|
9 | Prism.languages.insertBefore('flow', 'keyword', {
|
---|
10 | type: [
|
---|
11 | {
|
---|
12 | pattern:
|
---|
13 | /\b(?:[Bb]oolean|Function|[Nn]umber|[Ss]tring|any|mixed|null|void)\b/,
|
---|
14 | alias: 'tag'
|
---|
15 | }
|
---|
16 | ]
|
---|
17 | })
|
---|
18 | Prism.languages.flow['function-variable'].pattern =
|
---|
19 | /(?!\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
|
---|
20 | delete Prism.languages.flow['parameter']
|
---|
21 | Prism.languages.insertBefore('flow', 'operator', {
|
---|
22 | 'flow-punctuation': {
|
---|
23 | pattern: /\{\||\|\}/,
|
---|
24 | alias: 'punctuation'
|
---|
25 | }
|
---|
26 | })
|
---|
27 | if (!Array.isArray(Prism.languages.flow.keyword)) {
|
---|
28 | Prism.languages.flow.keyword = [Prism.languages.flow.keyword]
|
---|
29 | }
|
---|
30 | Prism.languages.flow.keyword.unshift(
|
---|
31 | {
|
---|
32 | pattern: /(^|[^$]\b)(?:Class|declare|opaque|type)\b(?!\$)/,
|
---|
33 | lookbehind: true
|
---|
34 | },
|
---|
35 | {
|
---|
36 | pattern:
|
---|
37 | /(^|[^$]\B)\$(?:Diff|Enum|Exact|Keys|ObjMap|PropertyType|Record|Shape|Subtype|Supertype|await)\b(?!\$)/,
|
---|
38 | lookbehind: true
|
---|
39 | }
|
---|
40 | )
|
---|
41 | })(Prism)
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.