Closed gnprice closed 9 years ago
As currently defined, it wants a semicolon at the end of "EOTEXT" here. Is this wrong?
From what I can tell, heredocs should end with a semicolon unless used as a function argument (as in the example given above). See also example #3 here: http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
But even in the semicolon case, I think it should be just like any normal string -- the semicolon need not immediately follow, but can have whitespace preceding it. Highlighting also seems to break if you include the semicolon, but with intermediate whitespace.
Even in statements, it seems to work fine without a trailing semicolon on the same line:
php > $a = <<<EOTEXT
<<< > foo
<<< > EOTEXT
php > ;
php > print $a;
foo
Yeah, many rare use-cases are not highlighted properly in many language and we always try to improve them on bug reports if it is not overkill.
Fixed (sort of) in a9e6bd6 (see commit message).
Thanks!
On PHP code that contains a here-doc, the "string" highlight for the here-doc continues on long after the here-doc has actually been closed -- it seems to miss the end of the here-doc.
For example if this snippet is highlighted as PHP:
then everything from
<<<EOTEXT
to the end goes in a span of classhljs-string
.See repro at https://jsfiddle.net/5pdjee5v/ .
(/cc @christoffer, and thanks @jboning for spotting the issue!)