leonardocxavier / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Regular expressions with grouping shouldn't be used in String.split() #289

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
DocComment.js has the following line:

  .split(/(^|[\r\n])\s*@/)

It should be replaced by:

  .split(/(?:^|[\r\n])\s*@/)

Without the unnecessary grouping this operation will execute marginally
faster. What's more important for me: Perl's JavaScript 1.11 module (which
I am using to run JSDoc Toolkit instead of Rhino) crashes with that
grouping for some reason. So it would be nice if that simple change could
be taken over in a future JSDoc Toolkit release.

Another line with the same issue in SymbolSet.js:

  var assumedName = borrowed.name.split(/([#.-])/).pop();

Should be:

  var assumedName = borrowed.name.split(/[#.-]/).pop();

Original issue reported on code.google.com by wladi...@palant.de on 12 May 2010 at 10:53

GoogleCodeExporter commented 8 years ago
I applied this change to my repository:
https://hg.adblockplus.org/jsdoc-toolkit/rev/c38fc570a4a1

Original comment by wladi...@palant.de on 12 May 2010 at 10:55

GoogleCodeExporter commented 8 years ago
Committed revision 845. Thank you for your contribution!

Original comment by micmath on 3 Jul 2010 at 7:48