1 | Prism.languages.csharp = Prism.languages.extend('clike', {
|
2 | 'keyword': /\b(?:abstract|add|alias|as|ascending|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|global|goto|group|if|implicit|in|int|interface|internal|into|is|join|let|lock|long|namespace|new|null|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/,
|
3 | 'string': [
|
4 | {
|
5 | pattern: /@("|')(?:\1\1|\\[\s\S]|(?!\1)[^\\])*\1/,
|
6 | greedy: true
|
7 | },
|
8 | {
|
9 | pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*?\1/,
|
10 | greedy: true
|
11 | }
|
12 | ],
|
13 | 'class-name': [
|
14 | {
|
15 |
|
16 | pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=\s+\w+)/,
|
17 | inside: {
|
18 | punctuation: /\./
|
19 | }
|
20 | },
|
21 | {
|
22 |
|
23 | pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/,
|
24 | lookbehind: true,
|
25 | inside: {
|
26 | punctuation: /\./
|
27 | }
|
28 | },
|
29 | {
|
30 |
|
31 | pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/,
|
32 | lookbehind: true,
|
33 | inside: {
|
34 | punctuation: /\./
|
35 | }
|
36 | },
|
37 | {
|
38 |
|
39 | pattern: /((?:\b(?:class|interface|new)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/,
|
40 | lookbehind: true,
|
41 | inside: {
|
42 | punctuation: /\./
|
43 | }
|
44 | }
|
45 | ],
|
46 | 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)f?/i
|
47 | });
|
48 |
|
49 | Prism.languages.insertBefore('csharp', 'class-name', {
|
50 | 'generic-method': {
|
51 | pattern: /\w+\s*<[^>\r\n]+?>\s*(?=\()/,
|
52 | inside: {
|
53 | function: /^\w+/,
|
54 | 'class-name': {
|
55 | pattern: /\b[A-Z]\w*(?:\.\w+)*\b/,
|
56 | inside: {
|
57 | punctuation: /\./
|
58 | }
|
59 | },
|
60 | keyword: Prism.languages.csharp.keyword,
|
61 | punctuation: /[<>(),.:]/
|
62 | }
|
63 | },
|
64 | 'preprocessor': {
|
65 | pattern: /(^\s*)#.*/m,
|
66 | lookbehind: true,
|
67 | alias: 'property',
|
68 | inside: {
|
69 |
|
70 | 'directive': {
|
71 | pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,
|
72 | lookbehind: true,
|
73 | alias: 'keyword'
|
74 | }
|
75 | }
|
76 | }
|
77 | });
|
78 |
|
79 | Prism.languages.dotnet = Prism.languages.csharp; |
\ | No newline at end of file |