Commit eaaae5fa authored by Jeffery To's avatar Jeffery To

php.lang: Add support for flexible heredoc and nowdoc syntaxes

Supported since PHP 7.3.0[1].

This also fixes the highlighting for the semicolon following heredoc
closing identifiers.

[1]: https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes
parent 50da04aa
......@@ -150,10 +150,11 @@
<context id="here-doc-string" style-ref="here-doc" extend-parent="true">
<start>(&lt;&lt;&lt;)\s?(\%{identifier})</start>
<end>^(\%{2@start});?$</end>
<end>^\s*(\%{2@start})(;|\b)</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 sub-pattern="2" where="end" style-ref="operator"/>
<context ref="escape"/>
<context ref="string-var"/>
<context ref="def:line-continue"/>
......@@ -162,10 +163,11 @@
<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>
<end>^\s*(\%{2@start})(;|\b)</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 sub-pattern="2" where="end" style-ref="operator"/>
<context ref="escape"/>
<context ref="string-var"/>
<context ref="def:line-continue"/>
......@@ -174,10 +176,11 @@
<context id="now-doc-string" style-ref="here-doc" extend-parent="true">
<start>(&lt;&lt;&lt;)\s?'(\%{identifier})'</start>
<end>^(\%{2@start});?$</end>
<end>^\s*(\%{2@start})(;|\b)</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 sub-pattern="2" where="end" style-ref="operator"/>
<context style-ref="def:special-char">
<match>\\['\\]</match>
</context>
......
......@@ -8,7 +8,19 @@ text
extrémité
echo <<<"END"
a
b
c
END;
stringManipulator(<<<'END'
a
b
c
END);
$values = [<<<END
a
b
c
END;
ENDING
END, 'd e f'];
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment