From 8a49b6f80395ee08d1f75ba7a3c25fe0e03479ac Mon Sep 17 00:00:00 2001 From: Jose Mendoza <56417208+StunxFS@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:50:04 +0000 Subject: [PATCH] new syntax --- rivetc/src/parser.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rivetc/src/parser.py b/rivetc/src/parser.py index 448aa1559..b099f9730 100644 --- a/rivetc/src/parser.py +++ b/rivetc/src/parser.py @@ -719,6 +719,9 @@ def parse_relational_expr(self): right = ast.TypeNode(self.parse_type(), pos) if self.accept(Kind.KwAs): var = self.parse_var_decl(support_ref = False) + elif self.accept(Kind.Lparen): + var = self.parse_var_decl(support_ref = False) + self.expect(Kind.Rparen) else: var = None left = ast.BinaryExpr( @@ -1136,10 +1139,17 @@ def parse_match_expr(self): if not self.accept(Kind.Comma): break if self.accept(Kind.KwAs): + #report.warn("deprecated", self.tok.pos) + has_var = True + var_is_mut = self.accept(Kind.KwMut) + var_pos = self.tok.pos + var_name = self.parse_name() + elif self.accept(Kind.Lparen): has_var = True var_is_mut = self.accept(Kind.KwMut) var_pos = self.tok.pos var_name = self.parse_name() + self.expect(Kind.Rparen) if self.accept(Kind.KwIf): has_cond = True cond = self.parse_expr()