Fixup negative allowance in calls

This commit is contained in:
Joshua Warner 2024-12-02 20:01:19 -08:00
parent 1be2075e7f
commit 78cda703d9
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
5 changed files with 12 additions and 8 deletions

View file

@ -414,7 +414,7 @@ fn parse_expr_operator_chain<'a>(
.parse(arena, state, min_indent)?;
let mut initial_state = state.clone();
let end = state.pos();
let mut end = state.pos();
let (spaces_before_op, state) =
match space0_e(EExpr::IndentEnd).parse(arena, state.clone(), min_indent) {
@ -422,8 +422,6 @@ fn parse_expr_operator_chain<'a>(
Ok((_, spaces_before_op, state)) => (spaces_before_op, state),
};
let allow_negate = state.pos() > end;
let mut expr_state = ExprState {
operators: Vec::new_in(arena),
arguments: Vec::new_in(arena),
@ -437,11 +435,13 @@ fn parse_expr_operator_chain<'a>(
let call_min_indent = line_indent + 1;
loop {
let allow_negate = state.pos() > end;
let parser = skip_first(
crate::blankspace::check_indent(EExpr::IndentEnd),
loc_possibly_negative_or_negated_term(options, allow_negate, false),
)
.trace("term_or_underscore");
end = state.pos();
match parser.parse(arena, state.clone(), call_min_indent) {
Err((MadeProgress, f)) => return Err((MadeProgress, f)),
Err((NoProgress, _)) => {
@ -612,7 +612,7 @@ fn parse_stmt_operator_chain<'a>(
.parse(arena, state, min_indent)?;
let mut initial_state = state.clone();
let end = state.pos();
let mut end = state.pos();
let (spaces_before_op, state) =
match space0_e(EExpr::IndentEnd).parse(arena, state.clone(), min_indent) {
@ -620,8 +620,6 @@ fn parse_stmt_operator_chain<'a>(
Ok((_, spaces_before_op, state)) => (spaces_before_op, state),
};
let allow_negate = state.pos() > end;
let mut expr_state = ExprState {
operators: Vec::new_in(arena),
arguments: Vec::new_in(arena),
@ -635,11 +633,13 @@ fn parse_stmt_operator_chain<'a>(
let call_min_indent = line_indent + 1;
loop {
let allow_negate = state.pos() > end;
let parser = skip_first(
crate::blankspace::check_indent(EExpr::IndentEnd),
loc_possibly_negative_or_negated_term(options, allow_negate, false),
);
match parser.parse(arena, state.clone(), call_min_indent) {
end = state.pos();
match dbg!(parser.parse(arena, state.clone(), call_min_indent)) {
Err((MadeProgress, f)) => return Err((MadeProgress, f)),
Ok((
_,
@ -653,7 +653,7 @@ fn parse_stmt_operator_chain<'a>(
..
},
state,
)) if matches!(expr_state.expr.value, Expr::Tag(..)) => {
)) if matches!(dbg!(expr_state.expr.value), Expr::Tag(..)) => {
return parse_ability_def(expr_state, state, arena, implements, call_min_indent)
.map(|(td, s)| (MadeProgress, Stmt::TypeDef(td), s));
}