Hi all,
This is regarding Derick's addition of the (binary) cast in 5.2, and its
discussion. I agree with the others who think it's a good addition so
future code for PHP 6 won't fail with a parse error on a small thing that
could be handled transparently.
But the point of this message is to ask about the "b" binary-string "prefix
thing" from 6: Isn't that a closely-related syntax addition which should
also be included? If so, the attached patch hopefully covers it. :-)
Matt
Index: zend_language_scanner.l
===================================================================
RCS file: /repository/ZendEngine2/zend_language_scanner.l,v
retrieving revision 1.131.2.11.2.1
diff -u -r1.131.2.11.2.1 zend_language_scanner.l
--- zend_language_scanner.l 10 Nov 2006 12:02:51 -0000 1.131.2.11.2.1
+++ zend_language_scanner.l 14 Nov 2006 11:30:00 -0000
@@ -1564,10 +1564,15 @@
}
-<ST_IN_SCRIPTING>(["]([^$"\\]|("\\".))*["]) {
+<ST_IN_SCRIPTING>("b"?["]([^$"\\]|("\\".))*["]) {
register char *s, *t;
char *end;
+ if (*yytext == 'b') {
+ yytext++;
+ yyleng--;
+ }
+
zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
zendlval->value.str.len = yyleng-2;
zendlval->type = IS_STRING;
@@ -1654,10 +1659,15 @@
}
-<ST_IN_SCRIPTING>([']([^'\\]|("\\".))*[']) {
+<ST_IN_SCRIPTING>("b"?[']([^'\\]|("\\".))*[']) {
register char *s, *t;
char *end;
+ if (*yytext == 'b') {
+ yytext++;
+ yyleng--;
+ }
+
zendlval->value.str.val = estrndup(yytext+1, yyleng-2);
zendlval->value.str.len = yyleng-2;
zendlval->type = IS_STRING;
@@ -1702,14 +1712,20 @@
}
-<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;
+
+ if (*yytext == 'b') {
+ yytext++;
+ yyleng--;
+ }
+
CG(zend_lineno)++;
CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0);
s = yytext+3;
@@ -1729,7 +1745,7 @@
}
-<ST_IN_SCRIPTING>['] {
+<ST_IN_SCRIPTING>"b"?['] {
BEGIN(ST_SINGLE_QUOTE);
return '\'';
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php