Replace Python parser with ruff parser#5453
Conversation
|
Thank you so much! Since ruff already has its own ast coworking with same parser, how about starting from ruff side again about it too? |
|
@qingshi163 @coolreader18 do you also have advices? |
|
I have to look in this PR, sorry for delay |
# Conflicts: # Cargo.lock # Cargo.toml # compiler/codegen/src/compile.rs # compiler/codegen/src/symboltable.rs # wasm/lib/src/convert.rs
|
@youknowone I think this is ready to be reviewed now. I went ahead and merged |
|
@etaloof could you make your fork of RustPython not from qingshi163's but from RustPython org's? Then I can directly push my edits to your PR |
|
It looks going well. this commit will pin parser version to git version of Ruff c8acbf8 |
|
Thank you, I deleted my fork from qingshi163's repository and forked again from RustPython. Could you please open this PR again? Sorry for the confusion. |
|
a PR is only can be re-opened when the branch is not changed. This one doesn't seem so. Please open a new one. |
|
Thanks, I have created a new PR #5494. |
This PR replaces the Python parser with the ruff Parser. It is based on the work of the earlier PR #5423 (thanks @qingshi163)! Code generation has been updated and should mostly work now. There is is still some work left to fix the built-in AST module, REPL (probably) and I haven't looked into WASM support.
Running the tests with
cargo test --workspace --exclude rustpython_wasm --features freeze-stdlibgives me one remaining test failure:test_run_scriptinsrc/lib.rs. It seems fail when importing theextra_tests/snippets/dir_mainbut I am not sure why that happens.Concerning the AST module: The previous implementation is using a lot of generated code (script). Not sure if we should continue updating this script, I'll look into it. @youknowone do you have any suggestions on this?