This commit is contained in:
Folkert 2021-03-12 03:43:39 +01:00
parent cba55734cb
commit f5f98b2400
2 changed files with 8 additions and 10 deletions

View file

@ -201,8 +201,6 @@ pub fn spaces_till_end_of_line<'a, E: 'a>(
state.bytes = &bytes[width..];
}
dbg!(comment, &state);
return Ok((MadeProgress, Some(comment), state));
}
Err(_) => unreachable!("we check the first character is a #"),
@ -227,7 +225,7 @@ pub fn spaces_till_end_of_line<'a, E: 'a>(
}
}
fn chomp_line_comment<'a>(buffer: &'a [u8]) -> Result<&'a str, Progress> {
fn chomp_line_comment(buffer: &[u8]) -> Result<&str, Progress> {
if let Some(b'#') = buffer.get(0) {
if (&buffer[1..]).starts_with(b"# ") {
// this is a doc comment, not a line comment
@ -257,11 +255,11 @@ fn chomp_line_comment<'a>(buffer: &'a [u8]) -> Result<&'a str, Progress> {
/// Advance the parser while also indenting as appropriate.
/// This assumes we are only advancing with spaces, since they can indent.
fn advance_spaces_e<'a, TE, E>(
state: State<'a>,
fn advance_spaces_e<TE, E>(
state: State,
spaces: usize,
to_error: TE,
) -> Result<State<'a>, (Progress, E, State<'a>)>
) -> Result<State, (Progress, E, State)>
where
TE: Fn(Row, Col) -> E,
{
@ -424,7 +422,7 @@ fn eat_spaces<'a>(
}
}
return Good {
Good {
row,
col,
bytes,
@ -498,7 +496,7 @@ fn eat_line_comment<'a>(
}
}
return Good {
Good {
row,
col,
bytes,

View file

@ -1057,7 +1057,7 @@ where
move |arena: &'a Bump, state: State<'a>| {
// We have to clone this because if the optional parser fails,
// we need to revert back to the original state.
let original_state = state.clone();
let original_state = state;
match parser.parse(arena, state) {
Ok((progress, out1, state)) => Ok((progress, Some(out1), state)),
@ -1686,7 +1686,7 @@ where
Error: 'a,
{
move |arena: &'a Bump, state: State<'a>| {
let old_state = state.clone();
let old_state = state;
match parser.parse(arena, state) {
Ok((_, a, s1)) => Ok((NoProgress, a, s1)),