On 7/31/07, Tal Einat <[EMAIL PROTECTED]> wrote:
>
> On 6/6/07, Josiah Carlson <[EMAIL PROTECTED]> wrote:
> > For reference, PyPE auto-parses source code in the background, generating
> > (among other things) a function/class/method hierarchy.  Its autocomplete
> > generally sticks to global functions and keywords, but when doing
> > self.method lookups, it checks the current source code line, looks up in its
> > index of classes/methods, and trims the results based on known methods in
> > the current class in the current source file.
> >
> > It certainly isn't complete (it should try to check base classes of the
> > class in the same file, it could certainly pay attention to names assigned
> > in the current scope, the global scope, imports, types of objects as per
> > WingIDE's assert isinstance(obj, type), etc.), but it also makes the
> > computation fairly straightforward, fast, and only in reference to the
> > current document.
>
> How does PyPE parse code? Home-rolled, standard AST compiler, something else?

The compiler for syntactically correct Python, a line-based compiler
for broken Python.  TO generate a method list for self.methods, using
the current line number, I discover the enclosing class, check the
listing of methods for that class (generated by the compiler or
line-based parsers), and return a valid list for the specified prefix.
 It doesn't walk the inheritance tree, it doesn't do imports, etc.


> It seems to me we should try to come up with an algorithm for parsing,
> before getting to the code. All of the details you mentioned -
> noticing assignments, using base-class methods, etc. - could be better
> defined and organized this way. Perhaps we could brainstorm on this in
> a wiki?

A wiki would be fine, the one for this mailing list would likely be
best (if it is still up and working).  Then again, Rope looks quite
nifty.  I may have to borrow some of that source ;)

 - Josiah

Reply via email to