fix highlighting of multiline php strings

This commit is contained in:
nightwing 2012-05-26 22:03:41 +04:00
commit d2dfec41ee

View file

@ -948,18 +948,12 @@ var PhpHighlightRules = function() {
token : "string.regexp", token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)" regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"
}, { }, {
token : "string", // single line token : "string", // " string start
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' regex : '"',
}, {
token : "string", // multi line string start
regex : '["][\\s\\S]*',
next : "qqstring" next : "qqstring"
}, { }, {
token : "string", // single line token : "string", // ' string start
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" regex : "'",
}, {
token : "string", // multi line string start
regex : "['][\\s\\S]+",
next : "qstring" next : "qstring"
}, { }, {
token : "constant.numeric", // hex token : "constant.numeric", // hex
@ -1040,22 +1034,34 @@ var PhpHighlightRules = function() {
], ],
"qqstring" : [ "qqstring" : [
{ {
token : "constant.language.escape",
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
}, {
token : "constant.language.escape",
regex : /\$[\w\d]+(?:\[[\w\d]+\])?/
}, {
token : "constant.language.escape",
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
}, {
token : "string", token : "string",
regex : '"', regex : '"',
next : "start" next : "start"
}, { }, {
token : "string", token : "string",
regex : '[^"]+' regex : '.+?'
} }
], ],
"qstring" : [ "qstring" : [
{ {
token : "constant.language.escape",
regex : "\\\\['\\\\]"
}, {
token : "string", token : "string",
regex : "'", regex : "'",
next : "start" next : "start"
}, { }, {
token : "string", token : "string",
regex : "[^']+" regex : ".+?"
} }
], ],
"htmlcomment" : [ "htmlcomment" : [