Hi Andrei,
Ah, I was going to ask about this soon :-) since I submitted a patch last
month to compliment the backported (binary) cast. Couple things I noticed:
What about the 'b' prefix for T_CONSTANT_ENCAPSED_STRING? Otherwise places
that require that type and work in 6 would fail with a parse error, wouldn't
they? Also, 'b'-prefixed heredocs will fail since they don't account for
the extra char.
Here's my patch, BTW: http://news.php.net/php.internals/26562
Matt
----- Original Message -----
From: "Andrei Zmievski"
Sent: Tuesday, December 19, 2006
> andrei Tue Dec 19 17:26:17 2006 UTC
>
> Modified files: (Branch: PHP_5_2)
> /ZendEngine2 zend_language_scanner.l
> Log:
> Support 'b' prefix in front of string literals for forward compatibility
> with PHP 6.
>
>
>
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.11.2.2&r2=1.131.2.11.2.3&diff_format=u
> Index: ZendEngine2/zend_language_scanner.l
> diff -u ZendEngine2/zend_language_scanner.l:1.131.2.11.2.2
ZendEngine2/zend_language_scanner.l:1.131.2.11.2.3
> --- ZendEngine2/zend_language_scanner.l:1.131.2.11.2.2 Thu Nov 23 22:04:54
2006
> +++ ZendEngine2/zend_language_scanner.l Tue Dec 19 17:26:17 2006
> @@ -19,7 +19,7 @@
>
+----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.2 2006/11/23 22:04:54
tony2001 Exp $ */
> +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.3 2006/12/19 17:26:17
andrei Exp $ */
>
> #define yyleng SCNG(yy_leng)
> #define yytext SCNG(yy_text)
> @@ -1707,13 +1707,13 @@
> }
>
>
> -<ST_IN_SCRIPTING>["] {
> +<ST_IN_SCRIPTING>b?["] {
> BEGIN(ST_DOUBLE_QUOTES);
> return '\"';
> }
>
>
> -<ST_IN_SCRIPTING>"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} {
> +<ST_IN_SCRIPTING>b?"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} {
> char *s;
> CG(zend_lineno)++;
> CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0);
> @@ -1734,7 +1734,7 @@
> }
>
>
> -<ST_IN_SCRIPTING>['] {
> +<ST_IN_SCRIPTING>b?['] {
> BEGIN(ST_SINGLE_QUOTE);
> return '\'';
> }
>
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|