[gtksourceview: 2/4] php.lang: Add support for double quotes around heredoc identifiers



commit 50da04aa692b4df2035bc54c9adfbe4f0dde8d06
Author: Jeffery To <jeffery to gmail com>
Date:   Tue Oct 29 00:06:32 2019 +0800

    php.lang: Add support for double quotes around heredoc identifiers
    
    Supported since PHP 5.3.0[1].
    
    [1]: https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

 data/language-specs/php.lang       | 13 +++++++++++++
 tests/syntax-highlighting/file.php |  6 ++++++
 2 files changed, 19 insertions(+)
---
diff --git a/data/language-specs/php.lang b/data/language-specs/php.lang
index 0066707e..17eed5f0 100644
--- a/data/language-specs/php.lang
+++ b/data/language-specs/php.lang
@@ -160,6 +160,18 @@
       </include>
     </context>
 
+    <context id="here-doc-string-double-quotes" style-ref="here-doc" extend-parent="true">
+      <start>(&lt;&lt;&lt;)\s?"(\%{identifier})"</start>
+      <end>^(\%{2@start});?$</end>
+      <include>
+        <context sub-pattern="0" where="start" style-ref="here-doc-bound"/>
+        <context sub-pattern="1" where="end" style-ref="here-doc-bound"/>
+        <context ref="escape"/>
+        <context ref="string-var"/>
+        <context ref="def:line-continue"/>
+      </include>
+    </context>
+
     <context id="now-doc-string" style-ref="here-doc" extend-parent="true">
       <start>(&lt;&lt;&lt;)\s?'(\%{identifier})'</start>
       <end>^(\%{2@start});?$</end>
@@ -335,6 +347,7 @@
         <context ref="single-quoted-string"/>
         <context ref="backtick-string"/>
         <context ref="here-doc-string"/>
+        <context ref="here-doc-string-double-quotes"/>
         <context ref="now-doc-string"/>
         <context ref="variable"/>
         <context ref="array-operators"/>
diff --git a/tests/syntax-highlighting/file.php b/tests/syntax-highlighting/file.php
index 69d2c730..fe4b0f71 100644
--- a/tests/syntax-highlighting/file.php
+++ b/tests/syntax-highlighting/file.php
@@ -6,3 +6,9 @@ $i數 = 1;
 $str <<<extrémité
 text
 extrémité
+
+echo <<<"END"
+a
+b
+c
+END;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]