Hi,
I'm trying to write a filter for PHP_Beautifier that
automatically adds
the 'require' statements for lazy-loading files. Yes,
autoloading
classes would prob be easier, but the filter should handle
defines and
functions as well as work on PHP4 code.
I've run into a couple of gotchas, and am wondering if
anyone can help.
If my filter runs into a structure like:
class foo
{
function bar($param = DEFINED_ELSEWHERE)
{
...
}
}
it's got to know to place the require for the file
containing
'DEFINED_ELSEWHERE' before the 'class' structure. I tried
use
PHP_Beautifier::getMode('class') to see if I'm inside a
class structure,
but it appears that the mode is not cleared on leaving the
structure. So
if I run into:
class foo
{
...
}
function bar($param = DEFINED_ELSEWHERE)
{
...
}
my code will still think it's inside a class. Is this
intentional? Or is
that not what getMode() is intended for? Is there any other
way of doing
it (the class doesn't seem to get popped of the
getControlSeq() stack
either), or should I write my own extension to track this
stuff?
If I get my filter cleaned up, would Pear be interested in
it?
Regards,
Matt
--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|