Re: Parsing jython code

Jeff Allen <[email protected]> Tue, 1 Dec 2020 20:15:06 +0000
Newsgroups gmane.comp.lang.jython.devel
Message-ID <[email protected]>
Hi Albert.

Depends what you mean by "Jython code", but assuming it is Python source 
(with the few Jython quirks we need), then there's the ast module. 
There's a layer (_ast) generated by our ANTLR-based parser, and then the 
AST module sits on top to civilise it. It relies on the same classes we 
use in parsing to compile.

The documentation from python.org is not that great (or wasn't at 2.7) 
for the ast module, and I found this useful: 
https://greentreesnakes.readthedocs.io/en/latest/ when I was playing 
with the AST.

Jeff

Jeff Allen

On 30/11/2020 11:57, Albert Cardona wrote:
> Hi all,
> I assume there must be classes in the repos for parsing Jython code into an AST or similar representation, from which I could get a list of local and global variables and their properties available at a specific code block or script line.
> Would very much appreciate pointers.
> Best,
> Albert
>
> _______________________________________________
> Jython-dev mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jython-dev

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev