Hello Pierre,

Saturday, July 15, 2006, 8:48:01 PM, you wrote:

> On Sat, 15 Jul 2006 20:26:22 +0200
> [EMAIL PROTECTED] (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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to