-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whitespace handling in function regex #1
Comments
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. |
lol good line.
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. good feedback though, thank you |
closing since this hasn't really caused an issue |
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: