diff options
Diffstat (limited to 'public/prism/prism-csharp.min.js')
| -rw-r--r-- | public/prism/prism-csharp.min.js | 180 |
1 files changed, 88 insertions, 92 deletions
diff --git a/public/prism/prism-csharp.min.js b/public/prism/prism-csharp.min.js index bb80a4c..44e5704 100644 --- a/public/prism/prism-csharp.min.js +++ b/public/prism/prism-csharp.min.js @@ -1,20 +1,20 @@ -!(function (s) { - function a(e, s) { - return e.replace(/<<(\d+)>>/g, function (e, n) { - return '(?:' + s[+n] + ')'; +!(function (e) { + function n(e, n) { + return e.replace(/<<(\d+)>>/g, function (e, s) { + return '(?:' + n[+s] + ')'; }); } - function t(e, n, s) { - return RegExp(a(e, n), s || ''); + function s(e, s, a) { + return RegExp(n(e, s), a || ''); } - function e(e, n) { + function a(e, n) { for (var s = 0; s < n; s++) e = e.replace(/<<self>>/g, function () { return '(?:' + e + ')'; }); return e.replace(/<<self>>/g, '[^\\s\\S]'); } - var n = + var t = 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void', r = 'class enum interface record struct', i = @@ -25,65 +25,61 @@ return '\\b(?:' + e.trim().replace(/ /g, '|') + ')\\b'; } var d = l(r), - p = RegExp(l(n + ' ' + r + ' ' + i + ' ' + o)), + p = RegExp(l(t + ' ' + r + ' ' + i + ' ' + o)), c = l(r + ' ' + i + ' ' + o), - u = l(n + ' ' + r + ' ' + o), - g = e('<(?:[^<>;=+\\-*/%&|^]|<<self>>)*>', 2), - b = e('\\((?:[^()]|<<self>>)*\\)', 2), + u = l(t + ' ' + r + ' ' + o), + g = a('<(?:[^<>;=+\\-*/%&|^]|<<self>>)*>', 2), + b = a('\\((?:[^()]|<<self>>)*\\)', 2), h = '@?\\b[A-Za-z_]\\w*\\b', - f = a('<<0>>(?:\\s*<<1>>)?', [h, g]), - m = a('(?!<<0>>)<<1>>(?:\\s*\\.\\s*<<1>>)*', [c, f]), + f = n('<<0>>(?:\\s*<<1>>)?', [h, g]), + m = n('(?!<<0>>)<<1>>(?:\\s*\\.\\s*<<1>>)*', [c, f]), k = '\\[\\s*(?:,\\s*)*\\]', - y = a('<<0>>(?:\\s*(?:\\?\\s*)?<<1>>)*(?:\\s*\\?)?', [m, k]), - w = a('(?:<<0>>|<<1>>)(?:\\s*(?:\\?\\s*)?<<2>>)*(?:\\s*\\?)?', [ - a('\\(<<0>>+(?:,<<0>>+)+\\)', [ - a('[^,()<>[\\];=+\\-*/%&|^]|<<0>>|<<1>>|<<2>>', [g, b, k]), - ]), - m, - k, - ]), - v = { keyword: p, punctuation: /[<>()?,.:[\]]/ }, - x = "'(?:[^\r\n'\\\\]|\\\\.|\\\\[Uux][\\da-fA-F]{1,8})'", - $ = '"(?:\\\\.|[^\\\\"\r\n])*"'; - (s.languages.csharp = s.languages.extend('clike', { + y = n('<<0>>(?:\\s*(?:\\?\\s*)?<<1>>)*(?:\\s*\\?)?', [m, k]), + w = n('[^,()<>[\\];=+\\-*/%&|^]|<<0>>|<<1>>|<<2>>', [g, b, k]), + v = n('\\(<<0>>+(?:,<<0>>+)+\\)', [w]), + x = n('(?:<<0>>|<<1>>)(?:\\s*(?:\\?\\s*)?<<2>>)*(?:\\s*\\?)?', [v, m, k]), + $ = { keyword: p, punctuation: /[<>()?,.:[\]]/ }, + _ = "'(?:[^\r\n'\\\\]|\\\\.|\\\\[Uux][\\da-fA-F]{1,8})'", + B = '"(?:\\\\.|[^\\\\"\r\n])*"'; + (e.languages.csharp = e.languages.extend('clike', { string: [ { - pattern: t('(^|[^$\\\\])<<0>>', ['@"(?:""|\\\\[^]|[^\\\\"])*"(?!")']), + pattern: s('(^|[^$\\\\])<<0>>', ['@"(?:""|\\\\[^]|[^\\\\"])*"(?!")']), lookbehind: !0, greedy: !0, }, - { pattern: t('(^|[^@$\\\\])<<0>>', [$]), lookbehind: !0, greedy: !0 }, + { pattern: s('(^|[^@$\\\\])<<0>>', [B]), lookbehind: !0, greedy: !0 }, ], 'class-name': [ { - pattern: t('(\\busing\\s+static\\s+)<<0>>(?=\\s*;)', [m]), + pattern: s('(\\busing\\s+static\\s+)<<0>>(?=\\s*;)', [m]), lookbehind: !0, - inside: v, + inside: $, }, { - pattern: t('(\\busing\\s+<<0>>\\s*=\\s*)<<1>>(?=\\s*;)', [h, w]), + pattern: s('(\\busing\\s+<<0>>\\s*=\\s*)<<1>>(?=\\s*;)', [h, x]), lookbehind: !0, - inside: v, + inside: $, }, - { pattern: t('(\\busing\\s+)<<0>>(?=\\s*=)', [h]), lookbehind: !0 }, - { pattern: t('(\\b<<0>>\\s+)<<1>>', [d, f]), lookbehind: !0, inside: v }, + { pattern: s('(\\busing\\s+)<<0>>(?=\\s*=)', [h]), lookbehind: !0 }, + { pattern: s('(\\b<<0>>\\s+)<<1>>', [d, f]), lookbehind: !0, inside: $ }, { - pattern: t('(\\bcatch\\s*\\(\\s*)<<0>>', [m]), + pattern: s('(\\bcatch\\s*\\(\\s*)<<0>>', [m]), lookbehind: !0, - inside: v, + inside: $, }, - { pattern: t('(\\bwhere\\s+)<<0>>', [h]), lookbehind: !0 }, + { pattern: s('(\\bwhere\\s+)<<0>>', [h]), lookbehind: !0 }, { - pattern: t('(\\b(?:is(?:\\s+not)?|as)\\s+)<<0>>', [y]), + pattern: s('(\\b(?:is(?:\\s+not)?|as)\\s+)<<0>>', [y]), lookbehind: !0, - inside: v, + inside: $, }, { - pattern: t( + pattern: s( '\\b<<0>>(?=\\s+(?!<<1>>|with\\s*\\{)<<2>>(?:\\s*[=,;:{)\\]]|\\s+(?:in|when)\\b))', - [w, u, h] + [x, u, h] ), - inside: v, + inside: $, }, ], keyword: p, @@ -92,19 +88,19 @@ operator: />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/, punctuation: /\?\.?|::|[{}[\];(),.:]/, })), - s.languages.insertBefore('csharp', 'number', { + e.languages.insertBefore('csharp', 'number', { range: { pattern: /\.\./, alias: 'operator' }, }), - s.languages.insertBefore('csharp', 'punctuation', { + e.languages.insertBefore('csharp', 'punctuation', { 'named-parameter': { - pattern: t('([(,]\\s*)<<0>>(?=\\s*:)', [h]), + pattern: s('([(,]\\s*)<<0>>(?=\\s*:)', [h]), lookbehind: !0, alias: 'punctuation', }, }), - s.languages.insertBefore('csharp', 'class-name', { + e.languages.insertBefore('csharp', 'class-name', { namespace: { - pattern: t( + pattern: s( '(\\b(?:namespace|using)\\s+)<<0>>(?:\\s*\\.\\s*<<0>>)*(?=\\s*[;{])', [h] ), @@ -112,50 +108,50 @@ inside: { punctuation: /\./ }, }, 'type-expression': { - pattern: t( + pattern: s( '(\\b(?:default|sizeof|typeof)\\s*\\(\\s*(?!\\s))(?:[^()\\s]|\\s(?!\\s)|<<0>>)*(?=\\s*\\))', [b] ), lookbehind: !0, alias: 'class-name', - inside: v, + inside: $, }, 'return-type': { - pattern: t( + pattern: s( '<<0>>(?=\\s+(?:<<1>>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))', - [w, m] + [x, m] ), - inside: v, + inside: $, alias: 'class-name', }, 'constructor-invocation': { - pattern: t('(\\bnew\\s+)<<0>>(?=\\s*[[({])', [w]), + pattern: s('(\\bnew\\s+)<<0>>(?=\\s*[[({])', [x]), lookbehind: !0, - inside: v, + inside: $, alias: 'class-name', }, 'generic-method': { - pattern: t('<<0>>\\s*<<1>>(?=\\s*\\()', [h, g]), + pattern: s('<<0>>\\s*<<1>>(?=\\s*\\()', [h, g]), inside: { - function: t('^<<0>>', [h]), - generic: { pattern: RegExp(g), alias: 'class-name', inside: v }, + function: s('^<<0>>', [h]), + generic: { pattern: RegExp(g), alias: 'class-name', inside: $ }, }, }, 'type-list': { - pattern: t( + pattern: s( '\\b((?:<<0>>\\s+<<1>>|record\\s+<<1>>\\s*<<5>>|where\\s+<<2>>)\\s*:\\s*)(?:<<3>>|<<4>>|<<1>>\\s*<<5>>|<<6>>)(?:\\s*,\\s*(?:<<3>>|<<4>>|<<6>>))*(?=\\s*(?:where|[{;]|=>|$))', - [d, f, h, w, p.source, b, '\\bnew\\s*\\(\\s*\\)'] + [d, f, h, x, p.source, b, '\\bnew\\s*\\(\\s*\\)'] ), lookbehind: !0, inside: { 'record-arguments': { - pattern: t('(^(?!new\\s*\\()<<0>>\\s*)<<1>>', [f, b]), + pattern: s('(^(?!new\\s*\\()<<0>>\\s*)<<1>>', [f, b]), lookbehind: !0, greedy: !0, - inside: s.languages.csharp, + inside: e.languages.csharp, }, keyword: p, - 'class-name': { pattern: RegExp(w), greedy: !0, inside: v }, + 'class-name': { pattern: RegExp(x), greedy: !0, inside: $ }, punctuation: /[,()]/, }, }, @@ -173,49 +169,49 @@ }, }, }); - var _ = $ + '|' + x, - B = a('/(?![*/])|//[^\r\n]*[\r\n]|/\\*(?:[^*]|\\*(?!/))*\\*/|<<0>>', [_]), - E = e(a('[^"\'/()]|<<0>>|\\(<<self>>*\\)', [B]), 2), - R = + var E = B + '|' + _, + R = n('/(?![*/])|//[^\r\n]*[\r\n]|/\\*(?:[^*]|\\*(?!/))*\\*/|<<0>>', [E]), + z = a(n('[^"\'/()]|<<0>>|\\(<<self>>*\\)', [R]), 2), + S = '\\b(?:assembly|event|field|method|module|param|property|return|type)\\b', - z = a('<<0>>(?:\\s*\\(<<1>>*\\))?', [m, E]); - s.languages.insertBefore('csharp', 'class-name', { + j = n('<<0>>(?:\\s*\\(<<1>>*\\))?', [m, z]); + e.languages.insertBefore('csharp', 'class-name', { attribute: { - pattern: t( + pattern: s( '((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<<0>>\\s*:\\s*)?<<1>>(?:\\s*,\\s*<<1>>)*(?=\\s*\\])', - [R, z] + [S, j] ), lookbehind: !0, greedy: !0, inside: { - target: { pattern: t('^<<0>>(?=\\s*:)', [R]), alias: 'keyword' }, + target: { pattern: s('^<<0>>(?=\\s*:)', [S]), alias: 'keyword' }, 'attribute-arguments': { - pattern: t('\\(<<0>>*\\)', [E]), - inside: s.languages.csharp, + pattern: s('\\(<<0>>*\\)', [z]), + inside: e.languages.csharp, }, 'class-name': { pattern: RegExp(m), inside: { punctuation: /\./ } }, punctuation: /[:,]/, }, }, }); - var S = ':[^}\r\n]+', - j = e(a('[^"\'/()]|<<0>>|\\(<<self>>*\\)', [B]), 2), - A = a('\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}', [j, S]), - F = e( - a('[^"\'/()]|/(?!\\*)|/\\*(?:[^*]|\\*(?!/))*\\*/|<<0>>|\\(<<self>>*\\)', [ - _, + var A = ':[^}\r\n]+', + F = a(n('[^"\'/()]|<<0>>|\\(<<self>>*\\)', [R]), 2), + P = n('\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}', [F, A]), + U = a( + n('[^"\'/()]|/(?!\\*)|/\\*(?:[^*]|\\*(?!/))*\\*/|<<0>>|\\(<<self>>*\\)', [ + E, ]), 2 ), - P = a('\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}', [F, S]); - function U(e, n) { + Z = n('\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}', [U, A]); + function q(n, a) { return { interpolation: { - pattern: t('((?:^|[^{])(?:\\{\\{)*)<<0>>', [e]), + pattern: s('((?:^|[^{])(?:\\{\\{)*)<<0>>', [n]), lookbehind: !0, inside: { 'format-string': { - pattern: t('(^\\{(?:(?![}:])<<0>>)*)<<1>>(?=\\}$)', [n, S]), + pattern: s('(^\\{(?:(?![}:])<<0>>)*)<<1>>(?=\\}$)', [a, A]), lookbehind: !0, inside: { punctuation: /^:/ }, }, @@ -223,32 +219,32 @@ expression: { pattern: /[\s\S]+/, alias: 'language-csharp', - inside: s.languages.csharp, + inside: e.languages.csharp, }, }, }, string: /[\s\S]+/, }; } - s.languages.insertBefore('csharp', 'string', { + e.languages.insertBefore('csharp', 'string', { 'interpolation-string': [ { - pattern: t( + pattern: s( '(^|[^\\\\])(?:\\$@|@\\$)"(?:""|\\\\[^]|\\{\\{|<<0>>|[^\\\\{"])*"', - [A] + [P] ), lookbehind: !0, greedy: !0, - inside: U(A, j), + inside: q(P, F), }, { - pattern: t('(^|[^@\\\\])\\$"(?:\\\\.|\\{\\{|<<0>>|[^\\\\"{])*"', [P]), + pattern: s('(^|[^@\\\\])\\$"(?:\\\\.|\\{\\{|<<0>>|[^\\\\"{])*"', [Z]), lookbehind: !0, greedy: !0, - inside: U(P, F), + inside: q(Z, U), }, ], - char: { pattern: RegExp(x), greedy: !0 }, + char: { pattern: RegExp(_), greedy: !0 }, }), - (s.languages.dotnet = s.languages.cs = s.languages.csharp); + (e.languages.dotnet = e.languages.cs = e.languages.csharp); })(Prism); |
