UNPKG

1.22 kBJavaScriptView Raw
1Prism.languages.reason = Prism.languages.extend('clike', {
2 'comment': {
3 pattern: /(^|[^\\])\/\*[\s\S]*?\*\//,
4 lookbehind: true
5 },
6 'string': {
7 pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
8 greedy: true
9 },
10 // 'class-name' must be matched *after* 'constructor' defined below
11 'class-name': /\b[A-Z]\w*/,
12 'keyword': /\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,
13 'operator': /\.{3}|:[:=]|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:mod|land|lor|lxor|lsl|lsr|asr)\b/
14});
15Prism.languages.insertBefore('reason', 'class-name', {
16 'character': {
17 pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
18 alias: 'string'
19 },
20 'constructor': {
21 // Negative look-ahead prevents from matching things like String.capitalize
22 pattern: /\b[A-Z]\w*\b(?!\s*\.)/,
23 alias: 'variable'
24 },
25 'label': {
26 pattern: /\b[a-z]\w*(?=::)/,
27 alias: 'symbol'
28 }
29});
30
31// We can't match functions property, so let's not even try.
32delete Prism.languages.reason.function;
\No newline at end of file