Emit LexError for dedent to incorrect level (#7638)

This commit is contained in:
Micha Reiser 2023-09-25 12:45:44 +02:00 committed by GitHub
parent 10e35e38d7
commit 8ce138760a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 126 additions and 13 deletions

View file

@ -0,0 +1,66 @@
---
source: crates/ruff_python_parser/src/lexer.rs
expression: tokens
---
[
Ok(
(
If,
0..2,
),
),
Ok(
(
True,
3..7,
),
),
Ok(
(
Colon,
7..8,
),
),
Ok(
(
Newline,
8..9,
),
),
Ok(
(
Indent,
9..13,
),
),
Ok(
(
Pass,
13..17,
),
),
Ok(
(
Newline,
17..18,
),
),
Err(
LexicalError {
error: IndentationError,
location: 20,
},
),
Ok(
(
Pass,
20..24,
),
),
Ok(
(
Newline,
24..24,
),
),
]