Format the code.
This commit is contained in:
parent
3a174dd41b
commit
c75f4ebcff
@ -1,8 +1,8 @@
|
|||||||
#![feature(round_char_boundary)]
|
#![feature(round_char_boundary)]
|
||||||
#![feature(exit_status_error)]
|
#![feature(exit_status_error)]
|
||||||
mod parser;
|
|
||||||
mod compare;
|
mod compare;
|
||||||
pub use parser::*;
|
mod parser;
|
||||||
|
pub use compare::compare_document;
|
||||||
pub use compare::emacs_parse_org_document;
|
pub use compare::emacs_parse_org_document;
|
||||||
pub use compare::sexp;
|
pub use compare::sexp;
|
||||||
pub use compare::compare_document;
|
pub use parser::*;
|
||||||
|
@ -49,8 +49,11 @@ pub fn comment<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
|
|||||||
fn comment_line<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
fn comment_line<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||||
start_of_line(context, input)?;
|
start_of_line(context, input)?;
|
||||||
let (remaining, _indent) = space0(input)?;
|
let (remaining, _indent) = space0(input)?;
|
||||||
let (remaining, (_hash, _leading_whitespace_and_content, _line_ending)) =
|
let (remaining, (_hash, _leading_whitespace_and_content, _line_ending)) = tuple((
|
||||||
tuple((tag("#"), opt(tuple((space1, is_not("\r\n")))), alt((line_ending, eof))))(remaining)?;
|
tag("#"),
|
||||||
|
opt(tuple((space1, is_not("\r\n")))),
|
||||||
|
alt((line_ending, eof)),
|
||||||
|
))(remaining)?;
|
||||||
let source = get_consumed(input, remaining);
|
let source = get_consumed(input, remaining);
|
||||||
Ok((remaining, source))
|
Ok((remaining, source))
|
||||||
}
|
}
|
||||||
@ -71,12 +74,13 @@ mod tests {
|
|||||||
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
let initial_context: ContextTree<'_, '_> = ContextTree::new();
|
||||||
let document_context =
|
let document_context =
|
||||||
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
|
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
|
||||||
let comment_matcher =
|
let comment_matcher = parser_with_context!(comment)(&document_context);
|
||||||
parser_with_context!(comment)(&document_context);
|
let (remaining, first_comment) = comment_matcher(input).expect("Parse first comment");
|
||||||
let (remaining, first_comment) =
|
assert_eq!(
|
||||||
comment_matcher(input).expect("Parse first comment");
|
remaining,
|
||||||
assert_eq!(remaining, r#"#not a comment
|
r#"#not a comment
|
||||||
# Comment again"#);
|
# Comment again"#
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
first_comment.source,
|
first_comment.source,
|
||||||
"# Comment line
|
"# Comment line
|
||||||
|
@ -89,7 +89,6 @@ impl<'r, 's> ContextTree<'r, 's> {
|
|||||||
return local_result;
|
return local_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
@ -120,7 +120,6 @@ pub fn org_mode_table_cell<'r, 's>(
|
|||||||
|(children, exit_contents)| !children.is_empty() || *exit_contents == "|",
|
|(children, exit_contents)| !children.is_empty() || *exit_contents == "|",
|
||||||
)(input)?;
|
)(input)?;
|
||||||
|
|
||||||
|
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user