jsdoc2md / jsdoc-parse

parses jsdoc documentation from javascript or html files, outputs JSON
MIT License
99 stars 19 forks source link

Variadic arguments break the parser #2

Closed Rantanen closed 9 years ago

Rantanen commented 9 years ago
/**
 * Example event
 *
 * @event Class#event
 * @param {...} arguments - The original event arguments.
 */

Results in

ERROR: Unable to parse a tag's type expression for source file /tmp/3939179752temp-file.js with tag title "param" and text "{...} arguments - The original event arguments.": Invalid type expression "...": Expected "!", "$", "'", "(", "*", "?", "Function", "\"", "\\", "_", "break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "implements", "import", "in", "instanceof", "interface", "let", "new", "null", "package", "private", "protected", "public", "return", "static", "super", "switch", "this", "throw", "true", "try", "typeof", "undefined", "var", "void", "while", "with", "yield", "{", Unicode letter number, Unicode lowercase letter, Unicode modifier letter, Unicode other letter, Unicode titlecase letter or Unicode uppercase letter but end of input found.

http://usejsdoc.org/tags-param.html#multiple-types-and-repeatable-parameters

75lb commented 9 years ago

your syntax is incorrect, you forgot to specify the type of the variadic args.. should look something like

/**
 * Example event
 *
 * @event Class#event
 * @param {...string} arguments - The original event arguments.
 */

in this case we use string but it could be any valid type expression..

Rantanen commented 9 years ago

Right. Don't suppose there's a way to omit the type? I'd rather have the output with:

Instead of

The *-type doesn't really add any meaning to the documentation.

Rantanen commented 9 years ago

(And not a big deal. I can always alter the templates myself and make a special case to omit all * types from the markdown, was just wondering if there was something built-in)

75lb commented 9 years ago

sorry, this is an issue for the jsdoc project.. the error you are seeing is thrown by jsdoc, which means jsdoc-parse (running upstream of jsdoc) fails too..

Rantanen commented 9 years ago

Oh wait. jsdoc-parse is using jsdoc internally? Thought it was your own parser, in that case I won't feel too bad opening another one... :)

75lb commented 9 years ago

Yes, it does