Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27340 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82577 invoked by uid 1010); 9 Jan 2007 03:18:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82562 invoked from network); 9 Jan 2007 03:18:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jan 2007 03:18:42 -0000 Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.142.136.132 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.142.136.132 msa2-mx.centurytel.net Linux 2.4/2.6 Received: from [209.142.136.132] ([209.142.136.132:34677] helo=msa2-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/FE-27400-19903A54 for ; Mon, 08 Jan 2007 22:18:41 -0500 Received: from pc1 (d45-143.rt-bras.wnvl.centurytel.net [69.179.172.143]) by msa2-mx.centurytel.net (8.13.6/8.13.6) with SMTP id l093Ib4m016068 for ; Mon, 8 Jan 2007 21:18:37 -0600 Message-ID: <006a01c7339c$db294c20$0201a8c0@pc1> To: Date: Mon, 8 Jan 2007 21:18:38 -0600 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0067_01C7336A.902F7E10" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Subject: [PATCH] Syntax highlighting with 'b' string prefix From: php_lists@realplain.com ("Matt Wilmas") ------=_NextPart_000_0067_01C7336A.902F7E10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi all, Just noticed that the 'b' prefix doesn't appear in syntax highlighting, nor Tokenizer extension, with T_CONSTANT_ENCAPSED_STRING (and with heredocs in 5.2). That's because yytext is incremented. I've attached patches (didn't test HEAD's) with a quick fix if it's acceptable. :-) Matt ------=_NextPart_000_0067_01C7336A.902F7E10 Content-Type: text/plain; name="b_prefix.diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="b_prefix.diff.txt" Index: zend_language_scanner.l=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_language_scanner.l,v=0A= retrieving revision 1.160=0A= diff -u -r1.160 zend_language_scanner.l=0A= --- zend_language_scanner.l 23 Nov 2006 22:04:32 -0000 1.160=0A= +++ zend_language_scanner.l 9 Jan 2007 02:32:29 -0000=0A= @@ -1271,13 +1271,13 @@=0A= return T_CONSTANT_ENCAPSED_STRING;=0A= }=0A= =0A= -int zend_scan_binary_double_string(zval *zendlval TSRMLS_DC)=0A= +int zend_scan_binary_double_string(zval *zendlval, int bprefix = TSRMLS_DC)=0A= {=0A= register char *s, *t;=0A= char *end;=0A= =0A= - Z_STRVAL_P(zendlval) =3D estrndup(yytext+1, yyleng-2);=0A= - Z_STRLEN_P(zendlval) =3D yyleng-2;=0A= + Z_STRVAL_P(zendlval) =3D estrndup(yytext+bprefix+1, yyleng-bprefix-2);=0A= + Z_STRLEN_P(zendlval) =3D yyleng-bprefix-2;=0A= Z_TYPE_P(zendlval) =3D IS_STRING;=0A= HANDLE_NEWLINES(yytext, yyleng);=0A= =0A= @@ -1353,13 +1353,13 @@=0A= return T_CONSTANT_ENCAPSED_STRING;=0A= }=0A= =0A= -int zend_scan_binary_single_string(zval *zendlval TSRMLS_DC)=0A= +int zend_scan_binary_single_string(zval *zendlval, int bprefix = TSRMLS_DC)=0A= {=0A= register char *s, *t;=0A= char *end;=0A= =0A= - Z_STRVAL_P(zendlval) =3D estrndup(yytext+1, yyleng-2);=0A= - Z_STRLEN_P(zendlval) =3D yyleng-2;=0A= + Z_STRVAL_P(zendlval) =3D estrndup(yytext+bprefix+1, yyleng-bprefix-2);=0A= + Z_STRLEN_P(zendlval) =3D yyleng-bprefix-2;=0A= Z_TYPE_P(zendlval) =3D IS_STRING;=0A= HANDLE_NEWLINES(yytext, yyleng);=0A= =0A= @@ -2221,15 +2221,13 @@=0A= if (UG(unicode)) {=0A= return zend_scan_unicode_double_string(zendlval TSRMLS_CC);=0A= } else {=0A= - return zend_scan_binary_double_string(zendlval TSRMLS_CC);=0A= + return zend_scan_binary_double_string(zendlval, 0 TSRMLS_CC);=0A= }=0A= }=0A= =0A= =0A= (b["]([^$"\\]|("\\".))*["]) {=0A= - yytext++; /* adjust for 'b' */=0A= - yyleng--;=0A= - return zend_scan_binary_double_string(zendlval TSRMLS_CC);=0A= + return zend_scan_binary_double_string(zendlval, 1 TSRMLS_CC);=0A= }=0A= =0A= =0A= @@ -2237,15 +2235,13 @@=0A= if (UG(unicode)) {=0A= return zend_scan_unicode_single_string(zendlval TSRMLS_CC);=0A= } else {=0A= - return zend_scan_binary_single_string(zendlval TSRMLS_CC);=0A= + return zend_scan_binary_single_string(zendlval, 0 TSRMLS_CC);=0A= }=0A= }=0A= =0A= =0A= ("b'"([^'\\]|("\\".))*[']) {=0A= - yytext++; /* adjust for 'b' */=0A= - yyleng--;=0A= - return zend_scan_binary_single_string(zendlval TSRMLS_CC);=0A= + return zend_scan_binary_single_string(zendlval, 1 TSRMLS_CC);=0A= }=0A= =0A= =0A= ------=_NextPart_000_0067_01C7336A.902F7E10 Content-Type: text/plain; name="b_prefix_5_2.diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="b_prefix_5_2.diff.txt" Index: zend_language_scanner.l=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_language_scanner.l,v=0A= retrieving revision 1.131.2.11.2.5=0A= diff -u -r1.131.2.11.2.5 zend_language_scanner.l=0A= --- zend_language_scanner.l 26 Dec 2006 16:44:20 -0000 1.131.2.11.2.5=0A= +++ zend_language_scanner.l 9 Jan 2007 02:06:13 -0000=0A= @@ -1578,14 +1578,10 @@=0A= ("b"?["]([^$"\\]|("\\".))*["]) {=0A= register char *s, *t;=0A= char *end;=0A= + int bprefix =3D (*yytext =3D=3D 'b') ? 1 : 0;=0A= =0A= - if (*yytext =3D=3D 'b') {=0A= - yytext++;=0A= - yyleng--;=0A= - }=0A= -=0A= - zendlval->value.str.val =3D estrndup(yytext+1, yyleng-2);=0A= - zendlval->value.str.len =3D yyleng-2;=0A= + zendlval->value.str.val =3D estrndup(yytext+bprefix+1, = yyleng-bprefix-2);=0A= + zendlval->value.str.len =3D yyleng-bprefix-2;=0A= zendlval->type =3D IS_STRING;=0A= HANDLE_NEWLINES(yytext, yyleng);=0A= =0A= @@ -1673,14 +1669,10 @@=0A= ("b"?[']([^'\\]|("\\".))*[']) {=0A= register char *s, *t;=0A= char *end;=0A= + int bprefix =3D (*yytext =3D=3D 'b') ? 1 : 0;=0A= =0A= - if (*yytext =3D=3D 'b') {=0A= - yytext++;=0A= - yyleng--;=0A= - }=0A= -=0A= - zendlval->value.str.val =3D estrndup(yytext+1, yyleng-2);=0A= - zendlval->value.str.len =3D yyleng-2;=0A= + zendlval->value.str.val =3D estrndup(yytext+bprefix+1, = yyleng-bprefix-2);=0A= + zendlval->value.str.len =3D yyleng-bprefix-2;=0A= zendlval->type =3D IS_STRING;=0A= HANDLE_NEWLINES(yytext, yyleng);=0A= =0A= @@ -1731,15 +1723,11 @@=0A= =0A= "b"?"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} {=0A= char *s;=0A= -=0A= - if (*yytext =3D=3D 'b') {=0A= - yytext++;=0A= - yyleng--;=0A= - }=0A= + int bprefix =3D (*yytext =3D=3D 'b') ? 1 : 0;=0A= =0A= CG(zend_lineno)++;=0A= - CG(heredoc_len) =3D yyleng-3-1-(yytext[yyleng-2]=3D=3D'\r'?1:0);=0A= - s =3D yytext+3;=0A= + CG(heredoc_len) =3D = yyleng-bprefix-3-1-(yytext[yyleng-2]=3D=3D'\r'?1:0);=0A= + s =3D yytext+bprefix+3;=0A= while ((*s =3D=3D ' ') || (*s =3D=3D '\t')) {=0A= s++;=0A= CG(heredoc_len)--;=0A= ------=_NextPart_000_0067_01C7336A.902F7E10--