Merge branch 'target_properties'
This commit is contained in:
commit
c49455e9ce
@ -3739,20 +3739,41 @@ fn compare_line_break<'b, 's>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn compare_target<'b, 's>(
|
fn compare_target<'b, 's>(
|
||||||
_source: &'s str,
|
source: &'s str,
|
||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'b Target<'s>,
|
rust: &'b Target<'s>,
|
||||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
let this_status = DiffStatus::Good;
|
let mut this_status = DiffStatus::Good;
|
||||||
let message = None;
|
let mut child_status = Vec::new();
|
||||||
|
let mut message = None;
|
||||||
|
|
||||||
// TODO: Compare :value
|
assert_no_children(emacs, &mut this_status, &mut message)?;
|
||||||
|
|
||||||
|
for diff in compare_properties!(
|
||||||
|
source,
|
||||||
|
emacs,
|
||||||
|
rust,
|
||||||
|
(
|
||||||
|
EmacsField::Required(":value"),
|
||||||
|
|r| Some(r.value),
|
||||||
|
compare_property_quoted_string
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
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,
|
||||||
name: rust.get_elisp_name(),
|
name: rust.get_elisp_name(),
|
||||||
message,
|
message,
|
||||||
children: Vec::new(),
|
children: child_status,
|
||||||
rust_source: rust.get_source(),
|
rust_source: rust.get_source(),
|
||||||
emacs_token: emacs,
|
emacs_token: emacs,
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,10 @@ use nom::character::complete::one_of;
|
|||||||
use nom::combinator::peek;
|
use nom::combinator::peek;
|
||||||
use nom::combinator::recognize;
|
use nom::combinator::recognize;
|
||||||
use nom::combinator::verify;
|
use nom::combinator::verify;
|
||||||
use nom::multi::many_till;
|
|
||||||
|
|
||||||
use super::org_source::OrgSource;
|
use super::org_source::OrgSource;
|
||||||
use super::util::exit_matcher_parser;
|
|
||||||
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
|
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
|
||||||
use crate::context::parser_with_context;
|
use super::util::text_until_exit;
|
||||||
use crate::context::ContextElement;
|
use crate::context::ContextElement;
|
||||||
use crate::context::ExitClass;
|
use crate::context::ExitClass;
|
||||||
use crate::context::ExitMatcherNode;
|
use crate::context::ExitMatcherNode;
|
||||||
@ -38,10 +36,7 @@ pub(crate) fn target<'b, 'g, 'r, 's>(
|
|||||||
exit_matcher: &target_end,
|
exit_matcher: &target_end,
|
||||||
});
|
});
|
||||||
let parser_context = context.with_additional_node(&parser_context);
|
let parser_context = context.with_additional_node(&parser_context);
|
||||||
let (remaining, _body) = recognize(many_till(
|
let (remaining, body) = text_until_exit(&parser_context, remaining)?;
|
||||||
anychar,
|
|
||||||
parser_with_context!(exit_matcher_parser)(&parser_context),
|
|
||||||
))(remaining)?;
|
|
||||||
|
|
||||||
let preceding_character = remaining
|
let preceding_character = remaining
|
||||||
.get_preceding_character()
|
.get_preceding_character()
|
||||||
@ -60,6 +55,7 @@ pub(crate) fn target<'b, 'g, 'r, 's>(
|
|||||||
remaining,
|
remaining,
|
||||||
Target {
|
Target {
|
||||||
source: source.into(),
|
source: source.into(),
|
||||||
|
value: body.into(),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,7 @@ pub struct LineBreak<'s> {
|
|||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct Target<'s> {
|
pub struct Target<'s> {
|
||||||
pub source: &'s str,
|
pub source: &'s str,
|
||||||
|
pub value: &'s str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
Loading…
Reference in New Issue
Block a user