Implement comparing the lesser blocks.

This commit is contained in:
Tom Alexander 2023-04-21 18:05:40 -04:00
parent 1006576a69
commit f5218a6c31
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -564,7 +564,26 @@ fn compare_verse_block<'s>(
emacs: &'s Token<'s>, emacs: &'s Token<'s>,
rust: &'s VerseBlock<'s>, rust: &'s VerseBlock<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> { ) -> Result<DiffResult, Box<dyn std::error::Error>> {
todo!() let children = emacs.as_list()?;
let mut child_status = Vec::new();
let mut this_status = DiffStatus::Good;
let emacs_name = "verse-block";
if assert_name(emacs, emacs_name).is_err() {
this_status = DiffStatus::Bad;
}
if assert_bounds(source, emacs, rust).is_err() {
this_status = DiffStatus::Bad;
}
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {}
Ok(DiffResult {
status: this_status,
name: emacs_name.to_owned(),
message: None,
children: child_status,
})
} }
fn compare_comment_block<'s>( fn compare_comment_block<'s>(
@ -572,7 +591,22 @@ fn compare_comment_block<'s>(
emacs: &'s Token<'s>, emacs: &'s Token<'s>,
rust: &'s CommentBlock<'s>, rust: &'s CommentBlock<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> { ) -> Result<DiffResult, Box<dyn std::error::Error>> {
todo!() let mut this_status = DiffStatus::Good;
let emacs_name = "comment-block";
if assert_name(emacs, emacs_name).is_err() {
this_status = DiffStatus::Bad;
}
if assert_bounds(source, emacs, rust).is_err() {
this_status = DiffStatus::Bad;
}
Ok(DiffResult {
status: this_status,
name: emacs_name.to_owned(),
message: None,
children: Vec::new(),
})
} }
fn compare_example_block<'s>( fn compare_example_block<'s>(
@ -580,7 +614,22 @@ fn compare_example_block<'s>(
emacs: &'s Token<'s>, emacs: &'s Token<'s>,
rust: &'s ExampleBlock<'s>, rust: &'s ExampleBlock<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> { ) -> Result<DiffResult, Box<dyn std::error::Error>> {
todo!() let mut this_status = DiffStatus::Good;
let emacs_name = "example-block";
if assert_name(emacs, emacs_name).is_err() {
this_status = DiffStatus::Bad;
}
if assert_bounds(source, emacs, rust).is_err() {
this_status = DiffStatus::Bad;
}
Ok(DiffResult {
status: this_status,
name: emacs_name.to_owned(),
message: None,
children: Vec::new(),
})
} }
fn compare_export_block<'s>( fn compare_export_block<'s>(
@ -588,7 +637,22 @@ fn compare_export_block<'s>(
emacs: &'s Token<'s>, emacs: &'s Token<'s>,
rust: &'s ExportBlock<'s>, rust: &'s ExportBlock<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> { ) -> Result<DiffResult, Box<dyn std::error::Error>> {
todo!() let mut this_status = DiffStatus::Good;
let emacs_name = "export-block";
if assert_name(emacs, emacs_name).is_err() {
this_status = DiffStatus::Bad;
}
if assert_bounds(source, emacs, rust).is_err() {
this_status = DiffStatus::Bad;
}
Ok(DiffResult {
status: this_status,
name: emacs_name.to_owned(),
message: None,
children: Vec::new(),
})
} }
fn compare_src_block<'s>( fn compare_src_block<'s>(
@ -596,5 +660,20 @@ fn compare_src_block<'s>(
emacs: &'s Token<'s>, emacs: &'s Token<'s>,
rust: &'s SrcBlock<'s>, rust: &'s SrcBlock<'s>,
) -> Result<DiffResult, Box<dyn std::error::Error>> { ) -> Result<DiffResult, Box<dyn std::error::Error>> {
todo!() let mut this_status = DiffStatus::Good;
let emacs_name = "src-block";
if assert_name(emacs, emacs_name).is_err() {
this_status = DiffStatus::Bad;
}
if assert_bounds(source, emacs, rust).is_err() {
this_status = DiffStatus::Bad;
}
Ok(DiffResult {
status: this_status,
name: emacs_name.to_owned(),
message: None,
children: Vec::new(),
})
} }