On 09/04/2011 09:21 AM, Nikita Popov wrote:
Hi Flavius!
Hi Nikita
First, you seem to try to lex the PHP code yourself too. Why don't you use PHP's internal lexing capabilities?
I can't. This is documented in the README.
Second, you seem to try to parse PHP using your own grammar. From my experience, the PHP grammar (http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_parser.y) is really messed up and it's already quite hard to strictly adhere to that grammar (as it has lots of strange quirks) and make it AST-able. If you write up your own grammar I doubt that it will ever match the PHP grammar.
This will become a non-issue, once we've formalized the grammar in standard EBNF, which is already on the TODO list (TODO.txt). I've heard there's an old need to do this among other developers, and I can do it, as I work on meta.
I think you should stick as much as possible to the PHP grammar and only introduce changes where required.
I can't. This is documented in the README.
For example you already have at least one error in the little grammar you have: The opening and closing tags should be filtered away before being passed to the parser
It's a feature, and it's documented in the README. There will be flags to instruct it to skip those tokens if desired - it's documented in the code.
as the may occur anywhere, even in the middle of an expression (`echo $hi . ?><?php $hi;` is valid).
I know, there is no error handling yet. I've put it on the TODO list. Thanks, Flavius -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php