fix #510 #{} highlighting for CoffeeScript
This commit is contained in:
parent
743aad3ad4
commit
f40cc1c31d
2 changed files with 63 additions and 10 deletions
|
|
@ -100,10 +100,12 @@
|
|||
["text"," "],
|
||||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["paren.lparen","({"],
|
||||
["paren.lparen","("],
|
||||
["paren","{"],
|
||||
["keyword.operator","/"],
|
||||
["identifier","abc"],
|
||||
["paren.rparen","})"],
|
||||
["paren","}"],
|
||||
["paren.rparen",")"],
|
||||
["text"," "],
|
||||
["storage.type","=>"]
|
||||
],[
|
||||
|
|
@ -113,10 +115,12 @@
|
|||
["text"," "],
|
||||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["paren.lparen","({"],
|
||||
["paren.lparen","("],
|
||||
["paren","{"],
|
||||
["identifier","abc"],
|
||||
["keyword.operator","/"],
|
||||
["paren.rparen","})"],
|
||||
["paren","}"],
|
||||
["paren.rparen",")"],
|
||||
["text"," "],
|
||||
["storage.type","->"]
|
||||
],[
|
||||
|
|
@ -150,10 +154,12 @@
|
|||
["text"," "],
|
||||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["paren.lparen","({"],
|
||||
["paren.lparen","("],
|
||||
["paren","{"],
|
||||
["paren.rparen",")"],
|
||||
["identifier","abc"],
|
||||
["paren.rparen","})"],
|
||||
["paren","}"],
|
||||
["paren.rparen",")"],
|
||||
["text"," "],
|
||||
["storage.type","->"]
|
||||
],[
|
||||
|
|
@ -163,9 +169,12 @@
|
|||
["text"," "],
|
||||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["paren.lparen","({"],
|
||||
["paren.lparen","("],
|
||||
["paren","{"],
|
||||
["identifier","abc"],
|
||||
["paren.rparen",")})"],
|
||||
["paren.rparen",")"],
|
||||
["paren","}"],
|
||||
["paren.rparen",")"],
|
||||
["text"," "],
|
||||
["storage.type","->"]
|
||||
],[
|
||||
|
|
@ -427,9 +436,36 @@
|
|||
["keyword.operator","="],
|
||||
["text"," "],
|
||||
["string.start","\""],
|
||||
["string","#{ 22 / 7 + {x: "],
|
||||
["paren.string","#{"],
|
||||
["text"," "],
|
||||
["constant.numeric","22"],
|
||||
["text"," "],
|
||||
["keyword.operator","/"],
|
||||
["text"," "],
|
||||
["constant.numeric","7"],
|
||||
["text"," "],
|
||||
["keyword.operator","+"],
|
||||
["text"," "],
|
||||
["paren","{"],
|
||||
["identifier","x"],
|
||||
["keyword.operator",":"],
|
||||
["text"," "],
|
||||
["string.start","\""],
|
||||
["paren.string","#{"],
|
||||
["identifier","a"],
|
||||
["text"," "],
|
||||
["keyword.operator","+"],
|
||||
["text"," "],
|
||||
["identifier","b"],
|
||||
["paren.string","}"],
|
||||
["string.end","\""],
|
||||
["comment","#{a + b}\"} + 2}\""]
|
||||
["paren","}"],
|
||||
["text"," "],
|
||||
["keyword.operator","+"],
|
||||
["text"," "],
|
||||
["constant.numeric","2"],
|
||||
["paren.string","}"],
|
||||
["string.end","\""]
|
||||
],[
|
||||
"qqdoc",
|
||||
["string","\"\"\"heredoc"]
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ define(function(require, exports, module) {
|
|||
regex : '"""',
|
||||
next : [
|
||||
{token : "string", regex : '"""', next : "start"},
|
||||
{token : "paren.string", regex : '#{', push : "start"},
|
||||
{token : "constant.language.escape", regex : stringEscape},
|
||||
{defaultToken: "string"}
|
||||
]
|
||||
|
|
@ -121,6 +122,7 @@ define(function(require, exports, module) {
|
|||
stateName: "qqstring",
|
||||
token : "string.start", regex : '"', next : [
|
||||
{token : "string.end", regex : '"', next : "start"},
|
||||
{token : "paren.string", regex : '#{', push : "start"},
|
||||
{token : "constant.language.escape", regex : stringEscape},
|
||||
{defaultToken: "string"}
|
||||
]
|
||||
|
|
@ -131,6 +133,21 @@ define(function(require, exports, module) {
|
|||
{token : "constant.language.escape", regex : stringEscape},
|
||||
{defaultToken: "string"}
|
||||
]
|
||||
}, {
|
||||
regex: "[{}]", onMatch: function(val, state, stack) {
|
||||
this.next = "";
|
||||
if (val == "{" && stack.length) {
|
||||
stack.unshift("start", state);
|
||||
return "paren";
|
||||
}
|
||||
if (val == "}" && stack.length) {
|
||||
stack.shift();
|
||||
this.next = stack.shift();
|
||||
if (this.next.indexOf("string") != -1)
|
||||
return "paren.string";
|
||||
}
|
||||
return "paren";
|
||||
}
|
||||
}, {
|
||||
token : "string.regex",
|
||||
regex : "///",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue