inline: do not merge discontinuous str

may appear when ignoring attributes
This commit is contained in:
Noah Hellman 2023-01-19 22:39:49 +01:00
parent d3b2ee14cb
commit 79dfd3be36

View file

@ -662,10 +662,9 @@ impl<I: Iterator<Item = char> + Clone> Iterator for Parser<I> {
matches!( matches!(
e.kind, e.kind,
EventKind::Str | EventKind::Whitespace | EventKind::Placeholder EventKind::Str | EventKind::Whitespace | EventKind::Placeholder
) ) && span.end() == e.span.start()
}) { }) {
let ev = self.events.pop_front().unwrap(); let ev = self.events.pop_front().unwrap();
assert_eq!(span.end(), ev.span.start());
span = span.union(ev.span); span = span.union(ev.span);
} }
Some(Event { Some(Event {
@ -950,6 +949,7 @@ mod test {
(Str, "abc"), (Str, "abc"),
(Exit(Span), "]"), (Exit(Span), "]"),
); );
test_parse!("not a [span] {#id}.", (Str, "not a [span] "), (Str, "."));
} }
#[test] #[test]