basic structure

This commit is contained in:
Folkert 2021-03-12 22:21:27 +01:00
parent 28cc3348a6
commit 703a8de72f
5 changed files with 362 additions and 18 deletions

View file

@ -117,6 +117,22 @@ where
)
}
pub fn check_indent<'a, E>(
min_indent: u16,
indent_problem: fn(Row, Col) -> E,
) -> impl Parser<'a, (), E>
where
E: 'a,
{
move |_, state: State<'a>| {
if state.column > state.indent_col {
Ok((NoProgress, (), state))
} else {
Err((NoProgress, indent_problem(state.line, state.column), state))
}
}
}
pub fn space0_e<'a, E>(
min_indent: u16,
space_problem: fn(BadInputError, Row, Col) -> E,