From e02a95f0658423cde6ac20a09eecad6e1089afd8 Mon Sep 17 00:00:00 2001 From: Araozu Date: Sat, 4 Nov 2023 05:41:16 -0500 Subject: [PATCH] fix tests --- src/syntax/binding.rs | 13 ++++++++++--- src/syntax/functions/function_call.rs | 3 +-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/syntax/binding.rs b/src/syntax/binding.rs index 81562a2..760d7a0 100644 --- a/src/syntax/binding.rs +++ b/src/syntax/binding.rs @@ -1,5 +1,5 @@ use super::ast::var_binding::{Binding, ValBinding, VarBinding}; -use super::utils::{try_operator, try_token_type, parse_token_type}; +use super::utils::{try_operator, parse_token_type}; use super::{expression, ParseResult}; use crate::error_handling::SyntaxError; use crate::lexic::token::{Token, TokenType}; @@ -32,8 +32,15 @@ pub fn try_parse<'a>(tokens: &'a Vec, pos: usize) -> ParseResult (t, n), - ParseResult::Err(error) => { + ParseResult::Mismatch(token) => { // The parser found a token, but it's not an identifier + return ParseResult::Err(SyntaxError { + error_start: token.position, + error_end: token.get_end_position(), + reason: "??".into(), + }) + } + ParseResult::Err(error) => { return ParseResult::Err(error); } _ => { @@ -103,7 +110,7 @@ pub fn try_parse<'a>(tokens: &'a Vec, pos: usize) -> ParseResult(tokens: &'a Vec, pos: usize) -> ParseResult (args, next), ParseResult::Err(err) => return ParseResult::Err(err), ParseResult::Mismatch(_) => {