-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inspect the AST instead of iterating through the tokenized source #22
Comments
I'm working on a library of the kind that was discussed in better-exceptions and IPython and planning on using it here. It's entirely AST based and satisfies these requirements. It uses https://github.com/gristlabs/asttokens for the second point and https://github.com/alexmojaki/executing for some extra functionality. |
sounds very promising! |
If you're interested in a sneak peek or following progress, I've just created the repo here: https://github.com/alexmojaki/stack_data Still lots of work to do though. |
👀 |
the solution is #52 |
Currently, to find out where in the code which variable names occur, I traverse the code token-by-token and apply a sort of ad hoc stack machine that detects stuff like the beginning of function definitions, dot attributes etc. This is clearly nuts, and purely a path effect (= it's how ipython's ultratb does it, and then my scope expanded and here we are).
https://github.com/cknd/stackprinter/blob/master/stackprinter/source_inspection.py
This approach works for now, but it has hit its limits. For example, I'd like to ignore the left-hand side of named arguments in function calls.
Goals:
The text was updated successfully, but these errors were encountered: