mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-19 03:44:23 -05:00
heregex: now allows bare slashes and empty body
This commit is contained in:
@@ -205,11 +205,12 @@
|
||||
return true;
|
||||
};
|
||||
Lexer.prototype.heregexToken = function(match) {
|
||||
var _ref2, body, flags, heregex;
|
||||
var _ref2, body, flags, heregex, re;
|
||||
_ref2 = match, heregex = _ref2[0], body = _ref2[1], flags = _ref2[2];
|
||||
this.i += heregex.length;
|
||||
if (!(~body.indexOf('#{'))) {
|
||||
this.token('REGEX', '/' + body.replace(HEREGEX_OMIT, '') + '/' + flags);
|
||||
re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
|
||||
this.token('REGEX', "/" + (re || '(?:)') + "/" + (flags));
|
||||
return true;
|
||||
}
|
||||
this.token('IDENTIFIER', 'RegExp');
|
||||
|
||||
Reference in New Issue
Block a user