Compare commits
No commits in common. "d4a2ad4a7fb8d2e284c79b987d87845555bad1b9" and "76fb24d1d1001fd14794be3d54048729aec0ea25" have entirely different histories.
d4a2ad4a7f
...
76fb24d1d1
@ -1241,19 +1241,9 @@ fn compare_drawer<'b, '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 children = emacs.as_list()?;
|
||||||
let mut child_status = Vec::new();
|
let mut child_status = Vec::new();
|
||||||
let mut this_status = DiffStatus::Good;
|
let this_status = DiffStatus::Good;
|
||||||
let mut message = None;
|
let message = None;
|
||||||
|
// TODO: Compare :drawer-name
|
||||||
// Compare drawer-name
|
|
||||||
let name =
|
|
||||||
get_property_quoted_string(emacs, ":drawer-name")?.ok_or("Drawers should have a name.")?;
|
|
||||||
if name != rust.name {
|
|
||||||
this_status = DiffStatus::Bad;
|
|
||||||
message = Some(format!(
|
|
||||||
"Name mismatch (emacs != rust) {:?} != {:?}",
|
|
||||||
name, rust.name
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
|
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())?);
|
child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);
|
||||||
@ -1301,33 +1291,10 @@ fn compare_node_property<'b, 's>(
|
|||||||
rust: &'b NodeProperty<'s>,
|
rust: &'b NodeProperty<'s>,
|
||||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
let child_status = Vec::new();
|
let child_status = Vec::new();
|
||||||
let mut this_status = DiffStatus::Good;
|
let this_status = DiffStatus::Good;
|
||||||
let mut message = None;
|
let message = None;
|
||||||
|
|
||||||
// Compare key
|
// TODO: Compare :key :value
|
||||||
let key =
|
|
||||||
get_property_quoted_string(emacs, ":key")?.ok_or("Node properties should have a key.")?;
|
|
||||||
if key != rust.name {
|
|
||||||
this_status = DiffStatus::Bad;
|
|
||||||
message = Some(format!(
|
|
||||||
"Key mismatch (emacs != rust) {:?} != {:?}",
|
|
||||||
key, rust.name
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compare value
|
|
||||||
let value = get_property_quoted_string(emacs, ":value")?;
|
|
||||||
match (value.as_ref(), rust.value) {
|
|
||||||
(None, None) => {}
|
|
||||||
(Some(emacs_value), Some(rust_value)) if emacs_value == rust_value => {}
|
|
||||||
_ => {
|
|
||||||
this_status = DiffStatus::Bad;
|
|
||||||
message = Some(format!(
|
|
||||||
"Value mismatch (emacs != rust) {:?} != {:?}",
|
|
||||||
value, rust.value
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(DiffResult {
|
Ok(DiffResult {
|
||||||
status: this_status,
|
status: this_status,
|
||||||
|
@ -101,7 +101,7 @@ fn node_property<'b, 'g, 'r, 's>(
|
|||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
) -> Res<OrgSource<'s>, NodeProperty<'s>> {
|
) -> Res<OrgSource<'s>, NodeProperty<'s>> {
|
||||||
let (remaining, (_start_of_line, _leading_whitespace, _open_colon, name, _close_colon)) =
|
let (remaining, (_start_of_line, _leading_whitespace, _open_colon, _name, _close_colon)) =
|
||||||
tuple((
|
tuple((
|
||||||
start_of_line,
|
start_of_line,
|
||||||
space0,
|
space0,
|
||||||
@ -120,7 +120,6 @@ fn node_property<'b, 'g, 'r, 's>(
|
|||||||
remaining,
|
remaining,
|
||||||
NodeProperty {
|
NodeProperty {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
name: Into::<&str>::into(name),
|
|
||||||
value: None,
|
value: None,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
@ -133,7 +132,6 @@ fn node_property<'b, 'g, 'r, 's>(
|
|||||||
remaining,
|
remaining,
|
||||||
NodeProperty {
|
NodeProperty {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
name: Into::<&str>::into(name),
|
|
||||||
value: Some(value.into()),
|
value: Some(value.into()),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
@ -94,7 +94,6 @@ pub struct PropertyDrawer<'s> {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct NodeProperty<'s> {
|
pub struct NodeProperty<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
pub name: &'s str,
|
|
||||||
pub value: Option<&'s str>,
|
pub value: Option<&'s str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user