Implement a basic paragraph parser.

This commit is contained in:
Tom Alexander
2023-03-25 11:22:59 -04:00
parent b88365e7eb
commit d582c8603a
3 changed files with 51 additions and 3 deletions

View File

@@ -155,7 +155,7 @@ fn headline<'r, 's>(
}
fn headline_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
line_ending(input)
alt((line_ending, eof))(input)
}
/// Check that we are at the start of a line
@@ -199,7 +199,7 @@ fn is_slice_of(parent: &str, child: &str) -> bool {
}
/// Get a slice of the string that was consumed in a parser using the original input to the parser and the remaining input after the parser.
fn get_consumed<'s>(input: &'s str, remaining: &'s str) -> &'s str {
pub fn get_consumed<'s>(input: &'s str, remaining: &'s str) -> &'s str {
assert!(is_slice_of(input, remaining));
let source = {
let offset = remaining.as_ptr() as usize - input.as_ptr() as usize;