public
/
UglifyJS.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
252fc65
)
Give a good error message if an invalid regular expression is found.
author
Chris Cowan
<agentme49@gmail.com>
Thu, 14 May 2015 19:03:54 +0000
(12:03 -0700)
committer
Richard van Velzen
<rvanvelzen@experty.com>
Wed, 29 Jul 2015 13:05:59 +0000
(15:05 +0200)
lib/parse.js
patch
|
blob
|
history
diff --git
a/lib/parse.js
b/lib/parse.js
index
e65c4fa
..
70ee2e8
100644
(file)
--- a/
lib/parse.js
+++ b/
lib/parse.js
@@
-480,7
+480,13
@@
function tokenizer($TEXT, filename, html5_comments) {
regexp += ch;
}
var mods = read_name();
- return token("regexp", new RegExp(regexp, mods));
+ var r;
+ try {
+ r = new RegExp(regexp, mods);
+ } catch(e) {
+ parse_error("Invalid regular expression");
+ }
+ return token("regexp", r);
});
function read_operator(prefix) {