Compare commits
No commits in common. "36327e92d70a406c7312713f0916403c43397747" and "8d9ff7779970bf9b17e9b3e68ec72ebcff7d429d" have entirely different histories.
36327e92d7
...
8d9ff77799
@ -1,6 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
// TODO: Update all to use the macro to assert there are no unexpected keys.
|
||||
// TODO: Check all compare funtions for whether they correctly iterate children.
|
||||
// TODO: Add a check for unexpected keys in the properties
|
||||
use std::collections::BTreeSet;
|
||||
use std::collections::HashSet;
|
||||
|
||||
@ -2894,31 +2893,14 @@ fn compare_radio_link<'b, 's>(
|
||||
}
|
||||
|
||||
fn compare_radio_target<'b, 's>(
|
||||
source: &'s str,
|
||||
_source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
rust: &'b RadioTarget<'s>,
|
||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut child_status = Vec::new();
|
||||
let mut message = None;
|
||||
let this_status = DiffStatus::Good;
|
||||
let message = None;
|
||||
|
||||
if let Some((new_status, new_message)) = compare_properties!(
|
||||
emacs,
|
||||
rust,
|
||||
(
|
||||
EmacsField::Required(":value"),
|
||||
|r| Some(r.value),
|
||||
compare_property_quoted_string
|
||||
)
|
||||
)? {
|
||||
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())?);
|
||||
}
|
||||
// TODO: Compare :value
|
||||
|
||||
Ok(DiffResult {
|
||||
status: this_status,
|
||||
|
@ -2,8 +2,6 @@ use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::line_ending;
|
||||
use nom::character::complete::space0;
|
||||
use nom::combinator::consumed;
|
||||
use nom::combinator::map;
|
||||
use nom::combinator::verify;
|
||||
use nom::multi::many_till;
|
||||
|
||||
@ -110,16 +108,13 @@ pub(crate) fn radio_target<'b, 'g, 'r, 's>(
|
||||
});
|
||||
let parser_context = context.with_additional_node(&parser_context);
|
||||
|
||||
let (remaining, (raw_value, children)) = consumed(verify(
|
||||
map(
|
||||
let (remaining, (children, _exit_contents)) = verify(
|
||||
many_till(
|
||||
parser_with_context!(minimal_set_object)(&parser_context),
|
||||
parser_with_context!(exit_matcher_parser)(&parser_context),
|
||||
),
|
||||
|(children, _)| children,
|
||||
),
|
||||
|children: &Vec<_>| !children.is_empty(),
|
||||
))(remaining)?;
|
||||
|(children, _exit_contents)| !children.is_empty(),
|
||||
)(remaining)?;
|
||||
|
||||
let (remaining, _closing) = tag(">>>")(remaining)?;
|
||||
let (remaining, _trailing_whitespace) =
|
||||
@ -129,7 +124,6 @@ pub(crate) fn radio_target<'b, 'g, 'r, 's>(
|
||||
remaining,
|
||||
RadioTarget {
|
||||
source: source.into(),
|
||||
value: raw_value.into(),
|
||||
children,
|
||||
},
|
||||
))
|
||||
|
@ -90,15 +90,14 @@ pub struct RegularLink<'s> {
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct RadioTarget<'s> {
|
||||
pub source: &'s str,
|
||||
pub value: &'s str,
|
||||
pub children: Vec<Object<'s>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct RadioLink<'s> {
|
||||
pub source: &'s str,
|
||||
pub path: &'s str,
|
||||
pub raw_link: &'s str, // TODO: Is this always the same as path? If so, this could be a function instead of a field.
|
||||
pub path: Cow<'s, str>,
|
||||
pub raw_link: Cow<'s, str>,
|
||||
pub children: Vec<Object<'s>>,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user