Accessing Python parse trees

Manlio Perillo NOmanlio_perilloSPAM at libero.it
Thu Mar 3 12:35:31 EST 2005


Hi.
With module parser it is possible to access Python parse trees.
But this only works for 'external' source.
I would like to known if, at least in theory, it can be possible to
access Python parse trees from 'inside' a script.


As a simple example:


def on_parsing(ast):
 ...


@parsing -> on_parsing
some statement



This will call on_parsing function with the AST object generated from
the next statement:

on_parsing(parser.suit(somestatement))



Thanks and regards  Manlio Perillo




More information about the Python-list mailing list