From 7cd5a62253e0f37a95b5470def56ec5bd88f80c1 Mon Sep 17 00:00:00 2001 From: bakk Date: Thu, 27 May 2021 23:31:17 +0200 Subject: [PATCH] =?UTF-8?q?Only=20parse=20one=20factor=20after=20'?= =?UTF-8?q?=E2=88=9A'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kalk/src/parser.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kalk/src/parser.rs b/kalk/src/parser.rs index ed1df5d..c86c3f5 100644 --- a/kalk/src/parser.rs +++ b/kalk/src/parser.rs @@ -504,7 +504,11 @@ fn parse_identifier(context: &mut Context) -> Result { { // If there is a function with this name, parse it as a function, with the next token as the argument. if context.symbol_table.contains_fn(&identifier.pure_name) { - let parameter = parse_factor(context)?; + let parameter = if identifier.full_name == "√" { + parse_exponent(context)? + } else { + parse_factor(context)? + }; return Ok(Expr::FnCall(identifier, vec![parameter])); } }