fix highlighting of c# strings

This commit is contained in:
nightwing 2013-02-09 14:14:36 +04:00
commit 0f71bb2f00

View file

@ -30,11 +30,17 @@ var CSharpHighlightRules = function() {
token : "string.regexp", token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, { }, {
token : "string", // single line token : "string", // character
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
}, { }, {
token : "string", // single line token : "string", start : '"', end : '"|$', next: [
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
{token: "invalid", regex: /\\./}
]
}, {
token : "string", start : '@"', end : '"', next:[
{token: "constant.language.escape", regex: '""'}
]
}, { }, {
token : "constant.numeric", // hex token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b" regex : "0[xX][0-9a-fA-F]+\\b"
@ -46,8 +52,6 @@ var CSharpHighlightRules = function() {
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : keywordMapper, token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",
@ -80,6 +84,7 @@ var CSharpHighlightRules = function() {
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
this.normalizeRules();
}; };
oop.inherits(CSharpHighlightRules, TextHighlightRules); oop.inherits(CSharpHighlightRules, TextHighlightRules);