Skip to content

Commit

Permalink
new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS committed Dec 7, 2023
1 parent 3e7e801 commit 8a49b6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rivetc/src/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 8a49b6f

Please sign in to comment.