~didrocks/+junk/face-detection-15.04

« back to all changes in this revision

Viewing changes to facedetection/www/bower_components/prism/components/prism-coffeescript.js

  • Committer: Didier Roche
  • Date: 2016-05-10 23:09:11 UTC
  • Revision ID: didier.roche@canonical.com-20160510230911-c7xr490zrj3yrzxd
New version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(function(Prism) {
 
2
 
 
3
// Ignore comments starting with { to privilege string interpolation highlighting
 
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
                // Strings are multiline
 
15
                /'(?:\\?[^\\])*?'/,
 
16
 
 
17
                {
 
18
                        // Strings are multiline
 
19
                        pattern: /"(?:\\?[^\\])*?"/,
 
20
                        inside: {
 
21
                                'interpolation': interpolation
 
22
                        }
 
23
                }
 
24
        ],
 
25
        '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/,
 
26
        'class-member': {
 
27
                pattern: /@(?!\d)\w+/,
 
28
                alias: 'variable'
 
29
        }
 
30
});
 
31
 
 
32
Prism.languages.insertBefore('coffeescript', 'comment', {
 
33
        'multiline-comment': {
 
34
                pattern: /###[\s\S]+?###/,
 
35
                alias: 'comment'
 
36
        },
 
37
 
 
38
        // Block regexp can contain comments and interpolation
 
39
        'block-regex': {
 
40
                pattern: /\/{3}[\s\S]*?\/{3}/,
 
41
                alias: 'regex',
 
42
                inside: {
 
43
                        'comment': comment,
 
44
                        'interpolation': interpolation
 
45
                }
 
46
        }
 
47
});
 
48
 
 
49
Prism.languages.insertBefore('coffeescript', 'string', {
 
50
        'inline-javascript': {
 
51
                pattern: /`(?:\\?[\s\S])*?`/,
 
52
                inside: {
 
53
                        'delimiter': {
 
54
                                pattern: /^`|`$/,
 
55
                                alias: 'punctuation'
 
56
                        },
 
57
                        rest: Prism.languages.javascript
 
58
                }
 
59
        },
 
60
 
 
61
        // Block strings
 
62
        'multiline-string': [
 
63
                {
 
64
                        pattern: /'''[\s\S]*?'''/,
 
65
                        alias: 'string'
 
66
                },
 
67
                {
 
68
                        pattern: /"""[\s\S]*?"""/,
 
69
                        alias: 'string',
 
70
                        inside: {
 
71
                                interpolation: interpolation
 
72
                        }
 
73
                }
 
74
        ]
 
75
 
 
76
});
 
77
 
 
78
Prism.languages.insertBefore('coffeescript', 'keyword', {
 
79
        // Object property
 
80
        'property': /(?!\d)\w+(?=\s*:(?!:))/
 
81
});
 
82
 
 
83
}(Prism));
 
 
b'\\ No newline at end of file'