From:             php at koterov dot ru
Operating system: all
PHP version:      5.2.6
PHP Bug Type:     Feature/Change Request
Bug description:  Support of #line instruction for parser context substitutuon

Description:
------------
In Perl, we could write the following program test.pl (lines are
enumerated for better look):

01  #!/usr/bin/perl -w
02  print "hello!\n";
03  print "something!\n";
04
05  #line 100 "aaa.pl"
06  print $undefined_var;

This code generates a warning message "Using of undefined variable", but
(attention!) - the context of this error is NOT "test.pl line 5", but -
"aaa.pl line 100".

So, the "pseudo-comment" operator

#line xxx "yyy"

in Perl substitutes the current parsing context to a specified line number
and filename. (You may ommit filename, then - only the line number will be
substituted). And, if a warning or a fatal error occurs, the line number
and filename in the error message will be changed. There is the same
feature in C language: it is used by C preprocessor to execute #include
directives an keep line numbers clear to understand.

This feature is VERY VERY useful when we write some code translator (e.g.
from a templating language to pure PHP). This kind of translation is done
e.g. in Smarty: it translates Smarty templates into pure PHP code, but line
numbers are mixed up in translated files, so we cannot revert back and
detect which line of the template had produced an error.

Please say, do you plan to add this feature to a new PHP versions? I'd
like to ask you very much about it...



-- 
Edit bug report at http://bugs.php.net/?id=45111&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45111&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45111&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45111&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45111&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45111&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45111&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45111&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45111&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45111&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45111&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45111&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45111&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45111&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45111&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45111&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45111&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45111&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45111&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45111&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45111&r=mysqlcfg

Reply via email to