mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Fix keyword parsing bug
This commit is contained in:
parent
98fa4a752d
commit
e2804398b4
1 changed files with 7 additions and 3 deletions
|
@ -917,9 +917,13 @@ fn parse_def_signature<'a>(
|
||||||
|
|
||||||
fn loc_function_arg<'a>(min_indent: u16) -> impl Parser<'a, Located<Expr<'a>>> {
|
fn loc_function_arg<'a>(min_indent: u16) -> impl Parser<'a, Located<Expr<'a>>> {
|
||||||
skip_first!(
|
skip_first!(
|
||||||
// If this is a reserved keyword ("if", "then", "case, "when"), then
|
// If this is a reserved keyword ("if", "then", "case, "when"),
|
||||||
// it is not a function argument!
|
// followed by a blank space, then it is not a function argument!
|
||||||
not(reserved_keyword()),
|
//
|
||||||
|
// (The space is necessary because otherwise we'll get a false
|
||||||
|
// positive on function arguments beginning with keywords,
|
||||||
|
// e.g. `ifBlah` or `isSomething` will register as `if`/`is` keywords)
|
||||||
|
not(and!(reserved_keyword(), space1(min_indent))),
|
||||||
// Don't parse operators, because they have a higher precedence than function application.
|
// Don't parse operators, because they have a higher precedence than function application.
|
||||||
// If we encounter one, we're done parsing function args!
|
// If we encounter one, we're done parsing function args!
|
||||||
move |arena, state| loc_parse_function_arg(min_indent, arena, state)
|
move |arena, state| loc_parse_function_arg(min_indent, arena, state)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue