|
11 | 11 | '3': |
12 | 12 | 'name': 'constant.language.access-type.jsdoc' |
13 | 13 | 'match': '''(?x) |
14 | | - ((@)access) |
| 14 | + ((@)(?:access|api)) |
15 | 15 | \\s+ |
16 | 16 | (private|protected|public) |
17 | 17 | \\b |
|
155 | 155 | | |
156 | 156 | # JSDoc namepath |
157 | 157 | ( |
158 | | - (?!https?://) |
| 158 | + (?! |
| 159 | + # Avoid matching bare URIs (also acceptable as links) |
| 160 | + https?:// |
| 161 | + | |
| 162 | + # Avoid matching {@inline tags}; we match those below |
| 163 | + (?:\\[[^\\[\\]]*\\])? # Possible description [preceding]{@tag} |
| 164 | + {@(?:link|linkcode|linkplain|tutorial)\\b |
| 165 | + ) |
| 166 | + # Matched namepath |
159 | 167 | (?:[^@\\s*/]|\\*[^/])+ |
160 | 168 | ) |
161 | 169 | ) |
|
252 | 260 | 'name': 'variable.other.jsdoc' |
253 | 261 | } |
254 | 262 | { |
| 263 | + # Optional value |
255 | 264 | 'name': 'variable.other.jsdoc' |
256 | | - 'begin': '\\[' |
257 | | - 'end': '\\]|(?=\\*/)' |
258 | | - 'patterns': [ |
259 | | - { |
260 | | - 'match': '(=)((?:[^\\]*]|\\*[^/])*)' |
261 | | - 'captures': |
262 | | - '1': |
263 | | - 'name': 'keyword.operator.assignment.jsdoc' |
264 | | - '2': |
265 | | - 'name': 'source.embedded.js' |
266 | | - 'patterns': [ |
267 | | - { |
268 | | - 'include': '#inline-tags' |
269 | | - } |
270 | | - { |
271 | | - 'include': 'source.js' |
272 | | - } |
273 | | - ] |
274 | | - } |
275 | | - { |
276 | | - 'include': '#brackets' |
277 | | - } |
278 | | - { |
279 | | - 'include': '#quotes' |
280 | | - } |
281 | | - ] |
| 265 | + 'match': '''(?x) |
| 266 | + (\\[)\\s* |
| 267 | + [\\w$]+ |
| 268 | + (?: |
| 269 | + (?:\\[\\])? # Foo[].bar properties within an array |
| 270 | + \\. # Foo.Bar namespaced parameter |
| 271 | + [\\w$]+ |
| 272 | + )* |
| 273 | + (?: |
| 274 | + \\s* |
| 275 | + (=) # [foo=bar] Default parameter value |
| 276 | + \\s* |
| 277 | + ( |
| 278 | + # The inner regexes are to stop the match early at */ and to not stop at escaped quotes |
| 279 | + (?: |
| 280 | + "(?:(?:\\*(?!/))|(?:\\\\(?!"))|[^*\\\\])*?" | # [foo="bar"] Double-quoted |
| 281 | + '(?:(?:\\*(?!/))|(?:\\\\(?!'))|[^*\\\\])*?' | # [foo='bar'] Single-quoted |
| 282 | + \\[ (?:(?:\\*(?!/))|[^*])*? \\] | # [foo=[1,2]] Array literal |
| 283 | + (?:(?:\\*(?!/))|[^*])*? # Everything else |
| 284 | + )* |
| 285 | + ) |
| 286 | + )? |
| 287 | + \\s*(?:(\\])((?:[^*\\s]|\\*[^\\s/])+)?|(?=\\*/)) |
| 288 | + ''' |
| 289 | + 'captures': |
| 290 | + '1': |
| 291 | + 'name': 'punctuation.definition.optional-value.begin.bracket.square.jsdoc' |
| 292 | + '2': |
| 293 | + 'name': 'keyword.operator.assignment.jsdoc' |
| 294 | + '3': |
| 295 | + 'name': 'source.embedded.js' |
| 296 | + 'patterns': [ |
| 297 | + { |
| 298 | + 'include': '#inline-tags' |
| 299 | + } |
| 300 | + { |
| 301 | + 'include': 'source.js' |
| 302 | + } |
| 303 | + ] |
| 304 | + '4': |
| 305 | + 'name': 'punctuation.definition.optional-value.end.bracket.square.jsdoc' |
| 306 | + '5': |
| 307 | + 'name': 'invalid.illegal.syntax.jsdoc' |
282 | 308 | } |
283 | 309 | ] |
284 | 310 | } |
|
369 | 395 | '1': |
370 | 396 | 'name': 'punctuation.definition.block.tag.jsdoc' |
371 | 397 | 'match': '''(?x) (@) |
372 | | - (?:abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |
| 398 | + (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |
373 | 399 | |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |
374 | 400 | |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |
375 | 401 | |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |
376 | | - |function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface|kind |
377 | | - |lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module|name|namespace |
378 | | - |noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve|private|prop |
379 | | - |property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule |
380 | | - |summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |
381 | | - |version|virtual|writeOnce) |
| 402 | + |function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface |
| 403 | + |internal|kind|lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module |
| 404 | + |name|namespace|noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve |
| 405 | + |private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static |
| 406 | + |struct|submodule|summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted |
| 407 | + |uses|var|variation|version|virtual|writeOnce) |
382 | 408 | \\b |
383 | 409 | ''' |
384 | 410 | 'name': 'storage.type.class.jsdoc' |
|
462 | 488 | ] |
463 | 489 | } |
464 | 490 | ] |
465 | | - # Balanced quotes |
466 | | - 'quotes': |
467 | | - 'patterns': [ |
468 | | - { |
469 | | - 'begin': "'" |
470 | | - 'end': "'|(?=\\*/)" |
471 | | - 'patterns': [ |
472 | | - { |
473 | | - 'include': '#quotes' |
474 | | - } |
475 | | - ] |
476 | | - } |
477 | | - { |
478 | | - 'begin': '"' |
479 | | - 'end': '"|(?=\\*/)' |
480 | | - 'patterns': [ |
481 | | - { |
482 | | - 'include': '#quotes' |
483 | | - } |
484 | | - ] |
485 | | - } |
486 | | - ] |
487 | 491 | # {type} |
488 | 492 | 'type': |
489 | 493 | 'patterns': [ |
|
0 commit comments