fix highlighting of /"[s]/ in coffeeScript

This commit is contained in:
nightwing 2012-09-28 12:13:48 +04:00
commit 3b911019f1
2 changed files with 7 additions and 1 deletions

View file

@ -125,7 +125,7 @@ define(function(require, exports, module) {
next : "heregex"
}, {
token : "string.regex",
regex : "/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"
regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
}, {
token : "comment",
merge : true,

View file

@ -49,6 +49,12 @@ module.exports = {
assert.equal(tokens[0].type, "keyword");
},
"test: tokenize regexp": function() {
var tokens = this.tokenizer.getLineTokens('/"[a]/', "start").tokens;
assert.equal(tokens.length, 1);
assert.equal(tokens[0].type, "string.regex");
},
// TODO: disable. not yet implemented
"!test tokenize string with interpolation": function() {
var tokens = this.tokenizer.getLineTokens('"#{ 22 / 7 } is a decent approximation of π"', "start").tokens;