Skip to content

Commit

Permalink
Allow multi-character parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddiM8 committed Mar 23, 2024
1 parent 90b6bed commit 416b2c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions kalk/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion tests/functions.kalker
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 416b2c5

Please sign in to comment.