The matter is that "ast" is needed in cPython to parse Python code
itself - while in Brython other methods are used to translate python
to javascript that make the Python AST prescindeble at this time.
If there was a Python implementation of AST's it might just work as is
in Brython right now - but it is implemented in C, instead. Maybe
there is a Python "ast" module in Pypy? It cold possibly e made to
work as is in Brython. Apparently. there are no Brython contributor
resources to check for that right now.
So, while one of Brythpon's ains is to have most of the stdlib
available client side, that goal is not reached, and theast module is
not a priority.
If your input data is trusted - i.e. not genereated by 3rd parties,
you could simply use Brython's eval -
it will be no different from AST in that case. If your data is machine
generated (i.e. not typed by humans, but formed
by fecthign data at some source - escaping it to properly conform to
json should not be an issue.
Otherwise, if writting Python data structures is preferred that much,
an option is to take that as a string in Brython, use an Ajax call to
a server-side Python application that can run native Python's AST and
return porperly encoded json to use in your Brython application -
maybe that is the easiest way to go, since, onece this is in polace
you could work around other Brython bumps using this technique.
I could point you in the right directions if you opt for this last option.
> --
> You received this message because you are subscribed to the Google Groups
> "brython" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
brython+u...@googlegroups.com.
> To post to this group, send email to
bry...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/brython/8bfeb451-b2cc-45a3-8ee4-0d6862bcfd18%40googlegroups.com.