mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
other parsing adjustment!
This commit is contained in:
parent
bf68477c8a
commit
66392eeeaf
4 changed files with 152 additions and 9 deletions
|
@ -341,6 +341,22 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn and_then_with_indent_level<'a, P1, P2, F, Before, After>(
|
||||
parser: P1,
|
||||
transform: F,
|
||||
) -> impl Parser<'a, After>
|
||||
where
|
||||
P1: Parser<'a, Before>,
|
||||
P2: Parser<'a, After>,
|
||||
F: Fn(Before, u16) -> P2,
|
||||
{
|
||||
move |arena, state| {
|
||||
parser.parse(arena, state).and_then(|(output, next_state)| {
|
||||
transform(output, next_state.indent_col).parse(arena, next_state)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn then<'a, P1, F, Before, After>(parser: P1, transform: F) -> impl Parser<'a, After>
|
||||
where
|
||||
P1: Parser<'a, Before>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue