mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
Don't allow closures to gobble unindented expr lines following them
This commit is contained in:
parent
ab4e03b05d
commit
4d4c0d9483
13 changed files with 267 additions and 87 deletions
|
@ -1452,6 +1452,31 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_word1<'a, ToError, E>(
|
||||
state: State<'a>,
|
||||
min_indent: u32,
|
||||
word: u8,
|
||||
to_error: ToError,
|
||||
) -> ParseResult<'a, (), E>
|
||||
where
|
||||
ToError: Fn(Position) -> E,
|
||||
E: 'a,
|
||||
{
|
||||
debug_assert_ne!(word, b'\n');
|
||||
|
||||
if min_indent > state.column() {
|
||||
return Err((NoProgress, to_error(state.pos()), state));
|
||||
}
|
||||
|
||||
match state.bytes().first() {
|
||||
Some(x) if *x == word => {
|
||||
let state = state.advance(1);
|
||||
Ok((MadeProgress, (), state))
|
||||
}
|
||||
_ => Err((NoProgress, to_error(state.pos()), state)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn word2<'a, ToError, E>(word_1: u8, word_2: u8, to_error: ToError) -> impl Parser<'a, (), E>
|
||||
where
|
||||
ToError: Fn(Position) -> E,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue