Compare commits
No commits in common. "ae66d1bd89cf687d71c7f418204d0935b84f3134" and "590e7fba0eff207dbc2f5f89c1c1bc1b47cedd89" have entirely different histories.
ae66d1bd89
...
590e7fba0e
@ -1122,33 +1122,9 @@ fn compare_dynamic_block<'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 :block-name :arguments
|
||||||
// Compare block-name
|
|
||||||
let block_name = get_property_quoted_string(emacs, ":block-name")?
|
|
||||||
.ok_or("Dynamic blocks should have a name.")?;
|
|
||||||
if block_name != rust.name {
|
|
||||||
this_status = DiffStatus::Bad;
|
|
||||||
message = Some(format!(
|
|
||||||
"Name mismatch (emacs != rust) {:?} != {:?}",
|
|
||||||
block_name, rust.name
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compare arguments
|
|
||||||
let parameters = get_property_quoted_string(emacs, ":arguments")?;
|
|
||||||
match (parameters.as_ref(), rust.parameters) {
|
|
||||||
(None, None) => {}
|
|
||||||
(Some(emacs_parameters), Some(rust_parameters)) if emacs_parameters == rust_parameters => {}
|
|
||||||
_ => {
|
|
||||||
this_status = DiffStatus::Bad;
|
|
||||||
message = Some(format!(
|
|
||||||
"Parameters mismatch (emacs != rust) {:?} != {:?}",
|
|
||||||
parameters, rust.parameters
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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())?);
|
||||||
|
@ -2,7 +2,6 @@ use nom::branch::alt;
|
|||||||
use nom::bytes::complete::is_not;
|
use nom::bytes::complete::is_not;
|
||||||
use nom::bytes::complete::tag;
|
use nom::bytes::complete::tag;
|
||||||
use nom::bytes::complete::tag_no_case;
|
use nom::bytes::complete::tag_no_case;
|
||||||
use nom::character::complete::anychar;
|
|
||||||
use nom::character::complete::line_ending;
|
use nom::character::complete::line_ending;
|
||||||
use nom::character::complete::space0;
|
use nom::character::complete::space0;
|
||||||
use nom::character::complete::space1;
|
use nom::character::complete::space1;
|
||||||
@ -10,7 +9,6 @@ use nom::combinator::consumed;
|
|||||||
use nom::combinator::eof;
|
use nom::combinator::eof;
|
||||||
use nom::combinator::not;
|
use nom::combinator::not;
|
||||||
use nom::combinator::opt;
|
use nom::combinator::opt;
|
||||||
use nom::combinator::peek;
|
|
||||||
use nom::combinator::recognize;
|
use nom::combinator::recognize;
|
||||||
use nom::multi::many0;
|
use nom::multi::many0;
|
||||||
use nom::multi::many_till;
|
use nom::multi::many_till;
|
||||||
@ -49,11 +47,10 @@ pub(crate) fn dynamic_block<'b, 'g, 'r, 's>(
|
|||||||
}
|
}
|
||||||
start_of_line(input)?;
|
start_of_line(input)?;
|
||||||
let (remaining, _leading_whitespace) = space0(input)?;
|
let (remaining, _leading_whitespace) = space0(input)?;
|
||||||
let (remaining, (_, name, parameters, _, _)) = tuple((
|
let (remaining, (_begin, name, parameters, _ws)) = tuple((
|
||||||
recognize(tuple((tag_no_case("#+begin:"), space1))),
|
recognize(tuple((tag_no_case("#+begin:"), space1))),
|
||||||
name,
|
name,
|
||||||
opt(tuple((space1, parameters))),
|
opt(tuple((space1, parameters))),
|
||||||
space0,
|
|
||||||
line_ending,
|
line_ending,
|
||||||
))(remaining)?;
|
))(remaining)?;
|
||||||
let contexts = [
|
let contexts = [
|
||||||
@ -111,7 +108,7 @@ fn name<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
|||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn parameters<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
fn parameters<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||||
recognize(many_till(anychar, peek(tuple((space0, line_ending)))))(input)
|
is_not("\r\n")(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
|
@ -93,6 +93,7 @@ fn quote_block<'b, 'g, 'r, 's>(
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn special_block<'s>(
|
fn special_block<'s>(
|
||||||
name: &'s str,
|
name: &'s str,
|
||||||
) -> impl for<'b, 'g, 'r> Fn(
|
) -> impl for<'b, 'g, 'r> Fn(
|
||||||
|
@ -63,7 +63,6 @@ pub(crate) fn planning<'b, 'g, 'r, 's>(
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
enum PlanningTimestampType {
|
enum PlanningTimestampType {
|
||||||
Scheduled,
|
Scheduled,
|
||||||
Deadline,
|
Deadline,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user