Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(parser) better regular expression detection (#2380)
* enh(parser) better regular expression detection - fewer false positives - Uses a look-ahead to make sure we have a WHOLE regex and not just a partial (which is more likely a math expression)
- Loading branch information
1 parent
98b9cec
commit 11fcaea
Showing
4 changed files
with
31 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span class="hljs-comment">// examples that have proven problematic in the past</span> | ||
<span class="hljs-string">`Bad <span class="hljs-subst">${foo / <span class="hljs-number">1000</span>}</span>`</span> | ||
foo = <span class="hljs-number">2</span> / <span class="hljs-number">2</span> + <span class="hljs-number">2</span> / <span class="hljs-number">2</span>; | ||
foo = <span class="hljs-regexp">/ 2 + 2 /</span>; | ||
b = a++ / <span class="hljs-number">2</span>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// examples that have proven problematic in the past | ||
`Bad ${foo / 1000}` | ||
foo = 2 / 2 + 2 / 2; | ||
foo = / 2 + 2 /; | ||
b = a++ / 2; |