From 4c631146cb3be0831af549e510cabc3cfe909f8d Mon Sep 17 00:00:00 2001 From: Alberto Schiabel Date: Thu, 6 Jul 2017 11:02:52 +0200 Subject: [PATCH] Update guess_is_regexp.js 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. --- src/guess_is_regexp.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/guess_is_regexp.js b/src/guess_is_regexp.js index 2c5747d..f99af54 100644 --- a/src/guess_is_regexp.js +++ b/src/guess_is_regexp.js @@ -30,6 +30,8 @@ var REGEXP_PRECEDER_TOKEN_RE = new RegExp( + "|," // Second binary operand cannot start a division. + "|[*]" // Ditto binary operand. + ")$" + // Or match empty string + + "|^$" // Or match a token that ends with one of the characters below to match // a variety of punctuation tokens. // Some of the single char tokens could go above, but putting them below