Skip to content

Commit bedc463

Browse files
committed
make @reaction_network go through @network_component
1 parent 45ad1d8 commit bedc463

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/reaction_network.jl

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -148,35 +148,10 @@ emptyrn = @reaction_network
148148
149149
ReactionSystems generated through `@reaction_network` are compelte.
150150
"""
151-
macro reaction_network(name::Symbol, ex::Expr)
152-
:(complete($(make_reaction_system(MacroTools.striplines(ex); name = :($(QuoteNode(name)))))))
151+
macro reaction_network(args...)
152+
return :(complete(@network_component $(args... )))
153153
end
154154

155-
# allows @reaction_network $name begin ... to interpolate variables storing a name
156-
macro reaction_network(name::Expr, ex::Expr)
157-
:(complete($(make_reaction_system(MacroTools.striplines(ex); name = :($(esc(name.args[1])))))))
158-
end
159-
160-
macro reaction_network(ex::Expr)
161-
ex = MacroTools.striplines(ex)
162-
163-
# no name but equations: @reaction_network begin ... end ...
164-
if ex.head == :block
165-
:(complete($(make_reaction_system(ex))))
166-
else # empty but has interpolated name: @reaction_network $name
167-
networkname = :($(esc(ex.args[1])))
168-
return Expr(:block, :(@parameters t),
169-
:(complete(ReactionSystem(Reaction[], t, [], []; name = $networkname))))
170-
end
171-
end
172-
173-
#Returns a empty network (with, or without, a declared name)
174-
macro reaction_network(name::Symbol = gensym(:ReactionSystem))
175-
return Expr(:block, :(@parameters t),
176-
:(complete(ReactionSystem(Reaction[], t, [], []; name = $(QuoteNode(name))))))
177-
end
178-
179-
180155
"""
181156
@network_component
182157

0 commit comments

Comments
 (0)