From d50122540b60189236922cd03c2facc8f2992176 Mon Sep 17 00:00:00 2001 From: Alex Bethel Date: Tue, 9 Aug 2022 14:51:40 -0500 Subject: [PATCH] Fix bracket subscript parsing --- axc/src/parser.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)), ))