diff --git a/src/parser.rs b/src/parser.rs index a7ecaf9..9f45cfb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -114,7 +114,7 @@ impl Parser { /// ``` fn parse_statement(&mut self) -> ParserResult { if self.expect(&[TokenType::Var]).is_some() { - self.parse_declaration() + self.parse_var_declaration() } else if self.expect(&[TokenType::LeftBrace]).is_some() { self.parse_block() } else if self.expect(&[TokenType::Address]).is_some() { @@ -151,7 +151,7 @@ impl Parser { /// declaration := "var" IDENTIFIER ";" /// declaration := "var" IDENTIFIER "=" expression ";" /// ``` - fn parse_declaration(&mut self) -> ParserResult { + fn parse_var_declaration(&mut self) -> ParserResult { let name = match self.peek().token_type { TokenType::Identifier(_) => self.advance().clone(), _ => return Err(ParserError::new(self.peek(), "expected variable name")), @@ -270,7 +270,7 @@ impl Parser { let initializer = if self.expect(&[TokenType::Semicolon]).is_some() { None } else if self.expect(&[TokenType::Var]).is_some() { - Some(self.parse_declaration()?) + Some(self.parse_var_declaration()?) } else { Some(self.parse_expression_stmt()?) };