Put Raw::lit field into a span

This commit is contained in:
Guillaume Gomez 2025-07-29 22:32:39 +02:00 committed by René Kijewski
parent 54be12a6e0
commit 89024013dd
2 changed files with 6 additions and 6 deletions

View File

@ -1135,7 +1135,7 @@ impl<'a> Lit<'a> {
#[derive(Debug, PartialEq)]
pub struct Raw<'a> {
pub ws1: Ws,
pub lit: Lit<'a>,
pub lit: WithSpan<'a, Lit<'a>>,
pub ws2: Ws,
}
@ -1187,7 +1187,7 @@ impl<'a> Raw<'a> {
);
let (pws, (nws, (ws2, content))) = p.parse_next(i)?;
let lit = Lit::split_ws_parts(content);
let lit = WithSpan::new_with_full(Lit::split_ws_parts(content), content);
let ws1 = Ws(pws, nws);
Ok(Box::new(Node::Raw(WithSpan::new(
Self { ws1, lit, ws2 },

View File

@ -1483,11 +1483,11 @@ fn test_raw() {
.nodes,
[Box::new(Node::Raw(WithSpan::no_span(Raw {
ws1: Ws(Some(Whitespace::Preserve), Some(Whitespace::Suppress)),
lit: Lit {
lit: WithSpan::no_span(Lit {
lws: " ",
val,
rws: " ",
},
}),
ws2: Ws(Some(Whitespace::Minimize), Some(Whitespace::Minimize)),
})))],
);
@ -1507,11 +1507,11 @@ fn test_raw() {
.nodes,
[Box::new(Node::Raw(WithSpan::no_span(Raw {
ws1: Ws(Some(Whitespace::Suppress), Some(Whitespace::Suppress)),
lit: Lit {
lit: WithSpan::no_span(Lit {
lws: " ",
val: "-$- endraw",
rws: " ",
},
}),
ws2: Ws(None, Some(Whitespace::Suppress)),
})))],
);