Update get_consumed to use the new wrapped input type.

This commit is contained in:
Tom Alexander
2023-08-24 18:33:40 -04:00
parent 32071ce74d
commit 64e3481660
2 changed files with 7 additions and 19 deletions

View File

@@ -50,6 +50,12 @@ impl<'s> OrgSource<'s> {
pub fn is_at_start_of_line(&self) -> bool {
self.start == self.start_of_line
}
pub fn get_until(&self, other: OrgSource<'s>) -> OrgSource<'s> {
assert!(other.start >= self.start);
assert!(other.end <= self.end);
self.slice(..(other.start - self.start))
}
}
impl<'s> InputTake for OrgSource<'s> {
@@ -118,7 +124,6 @@ where
.map(|idx| self.start + idx + 1)
.unwrap_or(self.start_of_line);
// TODO: calculate updated values for WrappedInput
OrgSource {
full_source: self.full_source,
start: new_start,