Skip to content

Commit 53a6254

Browse files
committed
up
1 parent 9a928fe commit 53a6254

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/dsl.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ end
5353
Macro for generating chemical reaction network models (Catalyst `ReactionSystem`s). See the
5454
following two section ([DSL introduction](https://docs.sciml.ai/Catalyst/stable/model_creation/dsl_basics/)
5555
and [advantage usage](https://docs.sciml.ai/Catalyst/stable/model_creation/dsl_advanced/)) of
56-
the Catalyst documentation for more details on the domain specific language (DSL) that the
57-
macro implements. The macros output (a `ReactionSystem` structure) are central to Catalyst
58-
and its functionality. How to e.g. simulate them is described in the [Catalyst documentation](https://docs.sciml.ai/Catalyst/stable/).
56+
the Catalyst documentation for more details on the domain-specific language (DSL) that the
57+
macro implements. The macro's output (a `ReactionSystem` structure) is central to Catalyst
58+
and its functionality. How to e.g. simulate these is described in the [Catalyst documentation](https://docs.sciml.ai/Catalyst/stable/).
5959
6060
Returns:
6161
- A Catalyst `ReactionSystem`, i.e. a symbolic model for the reaction network. The returned
6262
system is marked `complete`. To obtain a `ReactionSystem` that is not marked complete, for
63-
example to then use in compositional modeling, see the otherwise equivalent `@network_component`
63+
example to then use in compositional modelling, see the otherwise equivalent `@network_component`
6464
macro.
6565
6666
Examples:
@@ -253,7 +253,7 @@ function extract_metadata(metadata_line::Expr)
253253
return metadata
254254
end
255255

256-
### Specialised Error for @require_declaration Option ###
256+
### Specialised @require_declaration Option Error ###
257257
struct UndeclaredSymbolicError <: Exception
258258
msg::String
259259
end
@@ -282,13 +282,13 @@ function make_reaction_system(ex::Expr, name)
282282
any(!in(option_keys), keys(options)) &&
283283
error("The following unsupported options were used: $(filter(opt_in->!in(opt_in,option_keys), keys(options)))")
284284

285-
# Read options that explicitly declares some symbol. Compiles a list of all declared symbols
286-
# and checks that there has been no double-declarations.
287-
cmpexpr_init, cmps_declared = read_compound_options(options)
285+
# Read options that explicitly declares some symbol (e.g. `@species`). Compiles a list of
286+
# all declared symbols and checks that there has been no double-declarations.
288287
sps_declared = extract_syms(options, :species)
289288
ps_declared = extract_syms(options, :parameters)
290289
vs_declared = extract_syms(options, :variables)
291290
tiv, sivs, ivs, ivsexpr = read_ivs_option(options)
291+
cmpexpr_init, cmps_declared = read_compound_options(options)
292292
diffsexpr, diffs_declared = read_differentials_option(options)
293293
syms_declared = collect(Iterators.flatten((cmps_declared, sps_declared, ps_declared,
294294
vs_declared, ivs, diffs_declared)))
@@ -340,15 +340,15 @@ function make_reaction_system(ex::Expr, name)
340340
name = $name
341341
spatial_ivs = $sivs
342342
rx_eq_vec = $rxsexprs
343-
vars = setdiff(union($spsvar, $vsvar, $cmpsvar), $obs_syms)
343+
us = setdiff(union($spsvar, $vsvar, $cmpsvar), $obs_syms)
344344
observed = $obs_eqs
345345
continuous_events = $continuous_events_expr
346346
discrete_events = $discrete_events_expr
347347
combinatoric_ratelaws = $combinatoric_ratelaws
348348
default_reaction_metadata = $default_reaction_metadata
349349

350350
remake_ReactionSystem_internal(
351-
make_ReactionSystem_internal(rx_eq_vec, $tiv, vars, $psvar; name, spatial_ivs,
351+
make_ReactionSystem_internal(rx_eq_vec, $tiv, us, $psvar; name, spatial_ivs,
352352
observed, continuous_events, discrete_events, combinatoric_ratelaws);
353353
default_reaction_metadata)
354354
end))
@@ -581,7 +581,7 @@ function get_rxexpr(rx::DSLReaction)
581581
subs_stoich_init = deepcopy(subs_init)
582582
prod_init = isempty(rx.products) ? nothing : :([])
583583
prod_stoich_init = deepcopy(prod_init)
584-
rx_constructor = :(Reaction($rate, $subs_init, $subs_stoich_init, $prod_init,
584+
rx_constructor = :(Reaction($rate, $subs_init, $prod_init, $subs_stoich_init,
585585
$prod_stoich_init; metadata = $(rx.metadata)))
586586

587587
# Loops through all products and substrates, and adds them (and their stoichiometries)
@@ -876,22 +876,22 @@ macro (but permitting only a single reaction). A more detailed introduction to t
876876
be found in the description of `@reaction_network`.
877877
878878
The `@reaction` macro is followed by a single line consisting of three parts:
879-
- A rate (at which the reaction occur).
879+
- A rate (at which the reaction occurs).
880880
- Any number of substrates (which are consumed by the reaction).
881881
- Any number of products (which are produced by the reaction).
882882
883883
The output is a reaction (just like created using the `Reaction` constructor).
884884
885885
Examples:
886-
Here we create a simple binding reaction and stores it in the variable rx:
886+
Here we create a simple binding reaction and store it in the variable rx:
887887
```julia
888888
rx = @reaction k, X + Y --> XY
889889
```
890890
The macro will automatically deduce `X`, `Y`, and `XY` to be species (as these occur as reactants)
891-
and `k` as a parameters (as it does not occur as a reactant).
891+
and `k` as a parameter (as it does not occur as a reactant).
892892
893893
The `@reaction` macro provides a more concise notation to the `Reaction` constructor. I.e. here
894-
we create the same reaction using both approaches, and also confirms that they are identical.
894+
we create the same reaction using both approaches, and also confirm that they are identical.
895895
```julia
896896
# Creates a reaction using the `@reaction` macro.
897897
rx = @reaction k*v, A + B --> C + D
@@ -917,7 +917,7 @@ rx = @reaction b*\$ex*\$A, \$A --> C
917917
Notes:
918918
- `@reaction` does not support bi-directional type reactions (using `<-->`) or reaction bundling
919919
(e.g. `d, (X,Y) --> 0`).
920-
- Interpolation of Julia variables into the macro works similar to the `@reaction_network`
920+
- Interpolation of Julia variables into the macro works similarly to the `@reaction_network`
921921
macro. See [The Reaction DSL](@ref dsl_description) tutorial for more details.
922922
"""
923923
macro reaction(ex)

src/expression_utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ end
2525
### Parameters/Species/Variables Symbols Correctness Checking ###
2626

2727
# Throws an error when a forbidden symbol is used.
28-
function forbidden_symbol_check(sym)
29-
used_forbidden_syms =
28+
function forbidden_symbol_check(syms)
29+
used_forbidden_syms = intersect(forbidden_symbols_error, syms)
3030
isempty(used_forbidden_syms) ||
3131
error("The following symbol(s) are used as species or parameters: $used_forbidden_syms, this is not permitted.")
3232
end

0 commit comments

Comments
 (0)