From 7d68b2a05a19121b84ac66043d7fdf5cc0a75ec5 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 13 Jul 2018 22:13:52 -0700 Subject: [PATCH] Get rid of code related to old match stuff --- schala-lang/src/parsing.rs | 42 +------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index 60cc53a..7160555 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -71,7 +71,7 @@ prefix_op := '+' | '-' | '!' | '~' call_expr := index_expr ( '(' expr_list ')' )* expr_list := expression (',' expression)* | ε index_expr := primary ( '[' (expression (',' (expression)* | ε) ']' )* -primary := literal | paren_expr | if_expr | match_expr | for_expr | while_expr | identifier_expr | curly_brace_expr | list_expr +primary := literal | paren_expr | if_expr | for_expr | while_expr | identifier_expr | curly_brace_expr | list_expr /* Primary Expressions */ @@ -96,19 +96,6 @@ int_literal = ('0x' | '0b') digits float_literal := digits ('.' digits) digits := (DIGIT_GROUP underscore)+ -/* OLD OBSOLETE */ - -/* Expression - If */ -if_expr := 'if' expression block else_clause -else_clause := ε | 'else' block - -/* Expression - Match */ -match_expr := 'match' expression match_body -match_body := '{' (match_arm)* '}' -match_arm := pattern '=>' expression - -/* NEW GOOD */ - /* Pattern syntax */ pattern := '(' (pattern, ',')* ')' | simple_pattern simple_pattern := pattern_literal | record_pattern | tuple_struct_pattern @@ -580,7 +567,6 @@ impl Parser { LParen => self.paren_expr(), LSquareBracket => self.list_expr(), Keyword(Kw::If) => self.if_expr(), - //Keyword(Kw::Match) => self.match_expr(), Keyword(Kw::For) => self.for_expr(), Keyword(Kw::While) => self.while_expr(), Identifier(_) => self.identifier_expr(), @@ -781,32 +767,6 @@ impl Parser { Ok(delimited!(self, LCurlyBrace, statement, Newline | Semicolon, RCurlyBrace, nonstrict)) }); - /* - parse_method!(match_expr(&mut self) -> ParseResult { - expect!(self, Keyword(Kw::Match)); - let expr = { - self.restrictions.no_struct_literal = true; - let x = self.expression(); - self.restrictions.no_struct_literal = false; - x? - }; - let body = self.match_body()?; - Ok(Expression(ExpressionType::MatchExpression(bx!(expr), body), None)) - }); - - parse_method!(match_body(&mut self) -> ParseResult> { - Ok(delimited!(self, LCurlyBrace, match_arm, Comma, RCurlyBrace)) - }); - - parse_method!(match_arm(&mut self) -> ParseResult { - let pat = self.pattern()?; - expect!(self, Operator(ref c) if **c == "=>"); - let expr = self.expression()?; - Ok(MatchArm { pat, expr }) - }); - - */ - parse_method!(while_expr(&mut self) -> ParseResult { use self::ExpressionType::*; expect!(self, Keyword(Kw::While));