From 760c3c5ac4b12d277607868bcdbb0542d950c9dd Mon Sep 17 00:00:00 2001 From: Christopher Chang <51393127+chriscerie@users.noreply.github.com> Date: Sun, 7 Apr 2024 12:20:45 -0700 Subject: [PATCH] Fix fail case --- full-moon/src/ast/parsers.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/full-moon/src/ast/parsers.rs b/full-moon/src/ast/parsers.rs index caca4330..e5c2278c 100644 --- a/full-moon/src/ast/parsers.rs +++ b/full-moon/src/ast/parsers.rs @@ -1817,7 +1817,16 @@ fn parse_unary_expression( let primary_expression = match parse_primary_expression(state) { ParserResult::Value(expression) => expression, - ParserResult::NotFound => return ParserResult::NotFound, + ParserResult::NotFound => { + state.token_error( + unary_operator.token().clone(), + format!( + "expected an expression after {}", + unary_operator.token().token() + ), + ); + return ParserResult::NotFound; + } ParserResult::LexerMoved => return ParserResult::LexerMoved, };