1 | Prism.languages.mel = {
|
2 | 'comment': {
|
3 | pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
|
4 | greedy: true
|
5 | },
|
6 | 'code': {
|
7 | pattern: /`(?:\\.|[^\\`])*`/,
|
8 | greedy: true,
|
9 | alias: 'italic',
|
10 | inside: {
|
11 | 'delimiter': {
|
12 | pattern: /^`|`$/,
|
13 | alias: 'punctuation'
|
14 | },
|
15 | 'statement': {
|
16 | pattern: /[\s\S]+/,
|
17 | inside: null
|
18 | }
|
19 | }
|
20 | },
|
21 | 'string': {
|
22 | pattern: /"(?:\\.|[^\\"\r\n])*"/,
|
23 | greedy: true
|
24 | },
|
25 | 'variable': /\$\w+/,
|
26 | 'number': /\b0x[\da-fA-F]+\b|\b\d+(?:\.\d*)?|\B\.\d+/,
|
27 | 'flag': {
|
28 | pattern: /-[^\d\W]\w*/,
|
29 | alias: 'operator'
|
30 | },
|
31 | 'keyword': /\b(?:break|case|continue|default|do|else|float|for|global|if|in|int|matrix|proc|return|string|switch|vector|while)\b/,
|
32 | 'function': {
|
33 | pattern: /((?:^|[{;])[ \t]*)[a-z_]\w*\b(?!\s*(?:\.(?!\.)|[[{=]))|\b[a-z_]\w*(?=[ \t]*\()/im,
|
34 | lookbehind: true,
|
35 | greedy: true
|
36 | },
|
37 |
|
38 | 'tensor-punctuation': {
|
39 | pattern: /<<|>>/,
|
40 | alias: 'punctuation'
|
41 | },
|
42 | 'operator': /\+[+=]?|-[-=]?|&&|\|\||[<>]=?|[*\/!=]=?|[%^]/,
|
43 | 'punctuation': /[.,:;?\[\](){}]/
|
44 | };
|
45 |
|
46 | Prism.languages.mel['code'].inside['statement'].inside = Prism.languages.mel;
|