You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@chocolateboy I think the first example you gave is potentially an issue, function foo () {} // > 1 space, but since the other is intentionally defined in the regex, [ \t], maybe that's more of a feature request given that it's not really a javascript parser, just code context?
The text was updated successfully, but these errors were encountered:
I'm not familiar with this package, so my comment may not be relevant if handling real-world code is out of scope.
But for anything beyond basic grepping, I recommend using a parser rather than regexes if you want to avoid playing whack-a-mole with edge cases. There's an Esprima-based function parser here.
if you want to avoid playing whack-a-mole with edge cases.
lol good line.
I recommend using a parser rather than regexes
I mostly use this for generating documentation. You're right though, I've played whack-a-mole with far too many edge cases. At some point I might start using a real parser even for the code comments since the use cases are getting more complex, but speed-wise real parsers are orders of magnitude slower and I haven't really had any problems with this yet.
Per regexhq/function-regex#2 (comment).
@chocolateboy I think the first example you gave is potentially an issue,
function foo () {} // > 1 space
, but since the other is intentionally defined in the regex,[ \t]
, maybe that's more of a feature request given that it's not really a javascript parser, just code context?The text was updated successfully, but these errors were encountered: