Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24404 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60806 invoked by uid 1010); 15 Jul 2006 18:54:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60773 invoked from network); 15 Jul 2006 18:54:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2006 18:54:51 -0000 X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:37739] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 3B/90-11992-D3939B44 for ; Sat, 15 Jul 2006 14:51:41 -0400 Received: from baumbart.mbo (dslb-084-063-024-149.pools.arcor-ip.net [84.63.24.149]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id B51CF35C20A; Sat, 15 Jul 2006 20:51:38 +0200 (CEST) Date: Sat, 15 Jul 2006 20:51:44 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1544027164.20060715205144@marcus-boerger.de> To: Pierre Cc: internals@lists.php.net In-Reply-To: <20060715204801.4e02c985@pierre-u64> References: <347185750.20060715202622@marcus-boerger.de> <20060715204801.4e02c985@pierre-u64> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: Long awaited line directive From: helly@php.net (Marcus Boerger) Hello Pierre, Saturday, July 15, 2006, 8:48:01 PM, you wrote: > 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 :) Yes it works as expected. The directive is taken into account for both compiler and executor. Best regards, Marcus