Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 91452e6

Browse files
committed
🐛 Add prefixes to function type for JSDoc
1 parent d59666c commit 91452e6

File tree

1 file changed

+74
-18
lines changed

1 file changed

+74
-18
lines changed

grammars/javascript.cson

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,17 +1934,45 @@
19341934
(?:
19351935
function # {function(string, number)} function type
19361936
\\s*
1937-
\\(
1938-
\\s*
19391937
(?:
1940-
[a-zA-Z_$][\\w$]*
19411938
(?:
1942-
\\s*,\\s*
1943-
[a-zA-Z_$][\\w$]*
1944-
)*
1945-
)?
1946-
\\s*
1947-
\\)
1939+
\\(
1940+
\\s*
1941+
\\.{3}[a-zA-Z_$][\\w$]+ # {function(...string)} variable number of parameters
1942+
\\s*
1943+
\\)
1944+
)
1945+
|
1946+
(?:
1947+
\\(
1948+
\\s*
1949+
(?:
1950+
(?:
1951+
\\? | # {function(?string)} nullable type
1952+
! | # {function(!string)} non-nullable type
1953+
)?
1954+
[a-zA-Z_$][\\w$]+
1955+
(?:
1956+
\\s*,\\s*
1957+
(?:
1958+
(?:
1959+
(?:
1960+
\\? | # {function(string, ?string)} nullable type
1961+
! | # {function(string, !string)} non-nullable type
1962+
)?
1963+
[a-zA-Z_$][\\w$]+
1964+
)
1965+
|
1966+
(?:
1967+
\\.{3}[a-zA-Z_$][\\w$]+ # {function(string, ...string)} variable number of parameters
1968+
)
1969+
)
1970+
)*
1971+
)*
1972+
\\s*
1973+
\\)
1974+
)
1975+
)
19481976
(?: # {function(): string} function return type
19491977
\\s*:\\s*
19501978
[a-zA-Z_$][\\w$]*
@@ -2056,17 +2084,45 @@
20562084
(?:
20572085
function # {function(string, number)} function type
20582086
\\s*
2059-
\\(
2060-
\\s*
20612087
(?:
2062-
[a-zA-Z_$][\\w$]*
20632088
(?:
2064-
\\s*,\\s*
2065-
[a-zA-Z_$][\\w$]*
2066-
)*
2067-
)?
2068-
\\s*
2069-
\\)
2089+
\\(
2090+
\\s*
2091+
\\.{3}[a-zA-Z_$][\\w$]+ # {function(...string)} variable number of parameters
2092+
\\s*
2093+
\\)
2094+
)
2095+
|
2096+
(?:
2097+
\\(
2098+
\\s*
2099+
(?:
2100+
(?:
2101+
\\? | # {function(?string)} nullable type
2102+
! | # {function(!string)} non-nullable type
2103+
)?
2104+
[a-zA-Z_$][\\w$]+
2105+
(?:
2106+
\\s*,\\s*
2107+
(?:
2108+
(?:
2109+
(?:
2110+
\\? | # {function(string, ?string)} nullable type
2111+
! | # {function(string, !string)} non-nullable type
2112+
)?
2113+
[a-zA-Z_$][\\w$]+
2114+
)
2115+
|
2116+
(?:
2117+
\\.{3}[a-zA-Z_$][\\w$]+ # {function(string, ...string)} variable number of parameters
2118+
)
2119+
)
2120+
)*
2121+
)*
2122+
\\s*
2123+
\\)
2124+
)
2125+
)
20702126
(?: # {function(): string} function return type
20712127
\\s*:\\s*
20722128
[a-zA-Z_$][\\w$]*

0 commit comments

Comments
 (0)