-------------
Any one want to +1 the PHP_Parser into PEAR? - although the output
structure is extremely up in the air at present.. - at least the docs
should be easy - it's only got two public methods ;)
Alan,
Do you think this code could be adapted to parse some other languages ?
(java, smalltalk...)
To parse other languages you would need a tokenizer and Lexer - assuming you can get hold of the bison/flex code it should be pretty simple to build a parser/tokenizer using phpJay/phpLex (Thats what PHP-sharp already does with c#) - in terms of the code above the only shared bit is really about 15 lines which do the caching.
Note however without the caching, parsing and tokenizing files in PHP will probably take about 4-6 seconds on a 2000 line file.(using the p3/1000 as a reference).
Regards
Alan
Bertrand Mansion
Mamasam