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

View file

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