simpler regexp for js identifiers
non identifier chars in \u00a1-\uffff range are errors anyway so they can be highlighted either as operator or as identifier using this instead of detailed unicode regexps reduces parse time by ~3x, and gives the same result for any valid js
This commit is contained in:
parent
0918c7f1c0
commit
e92ed07a19
1 changed files with 1 additions and 5 deletions
|
|
@ -93,11 +93,7 @@ var JavaScriptHighlightRules = function() {
|
|||
);
|
||||
|
||||
// TODO: Unicode escape sequences
|
||||
var identifierRe = "[" + unicode.packages.L + "\\$_]["
|
||||
+ unicode.packages.L
|
||||
+ unicode.packages.Mn + unicode.packages.Mc
|
||||
+ unicode.packages.Nd
|
||||
+ unicode.packages.Pc + "\\$_]*\\b";
|
||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
||||
|
||||
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
||||
"u[0-9a-fA-F]{4}|" + // unicode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue