@@ -491,17 +491,16 @@ function handle_y_vars(y, dict, mod, varclass, kwargs)
491
491
conditional_y_expr, conditional_dict
492
492
end
493
493
494
- function handle_if_x_equations! (ifexpr, condition , x)
494
+ function handle_if_x_equations! (condition, dict, ifexpr , x)
495
495
push! (ifexpr. args, condition, :(push! (equations, $ (x. args... ))))
496
496
# push!(dict[:equations], [:if, readable_code(condition), readable_code.(x.args)])
497
497
readable_code .(x. args)
498
498
end
499
-
500
499
function handle_if_y_equations! (ifexpr, y, dict)
501
500
if y. head == :elseif
502
501
elseifexpr = Expr (:elseif )
503
502
eq_entry = [:elseif , readable_code .(y. args[1 ]. args)... ]
504
- push! (eq_entry, handle_if_x_equations! (elseifexpr, y. args[1 ], y. args[2 ]))
503
+ push! (eq_entry, handle_if_x_equations! (y. args[1 ], dict, elseifexpr , y. args[2 ]))
505
504
get (y. args, 3 , nothing ) != = nothing &&
506
505
push! (eq_entry, handle_if_y_equations! (elseifexpr, y. args[3 ], dict))
507
506
push! (ifexpr. args, elseifexpr)
@@ -511,30 +510,30 @@ function handle_if_y_equations!(ifexpr, y, dict)
511
510
readable_code .(y. args)
512
511
end
513
512
end
514
-
515
513
function parse_equations! (exprs, eqs, dict, body)
516
514
dict[:equations ] = []
517
515
Base. remove_linenums! (body)
518
516
for arg in body. args
519
517
MLStyle. @match arg begin
520
518
Expr (:if , condition, x) => begin
521
519
ifexpr = Expr (:if )
522
- eq_entry = handle_if_x_equations! (ifexpr, condition , x)
520
+ eq_entry = handle_if_x_equations! (condition, dict, ifexpr , x)
523
521
push! (exprs, ifexpr)
524
- push! (dict[:equations ], [ :if , condition, eq_entry] )
522
+ push! (dict[:equations ], ( :if , condition, eq_entry) )
525
523
end
526
524
Expr (:if , condition, x, y) => begin
527
525
ifexpr = Expr (:if )
528
- xeq_entry = handle_if_x_equations! (ifexpr, condition , x)
526
+ xeq_entry = handle_if_x_equations! (condition, dict, ifexpr , x)
529
527
yeq_entry = handle_if_y_equations! (ifexpr, y, dict)
530
528
push! (exprs, ifexpr)
531
- push! (dict[:equations ], [:if , condition, xeq_entry, yeq_entry])
529
+ push! (dict[:equations ], (:if , condition, xeq_entry, yeq_entry))
530
+ end
531
+ _ => begin
532
+ push! (eqs, arg)
533
+ push! (dict[:equations ], readable_code .(eqs)... )
532
534
end
533
- _ => push! (eqs, arg)
534
535
end
535
536
end
536
- # TODO : does this work with TOML?
537
- push! (dict[:equations ], readable_code .(eqs)... )
538
537
end
539
538
540
539
function parse_icon! (icon, dict, body:: String )
0 commit comments