Skip to content

Commit 763bcdb

Browse files
committed
2 parents 541392a + 4f41fa5 commit 763bcdb

File tree

4 files changed

+541
-328
lines changed

4 files changed

+541
-328
lines changed

grammars/javascript.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@
15241524
'name': 'punctuation.definition.unicode-escape.end.bracket.curly.js'
15251525
}
15261526
{
1527-
'match': '\\\\(x\\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
1527+
'match': '\\\\(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)'
15281528
'name': 'constant.character.escape.js'
15291529
}
15301530
]

grammars/jsdoc.cson

Lines changed: 61 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'3':
1212
'name': 'constant.language.access-type.jsdoc'
1313
'match': '''(?x)
14-
((@)access)
14+
((@)(?:access|api))
1515
\\s+
1616
(private|protected|public)
1717
\\b
@@ -155,7 +155,15 @@
155155
|
156156
# JSDoc namepath
157157
(
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
159167
(?:[^@\\s*/]|\\*[^/])+
160168
)
161169
)
@@ -252,33 +260,51 @@
252260
'name': 'variable.other.jsdoc'
253261
}
254262
{
263+
# Optional value
255264
'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'
282308
}
283309
]
284310
}
@@ -369,16 +395,16 @@
369395
'1':
370396
'name': 'punctuation.definition.block.tag.jsdoc'
371397
'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
373399
|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright
374400
|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception
375401
|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)
382408
\\b
383409
'''
384410
'name': 'storage.type.class.jsdoc'
@@ -462,28 +488,6 @@
462488
]
463489
}
464490
]
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-
]
487491
# {type}
488492
'type':
489493
'patterns': [

grammars/regular expressions (javascript).cson

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'name': 'constant.character.character-class.regexp'
1515
}
1616
{
17-
'match': '\\\\([0-7]{3}|x\\h\\h|u\\h\\h\\h\\h)'
17+
'match': '\\\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})'
1818
'name': 'constant.character.numeric.regexp'
1919
}
2020
{
@@ -107,7 +107,7 @@
107107
'name': 'constant.character.control.regexp'
108108
'6':
109109
'name': 'constant.character.escape.backslash.regexp'
110-
'match': '(?:.|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x\\h\\h|u\\h\\h\\h\\h))|(\\\\c[A-Z])|(\\\\.))'
110+
'match': '(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))'
111111
'name': 'constant.other.character-class.range.regexp'
112112
}
113113
{

0 commit comments

Comments
 (0)