From c02e1c1f8e69099af01b6b4312579dd3a3fd4f2c Mon Sep 17 00:00:00 2001 From: Araozu Date: Sat, 4 Nov 2023 06:52:46 -0500 Subject: [PATCH] [Syntax] Parse function call inside a binding --- src/syntax/binding.rs | 7 +++++-- src/syntax/expression.rs | 14 ++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/syntax/binding.rs b/src/syntax/binding.rs index a7dc6f3..11a2d29 100644 --- a/src/syntax/binding.rs +++ b/src/syntax/binding.rs @@ -7,6 +7,7 @@ use crate::utils::Result3; pub fn try_parse<'a>(tokens: &'a Vec, pos: usize) -> ParseResult { let mut current_pos = pos; + /* * val/var keyword */ @@ -80,8 +81,9 @@ pub fn try_parse<'a>(tokens: &'a Vec, pos: usize) -> ParseResult (exp, next), _ => { return ParseResult::Err(SyntaxError { @@ -91,6 +93,7 @@ pub fn try_parse<'a>(tokens: &'a Vec, pos: usize) -> ParseResult(tokens: &'a Vec, pos: usize) -> ParseResult, pos: usize) -> ParseResult { - /* match function_call::try_parse(tokens, pos) { - super::ParseResult::Ok(_, _) => todo!(), - super::ParseResult::Err(_) => todo!(), - super::ParseResult::Mismatch(_) => todo!(), - super::ParseResult::Unmatched => todo!(), - } - */ + super::ParseResult::Ok(function_call, next_pos) => { + return ParseResult::Ok::<_, ()>(Expression::FunctionCall(function_call), next_pos) + } + _ => {} + }; match tokens.get(pos) { Some(token) => match token.token_type {