disp icon indicating copy to clipboard operation
disp copied to clipboard

Add an html repr for ASTs nodes.

Open Carreau opened this issue 7 years ago • 5 comments

Carreau avatar Sep 12 '17 21:09 Carreau

🤔

rgbkrk avatar Sep 12 '17 21:09 rgbkrk

Yeah, the following is not helpful:

screen shot 2017-09-12 at 14 44 03

Would be nice if you could collapse/expand...

Carreau avatar Sep 12 '17 21:09 Carreau

Yeah, are you thinking a nested

details / summary tag That expands to show more nodes?

or something more like graphviz representation

rgbkrk avatar Sep 12 '17 21:09 rgbkrk

Yeah, are you thinking a nested

details / summary tag

Yes.

Dag is interesting... but ast will be a tree anyway, so likely easier to represent explicitely.

Carreau avatar Sep 12 '17 21:09 Carreau

+1

For an easier starting point, maybe add a text repr that pretty prints it? I use an ast pretty printer which I stole off someone's blog:

https://bitbucket.org/takluyver/greentreesnakes/src/96d6e70210789c0b743eabbbb57d9282b7e41d8c/astpp.py?at=default http://alexleone.blogspot.co.uk/2010/01/python-ast-pretty-printer.html

It doesn't have an explicit license, so we'd need to contact the author to clarify that before using it in IPython.

takluyver avatar Sep 13 '17 08:09 takluyver