Give a good error message if an invalid regular expression is found.
This commit is contained in:
committed by
Richard van Velzen
parent
252fc65558
commit
d6814050dd
@@ -480,7 +480,13 @@ function tokenizer($TEXT, filename, html5_comments) {
|
|||||||
regexp += ch;
|
regexp += ch;
|
||||||
}
|
}
|
||||||
var mods = read_name();
|
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) {
|
function read_operator(prefix) {
|
||||||
|
|||||||
Reference in New Issue
Block a user