Compare commits
No commits in common. "8d9ff7779970bf9b17e9b3e68ec72ebcff7d429d" and "dfad7b78886034cbc18d7332d91c1948d8545a5a" have entirely different histories.
8d9ff77799
...
dfad7b7888
@ -2758,13 +2758,11 @@ fn compare_strike_through<'b, 's>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn compare_regular_link<'b, 's>(
|
fn compare_regular_link<'b, 's>(
|
||||||
source: &'s str,
|
_source: &'s str,
|
||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'b RegularLink<'s>,
|
rust: &'b RegularLink<'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 mut this_status = DiffStatus::Good;
|
||||||
let mut child_status = Vec::new();
|
|
||||||
let mut message = None;
|
let mut message = None;
|
||||||
|
|
||||||
if let Some((new_status, new_message)) = compare_properties!(
|
if let Some((new_status, new_message)) = compare_properties!(
|
||||||
@ -2814,10 +2812,6 @@ fn compare_regular_link<'b, 's>(
|
|||||||
message = new_message;
|
message = new_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
|
|
||||||
child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(DiffResult {
|
Ok(DiffResult {
|
||||||
status: this_status,
|
status: this_status,
|
||||||
name: rust.get_elisp_name(),
|
name: rust.get_elisp_name(),
|
||||||
@ -2830,56 +2824,14 @@ fn compare_regular_link<'b, 's>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn compare_radio_link<'b, 's>(
|
fn compare_radio_link<'b, 's>(
|
||||||
source: &'s str,
|
_source: &'s str,
|
||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'b RadioLink<'s>,
|
rust: &'b RadioLink<'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 this_status = DiffStatus::Good;
|
||||||
let mut this_status = DiffStatus::Good;
|
let message = None;
|
||||||
let mut child_status = Vec::new();
|
|
||||||
let mut message = None;
|
|
||||||
|
|
||||||
if let Some((new_status, new_message)) = compare_properties!(
|
// TODO: Compare :type :path :format :raw-link :application :search-option
|
||||||
emacs,
|
|
||||||
rust,
|
|
||||||
(
|
|
||||||
EmacsField::Required(":type"),
|
|
||||||
|_| { Some("radio") },
|
|
||||||
compare_property_quoted_string
|
|
||||||
),
|
|
||||||
(
|
|
||||||
EmacsField::Required(":path"),
|
|
||||||
|r| Some(&r.path),
|
|
||||||
compare_property_quoted_string
|
|
||||||
),
|
|
||||||
(
|
|
||||||
EmacsField::Required(":format"),
|
|
||||||
|_| Some("plain"),
|
|
||||||
compare_property_unquoted_atom
|
|
||||||
),
|
|
||||||
(
|
|
||||||
EmacsField::Required(":raw-link"),
|
|
||||||
|r| Some(&r.raw_link),
|
|
||||||
compare_property_quoted_string
|
|
||||||
),
|
|
||||||
(
|
|
||||||
EmacsField::Required(":application"),
|
|
||||||
compare_identity,
|
|
||||||
compare_property_always_nil
|
|
||||||
),
|
|
||||||
(
|
|
||||||
EmacsField::Required(":search-option"),
|
|
||||||
compare_identity,
|
|
||||||
compare_property_always_nil
|
|
||||||
)
|
|
||||||
)? {
|
|
||||||
this_status = new_status;
|
|
||||||
message = new_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
|
|
||||||
child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(DiffResult {
|
Ok(DiffResult {
|
||||||
status: this_status,
|
status: this_status,
|
||||||
|
@ -30,7 +30,6 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
|
|||||||
for radio_target in &context.get_global_settings().radio_targets {
|
for radio_target in &context.get_global_settings().radio_targets {
|
||||||
let rematched_target = rematch_target(context, radio_target, input);
|
let rematched_target = rematch_target(context, radio_target, input);
|
||||||
if let Ok((remaining, rematched_target)) = rematched_target {
|
if let Ok((remaining, rematched_target)) = rematched_target {
|
||||||
let path = get_consumed(input, remaining);
|
|
||||||
let (remaining, _) = space0(remaining)?;
|
let (remaining, _) = space0(remaining)?;
|
||||||
let source = get_consumed(input, remaining);
|
let source = get_consumed(input, remaining);
|
||||||
return Ok((
|
return Ok((
|
||||||
@ -38,8 +37,6 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
|
|||||||
RadioLink {
|
RadioLink {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
children: rematched_target,
|
children: rematched_target,
|
||||||
path: path.into(),
|
|
||||||
raw_link: path.into(),
|
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -187,9 +184,7 @@ mod tests {
|
|||||||
.expect("Len already asserted to be 3"),
|
.expect("Len already asserted to be 3"),
|
||||||
&Object::RadioLink(RadioLink {
|
&Object::RadioLink(RadioLink {
|
||||||
source: "bar ",
|
source: "bar ",
|
||||||
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
children: vec![Object::PlainText(PlainText { source: "bar" })]
|
||||||
path: "bar".into(),
|
|
||||||
raw_link: "bar".into()
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -231,9 +226,7 @@ mod tests {
|
|||||||
children: vec![Object::Bold(Bold {
|
children: vec![Object::Bold(Bold {
|
||||||
source: "*bar* ",
|
source: "*bar* ",
|
||||||
children: vec![Object::PlainText(PlainText { source: "bar" })]
|
children: vec![Object::PlainText(PlainText { source: "bar" })]
|
||||||
})],
|
})]
|
||||||
path: "*bar* ".into(),
|
|
||||||
raw_link: "*bar* ".into()
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,6 @@ fn regular_link_without_description<'b, 'g, 'r, 's>(
|
|||||||
path: path.path,
|
path: path.path,
|
||||||
raw_link: path.raw_link,
|
raw_link: path.raw_link,
|
||||||
search_option: path.search_option,
|
search_option: path.search_option,
|
||||||
children: Vec::new(),
|
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@ -81,7 +80,7 @@ fn regular_link_with_description<'b, 'g, 'r, 's>(
|
|||||||
let (remaining, _opening_bracket) = tag("[[")(input)?;
|
let (remaining, _opening_bracket) = tag("[[")(input)?;
|
||||||
let (remaining, path) = pathreg(context, remaining)?;
|
let (remaining, path) = pathreg(context, remaining)?;
|
||||||
let (remaining, _closing_bracket) = tag("][")(remaining)?;
|
let (remaining, _closing_bracket) = tag("][")(remaining)?;
|
||||||
let (remaining, description) = description(context, remaining)?;
|
let (remaining, _description) = description(context, remaining)?;
|
||||||
let (remaining, _closing_bracket) = tag("]]")(remaining)?;
|
let (remaining, _closing_bracket) = tag("]]")(remaining)?;
|
||||||
let (remaining, _trailing_whitespace) =
|
let (remaining, _trailing_whitespace) =
|
||||||
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?;
|
||||||
@ -94,7 +93,6 @@ fn regular_link_with_description<'b, 'g, 'r, 's>(
|
|||||||
path: path.path,
|
path: path.path,
|
||||||
raw_link: path.raw_link,
|
raw_link: path.raw_link,
|
||||||
search_option: path.search_option,
|
search_option: path.search_option,
|
||||||
children: description,
|
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,6 @@ pub struct RegularLink<'s> {
|
|||||||
pub path: Cow<'s, str>,
|
pub path: Cow<'s, str>,
|
||||||
pub raw_link: Cow<'s, str>,
|
pub raw_link: Cow<'s, str>,
|
||||||
pub search_option: Option<Cow<'s, str>>,
|
pub search_option: Option<Cow<'s, str>>,
|
||||||
pub children: Vec<Object<'s>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
@ -96,8 +95,6 @@ pub struct RadioTarget<'s> {
|
|||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct RadioLink<'s> {
|
pub struct RadioLink<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub path: Cow<'s, str>,
|
|
||||||
pub raw_link: Cow<'s, str>,
|
|
||||||
pub children: Vec<Object<'s>>,
|
pub children: Vec<Object<'s>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user