|
47 | 47 | typeDeclaration: 'class enum interface record struct',
|
48 | 48 | // contextual keywords
|
49 | 49 | // ("var" and "dynamic" are missing because they are used like types)
|
50 |
| - contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where', |
| 50 | + contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)', |
51 | 51 | // all other keywords
|
52 | 52 | other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
|
53 | 53 | };
|
|
158 | 158 | {
|
159 | 159 | // Variable, field and parameter declaration
|
160 | 160 | // (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
|
161 |
| - pattern: re(/\b<<0>>(?=\s+(?!<<1>>)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]), |
| 161 | + pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]), |
162 | 162 | inside: typeInside
|
163 | 163 | }
|
164 | 164 | ],
|
|
239 | 239 | // class Foo<F> : Bar, IList<FooBar>
|
240 | 240 | // where F : Bar, IList<int>
|
241 | 241 | pattern: re(
|
242 |
| - /\b((?:<<0>>\s+<<1>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>)(?:\s*,\s*(?:<<3>>|<<4>>))*(?=\s*(?:where|[{;]|=>|$))/.source, |
243 |
| - [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source] |
| 242 | + /\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|[{;]|=>|$))/.source, |
| 243 | + [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source] |
244 | 244 | ),
|
245 | 245 | lookbehind: true,
|
246 | 246 | inside: {
|
| 247 | + 'record-arguments': { |
| 248 | + pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]), |
| 249 | + lookbehind: true, |
| 250 | + greedy: true, |
| 251 | + inside: Prism.languages.csharp |
| 252 | + }, |
247 | 253 | 'keyword': keywords,
|
248 | 254 | 'class-name': {
|
249 | 255 | pattern: RegExp(typeExpression),
|
250 | 256 | greedy: true,
|
251 | 257 | inside: typeInside
|
252 | 258 | },
|
253 |
| - 'punctuation': /,/ |
| 259 | + 'punctuation': /[,()]/ |
254 | 260 | }
|
255 | 261 | },
|
256 | 262 | 'preprocessor': {
|
|
0 commit comments