diff --git a/crates/pawarser/src/parser/marker.rs b/crates/pawarser/src/parser/marker.rs index 2d3fc5a..d03e358 100644 --- a/crates/pawarser/src/parser/marker.rs +++ b/crates/pawarser/src/parser/marker.rs @@ -69,6 +69,17 @@ pub struct CompletedMarker { impl CompletedMarker { pub fn precede(self, p: &mut Parser, name: &str) -> Marker { - todo!() + let new_pos = p.start(name); + + match &mut p.events[self.pos] { + Event::Start { forward_parent, .. } => { + // point forward parent of the node this marker completed to the new node + // will later be used to make the new node a parent of the current node. + *forward_parent = Some(new_pos.pos - self.pos) + } + _ => unreachable!(), + } + + new_pos } }