rope
rope copied to clipboard
investigate better approach to patchedast
I'm familiar with these. What's the problem you are trying to resolve that makes any of these better?
Current architecture of patchedast is limited and can't parse all code. It can be proved by traversing site-packages and applying it to files. Or just write some rich function call or multiline string with nested bracket to feel that the task requires full parsing approach instead of ad-hoc lookahead and manual assumptions about a next node.
Current architecture of patchedast is limited and can't parse all code.
How patchedast is related to parsing? Do you understand what parsing is about? Rope uses python's native parser https://docs.python.org/3/library/parser.html
architecture of patchedast is limited
What exactly limitation on architecture level do you mean?
I understand some advantages of astroid, but they mainly are not related to parsing.
How patchedast is related to parsing? Do you understand what parsing is about? Rope uses python's native parser
Well okay. What do you think patchedast do ? It parses
python code with little help of parsed ast because python's parser (surprisingly) cant parse pythons code with column resolution.
What exactly limitation on architecture level do you mean?
I mean that its exactly not a parser, but should be. Currently it tries to assume pos
of nodes ad-hoc, without any 'parsing things' like stacks, automata (sorry for such silly terms, I guess you got what I mean).
It parses python code with little help of parsed ast because python's parser (surprisingly) cant parse pythons code with column resolution.
- Can you give me any test case to reproduce any problem of python's native parser?
Existence of https://github.com/python-rope/rope/blob/master/rope/refactor/patchedast.py is a good proof I guess. If i'm wrong and pythons parser can parse python code i'll be very happy
At what line of the file do you see a good proof?
Whole file, purpose of the file. Stop trolling please. If you are sure the problem is 100% gone since 2012 and python parser have good column resolution so okay then we can close the ticket...
Can you call me with Skype to discuss this? My skypename is industrialnet.
yes, astroid solves some issues of rope, but its implementation requires a lot of works.
I've messed around with removing the patchedast. It provides two things:
- Sorted children, which afaik isn't directly used
- Region of code.
Since rope reads everything into a single line, using the standard ast would break region based functionality. Regardless, I am working on a solution using standard ast. If we can use parso, we'll get error recovery and port some of my autoimport code from pylsp.