1 | (function(Prism) {
|
2 |
|
3 |
|
4 | var comment = /#(?!\{).+/,
|
5 | interpolation = {
|
6 | pattern: /#\{[^}]+\}/,
|
7 | alias: 'variable'
|
8 | };
|
9 |
|
10 | Prism.languages.coffeescript = Prism.languages.extend('javascript', {
|
11 | 'comment': comment,
|
12 | 'string': [
|
13 |
|
14 |
|
15 | {
|
16 | pattern: /'(?:\\[\s\S]|[^\\'])*'/,
|
17 | greedy: true
|
18 | },
|
19 |
|
20 | {
|
21 |
|
22 | pattern: /"(?:\\[\s\S]|[^\\"])*"/,
|
23 | greedy: true,
|
24 | inside: {
|
25 | 'interpolation': interpolation
|
26 | }
|
27 | }
|
28 | ],
|
29 | 'keyword': /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
|
30 | 'class-member': {
|
31 | pattern: /@(?!\d)\w+/,
|
32 | alias: 'variable'
|
33 | }
|
34 | });
|
35 |
|
36 | Prism.languages.insertBefore('coffeescript', 'comment', {
|
37 | 'multiline-comment': {
|
38 | pattern: /###[\s\S]+?###/,
|
39 | alias: 'comment'
|
40 | },
|
41 |
|
42 |
|
43 | 'block-regex': {
|
44 | pattern: /\/{3}[\s\S]*?\/{3}/,
|
45 | alias: 'regex',
|
46 | inside: {
|
47 | 'comment': comment,
|
48 | 'interpolation': interpolation
|
49 | }
|
50 | }
|
51 | });
|
52 |
|
53 | Prism.languages.insertBefore('coffeescript', 'string', {
|
54 | 'inline-javascript': {
|
55 | pattern: /`(?:\\[\s\S]|[^\\`])*`/,
|
56 | inside: {
|
57 | 'delimiter': {
|
58 | pattern: /^`|`$/,
|
59 | alias: 'punctuation'
|
60 | },
|
61 | rest: Prism.languages.javascript
|
62 | }
|
63 | },
|
64 |
|
65 |
|
66 | 'multiline-string': [
|
67 | {
|
68 | pattern: /'''[\s\S]*?'''/,
|
69 | greedy: true,
|
70 | alias: 'string'
|
71 | },
|
72 | {
|
73 | pattern: /"""[\s\S]*?"""/,
|
74 | greedy: true,
|
75 | alias: 'string',
|
76 | inside: {
|
77 | interpolation: interpolation
|
78 | }
|
79 | }
|
80 | ]
|
81 |
|
82 | });
|
83 |
|
84 | Prism.languages.insertBefore('coffeescript', 'keyword', {
|
85 |
|
86 | 'property': /(?!\d)\w+(?=\s*:(?!:))/
|
87 | });
|
88 |
|
89 | delete Prism.languages.coffeescript['template-string'];
|
90 |
|
91 | Prism.languages.coffee = Prism.languages.coffeescript;
|
92 | }(Prism)); |
\ | No newline at end of file |