1 | Prism.languages.d = Prism.languages.extend('clike', {
|
2 | 'comment': [
|
3 | {
|
4 |
|
5 | pattern: /^\s*#!.+/,
|
6 | greedy: true
|
7 | },
|
8 | {
|
9 | pattern: RegExp(/(^|[^\\])/.source + '(?:' + [
|
10 |
|
11 |
|
12 | /\/\+(?:\/\+[\s\S]*?\+\/|(?!\/\+)[\s\S])*?\+\
|
13 |
|
14 | /\/\/.*/.source,
|
15 |
|
16 | /\/\*[\s\S]*?\*\
|
17 | ].join('|') + ')'),
|
18 | lookbehind: true,
|
19 | greedy: true
|
20 | }
|
21 | ],
|
22 | 'string': [
|
23 | {
|
24 | pattern: RegExp([
|
25 |
|
26 | /\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/.source,
|
27 |
|
28 |
|
29 | /\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/.source,
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | /\bq"((?!\d)\w+)$[\s\S]*?^\1"/.source,
|
35 |
|
36 |
|
37 | /\bq"(.)[\s\S]*?\2"/.source,
|
38 |
|
39 |
|
40 |
|
41 | /'(?:\\(?:\W|\w+)|[^\\])'/.source,
|
42 |
|
43 | /(["`])(?:\\[\s\S]|(?!\3)[^\\])*\3[cwd]?/.source
|
44 | ].join('|'), 'm'),
|
45 | greedy: true
|
46 | },
|
47 | {
|
48 | pattern: /\bq\{(?:\{[^{}]*\}|[^{}])*\}/,
|
49 | greedy: true,
|
50 | alias: 'token-string'
|
51 | }
|
52 | ],
|
53 |
|
54 | 'number': [
|
55 |
|
56 |
|
57 | /\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,
|
58 | {
|
59 | pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,
|
60 | lookbehind: true
|
61 | }
|
62 | ],
|
63 |
|
64 |
|
65 | 'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,
|
66 | 'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/
|
67 | });
|
68 |
|
69 | Prism.languages.insertBefore('d', 'keyword', {
|
70 | 'property': /\B@\w*/
|
71 | });
|
72 |
|
73 | Prism.languages.insertBefore('d', 'function', {
|
74 | 'register': {
|
75 |
|
76 | pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,
|
77 | alias: 'variable'
|
78 | }
|
79 | });
|