inline: rename AttributesDummy -> Placeholder

allow general use
This commit is contained in:
Noah Hellman 2023-01-16 17:25:09 +01:00
parent b512c670e6
commit 064b4b1f88
2 changed files with 6 additions and 7 deletions

View file

@ -58,7 +58,7 @@ pub enum EventKind {
Str,
Whitespace,
Attributes,
AttributesDummy,
Placeholder,
}
#[derive(Debug, PartialEq, Eq)]
@ -372,10 +372,9 @@ impl<I: Iterator<Item = char> + Clone> Parser<I> {
})
.unwrap_or_else(|| {
self.openers.push((delim, self.events.len()));
// push dummy attributes in case attributes are encountered after closing
// delimiter
// push dummy event in case attributes are encountered after closing delimiter
self.events.push_back(Event {
kind: EventKind::AttributesDummy,
kind: EventKind::Placeholder,
span: Span::empty_at(self.span.start()),
});
// use str for now, replace if closed later
@ -562,7 +561,7 @@ impl<I: Iterator<Item = char> + Clone> Iterator for Parser<I> {
while self.events.front().map_or(false, |e| {
matches!(
e.kind,
EventKind::Str | EventKind::Whitespace | EventKind::AttributesDummy
EventKind::Str | EventKind::Whitespace | EventKind::Placeholder
)
}) {
let ev = self.events.pop_front().unwrap();
@ -574,7 +573,7 @@ impl<I: Iterator<Item = char> + Clone> Iterator for Parser<I> {
span,
})
}
EventKind::AttributesDummy => self.next(),
EventKind::Placeholder => self.next(),
_ => Some(e),
}
})

View file

@ -359,7 +359,7 @@ impl<'s> Parser<'s> {
inline::EventKind::Str => Event::Str(self.inlines.src(inline.span)),
inline::EventKind::Whitespace
| inline::EventKind::Attributes
| inline::EventKind::AttributesDummy => {
| inline::EventKind::Placeholder => {
panic!("{:?}", inline)
}
})