fix #1893 fix highlighting for PHP CJK variable name.

This commit is contained in:
nightwing 2014-04-10 14:33:37 +04:00
commit fdf832784f
2 changed files with 9 additions and 9 deletions

View file

@ -629,7 +629,7 @@ PHP.Lexer = function( src, ini ) {
}, },
{ {
value: PHP.Constants.T_VARIABLE, value: PHP.Constants.T_VARIABLE,
re: /^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ re: /^\$[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/
}, },
{ {
value: PHP.Constants.T_WHITESPACE, value: PHP.Constants.T_WHITESPACE,
@ -648,7 +648,7 @@ PHP.Lexer = function( src, ini ) {
return result; return result;
} }
var match = result.match( /(?:[^\\]|\\.)*[^\\]\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/g ); var match = result.match( /(?:[^\\]|\\.)*[^\\]\$[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/g );
if ( match !== null ) { if ( match !== null ) {
// string has a variable // string has a variable
@ -675,7 +675,7 @@ PHP.Lexer = function( src, ini ) {
} }
match = result.match(/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/); match = result.match(/^\$[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/);
@ -689,7 +689,7 @@ PHP.Lexer = function( src, ini ) {
result = result.substring( match[ 0 ].length ); result = result.substring( match[ 0 ].length );
match = result.match(/^(\-\>)\s*([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*(\()/); match = result.match(/^(\-\>)\s*([a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*)\s*(\()/);
if ( match !== null ) { if ( match !== null ) {
@ -719,7 +719,7 @@ PHP.Lexer = function( src, ini ) {
if ( curlyOpen > 0) { if ( curlyOpen > 0) {
re = /^([^\\\$"{}\]\)]|\\.)+/g; re = /^([^\\\$"{}\]\)]|\\.)+/g;
} else { } else {
re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\xff]))+/g;; re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\uffff]))+/g;;
} }
while(( match = result.match( re )) !== null ) { while(( match = result.match( re )) !== null ) {
@ -756,7 +756,7 @@ PHP.Lexer = function( src, ini ) {
if (len === result.length) { if (len === result.length) {
// nothing has been found yet // nothing has been found yet
if ((match = result.match( /^(([^\\]|\\.)*?[^\\]\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/g )) !== null) { if ((match = result.match( /^(([^\\]|\\.)*?[^\\]\$[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*)/g )) !== null) {
return; return;
} }
} }
@ -786,7 +786,7 @@ PHP.Lexer = function( src, ini ) {
}, },
{ {
value: PHP.Constants.T_STRING, value: PHP.Constants.T_STRING,
re: /^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ re: /^[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/
}, },
{ {
value: -1, value: -1,

View file

@ -969,11 +969,11 @@ var PhpLangHighlightRules = function() {
else if (value == "debugger") else if (value == "debugger")
return "invalid.deprecated"; return "invalid.deprecated";
else else
if(value.match(/^(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|self|parent)$/)) if(value.match(/^(\$[a-zA-Z_\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*|self|parent)$/))
return "variable"; return "variable";
return "identifier"; return "identifier";
}, },
regex : "[a-zA-Z_$\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\b" regex : /[a-zA-Z_$\x7f-\uffff][a-zA-Z0-9_\x7f-\uffff]*/
}, { }, {
onMatch : function(value, currentSate, state) { onMatch : function(value, currentSate, state) {
value = value.substr(3); value = value.substr(3);