Skip to content
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

[CLOSED] Make function regexp match JS identifier syntax exactly #1109

Open
core-ai-bot opened this issue Aug 29, 2021 · 4 comments
Open

[CLOSED] Make function regexp match JS identifier syntax exactly #1109

core-ai-bot opened this issue Aug 29, 2021 · 4 comments

Comments

@core-ai-bot
Copy link
Member

Issue by njx
Friday Jun 22, 2012 at 18:55 GMT
Originally opened as adobe/brackets#1119


Fixes #1108.

In addition to changing the function name regexps to exactly match JS identifier syntax (first char is $, _, or alpha; later chars are $, _, or alphanumeric), I removed a \b from the first arm of the regexp that seems unnecessary since it explicitly looks for a \s afterwards anyway.

Added unit tests for various whitespace cases, but we might want to add some more as well (including false positives).


njx included the following code: https://github.com/adobe/brackets/pull/1119/commits

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday Jun 22, 2012 at 19:03 GMT


Note that this also fixes the ternary operator case that Peter mentioned, but I couldn't quickly write a unit test for that since we don't have an easy way right now to verify that it doesn't find a match for a nonexistent name. Would be good if someone could add that.

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Friday Jun 22, 2012 at 20:23 GMT


Reviewing

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Friday Jun 22, 2012 at 21:44 GMT


RegExps look good.

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Friday Jun 22, 2012 at 21:48 GMT


I'm working on some false positive tests now. I'll update this pull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant