Pass the source through to child diff status so I can calculate offsets.

This commit is contained in:
Tom Alexander 2023-04-11 18:34:11 -04:00
parent 6e62bd5ff2
commit 276e8abb13
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 4 additions and 1 deletions

View File

@ -60,6 +60,7 @@ pub fn compare_document<'s>(
return Err("Section cannot be after the first child of document.".into());
}
child_status.push(compare_section(
rust.source,
token,
rust.zeroth_section
.as_ref()
@ -71,7 +72,7 @@ pub fn compare_document<'s>(
.iter()
.nth(i - rust.zeroth_section.as_ref().map(|_| 1).unwrap_or(0))
.ok_or("Should have a corresponding heading.")?;
child_status.push(compare_heading(token, rust)?);
child_status.push(compare_heading(rust.source, token, rust)?);
} else {
return Err("Document should only contain sections and headlines.".into());
}
@ -85,6 +86,7 @@ pub fn compare_document<'s>(
}
pub fn compare_section<'s>(
source: &'s str,
emacs: &'s Token<'s>,
rust: &'s Section<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> {
@ -104,6 +106,7 @@ pub fn compare_section<'s>(
}
pub fn compare_heading<'s>(
source: &'s str,
emacs: &'s Token<'s>,
rust: &'s Document<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> {