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

Update guess_is_regexp.js #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update guess_is_regexp.js #1

wants to merge 1 commit into from

Conversation

jkomyno
Copy link

@jkomyno jkomyno commented Jul 6, 2017

Fixes failure case. For instance, consider the following:

import { AppRegistry } from 'react-native';
// import './ReactotronConfig';
import { App } from 'app/root';
AppRegistry.registerComponent('MyApp', () => App);

With the previous version of REGEXP_PRECEDER_TOKEN_RE, it would have failed to find out that L#2 is a comment. Now it has this capability.

Fixes failure case. For instance, consider the following:

```javascript
import { AppRegistry } from 'react-native';
// import './ReactotronConfig';
import { App } from 'app/root';
AppRegistry.registerComponent('MyApp', () => App);
```

With the previous version of `REGEXP_PRECEDER_TOKEN_RE`, it would have failed to find out that L#2 is a comment. Now it has this capability.
@mikesamuel
Copy link
Owner

mikesamuel commented Jul 7, 2017

It seems like there might be a separate bug. Where is guess_is_regexp being called for a //... token?

11.8.5 Regular Expression Literals says

NOTE 2 Regular expression literals may not be empty; instead of representing an empty regular expression literal, the code unit sequence // starts a single-line comment. To specify an empty regular expression, use: /(?:)/.

Though not explicitly called out, an analysis of the grammar shows that /* cannot start a regexp literal since * is a suffix operator and its operand does not match the empty string.

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

Successfully merging this pull request may close these issues.

2 participants