From a96fbc95925399dabd66a936bff75b2b327a8ad8 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 12 Jun 2018 20:58:03 -0700 Subject: [PATCH] Fix match expression parsing --- schala-lang/src/parsing.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index 6957249..b9b73fe 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -627,11 +627,13 @@ impl Parser { parse_method!(match_expr(&mut self) -> ParseResult { expect!(self, Keyword(Kw::Match)); - let expr = self.expression()?; - //TODO abstract these errors into the delimited macro - //expect!(self, LCurlyBrace, "Expected '{'"); + let expr = { + self.restrictions.no_struct_literal = true; + let x = self.expression(); + self.restrictions.no_struct_literal = false; + x? + }; let body = self.match_body()?; - //expect!(self, RCurlyBrace, "Expected '}'"); Ok(Expression(ExpressionType::MatchExpression(bx!(expr), body), None)) });