From 94722ed27e5591f2a515cdb8b58af14590492b33 Mon Sep 17 00:00:00 2001 From: PaddiM8 Date: Thu, 28 May 2020 23:56:09 +0200 Subject: [PATCH] Fixed function declarations not parsing properly. --- src/parser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index d9d14f5..dbf9a92 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -68,7 +68,7 @@ impl Parser { if self.match_token(TokenKind::Identifier) { return match self.peek_next().kind { TokenKind::Equals => self.parse_var_decl_stmt(), - TokenKind::Identifier => self.parse_identifier_stmt(), + TokenKind::OpenParenthesis => self.parse_identifier_stmt(), _ => Stmt::Expr(Box::new(self.parse_expr())), }; } @@ -81,7 +81,7 @@ impl Parser { let primary = self.parse_primary(); // Since function declarations and function calls look the same at first, simply parse a "function call", and re-use the data. // If `primary` is followed by an equal sign, it is a function declaration. - if self.peek().kind.compare(&TokenKind::Equals) { + if let TokenKind::Equals = self.peek().kind { self.advance(); let expr = self.parse_expr();