Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38906 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88906 invoked from network); 10 Jul 2008 16:47:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jul 2008 16:47:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=nlopess@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=nlopess@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.55.154.24 as permitted sender) X-PHP-List-Original-Sender: nlopess@php.net X-Host-Fingerprint: 212.55.154.24 relay4.ptmail.sapo.pt Linux 2.4/2.6 Received: from [212.55.154.24] ([212.55.154.24:52554] helo=sapo.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/90-11681-4E736784 for ; Thu, 10 Jul 2008 12:25:09 -0400 Received: (qmail 1122 invoked from network); 10 Jul 2008 16:25:05 -0000 Received: from unknown (HELO sapo.pt) (10.134.37.163) by relay4 with SMTP; 10 Jul 2008 16:25:05 -0000 Received: (qmail 26651 invoked from network); 10 Jul 2008 16:25:05 -0000 X-AntiVirus: PTMail-AV 0.3-0.92.0 X-Virus-Status: Clean (0.00947 seconds) Received: from unknown (HELO pc07654) (nunoplopes@sapo.pt@[85.240.54.204]) (envelope-sender ) by mta13 (qmail-ldap-1.03) with SMTP for ; 10 Jul 2008 16:25:05 -0000 Message-ID: <20784016A49F4AC6B24D4F9071513C16@pc07654> To: "Scott MacVicar" Cc: "Matt Wilmas" , , "Dmitry Stogov" References: <013a01c8aec5$b189d650$0201a8c0@pc1> <013201c8e28a$e024a000$0201a8c0@pc1> <4876365E.9080609@macvicar.net> In-Reply-To: <4876365E.9080609@macvicar.net> Date: Thu, 10 Jul 2008 17:25:01 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000 Subject: Re: [PHP-DEV] [PATCH] Some string changes/optimizations From: nlopess@php.net ("Nuno Lopes") Ah, nowdocs is php >= 5.3 only. it has been such a long time since last release that I didn't even remember that.. So, forget my previous comment. Nuno ----- Original Message ----- > There hasn't been an official release with the NOWDOCS token though. > > Scott > > Nuno Lopes wrote: >> Patch seems ok to me, although I haven't tested it. But let's see what >> Dmitry thinks about it. >> I'm not sure about the removal of the nowdoc tokens, though. Somebody may >> me relying on them for pretty-printing.. >> >> Nuno >> >> >> ----- Original Message ----- From: "Matt Wilmas" >> >> To: >> Cc: "Dmitry Stogov" ; "Nuno Lopes" >> Sent: Thursday, July 10, 2008 1:45 PM >> Subject: Re: [PHP-DEV] [PATCH] Some string changes/optimizations >> >> >>> Hi all, >>> >>> I had been meaning to update this patch for a while (after conflicting >>> updates to some files), and finally did. :-) See original message for >>> more >>> details... >>> >>> There's been one change for strings -- before, I was moving the first >>> ADD_* >>> op into INIT_STRING, but wasn't too satisfied with that. So I >>> eliminated >>> the INIT_STRING opcode after realizing that simply setting the string to >>> NULL makes it create a new string in add_string_to_string (the first >>> ADD_* >>> has op1 set to IS_UNUSED; otherwise it's still IS_TMP_VAR, though it's >>> not >>> "used" after my changes). Is this OK? >>> >>> The other prior changes seem fine to me: syntax highlighting >>> consistency, >>> combining the duplicate heredoc/nowdoc stuff and removing the NOWDOC >>> tokens, >>> allowing static heredocs to be used in static contexts, etc.? >>> >>> http://realplain.com/php/string_optimizations.diff >>> http://realplain.com/php/string_optimizations_5_3.diff >>> >>> Remember to regenerate the scanner/parser with re2c/bison and run >>> zend_vm_gen.php! I also included possible NEWS updates in the 5.3 patch >>> this time. :-P >>> >>> >>> Thanks for any feedback, >>> Matt >>> >>> >>> ----- Original Message ----- >>> From: "Matt Wilmas" >>> Sent: Monday, May 05, 2008 >>> >>>> Hi all, >>>> >>>> This patch... Saves one opcode per interpolated string [snip, old >>>> info] >>>> >>>> Next, after nowdoc support was added, I noticed it was mostly duplicate >>>> heredoc code in the scanner, so I combined them for the most part, >>> removing >>>> the NOWDOC tokens, etc. Is that OK? It seems like they may have just >>> been >>>> there for the parser... but I updated the parser so that static >>>> heredocs >>>> also work like nowdocs. Also removed the ST_START_[HEREDOC|NOWDOC] >>>> states >>>> in the scanner, by doing their work (to catch immediate ending label) >>>> in >>> the >>>> initial heredoc rule. >>>> >>>> While removing the NOWDOC references from zend_highlight.c, I made a >>> little >>>> change that I think improves (err... adds) highlighting of variables in >>>> double-quoted strings, and makes literal text in heredocs/backticks the >>>> correct "highlight_string" color. This makes coloring consistent >>>> across >>> all >>>> strings. :-) Before/after example: >>> http://realplain.com/php/highlight.html >>>> >>>> Speaking of backticks, while updating their parser grammar, they now >>> behave >>>> more precisely like shell_exec(), in that `cmd` (constant string) or >>> `$cmd` >>>> (one variable) won't use INIT_STRING and create a temporary variable... >>>> >>>> Oh, almost forgot a couple things -- for HEAD: [snip] moved >>>> HANDLE_NEWLINES() so nowdoc text is copied first, otherwise the line >>> number >>>> would be off if there's an error in zend_copy_scanner_string. [snip] >>>> >>>> http://realplain.com/php/string_optimizations.diff >>>> http://realplain.com/php/string_optimizations_5_3.diff >>>> >>>> >>>> Thanks, >>>> Matt >>>> >>>> P.S. (for Marcus?), the ({LABEL}|([']{LABEL}['])|(["]{LABEL}["])) part >>>> of >>>> the heredoc rule crashed re2c (Windows) until I added the extra ( ), >>>> which >>>> shouldn't be needed AFAIK and was fine with just 2 alternate matches...