From c75f4ebcffe43d6402054dc32cbf1342c8d2c1b1 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 21 Apr 2023 14:35:34 -0400 Subject: [PATCH] Format the code. --- src/lib.rs | 6 +++--- src/parser/comment.rs | 20 ++++++++++++-------- src/parser/parser_context.rs | 1 - src/parser/table.rs | 1 - 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fbcf791..bea65b3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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::*; diff --git a/src/parser/comment.rs b/src/parser/comment.rs index 92f79f6..558af0b 100644 --- a/src/parser/comment.rs +++ b/src/parser/comment.rs @@ -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 diff --git a/src/parser/parser_context.rs b/src/parser/parser_context.rs index e113d21..c97f666 100644 --- a/src/parser/parser_context.rs +++ b/src/parser/parser_context.rs @@ -89,7 +89,6 @@ impl<'r, 's> ContextTree<'r, 's> { return local_result; } } - } _ => {} }; diff --git a/src/parser/table.rs b/src/parser/table.rs index d475398..0b1f4a0 100644 --- a/src/parser/table.rs +++ b/src/parser/table.rs @@ -120,7 +120,6 @@ pub fn org_mode_table_cell<'r, 's>( |(children, exit_contents)| !children.is_empty() || *exit_contents == "|", )(input)?; - todo!() }