bpo-40334: refactor and cleanup for the PEG generators by pablogsal · Pull Request #19775 · python/cpython
Improvements in this PR:
- No more relying on the string names to deduce the types of local variables.
- No more threading down the names of local variables from all functions and
visiting: now the code has a local variable scope with a context manager. - Specially for @lysnikolaou: I have actually managed to do bpo-40334: Refactor peg_generator to receive a Tokens file when building c code #19745 (comment) and now we don't need all the specialized token functions. Just one for name, string and number.
- Now we have a class to represent function calls, making the code a bit
more explicit and carrying metadata if needed. Also helps when debugging (from experience 😉 ). - Fix some mypy errors (like the fact that in
add_varthe variabletypecould actually have beenNoneas opposed to our previous declaration).
pablogsal
changed the title
bpo-40334: refactor and cleanup for the PEG c_generator
bpo-40334: refactor and cleanup for the PEG generators
- Specially for @lysnikolaou: I have actually managed to do #19745 (comment) and now we don't need all the specialized token functions. Just one for name, string and number.
😃 😃
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really a great improvement! Thanks a a lot! Most of my comments are stylistic, so feel free to ignore them.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! 🚀
The buildbot failures are unrelated and they are being addressed here:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters