efficient way for building class browsers.

Lothar Scholz llothar at web.de
Sun Feb 8 07:54:03 EST 2004


Josiah Carlson <jcarlson at nospam.uci.edu> wrote in message news:<c04nvs$h6j$1 at news.service.uci.edu>...
> > I am looking for a class browser that has these features.
> 
> Only a browser?  Text or GUI?  What OS?  Any particular GUI toolkit?
> 
> > Remember I need a class browser, that also tells me the line no in
> > source code of that symbol. (So compiler module  (ast) can't be used -
> > Is it so? )
> 
> compiler.ast can be used for this, but only produces proper results when 
> the file has no syntax errors.  Don't get me wrong, using the output of 
> compiler.ast can be a pain in the ass, and slow as hell (5 seconds for 
> 100k of source on a celeron 400), but it can be used.
> 
> > Are there any better ways for achieving this?
> 
> You can write a limited parser (subject to certain flaws), one that 
> doesn't use tokenize or compiler.ast, and get pretty fast results.  I 
> wrote one to go into my own editor PyPE (pype.sourceforge.net), and it 
> has no problems parsing a 100k Python source file and displaying the 
> source tree in a GUI in less than 1/2 second on a celeron 400.

Thats slow i have a parser that parses 100k in less then 15 ms on a
1,2 GHz system. It will be part of "http://www.python-ide.com"
It is a 100% GNU Eiffel solution which generates plain C code.

I think the 1/2 second could also be done with some intelligent
regexpr's. There is something like this in the IDLE code.



More information about the Python-list mailing list