1 |
|
2 |
|
3 | (function (Prism) {
|
4 |
|
5 | var orgType = /\b(?:(?:col|row)?vector|matrix|scalar)\b/.source;
|
6 | var type = /\bvoid\b|<org>|\b(?:complex|numeric|pointer(?:\s*\([^()]*\))?|real|string|(?:class|struct)\s+\w+|transmorphic)(?:\s*<org>)?/.source
|
7 | .replace(/<org>/g, orgType);
|
8 |
|
9 | Prism.languages.mata = {
|
10 | 'comment': {
|
11 | pattern: /\/\/.*|\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\//,
|
12 | greedy: true
|
13 | },
|
14 | 'string': {
|
15 | pattern: /"[^"\r\n]*"|[‘`']".*?"[’`']/,
|
16 | greedy: true
|
17 | },
|
18 |
|
19 | 'class-name': {
|
20 | pattern: /(\b(?:class|extends|struct)\s+)\w+(?=\s*(?:\{|\bextends\b))/,
|
21 | lookbehind: true
|
22 | },
|
23 | 'type': {
|
24 | pattern: RegExp(type),
|
25 | alias: 'class-name',
|
26 | inside: {
|
27 | 'punctuation': /[()]/,
|
28 | 'keyword': /\b(?:class|function|struct|void)\b/
|
29 | }
|
30 | },
|
31 | 'keyword': /\b(?:break|class|continue|do|else|end|extends|external|final|for|function|goto|if|pragma|private|protected|public|return|static|struct|unset|unused|version|virtual|while)\b/,
|
32 | 'constant': /\bNULL\b/,
|
33 |
|
34 | 'number': {
|
35 | pattern: /(^|[^\w.])(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?|\d[a-f0-9]*(?:\.[a-f0-9]+)?x[+-]?\d+)i?(?![\w.])/i,
|
36 | lookbehind: true
|
37 | },
|
38 | 'missing': {
|
39 | pattern: /(^|[^\w.])(?:\.[a-z]?)(?![\w.])/,
|
40 | lookbehind: true,
|
41 | alias: 'symbol'
|
42 | },
|
43 |
|
44 | 'function': /\b[a-z_]\w*(?=\s*\()/i,
|
45 |
|
46 | 'operator': /\.\.|\+\+|--|&&|\|\||:?(?:[!=<>]=|[+\-*/^<>&|:])|[!?=\\#’`']/,
|
47 | 'punctuation': /[()[\]{},;.]/
|
48 | };
|
49 |
|
50 | }(Prism));
|