hegemonic / catharsis

A JavaScript parser for Google Closure Compiler and JSDoc type expressions.
MIT License
54 stars 14 forks source link

Can't parse type expressions that contain the identifier 'undefinedFoo' #29

Closed hegemonic closed 10 years ago

hegemonic commented 10 years ago

Originally reported as jsdoc3/jsdoc#619:

It looks like the parser is being a bit greedy with the undefined literal. I'm getting an error parsing the following comment.

/**
 * @typedef {{className: (string|undefined),
 *     coordinateFormat: (ol.CoordinateFormatType|undefined),
 *     projection: ol.proj.ProjectionLike,
 *     target: (Element|undefined),
 *     undefinedHTML: (string|undefined)}}
 */

Here's the error message:

Invalid type expression "{className: (string|undefined),
   coordinateFormat: (ol.CoordinateFormatType|undefined),
   projection: ol.proj.ProjectionLike,
   target: (Element|undefined),
   undefinedHTML: (string|undefined)}": Expected "!", ",", ":", "=", "?", "|" or "}" but "H" found.

I'm having trouble debugging this. It may be an issue with Catharsis or PEG.js. Thanks for any insight.

hegemonic commented 10 years ago

This only occurs when JSDoc support is enabled.

hegemonic commented 10 years ago

Fixed in 0.7.1.