diff --git a/src/Symbolics.jl b/src/Symbolics.jl index 9481525ab..7198859ab 100644 --- a/src/Symbolics.jl +++ b/src/Symbolics.jl @@ -146,6 +146,7 @@ export parse_expr_to_symbolic include("error_hints.jl") include("struct.jl") +include("operators.jl") # Hacks to make wrappers "nicer" const NumberTypes = Union{AbstractFloat,Integer,Complex{<:AbstractFloat},Complex{<:Integer}} diff --git a/src/operators.jl b/src/operators.jl new file mode 100644 index 000000000..a986ee50a --- /dev/null +++ b/src/operators.jl @@ -0,0 +1,25 @@ +function activeState end +function entry end +function ticksInState end +function timeInState end + +for (s, T) in [(:timeInState, :Real), + (:ticksInState, :Integer), + (:entry, :Bool), + (:activeState, :Bool)] + seed = hash(s) + @eval begin + $s(x) = wrap(term($s, x)) + SymbolicUtils.promote_symtype(::typeof($s), _...) = $T + function SymbolicUtils.show_call(io, ::typeof($s), args) + if isempty(args) + print(io, $s, "()") + else + print(io, $s, "(", nameof(only(args)), ")") + end + end + end + if s != :activeState + @eval $s() = wrap(term($s)) + end +end