From 3600f46e3be0350de2a5f0ee9d78a2cbb09ad0b2 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 23 Apr 2023 16:17:52 -0400 Subject: [PATCH] Initial code structure for regular links. --- src/compare/diff.rs | 20 +++++++++++++++----- src/parser/object.rs | 6 ++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 1f13463..80df736 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -1071,13 +1071,23 @@ fn compare_strike_through<'s>( } fn compare_regular_link<'s>( - _source: &'s str, - _emacs: &'s Token<'s>, - _rust: &'s RegularLink<'s>, + source: &'s str, + emacs: &'s Token<'s>, + rust: &'s RegularLink<'s>, ) -> Result> { + let mut this_status = DiffStatus::Good; + let emacs_name = "link"; + 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: DiffStatus::Good, - name: "regular-link".to_owned(), + status: this_status, + name: emacs_name.to_owned(), message: None, children: Vec::new(), }) diff --git a/src/parser/object.rs b/src/parser/object.rs index 5a3ec31..370ed50 100644 --- a/src/parser/object.rs +++ b/src/parser/object.rs @@ -111,3 +111,9 @@ impl<'s> Source<'s> for Verbatim<'s> { self.source } } + +impl<'s> Source<'s> for RegularLink<'s> { + fn get_source(&'s self) -> &'s str { + self.source + } +}