Format the code.

This commit is contained in:
Tom Alexander 2023-04-21 14:35:34 -04:00
parent 3a174dd41b
commit c75f4ebcff
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 15 additions and 13 deletions

View File

@ -1,8 +1,8 @@
#![feature(round_char_boundary)]
#![feature(exit_status_error)]
mod parser;
mod compare;
pub use parser::*;
mod parser;
pub use compare::compare_document;
pub use compare::emacs_parse_org_document;
pub use compare::sexp;
pub use compare::compare_document;
pub use parser::*;

View File

@ -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> {
start_of_line(context, input)?;
let (remaining, _indent) = space0(input)?;
let (remaining, (_hash, _leading_whitespace_and_content, _line_ending)) =
tuple((tag("#"), opt(tuple((space1, is_not("\r\n")))), alt((line_ending, eof))))(remaining)?;
let (remaining, (_hash, _leading_whitespace_and_content, _line_ending)) = tuple((
tag("#"),
opt(tuple((space1, is_not("\r\n")))),
alt((line_ending, eof)),
))(remaining)?;
let source = get_consumed(input, remaining);
Ok((remaining, source))
}
@ -71,12 +74,13 @@ mod tests {
let initial_context: ContextTree<'_, '_> = ContextTree::new();
let document_context =
initial_context.with_additional_node(ContextElement::DocumentRoot(input));
let comment_matcher =
parser_with_context!(comment)(&document_context);
let (remaining, first_comment) =
comment_matcher(input).expect("Parse first comment");
assert_eq!(remaining, r#"#not a comment
# Comment again"#);
let comment_matcher = parser_with_context!(comment)(&document_context);
let (remaining, first_comment) = comment_matcher(input).expect("Parse first comment");
assert_eq!(
remaining,
r#"#not a comment
# Comment again"#
);
assert_eq!(
first_comment.source,
"# Comment line

View File

@ -89,7 +89,6 @@ impl<'r, 's> ContextTree<'r, 's> {
return local_result;
}
}
}
_ => {}
};

View File

@ -120,7 +120,6 @@ pub fn org_mode_table_cell<'r, 's>(
|(children, exit_contents)| !children.is_empty() || *exit_contents == "|",
)(input)?;
todo!()
}