-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lexer should consider BOM for the start offset
- Loading branch information
1 parent
6ffb961
commit 3f5207c
Showing
4 changed files
with
121 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
29 changes: 29 additions & 0 deletions
29
crates/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/lexer.rs | ||
expression: lex_source(source) | ||
--- | ||
## Tokens | ||
``` | ||
[ | ||
( | ||
Name( | ||
"x", | ||
), | ||
3..4, | ||
), | ||
( | ||
Equal, | ||
5..6, | ||
), | ||
( | ||
Int( | ||
1, | ||
), | ||
7..8, | ||
), | ||
( | ||
Newline, | ||
8..8, | ||
), | ||
] | ||
``` |
29 changes: 29 additions & 0 deletions
29
...s/ruff_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/lexer.rs | ||
expression: "lex_source_with_offset(source, TextSize::new(7))" | ||
--- | ||
## Tokens | ||
``` | ||
[ | ||
( | ||
Name( | ||
"y", | ||
), | ||
7..8, | ||
), | ||
( | ||
Plus, | ||
9..10, | ||
), | ||
( | ||
Name( | ||
"z", | ||
), | ||
11..12, | ||
), | ||
( | ||
Newline, | ||
12..12, | ||
), | ||
] | ||
``` |
19 changes: 19 additions & 0 deletions
19
...f_python_parser/src/snapshots/ruff_python_parser__lexer__tests__bom_with_offset_edge.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
source: crates/ruff_python_parser/src/lexer.rs | ||
expression: "lex_source_with_offset(source, TextSize::new(11))" | ||
--- | ||
## Tokens | ||
``` | ||
[ | ||
( | ||
Name( | ||
"z", | ||
), | ||
11..12, | ||
), | ||
( | ||
Newline, | ||
12..12, | ||
), | ||
] | ||
``` |