From 48e672b710a643ec6297f756c08969f6e4f9ee22 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 23 Aug 2013 11:46:49 +0400 Subject: [PATCH] fix php heredoc highlighting inside array fixes #1561 --- lib/ace/mode/php/php.js | 2 +- lib/ace/mode/php_highlight_rules.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ace/mode/php/php.js b/lib/ace/mode/php/php.js index 75393d85..de5e5a99 100644 --- a/lib/ace/mode/php/php.js +++ b/lib/ace/mode/php/php.js @@ -816,7 +816,7 @@ PHP.Lexer = function( src, ini ) { if ( heredoc !== undefined ) { // we are in a heredoc - var regexp = new RegExp('([\\S\\s]*)(\\r\\n|\\n|\\r)(' + heredoc + ')(;|\\r\\n|\\n)',"i"); + var regexp = new RegExp('([\\S\\s]*?)(\\r\\n|\\n|\\r)(' + heredoc + ')(;|\\r\\n|\\n)',"i"); diff --git a/lib/ace/mode/php_highlight_rules.js b/lib/ace/mode/php_highlight_rules.js index 3828f20a..033671eb 100644 --- a/lib/ace/mode/php_highlight_rules.js +++ b/lib/ace/mode/php_highlight_rules.js @@ -988,7 +988,7 @@ var PhpLangHighlightRules = function() { next: "heredoc" }, { token : "keyword.operator", - regex : "::|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" + regex : "::|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|!=|!==|<=|>=|=>|<<=|>>=|>>>=|<>|<|>|=|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "paren.lparen", regex : "[[({]" @@ -1003,13 +1003,13 @@ var PhpLangHighlightRules = function() { "heredoc" : [ { onMatch : function(value, currentSate, stack) { - if (stack[1] + ";" != value) + if (stack[1] != value) return "string"; stack.shift(); stack.shift(); return "markup.list" }, - regex : "^\\w+;$", + regex : "^\\w+(?=;?$)", next: "start" }, { token: "string",