@@ -93,31 +93,6 @@ function find_varinfo_in_declaration(expr::ExprValues)
9393 return (;ivs, idxs, default, metadata)
9494end
9595
96- # Sometimes (when declared on a single line, e.g. `@variables X [misc = 4] Y [misc = 5]`)
97- # the symbolic variable are metadata never form a single expression, but are simply separate
98- # (but adjacent) expressions in a longer expression array. This dispatch extracts the same
99- # information, but from this case. The input is the vector of all expressions, and the index
100- # of the symbolic variable which information we wish to extract.
101- function find_varinfo_in_declaration (exprs:: Vector , idx:: Integer )
102- if (idx != length (exprs)) && Meta. isexpr (exprs[idx + 1 ], :vect )
103- expr, (ivs, idxs, default, metadata) = find_varinfo_in_declaration (exprs[idx])
104- return expr => (ivs, idxs, default, exprs[idx + 1 ])
105- end
106- return find_varinfo_in_declaration (exprs[idx])
107- end
108-
109- # Checks an expression that declares several symbolic variables (either using `@variables ...`
110- # or using `@variables begin ... end`). Returns a dictionary with each information, using the
111- # form used in find_varinfo_in_declaration.
112- function find_all_varinfo_in_declaration (exprs)
113- # (1)) Removes the macro call (2) Handles the `@variables begin .. end` case
114- # (3) Find all indexes with variables (4) Extract their information.
115- exprs = exprs. args[3 : end ]
116- _head_equisexpral (exprs[1 ], :block ) && (exprs = exprs[1 ]. args)
117- var_idxs = findall (! Meta. isexpr (expr, :vect ) for expr in exprs)
118- return Dict ([find_varinfo_in_declaration (exprs, var_idx) for var_idx in var_idxs])
119- end
120-
12196# Converts an expression of the forms:
12297# X
12398# X = 1.0
0 commit comments