◐ Shell
clean mode source ↗

[DRAFT] PEG Parser via rust-peg by qingshi163 · Pull Request #4423 · RustPython/RustPython

Ok, just ran this over Ruff. Out of the box, we have 84 test failures, 47 of which are fixture failures (so the linter producing different results). 914 tests passed -- which is great!

In a lot of cases, the row and column numbers have changed slightly -- I'd really love these to be consistent with the old parser and/or consistent with CPython, but I can also help fix these up once we get that far:

Screen Shot 2023-02-01 at 3 32 19 PM

A few files are failing to parse -- here they are:

E101.py:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: LexicalError { error: TabsAfterSpaces, location: Location { row: 15, column: 1 } }', /Users/crmarsh/workspace/RustPython/compiler/parser/src/parser.rs:99:61

COM81.py:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError { location: "p: 151", expected: ExpectedSet { expected: {"[Pass]", "EOF", "[False]", "[Tilde]", "[EndOfFile]", "[Name { name }]", "[Lsqb]", "[Complex { real, imag }]", "[Tok :: String { value, kind, triple_quoted }]", "[Lpar]", "[Int { value }]", "[Plus]", "[True]", "[Lambda]", "[Float { value }]", "[Await]", "[Ellipsis]", "[Tok :: None]", "[Star]", "[Minus]", "[Break]", "[Not]", "[Continue]"} } }', /Users/crmarsh/workspace/RustPython/compiler/parser/src/parser.rs:102:27

F722.py:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError { location: "p: 0", expected: ExpectedSet { expected: {"[Tok :: None]", "[Name { name }]", "[True]", "[Int { value }]", "[Await]", "[Not]", "[False]", "[Complex { real, imag }]", "[Tilde]", "[Lambda]", "[Ellipsis]", "[Float { value }]", "[Minus]", "[Tok :: String { value, kind, triple_quoted }]", "[Plus]"} } }', /Users/crmarsh/workspace/RustPython/compiler/parser/src/parser.rs:102:27

E999.py (this actually does have a syntax error, but the old parser returned an error rather than panicking):

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ParseError { location: "p: 6", expected: ExpectedSet { expected: {"[Indent]"} } }', /Users/crmarsh/workspace/RustPython/compiler/parser/src/parser.rs:102:27