Skip to content

Commit be88474

Browse files
committed
Update jsdoc syntax to atom/language-javascript#d59666c
1 parent e6ba96f commit be88474

File tree

3 files changed

+633
-245
lines changed

3 files changed

+633
-245
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 215 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,148 +1931,264 @@ repository:
19311931
docblock:
19321932
patterns:
19331933
- name: storage.type.class.jsdoc
1934-
match: (?<!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b
1934+
match: |-
1935+
(?x)(?<!\w)@(
1936+
abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class
1937+
|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc
1938+
|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file
1939+
|fileoverview|final|fires|for|function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance
1940+
|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|modifies|module|name|namespace
1941+
|noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve|private|prop|property
1942+
|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|suppress
1943+
|template|this|throws|todo|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b
1944+
- name: other.meta.jsdoc
1945+
match: |-
1946+
(?x)
1947+
(
1948+
\[
1949+
[^\]]+ # Optional [link text] preceding {@link syntax}
1950+
\]
1951+
1952+
(?! # Check to avoid highlighting two sets of link text
1953+
{
1954+
@\w+ # Tagname
1955+
\s+
1956+
[^\s|}]+ # Namepath/URL
1957+
[\s|] # Whitespace or bar delimiting description
1958+
[^}]*
1959+
}
1960+
)
1961+
)?
1962+
1963+
(?:
1964+
{
1965+
(
1966+
@
1967+
(?: link # Name of tag
1968+
| linkcode
1969+
| linkplain
1970+
| tutorial
1971+
)
1972+
)
1973+
1974+
\s+
1975+
1976+
([^\s|}]+) # Namepath or URL
1977+
1978+
(?: # Optional link text following link target
1979+
[\s|] # Bar or space separating target and text
1980+
[^}]* # Actual text
1981+
)?
1982+
}
1983+
)
1984+
captures:
1985+
'0': { name: entity.name.type.instance.jsdoc }
1986+
'1': { name: constant.other.description.jsdoc }
1987+
'2': { name: storage.type.class.jsdoc }
1988+
'3': { name: variable.other.description.jsdoc }
19351989
- match: |-
1936-
(?x)
1937-
(?:(?<=@param)|(?<=@arg)|(?<=@argument)|(?<=@type))
1938-
\s+
1939-
({(?:
1940-
\* | # {*} any type
1941-
\? | # {?} unknown type
1942-
(?: # Check for a prefix
1943-
\? | # {?string} nullable type
1944-
! | # {!string} non-nullable type
1945-
\.{3} # {...string} variable number of parameters
1990+
(?x)
1991+
1992+
(?:(?<=@param)|(?<=@arg)|(?<=@argument)|(?<=@type))
1993+
1994+
\s+
1995+
1996+
({(?:
1997+
\* | # {*} any type
1998+
\? | # {?} unknown type
1999+
2000+
(?:
2001+
(?: # Check for a prefix
2002+
\? | # {?string} nullable type
2003+
! | # {!string} non-nullable type
2004+
\.{3} # {...string} variable number of parameters
19462005
)?
2006+
19472007
(?:
1948-
\( # Opening bracket of multiple types with parenthesis {(string|number)}
1949-
[a-zA-Z_$]+
2008+
(?:
2009+
function # {function(string, number)} function type
2010+
\s*
2011+
\(
2012+
\s*
19502013
(?:
2014+
[a-zA-Z_$][\w$]*
19512015
(?:
1952-
[\w$]*
1953-
(?:\[\])? # {(string[]|number)} type application, an array of strings or a number
1954-
) |
1955-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
1956-
)
1957-
(?:
1958-
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2016+
\s*,\s*
2017+
[a-zA-Z_$][\w$]*
2018+
)*
2019+
)?
2020+
\s*
2021+
\)
2022+
(?: # {function(): string} function return type
2023+
\s*:\s*
2024+
[a-zA-Z_$][\w$]*
2025+
)?
2026+
)?
2027+
|
2028+
(?:
2029+
\( # Opening bracket of multiple types with parenthesis {(string|number)}
19592030
[a-zA-Z_$]+
19602031
(?:
19612032
(?:
19622033
[\w$]*
1963-
(?:\[\])? # {(string|number[])} type application, a string or an array of numbers
2034+
(?:\[\])? # {(string[]|number)} type application, an array of strings or a number
19642035
) |
1965-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2036+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
19662037
)
1967-
)*
1968-
\) |
1969-
[a-zA-Z_$]+
1970-
(?:
1971-
(?:
1972-
[\w$]*
1973-
(?:\[\])? # {string[]|number} type application, an array of strings or a number
1974-
) |
1975-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
1976-
)
1977-
(?:
1978-
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2038+
(?:
2039+
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2040+
[a-zA-Z_$]+
2041+
(?:
2042+
(?:
2043+
[\w$]*
2044+
(?:\[\])? # {(string|number[])} type application, a string or an array of numbers
2045+
) |
2046+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2047+
)
2048+
)*
2049+
\) |
19792050
[a-zA-Z_$]+
19802051
(?:
1981-
[\w$]* |
1982-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2052+
(?:
2053+
[\w$]*
2054+
(?:\[\])? # {(string|number[])} type application, a string or an array of numbers
2055+
) |
2056+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
19832057
)
1984-
)*
1985-
)
1986-
# Check for suffix
1987-
(?:\[\])? # {string[]} type application, an array of strings
1988-
=? # {string=} optional parameter
1989-
)})
1990-
\s+
1991-
(
1992-
\[ # [foo] optional parameter
1993-
\s*
1994-
(?:
1995-
[a-zA-Z_$][\w$]*
19962058
(?:
1997-
(?:\[\])? # Foo[].bar properties within an array
1998-
\. # Foo.Bar namespaced parameter
1999-
[a-zA-Z_$][\w$]*
2059+
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2060+
[a-zA-Z_$]+
2061+
(?:
2062+
[\w$]* |
2063+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2064+
)
20002065
)*
2001-
(?:
2002-
\s*
2003-
= # [foo=bar] Default parameter value
2004-
\s*
2005-
[\w$\s]*
2006-
)?
20072066
)
2008-
\s*
2009-
\] |
2067+
)
2068+
# Check for suffix
2069+
(?:\[\])? # {string[]} type application, an array of strings
2070+
=? # {string=} optional parameter
2071+
)
2072+
)})
2073+
2074+
\s+
2075+
2076+
(
2077+
\[ # [foo] optional parameter
2078+
\s*
20102079
(?:
20112080
[a-zA-Z_$][\w$]*
20122081
(?:
2013-
(?:\[\])? # Foo[].bar properties within an array
2014-
\. # Foo.Bar namespaced parameter
2082+
(?:\[\])? # Foo[].bar properties within an array
2083+
\. # Foo.Bar namespaced parameter
20152084
[a-zA-Z_$][\w$]*
20162085
)*
2017-
)?
2018-
)
2019-
\s+
2020-
(?:-\s+)? # optional hyphen before the description
2021-
((?:(?!\*\/).)*) # The type description
2086+
(?:
2087+
\s*
2088+
= # [foo=bar] Default parameter value
2089+
\s*
2090+
[\w$\s]*
2091+
)?
2092+
)
2093+
\s*
2094+
\] |
2095+
(?:
2096+
[a-zA-Z_$][\w$]*
2097+
(?:
2098+
(?:\[\])? # Foo[].bar properties within an array
2099+
\. # Foo.Bar namespaced parameter
2100+
[a-zA-Z_$][\w$]*
2101+
)*
2102+
)?
2103+
)
2104+
2105+
\s+
2106+
2107+
(?:-\s+)? # optional hyphen before the description
2108+
2109+
((?:(?!\*\/).)*) # The type description
20222110
captures:
20232111
'0': { name: other.meta.jsdoc }
20242112
'1': { name: entity.name.type.instance.jsdoc }
20252113
'2': { name: variable.other.jsdoc }
20262114
'3': { name: other.description.jsdoc }
20272115
- match: |-
2028-
(?x)
2029-
({(?:
2030-
\* | # {*} any type
2031-
\? | # {?} unknown type
2032-
2033-
(?: # Check for a prefix
2034-
\? | # {?string} nullable type
2035-
! | # {!string} non-nullable type
2036-
\.{3} # {...string} variable number of parameters
2116+
(?x)
2117+
2118+
({(?:
2119+
\* | # {*} any type
2120+
\? | # {?} unknown type
2121+
2122+
(?:
2123+
(?: # Check for a prefix
2124+
\? | # {?string} nullable type
2125+
! | # {!string} non-nullable type
2126+
\.{3} # {...string} variable number of parameters
20372127
)?
20382128
20392129
(?:
2040-
\( # Opening bracket of multiple types with parenthesis {(string|number)}
2130+
(?:
2131+
function # {function(string, number)} function type
2132+
\s*
2133+
\(
2134+
\s*
2135+
(?:
2136+
[a-zA-Z_$][\w$]*
2137+
(?:
2138+
\s*,\s*
2139+
[a-zA-Z_$][\w$]*
2140+
)*
2141+
)?
2142+
\s*
2143+
\)
2144+
(?: # {function(): string} function return type
2145+
\s*:\s*
2146+
[a-zA-Z_$][\w$]*
2147+
)?
2148+
)?
2149+
|
2150+
(?:
2151+
\( # Opening bracket of multiple types with parenthesis {(string|number)}
2152+
[a-zA-Z_$]+
2153+
(?:
2154+
[\w$]* |
2155+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2156+
)
2157+
(?:
2158+
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2159+
[a-zA-Z_$]+
2160+
(?:
2161+
[\w$]* |
2162+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2163+
)
2164+
)*
2165+
\) |
20412166
[a-zA-Z_$]+
20422167
(?:
20432168
[\w$]* |
2044-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2169+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
20452170
)
20462171
(?:
2047-
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2172+
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
20482173
[a-zA-Z_$]+
20492174
(?:
20502175
[\w$]* |
2051-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2176+
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
20522177
)
20532178
)*
2054-
\) |
2055-
[a-zA-Z_$]+
2056-
(?:
2057-
[\w$]* |
2058-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
20592179
)
2060-
(?:
2061-
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
2062-
[a-zA-Z_$]+
2063-
(?:
2064-
[\w$]* |
2065-
\.?<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application (optional .)
2066-
)
2067-
)*
20682180
)
2069-
# Check for suffix
2070-
(?:\[\])? # {string[]} type application, an array of strings
2071-
=? # {string=} optional parameter
2072-
)})
2073-
\s+
2074-
(?:-\s+)? # optional hyphen before the description
2075-
((?:(?!\*\/).)*) # The type description
2181+
# Check for suffix
2182+
(?:\[\])? # {string[]} type application, an array of strings
2183+
=? # {string=} optional parameter
2184+
)
2185+
)})
2186+
2187+
\s+
2188+
2189+
(?:-\s+)? # optional hyphen before the description
2190+
2191+
((?:(?!\*\/).)*) # The type description
20762192
captures:
20772193
'0': { name: other.meta.jsdoc }
20782194
'1': { name: entity.name.type.instance.jsdoc }

0 commit comments

Comments
 (0)