Allow multi-character parameters

This commit is contained in:
PaddiM8 2024-03-23 01:57:45 +01:00
parent 90b6bed227
commit 416b2c571f
2 changed files with 8 additions and 1 deletions

View File

@ -484,6 +484,13 @@ fn analyse_var(
with_adjacent(Expr::Var(identifier), adjacent_factor, adjacent_exponent)
} else if context.symbol_table.contains_var(&identifier.pure_name)
|| (identifier.pure_name.len() == 1 && !context.in_equation)
|| context.current_function_parameters.is_some()
&& context
.current_function_parameters
.as_ref()
.unwrap()
.iter()
.any(|param| param[2..] == identifier.pure_name)
{
with_adjacent(
build_var(context, &identifier.full_name),

View File

@ -1,5 +1,5 @@
x = 3
f(x) = 2*x
g(x, y) = 2*x*y
g(x, long_name) = 2*x*long_name
f(x) = 6 and fx = 6 and x = 3 and g(x, x + 1) = 24 and sqrt4 = 2