#46046 [Bgs]: NON-DOUBLE-QUOTED PHP code within the HEREDOC syntax

From: Date: Wed, 09 Dec 2009 10:52:44 +0000
Subject: #46046 [Bgs]: NON-DOUBLE-QUOTED PHP code within the HEREDOC syntax
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145569@lists.php.net to get a copy of this message
ID: 46046 User updated by: vask at dmglobal dot net Reported By: vask at dmglobal dot net Status: Bogus Bug Type: Feature/Change Request Operating System: All PHP Version: 5.3.0alpha2 New Comment: This incident has been closed since [10 Sep 2008 9:10pm UTC] as "bogus," but it was never pointed out that /**/ (a php comment) can and does act as a valid separator to denote what language is in a quoted string. This is important because now the only thing needed is to find a text editor that can utilize this. So what TEXT EDITOR will support the following syntax or a similar syntax: /*FILETYPE*/' '/*FILETYPE*/ "/*FILETYPE*/ "/*FILETYPE*/ where FILETYPE is the extension on the file. ie) php_css.php <? $dark = true; echo /*CSS*/' font { '/*CSS*/ . $dark ? /*CSS*/'color: black;'/*CSS*/ : /*CSS*/'color: white;'/*CSS*/ . ' size: 20px; margin-top: 40px; } '/*CSS*/; ?> Text Editor NOTES: - You can NOT really see the code style in this post so let me explain. - All code SHOULD have php code style by default. - All code in between the /*CSS*/' and '/*CSS*/ SHOULD have css code style. (NOT a single solid color for a quoted string.) If anyone knows a text editor that supports code style as mentioned above please share! Thanks. -John Previous Comments: ------------------------------------------------------------------------ [2008-09-16 02:57:25] vask at dmglobal dot net NOWDOC or HEREDOC syntax works great with Textmate as long as you upgrade to the most recent Textmate PHP bundle. However, it is NOT equivalent to my proposition. I would still like the ability to use NON-DOUBLE-QUOTED PHP code within the NOWDOC or HEREDOC section. ie) // I would like to be able to do: echo <<<HTML <p><?= php_function(); ?></p> HTML; If this is NOT possible, I would like the status of this feature request changed from "Bogus" to something more appropriate. NOTE: I already modified the "Summary" of this feature request to be something more appropriate. -John ------------------------------------------------------------------------ [2008-09-11 13:25:59] lbarnaud@php.net You can use NOWDOC or HEREDOC syntax: $foo = <<<'HTML' bar HTML; This already works (on the PHP side) and is equivalent to your proposition. You can manage for your editor to use a different syntax highlighting based on the NOWDOC/HEREDOC token. ------------------------------------------------------------------------ [2008-09-11 07:54:20] vask at dmglobal dot net I do realize this is NOT a PHP bug, but it is NOT a text editor bug or a support issue. This is a feature request for new syntax. Both PHP and my text editor would have to support this new syntax or variation of it if implemented. It makes the most sense if PHP implements new syntax first and then text editors recognize the new syntax second. -John ------------------------------------------------------------------------ [2008-09-11 07:30:14] vask at dmglobal dot net It is impossible for a text-editor to ALWAYS automatically know what language is being dealt with without a valid separator. ie) <? // CURRENT IMPLEMENTATION ?> <? $variable = 'disabled="disabled"'; ?> The quoted part of course is going to be a solid color in a text editor... but... it is impossible for a text editor to tell what client side language is intended in the 'QUOTED' part so it can style the 'QUOTED' part correctly. It could be: vbscript javascript html etc... If I am wrong please tell me a text editor that knows how to perform correct code styling on the quoted part in the above example... The following text editors are INCAPABLE of doing this: Zend Studio for Eclipse Textmate EditPlus UltraEdit This is probably because it is not possible for a text editor to tell what syntax highlighting to use for the quoted part so the text editor just assumes it is an abitrary string. If PHP could provide a "valid separator" to tell a text editor what code highlighting to use for a specific part in the file it could greatly improve a programmer's and text editor's ability to incorporate several different languages in a single file. ie) <? // THEORETICAL ?> <? $variable = ?><?html disabled="disabled" ?><? ; ?> The <?html ?> part could then have html code styling in a text editor instead of just being a solid color. This suggestion was intended for more than just correct syntax highlighting of quoted strings but it is much easier to illustrate that way... If this is indeed a bogus feature request I apologize for wasting your time. -John ------------------------------------------------------------------------ [2008-09-10 21:10:35] lbarnaud@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. That's a bug of your editor, not PHP ;) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/46046 -- Edit this bug report at http://bugs.php.net/?id=46046&edit=1

« previous php.bugs (#145569) next »