ActiveState Community

php outline / source tree / source structure

Posted by idalgo on 2009-05-09 12:24
OS: All / Any

hello,
i'm not a komodo ext developer but i came across nice idea that might be useful to someone

idea is about using php cli to run php tokenizer on php code, encode it to json and then parse in komodo to nice whatever we wish tree

http://pl.php.net/manual/en/function.token-get-all.php
http://pl.php.net/manual/en/tokens.php

this way we can have very detailed info (similar to editors from borland / codegear) like:
- include / require list
- variable / constants list
- functions with arguments
- classes with methods and class properties / constants
- class inheritance / interfaces

example php cli command, this probably can be simplified for extension use
php --run "echo json_encode(token_get_all(file_get_contents($argv[1])));" "filename"

hopes somebody at least will try this and make some proof on concept extension

toddw | Mon, 2009-05-11 09:51

Thanks for the suggestions.

Komodo IDE does already include a code browser with the detailed fields described above for PHP files, see:
http://docs.activestate.com/komodo/5.0/codeintel.html#codeintel_codebrow...

Komodo Edit does not have a "code browser" though there is a similar extension written to provide a structured outline:
http://community.activestate.com/xpi/source-tree

Cheers,
Todd

idalgo | Mon, 2009-05-11 12:01

Thanks for reply.

I know about both Komodo IDE and source-tree plugin but i'm looking for free solution. And about source tree, indeed its awesome and free but i think that the regex aproach is not the best way.

anyway i just wanted to share my idea with hope tha someone might pick it up ;]

Take care,
Idalgo