Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24403 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51110 invoked by uid 1010); 15 Jul 2006 18:49:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51086 invoked from network); 15 Jul 2006 18:49:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2006 18:49:43 -0000 X-Host-Fingerprint: 217.79.190.163 r163.red.fastwebserver.de Received: from ([217.79.190.163:10823] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 95/30-11992-26839B44 for ; Sat, 15 Jul 2006 14:48:03 -0400 To: internals@lists.php.net,Marcus Boerger Date: Sat, 15 Jul 2006 20:48:01 +0200 Message-ID: <20060715204801.4e02c985@pierre-u64> In-Reply-To: <347185750.20060715202622@marcus-boerger.de> References: <347185750.20060715202622@marcus-boerger.de> Reply-To: pierre.php@gmail.com X-Newsreader: Sylpheed-Claws 2.1.1 (GTK+ 2.8.18; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Posted-By: 217.79.190.163 Subject: Re: Long awaited line directive From: pierre.php@gmail.com (Pierre) On Sat, 15 Jul 2006 20:26:22 +0200 mail@marcus-boerger.de (Marcus Boerger) wrote: > Hello internals, > > attached is a patch that brings the '#line' directive to php. > This is especially usefull for parser generators or any other > code shuffling/generator tools. Any opinions? If nothing speaks > against i'd like to commit this before heading towards OSCON > be end of next week. (oatch is against head of course). > To complete the request, one example (if you are not familiar with other generators or languages): 1. include 'somfile.php' 2. #line 1 "linedirective.php" 4. class Foo // treated as line 1 5. { // treated as line 2 6. var $prop1; // treated as line 3 7. // treated as line 4 8. function bar ($args) // treated as line 5 9. { // treated as line 6 10. Some invalid syntax; // treated as line 7 11. return; // treated as line 8 ... Even if the syntax error happens on line 10 of this file, it will be reported on line 7 of the file "linedirective.php". Not sure if it will work exactly like that in php, but this is how it works in c# for example. I would love to have it in 5.x :) Cheers, --Pierre