highlight js identifiers with unicode characters.

fix #148
This commit is contained in:
Fabian Jakobs 2011-07-25 17:32:17 +02:00
commit b837cd547b
5 changed files with 50 additions and 8 deletions

View file

@ -40,6 +40,7 @@ define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var regexp = require("ace/regexp");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
@ -60,6 +61,13 @@ var JavaScriptHighlightRules = function() {
"public|interface|package|protected|static").split("|")
);
// TODO: Unicode escape sequences
var identifierRe = "[" + regexp.unicode.L + "\\$_]["
+ regexp.unicode.L
+ regexp.unicode.Mn + regexp.unicode.Mc
+ regexp.unicode.Nd
+ regexp.unicode.Pc + "\\$_]*\\b";
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -115,9 +123,7 @@ var JavaScriptHighlightRules = function() {
else
return "identifier";
},
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
regex : identifierRe
}, {
token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"