Edit any PHP code that uses heardoc syntax with escaped dollar signs ($)
The following PHP code:
print <<<END
\$somevar
END;
...highlights the "$somevar" as a variable and not the literal text. I know this used to work correctly, and I'm unclear as to specifically which version broke it.
9.0.1503
Gentoo Linux
TERM=rxvt
Shell: bash
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
If you haven't already done so you should try approaching the maintainer, listed in the header, first.
https://github.com/TysonAndre/php-vim-syntax
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This is an expected behavior; please, do not confused Heredoc and Nowdoc.
If you want to highlight it as literal text, just enclose your opened Nowdoc in single quotes:
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #12952 as not planned.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
closing then.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I get the difference between the two, but have to disagree on the assessment here when it comes to the specific case where the dollar sign is escaped. Even a simple double quoted string correctly shows that as text and not a highlighted variable:
<?php
print "This is \$somevar\n";
That gets handled correctly. How is the current behavior within a HEREDOC correct?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Replace END with another word, for instance EOD and it should behave as expected; but please, read again very closely the whole https://www.php.net/manual/en/language.types.string.php because it contains valuable information in it, especially around string quotes versus double quotes and their parsing mechanism.
I like calling such information hidden pearls.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Wow. OK yes...I see you're correct about using something other than END. I don't understand why using that specific string is highlighted differently however(?), and I don't see anything in that documentation related specifically to the END quoting string. From a PHP standpoint it functions identically to any other.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I don't understand why using that specific string is highlighted differently however(?), and I don't see anything in that documentation related specifically to the END quoting string. From a PHP standpoint it functions identically to any other.
I presume the word end (case insensitive) is being recognized from PHP syntax as part of SQL support (BEGIN ... END); it's enabled by default if I'm not mistaken.
You can find more in Vim via :h ft-php-syntax.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It's the end function matching there with higher priority as it's a syn-keyword. I won't throw a fix at the wall unless the maintainer fails to come up with something soon.
Feel free to ping me if you have no luck.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Ahhh...OK, that makes total sense. As you see above I've logged a bug with the maintainer. I'll add to that and we'll see what he says. I actually wasn't aware you could even call functions using names in upper case like END() which for me is sort of horrifying :D. Thanks a million for the clarification!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()