1 | Prism.languages.haxe = Prism.languages.extend('clike', {
|
2 |
|
3 | 'string': {
|
4 | pattern: /(["'])(?:(?!\1)[^\\]|\\[\s\S])*\1/,
|
5 | greedy: true,
|
6 | inside: {
|
7 | 'interpolation': {
|
8 | pattern: /(^|[^\\])\$(?:\w+|\{[^}]+\})/,
|
9 | lookbehind: true,
|
10 | inside: {
|
11 | 'interpolation': {
|
12 | pattern: /^\$\w*/,
|
13 | alias: 'variable'
|
14 | }
|
15 |
|
16 | }
|
17 | }
|
18 | }
|
19 | },
|
20 |
|
21 | 'keyword': /\bthis\b|\b(?:abstract|as|break|case|cast|catch|class|continue|default|do|dynamic|else|enum|extends|extern|from|for|function|if|implements|import|in|inline|interface|macro|new|null|override|public|private|return|static|super|switch|throw|to|try|typedef|using|var|while)(?!\.)\b/,
|
22 | 'operator': /\.{3}|\+\+?|-[->]?|[=!]=?|&&?|\|\|?|<[<=]?|>[>=]?|[*\/%~^]/
|
23 | });
|
24 | Prism.languages.insertBefore('haxe', 'class-name', {
|
25 | 'regex': {
|
26 | pattern: /~\/(?:[^\/\\\r\n]|\\.)+\/[igmsu]*/,
|
27 | greedy: true
|
28 | }
|
29 | });
|
30 | Prism.languages.insertBefore('haxe', 'keyword', {
|
31 | 'preprocessor': {
|
32 | pattern: /#\w+/,
|
33 | alias: 'builtin'
|
34 | },
|
35 | 'metadata': {
|
36 | pattern: /@:?\w+/,
|
37 | alias: 'symbol'
|
38 | },
|
39 | 'reification': {
|
40 | pattern: /\$(?:\w+|(?=\{))/,
|
41 | alias: 'variable'
|
42 | }
|
43 | });
|
44 | Prism.languages.haxe['string'].inside['interpolation'].inside.rest = Prism.languages.haxe;
|
45 | delete Prism.languages.haxe['class-name'];
|