|
3 | 3 |
|
4 | 4 | ATTRIBUTE_NODES = [
|
5 | 5 | # token-list -> token? token-list?
|
6 |
| - Node('TokenList', kind='SyntaxCollection', |
| 6 | + Node('TokenList', name_for_diagnostics='token list', kind='SyntaxCollection', |
7 | 7 | element='Token'),
|
8 | 8 |
|
9 | 9 | # token-list -> token token-list?
|
10 |
| - Node('NonEmptyTokenList', kind='SyntaxCollection', |
11 |
| - element='Token', omit_when_empty=True), |
| 10 | + Node('NonEmptyTokenList', name_for_diagnostics='token list', |
| 11 | + kind='SyntaxCollection', element='Token', omit_when_empty=True), |
12 | 12 |
|
13 |
| - Node('CustomAttribute', kind='Syntax', |
| 13 | + Node('CustomAttribute', name_for_diagnostics='attribute', kind='Syntax', |
14 | 14 | description='''
|
15 | 15 | A custom `@` attribute.
|
16 | 16 | ''',
|
|
37 | 37 | # | named-attribute-string-argument
|
38 | 38 | # | back-deploy-attr-spec-list
|
39 | 39 | # )? ')'?
|
40 |
| - Node('Attribute', kind='Syntax', |
| 40 | + Node('Attribute', name_for_diagnostics='attribute', kind='Syntax', |
41 | 41 | description='''
|
42 | 42 | An `@` attribute.
|
43 | 43 | ''',
|
|
89 | 89 | ]),
|
90 | 90 |
|
91 | 91 | # attribute-list -> attribute attribute-list?
|
92 |
| - Node('AttributeList', kind='SyntaxCollection', |
| 92 | + Node('AttributeList', name_for_diagnostics='attributes', kind='SyntaxCollection', |
93 | 93 | omit_when_empty=True,
|
94 | 94 | element='Syntax', element_name='Attribute',
|
95 | 95 | element_choices=[
|
|
102 | 102 | # specialize-spec-attr-list?
|
103 | 103 | # | generic-where-clause
|
104 | 104 | # specialize-spec-attr-list?
|
105 |
| - Node('SpecializeAttributeSpecList', kind='SyntaxCollection', |
| 105 | + Node('SpecializeAttributeSpecList', |
| 106 | + name_for_diagnostics="argument to '@_specialize", kind='SyntaxCollection', |
106 | 107 | description='''
|
107 | 108 | A collection of arguments for the `@_specialize` attribute
|
108 | 109 | ''',
|
|
114 | 115 | 'GenericWhereClause',
|
115 | 116 | ]),
|
116 | 117 |
|
117 |
| - Node('AvailabilityEntry', kind='Syntax', |
| 118 | + Node('AvailabilityEntry', name_for_diagnostics='availability entry', kind='Syntax', |
118 | 119 | description='''
|
119 | 120 | The availability argument for the _specialize attribute
|
120 | 121 | ''',
|
|
131 | 132 | # Representation of e.g. 'exported: true,'
|
132 | 133 | # labeled-specialize-entry -> identifier ':' token ','?
|
133 | 134 | Node('LabeledSpecializeEntry', kind='Syntax',
|
| 135 | + name_for_diagnostics='attribute argument', |
134 | 136 | description='''
|
135 | 137 | A labeled argument for the `@_specialize` attribute like
|
136 | 138 | `exported: true`
|
|
151 | 153 | # Representation of e.g. 'exported: true,'
|
152 | 154 | # labeled-specialize-entry -> identifier ':' token ','?
|
153 | 155 | Node('TargetFunctionEntry', kind='Syntax',
|
| 156 | + name_for_diagnostics='attribute argument', |
154 | 157 | description='''
|
155 | 158 | A labeled argument for the `@_specialize` attribute with a function
|
156 | 159 | decl value like
|
|
173 | 176 | # The argument of '@_dynamic_replacement(for:)' or '@_private(sourceFile:)'
|
174 | 177 | # named-attribute-string-arg -> 'name': string-literal
|
175 | 178 | Node('NamedAttributeStringArgument', kind='Syntax',
|
| 179 | + name_for_diagnostics='attribute argument', |
176 | 180 | description='''
|
177 | 181 | The argument for the `@_dynamic_replacement` or `@_private`
|
178 | 182 | attribute of the form `for: "function()"` or `sourceFile:
|
|
188 | 192 | Child('Declname', kind='DeclName'),
|
189 | 193 | ]),
|
190 | 194 | ]),
|
191 |
| - Node('DeclName', kind='Syntax', children=[ |
| 195 | + Node('DeclName', name_for_diagnostics='declaration name', kind='Syntax', children=[ |
192 | 196 | Child('DeclBaseName', kind='Syntax', description='''
|
193 | 197 | The base name of the protocol\'s requirement.
|
194 | 198 | ''',
|
|
205 | 209 | # The argument of '@_implements(...)'
|
206 | 210 | # implements-attr-arguments -> simple-type-identifier ','
|
207 | 211 | # (identifier | operator) decl-name-arguments
|
208 |
| - Node('ImplementsAttributeArguments', kind='Syntax', |
| 212 | + Node('ImplementsAttributeArguments', name_for_diagnostics='@_implements arguemnts', |
| 213 | + kind='Syntax', |
209 | 214 | description='''
|
210 | 215 | The arguments for the `@_implements` attribute of the form
|
211 | 216 | `Type, methodName(arg1Label:arg2Label:)`
|
|
234 | 239 | ]),
|
235 | 240 |
|
236 | 241 | # objc-selector-piece -> identifier? ':'?
|
237 |
| - Node('ObjCSelectorPiece', kind='Syntax', |
| 242 | + Node('ObjCSelectorPiece', name_for_diagnostics='Objective-C selector piece', |
| 243 | + kind='Syntax', |
238 | 244 | description='''
|
239 | 245 | A piece of an Objective-C selector. Either consisting of just an
|
240 | 246 | identifier for a nullary selector, an identifier and a colon for a
|
|
246 | 252 | ]),
|
247 | 253 |
|
248 | 254 | # objc-selector -> objc-selector-piece objc-selector?
|
249 |
| - Node('ObjCSelector', kind='SyntaxCollection', element='ObjCSelectorPiece'), |
| 255 | + Node('ObjCSelector', name_for_diagnostics='Objective-C selector', |
| 256 | + kind='SyntaxCollection', element='ObjCSelectorPiece'), |
250 | 257 |
|
251 | 258 | # The argument of '@differentiable(...)'.
|
252 | 259 | # differentiable-attr-arguments ->
|
253 | 260 | # differentiability-kind? '.'? differentiability-params-clause? ','?
|
254 | 261 | # generic-where-clause?
|
255 |
| - Node('DifferentiableAttributeArguments', kind='Syntax', |
| 262 | + Node('DifferentiableAttributeArguments', |
| 263 | + name_for_diagnostics="'@differentiable' arguments", kind='Syntax', |
256 | 264 | description='''
|
257 | 265 | The arguments for the `@differentiable` attribute: an optional
|
258 | 266 | differentiability kind, an optional differentiability parameter clause,
|
|
276 | 284 |
|
277 | 285 | # differentiability-params-clause ->
|
278 | 286 | # 'wrt' ':' (differentiability-param | differentiability-params)
|
279 |
| - Node('DifferentiabilityParamsClause', kind='Syntax', |
| 287 | + Node('DifferentiabilityParamsClause', |
| 288 | + name_for_diagnostics="'@differentiable' argument", kind='Syntax', |
280 | 289 | description='A clause containing differentiability parameters.',
|
281 | 290 | children=[
|
282 | 291 | Child('WrtLabel', kind='IdentifierToken',
|
|
292 | 301 | ]),
|
293 | 302 |
|
294 | 303 | # differentiability-params -> '(' differentiability-param-list ')'
|
295 |
| - Node('DifferentiabilityParams', kind='Syntax', |
| 304 | + Node('DifferentiabilityParams', name_for_diagnostics='differentiability parameters', |
| 305 | + kind='Syntax', |
296 | 306 | description='The differentiability parameters.',
|
297 | 307 | children=[
|
298 | 308 | Child('LeftParen', kind='LeftParenToken'),
|
|
304 | 314 |
|
305 | 315 | # differentiability-param-list ->
|
306 | 316 | # differentiability-param differentiability-param-list?
|
307 |
| - Node('DifferentiabilityParamList', kind='SyntaxCollection', |
| 317 | + Node('DifferentiabilityParamList', |
| 318 | + name_for_diagnostics='differentiability parameters', kind='SyntaxCollection', |
308 | 319 | element='DifferentiabilityParam'),
|
309 | 320 |
|
310 | 321 | # differentiability-param -> ('self' | identifier | integer-literal) ','?
|
311 |
| - Node('DifferentiabilityParam', kind='Syntax', |
| 322 | + Node('DifferentiabilityParam', name_for_diagnostics='differentiability parameter', |
| 323 | + kind='Syntax', |
312 | 324 | description='''
|
313 | 325 | A differentiability parameter: either the "self" identifier, a function
|
314 | 326 | parameter name, or a function parameter index.
|
|
330 | 342 | #
|
331 | 343 | # derivative-registration-attr-arguments ->
|
332 | 344 | # 'of' ':' func-decl-name ','? differentiability-params-clause?
|
333 |
| - Node('DerivativeRegistrationAttributeArguments', kind='Syntax', |
| 345 | + Node('DerivativeRegistrationAttributeArguments', |
| 346 | + name_for_diagnostics='attribute arguments', |
| 347 | + kind='Syntax', |
334 | 348 | description='''
|
335 | 349 | The arguments for the '@derivative(of:)' and '@transpose(of:)'
|
336 | 350 | attributes: the 'of:' label, the original declaration name, and an
|
|
369 | 383 | # base-type ->
|
370 | 384 | # member-type-identifier | base-type-identifier
|
371 | 385 | Node('QualifiedDeclName', kind='Syntax',
|
| 386 | + name_for_diagnostics='declaration name', |
372 | 387 | description='''
|
373 | 388 | An optionally qualified function declaration name (e.g. `+(_:_:)`,
|
374 | 389 | `A.B.C.foo(_:_:)`).
|
|
402 | 417 | # NOTE: This is duplicated with `DeclName` above. Change `DeclName`
|
403 | 418 | # description and use it if possible.
|
404 | 419 | Node('FunctionDeclName', kind='Syntax',
|
| 420 | + name_for_diagnostics='function declaration name', |
405 | 421 | description='A function declaration name (e.g. `foo(_:_:)`).',
|
406 | 422 | children=[
|
407 | 423 | Child('Name', kind='Syntax', description='''
|
|
423 | 439 | # The arguments of '@_backDeploy(...)'
|
424 | 440 | # back-deploy-attr-spec-list -> 'before' ':' back-deploy-version-list
|
425 | 441 | Node('BackDeployAttributeSpecList', kind='Syntax',
|
| 442 | + name_for_diagnostics="'@_backDeploy' arguments", |
426 | 443 | description='''
|
427 | 444 | A collection of arguments for the `@_backDeploy` attribute
|
428 | 445 | ''',
|
|
441 | 458 |
|
442 | 459 | # back-deploy-version-list ->
|
443 | 460 | # back-deploy-version-entry back-deploy-version-list?
|
444 |
| - Node('BackDeployVersionList', kind='SyntaxCollection', |
445 |
| - element='BackDeployVersionArgument'), |
| 461 | + Node('BackDeployVersionList', name_for_diagnostics='version list', |
| 462 | + kind='SyntaxCollection', element='BackDeployVersionArgument'), |
446 | 463 |
|
447 | 464 | # back-deploy-version-entry -> availability-version-restriction ','?
|
448 |
| - Node('BackDeployVersionArgument', kind='Syntax', |
| 465 | + Node('BackDeployVersionArgument', name_for_diagnostics='version', kind='Syntax', |
449 | 466 | description='''
|
450 | 467 | A single platform/version pair in a `@_backDeploy` attribute,
|
451 | 468 | e.g. `iOS 10.1`.
|
|
0 commit comments