Only parse one factor after '√'

This commit is contained in:
bakk 2021-05-27 23:31:17 +02:00
parent 83898e3946
commit 7cd5a62253

View File

@ -504,7 +504,11 @@ fn parse_identifier(context: &mut Context) -> Result<Expr, CalcError> {
{ {
// If there is a function with this name, parse it as a function, with the next token as the argument. // 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) { 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])); return Ok(Expr::FnCall(identifier, vec![parameter]));
} }
} }