Re-use the caught exception's error message in the parse error call.

This commit is contained in:
Chris Cowan
2015-05-14 12:27:56 -07:00
committed by Richard van Velzen
parent d6814050dd
commit 9854deb626

View File

@@ -480,13 +480,11 @@ function tokenizer($TEXT, filename, html5_comments) {
regexp += ch; regexp += ch;
} }
var mods = read_name(); var mods = read_name();
var r;
try { try {
r = new RegExp(regexp, mods); return token("regexp", new RegExp(regexp, mods));
} catch(e) { } catch(e) {
parse_error("Invalid regular expression"); parse_error(e.message);
} }
return token("regexp", r);
}); });
function read_operator(prefix) { function read_operator(prefix) {