From ac13b57f1c17db42cdc456837f405a219ef78f7e Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Wed, 4 Dec 2024 21:13:32 +0100 Subject: [PATCH] Allow additional function names in ljl_propfunc --- src/ljl_expressions.jl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ljl_expressions.jl b/src/ljl_expressions.jl index 25b80e3e..50afc37c 100644 --- a/src/ljl_expressions.jl +++ b/src/ljl_expressions.jl @@ -30,30 +30,33 @@ end export parse_ljlexpr -const ljl_expr_allowed_heads = [:., :ref, :call, :macrocall, :||, :&&, :comparison, :if] +const ljl_expr_allowed_heads = Symbol[:., :ref, :call, :macrocall, :||, :&&, :comparison, :if] -const ljl_expr_allowed_funcs = Set([ +const ljl_expr_allowed_funcs = Set{Symbol}([ :!, :(==), :<, :>, :>=, :<=, :!=, - :isapprox, :≈, :≈, + :isapprox, :≈, :in, :∈, :.., - :+, :-, :*, :/, + :+, :-, :*, :/, :div, :rem, :mod, + :|, :&, :xor, :^, :sqrt, :one, :zero, :identity, :abs, :abs2, :normalize, :norm, :exp, :exp2, :exp10, :log, :log2, :log10, :sin, :cos, :tan, :asin, :acos, :atan, + :min, :max, :isnan, :isinf, :isfinite, :all, :any, :broadcast, - :get, :getproperty, - :value, :uncertainty, :stdscore, :weightedmean, - :±, + :sum, :prod, :minimum, :maximum, :mean, + :get, :getproperty, :getindex, first, last, + :haskey, :isempty, :length, :size, :(:), :Symbol, :String, :Int, :Float64, :Bool, :string, :parse, + :value, :uncertainty, :stdscore, :weightedmean, :±, :DetectorId, :ChannelId ]) -const _ljlexpr_units = IdDict([ +const _ljlexpr_units = IdDict{Symbol,Expr}([ :s => :(u"s"), :ms => :(u"ms"), :μs => :(u"μs"),