compare_properties table cell.

This commit is contained in:
Tom Alexander 2023-10-10 00:11:05 -04:00
parent cf257443b0
commit 2215c32e57
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 25 additions and 7 deletions

View File

@ -1798,16 +1798,33 @@ fn compare_table_row<'b, 's>(
} }
fn compare_table_cell<'b, 's>( fn compare_table_cell<'b, 's>(
_source: &'s str, source: &'s str,
emacs: &'b Token<'s>, emacs: &'b Token<'s>,
rust: &'b TableCell<'s>, rust: &'b TableCell<'s>,
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> { ) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
let children = emacs.as_list()?; let mut this_status = DiffStatus::Good;
let child_status = Vec::new(); let mut child_status = Vec::new();
let this_status = DiffStatus::Good; let mut message = None;
let message = None;
for (_emacs_child, _rust_child) in children.iter().skip(2).zip(rust.children.iter()) {} compare_children(
source,
emacs,
&rust.children,
&mut child_status,
&mut this_status,
&mut message,
)?;
for diff in compare_properties!(emacs) {
match diff {
ComparePropertiesResult::NoChange => {}
ComparePropertiesResult::SelfChange(new_status, new_message) => {
this_status = new_status;
message = new_message
}
ComparePropertiesResult::DiffEntry(diff_entry) => child_status.push(diff_entry),
}
}
Ok(DiffResult { Ok(DiffResult {
status: this_status, status: this_status,

View File

@ -176,12 +176,13 @@ fn org_mode_table_cell<'b, 'g, 'r, 's>(
let table_cell_set_object_matcher = let table_cell_set_object_matcher =
parser_with_context!(table_cell_set_object)(&parser_context); parser_with_context!(table_cell_set_object)(&parser_context);
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context); let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
let (remaining, _) = space0(input)?;
let (remaining, (children, _exit_contents)) = verify( let (remaining, (children, _exit_contents)) = verify(
many_till(table_cell_set_object_matcher, exit_matcher), many_till(table_cell_set_object_matcher, exit_matcher),
|(children, exit_contents)| { |(children, exit_contents)| {
!children.is_empty() || Into::<&str>::into(exit_contents).ends_with("|") !children.is_empty() || Into::<&str>::into(exit_contents).ends_with("|")
}, },
)(input)?; )(remaining)?;
let (remaining, _tail) = org_mode_table_cell_end(&parser_context, remaining)?; let (remaining, _tail) = org_mode_table_cell_end(&parser_context, remaining)?;