Skip to content

Commit 1b2db7a

Browse files
committed
save progress
1 parent bc1833d commit 1b2db7a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/reactionsystem_serialisation/serialisation_support.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ end
2323

2424
# Gets the character at a specific index.
2525
get_char(str, idx) = collect(str)[idx]
26-
get_char_end(str, offset) = collect(str)[end - offset]
26+
get_char_end(str, offset) = collect(str)[end+offset]
2727
# Gets a substring (which is robust to unicode characters like η).
28-
get_substring(str, idx1, idx2) = String(collect(str)[idx1, idx2])
29-
get_substring_end(str, idx1, offset) = String(collect(str)[idx1, end - offset])
28+
get_substring(str, idx1, idx2) = String(collect(str)[idx1:idx2])
29+
get_substring_end(str, idx1, offset) = String(collect(str)[idx1:end+offset])
3030

3131

3232
### Field Serialisation Support Functions ###
@@ -79,7 +79,7 @@ end
7979
# any calls (e.g. X(t) becomes X). E.g. a species vector [X, Y, Z] is converted to "[X, Y, Z]".
8080
function syms_2_strings(syms)
8181
strip_called_syms = [strip_call(Symbolics.unwrap(sym)) for sym in syms]
82-
return get_substring("$(convert(Vector{Any}, strip_called_syms))", 4)
82+
return get_substring_end("$(convert(Vector{Any}, strip_called_syms))", 4, 0)
8383
end
8484

8585
# Converts a vector of symbolics (e.g. the species or parameter vectors) to a string corresponding to
@@ -127,7 +127,7 @@ function sym_2_declaration_string(sym; multiline_format = false)
127127
for metadata in metadata_to_declare
128128
@string_append! metadata_string metadata_2_string(sym, metadata) ", "
129129
end
130-
@string_append! dec_string $(get_substring_end(metadata_string, 1, -2)) "]"
130+
@string_append! dec_string get_substring_end(metadata_string, 1, -2) "]"
131131
end
132132

133133
# Returns the declaration entry for the symbol.

test/miscellaneous_tests/reactionsystem_serialisation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### Prepare Tests ###
22

33
# Fetch packages.
4-
using Catalyst
4+
using Catalyst, Test
55
using Catalyst: get_rxs
66
using ModelingToolkit: getdefault, getdescription, get_metadata
77

0 commit comments

Comments
 (0)