mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Remove escaped mac/windows eol from AST string value (#7724)
## Summary This PR fixes the bug where the value of a string node type includes the escaped mac/windows newline character. Note that the token value still includes them, it's only removed when parsing the string content. ## Test Plan Add new test cases for the string node type to check that the escapes aren't being included in the string value. fixes: #7723
This commit is contained in:
parent
488ec54d21
commit
e72d617f4b
4 changed files with 103 additions and 1 deletions
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
source: crates/ruff_python_parser/src/string.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 0..18,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 0..18,
|
||||
value: Str(
|
||||
StringConstant {
|
||||
value: "text more text",
|
||||
unicode: false,
|
||||
implicit_concatenated: false,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
source: crates/ruff_python_parser/src/string.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 0..18,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 0..18,
|
||||
value: Str(
|
||||
StringConstant {
|
||||
value: "text more text",
|
||||
unicode: false,
|
||||
implicit_concatenated: false,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
source: crates/ruff_python_parser/src/string.rs
|
||||
expression: parse_ast
|
||||
---
|
||||
[
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 0..19,
|
||||
value: Constant(
|
||||
ExprConstant {
|
||||
range: 0..19,
|
||||
value: Str(
|
||||
StringConstant {
|
||||
value: "text more text",
|
||||
unicode: false,
|
||||
implicit_concatenated: false,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue