mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-13 16:15:16 +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(
|
end_location: Some(
|
||||||
Location {
|
Location {
|
||||||
row: 1,
|
row: 1,
|
||||||
column: 8,
|
column: 16,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
custom: (),
|
custom: (),
|
||||||
|
|
|
@ -24,7 +24,7 @@ expression: parse_ast
|
||||||
end_location: Some(
|
end_location: Some(
|
||||||
Location {
|
Location {
|
||||||
row: 1,
|
row: 1,
|
||||||
column: 8,
|
column: 17,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
custom: (),
|
custom: (),
|
||||||
|
|
|
@ -24,7 +24,7 @@ expression: parse_ast
|
||||||
end_location: Some(
|
end_location: Some(
|
||||||
Location {
|
Location {
|
||||||
row: 1,
|
row: 1,
|
||||||
column: 9,
|
column: 17,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
custom: (),
|
custom: (),
|
||||||
|
|
|
@ -82,18 +82,16 @@ pub fn parse_strings(
|
||||||
deduped.push(take_current(&mut current));
|
deduped.push(take_current(&mut current));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(if has_fstring {
|
let node = if has_fstring {
|
||||||
Expr::new(
|
ExprKind::JoinedStr { values: deduped }
|
||||||
initial_start,
|
|
||||||
last_end,
|
|
||||||
ExprKind::JoinedStr { values: deduped },
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
deduped
|
deduped
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.exactly_one()
|
.exactly_one()
|
||||||
.expect("String must be concatenated to a single element.")
|
.expect("String must be concatenated to a single element.")
|
||||||
})
|
.node
|
||||||
|
};
|
||||||
|
Ok(Expr::new(initial_start, last_end, node))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue