Skip to content

Commit

Permalink
fix highlighting of c# strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Feb 16, 2013
1 parent 382eb6a commit 0f71bb2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/ace/mode/csharp_highlight_rules.js
Expand Up @@ -30,11 +30,17 @@ var CSharpHighlightRules = function() {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
token : "string", // character
regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
token : "string", start : '"', end : '"|$', next: [
{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
regex : "0[xX][0-9a-fA-F]+\\b"
Expand All @@ -46,8 +52,6 @@ var CSharpHighlightRules = function() {
regex : "(?:true|false)\\b"
}, {
token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",
Expand Down Expand Up @@ -80,6 +84,7 @@ var CSharpHighlightRules = function() {

this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
this.normalizeRules();
};

oop.inherits(CSharpHighlightRules, TextHighlightRules);
Expand Down

0 comments on commit 0f71bb2

Please sign in to comment.