Converting the output of the python client filter function back to UAST
deepakorantak opened this issue · 6 comments
I'm using python client to parse a java source code file and use bblfsh.filter to check a condition of a rule.
The return type of this filter function is an iterator. I want to convert back to UAST.
how to do it ? please guide
list(iterator)
will convert the iterator into a list of nodes.
will be of UAST format ? so that I can apply futher filters i.e the way pass to the bblfsh.filter function ?
You can apply filter over any node in the UAST. Technically, there is not a UAST format (well, there is, but is binary and internal to the protocol), but for example in Python any Node
object could have a filter function applied to it.
Thanks for the reply. I have a different request. Can I save the UAST returned from the parse function i.e. response.uast into a plain text file ? If yes how to do that? I have tried to convert response.uast into list by list(response.uast) and try to iterate it says - 'Node' object is not iterable
@juanjux - thanks for solution for the original filtering UAST over and over again. It worked.
Also it helped me export the USATto text file. Thanks a lot for your help
Happy to help!