Every {@link org.python.pydev.editor.PyEdit PyEdit} has a PyParser associated with it. The parser continuously parses the input into AST (Abstract Syntax Tree). Listeners can register with PyParser to receive events when parse is complete.
Instead of using the parse tree directly, try {@link org.python.pydev.editor.model} first