add php heredoc support
This commit is contained in:
parent
d2d42499ca
commit
782e3f8743
1 changed files with 26 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue