diff options
Diffstat (limited to 'plugins/language_php.lua')
-rw-r--r-- | plugins/language_php.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/language_php.lua b/plugins/language_php.lua index bb54723..be24eb6 100644 --- a/plugins/language_php.lua +++ b/plugins/language_php.lua @@ -86,8 +86,7 @@ local inline_variables = { type = { "keyword2", "keyword", "symbol" } }, { pattern = "%$[%a_][%w_]*", type = "keyword2" }, - { pattern = "%w+", type = "string" }, - { pattern = "[^\"]", type = "string" }, + { pattern = "%w+", type = "string" } } local function combine_patterns(t1, t2) @@ -180,6 +179,7 @@ syntax.add { syntax = { patterns = combine_patterns(inline_variables, { -- prevent matching outside of the parent string + { pattern = "[^\"]", type = "string" }, { pattern = "%p+%f[\"]", type = "string" }, { pattern = "%p", type = "string" }, }), @@ -327,9 +327,9 @@ syntax.add { block_comment = {"/*", "*/"}, patterns = { { - pattern = { - "<%?php%s+", - "%?>" + regex = { + "<\\?php\\s+", + "(\\?>|(?=`{3}))" -- end if inside markdown code tags }, syntax = ".phps", type = "keyword2" @@ -370,6 +370,9 @@ syntax.add { { pattern = "%f[^<]/[%a_][%w_]*", type = "function" }, { pattern = "[%a_][%w_]*", type = "keyword" }, { pattern = "[/<>=]", type = "operator" }, + -- match markdown code tags to be able to end php highlighting + -- when inside the subsyntax .phps + { regex = "(?=`{3})", type = "string" } }, symbols = {}, } |