diff --git a/axc/src/parser.rs b/axc/src/parser.rs index c32ad86..be6891a 100644 --- a/axc/src/parser.rs +++ b/axc/src/parser.rs @@ -331,7 +331,7 @@ fn parse_expression<'a>( let tuple = parse_tuple_expr(m, full_expr.clone()); let base = choice((parse_literal(m), parse_var_ref_expr(m))); - let subscript = parse_subscript_expr(m, base); + let subscript = parse_subscript_expr(m, base, full_expr.clone()); let term = choice((lambda, let_, match_, record, subscript, tuple)); let application = term.repeated().at_least(1).map(|exprs| { @@ -518,6 +518,7 @@ fn parse_lambda_expr( fn parse_subscript_expr( _m: &ParserMeta, base: impl Parser> + Clone, + rec: impl Parser> + Clone, ) -> impl Parser> + Clone { enum SubscriptKind { Dot, @@ -530,7 +531,7 @@ fn parse_subscript_expr( pad(just('.')) .ignore_then(base.clone()) .map(|e| (SubscriptKind::Dot, e)), - base.clone() + rec.clone() .delimited_by(pad(just('[')), pad(just(']'))) .map(|e| (SubscriptKind::Bracket, e)), ))