add php heredoc support

This commit is contained in:
nightwing 2012-12-28 16:42:22 +04:00
commit 782e3f8743

View file

@ -974,6 +974,16 @@ var PhpLangHighlightRules = function() {
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : function(value, currentSate, state) {
value = value.substr(3);
if (value[0] == "'" || value[0] == '"')
value = value.slice(1, -1);
state.unshift(this.next, value);
return "markup.list";
},
regex : /<<<(?:\w+|'\w+'|"\w+")$/,
next: "heredoc"
}, {
token : "keyword.operator",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
@ -988,6 +998,22 @@ var PhpLangHighlightRules = function() {
regex : "\\s+"
}
],
"heredoc" : [
{
token : function(value, currentSate, stack) {
if (stack[1] + ";" != value)
return "string";
stack.shift();
stack.shift();
return "markup.list"
},
regex : "^\\w+;$",
next: "start"
}, {
token: "string",
regex : ".*",
}
],
"comment" : [
{
token : "comment", // closing comment