Parser
Parser copied to clipboard
I assume that the use of abbreviating `statement` as `stmt` is for CPython compatibility. Another reason might be that it's slightly less to type but I think that's no longer...
This relates to [a discussion on discord](https://discord.com/channels/1043121930691149845/1044217262225240094/1084150585382670457) a while back. The basic idea is that we can create a custom hash function for our keywords that's based on their structure...
There's been a couple of PRs lately that have been opened in hopes of speeding things up. We should probably add a good set of benchmarks that can be re-used...
```python >>> ast.dump(ast.parse("def woohoo(a, *, b): pass")) "Module(body=[FunctionDef(name='woohoo', args=arguments(posonlyargs=[], args=[arg(arg='a')], kwonlyargs=[arg(arg='b')], kw_defaults=[None], defaults=[]), body=[Pass()], decorator_list=[])], type_ignores=[])" ``` ```python >>> ast.dump(rustpython_parse("def woohoo(a, *, b): pass")) "Module(body=[FunctionDef(name='woohoo', args=arguments(posonlyargs=[], args=[arg(arg='a')], kwonlyargs=[arg(arg='b')], kw_defaults=[], defaults=[]),...
Most of text just exists on source code. We don't need to copy them until the source exist. This is not trivial but worth to try if we really need...
We should implement `PartialEq for &str` and `PartialEq for String` so that both `ident == str` and `str == ident` work.
We currently license it under MIT while previously it was licensed under a dual MIT/CC-BY-4.0 license. It would probably be a good idea to use similar licenses.
Would be a good idea to add a README describing why this is separate from main.
When using the `Visitor` trait I realized that the default values of arguments are never visited. This is because the `visit_arg` function is never actuall called: https://github.com/RustPython/Parser/blob/4588ea5c3e6327009640e7c9c89eb6fa9220358e/ast/src/gen/visitor.rs#L737 I also could...