mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-12 15:45:22 +00:00
Fix plain string
This commit is contained in:
parent
dd01ab1c9e
commit
9111cd8a3d
4 changed files with 8 additions and 10 deletions
|
@ -24,7 +24,7 @@ expression: parse_ast
|
|||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
column: 16,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
|
|
@ -24,7 +24,7 @@ expression: parse_ast
|
|||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 8,
|
||||
column: 17,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
|
|
@ -24,7 +24,7 @@ expression: parse_ast
|
|||
end_location: Some(
|
||||
Location {
|
||||
row: 1,
|
||||
column: 9,
|
||||
column: 17,
|
||||
},
|
||||
),
|
||||
custom: (),
|
||||
|
|
|
@ -82,18 +82,16 @@ pub fn parse_strings(
|
|||
deduped.push(take_current(&mut current));
|
||||
}
|
||||
|
||||
Ok(if has_fstring {
|
||||
Expr::new(
|
||||
initial_start,
|
||||
last_end,
|
||||
ExprKind::JoinedStr { values: deduped },
|
||||
)
|
||||
let node = if has_fstring {
|
||||
ExprKind::JoinedStr { values: deduped }
|
||||
} else {
|
||||
deduped
|
||||
.into_iter()
|
||||
.exactly_one()
|
||||
.expect("String must be concatenated to a single element.")
|
||||
})
|
||||
.node
|
||||
};
|
||||
Ok(Expr::new(initial_start, last_end, node))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue