Skip to content

Commit

Permalink
All tests seem to be ok now
Browse files Browse the repository at this point in the history
  • Loading branch information
licioromao committed Mar 29, 2024
1 parent 5f119dd commit 21b1c3b
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,18 @@ function parse(s::String, values::Vector{Vector{String}}; default=0.0)
index=Vector{NTuple{N,Int}}()
vv=Vector{T}()

# println(collection_regex)
# println(num_colons)
for (m, col) in zip(eachmatch(regex, s), num_colons)
tmp_str = "$(name_of_transition)" * m.match * "\n$(name_of_transition):"
# fields = match.captures
# filter!(x -> !isnothing(x) && !isempty(x), fields)
fields = match(collection_regex[dic_colons[col]], tmp_str).captures # choosing the right regex. dic_colons[col] contains the index of the correct regex

# param = strip(fields[end], ['\n', '\r', ' '])
# println("T"*match.match*"\nT:")
# println(typeof(collection_regex))
fields = match(collection_regex[dic_colons[col]], tmp_str).captures
filter!(x -> !isnothing(x) && !isempty(x), fields)
# println(fields)

param = strip(fields[end], ['\n', '\r', ' '])
if col == N
# tmp_str = "$(name_of_transition)" * match.match * "\n$(name_of_transition):"
# fields = match(collection_regex[col]

# println(fields)
push!(index, Tuple(dd[kk] for (dd,kk) in zip(dictionaries, fields[1:end-1])))
push!(vv, Base.parse(T, param))

elseif col == N-1
param = string.(split(param))
# println(param)
tmp_fields = [dd[kk] for (dd,kk) in zip(dictionaries, fields[1:end-1])]

if isequal(param, ["uniform"])
Expand Down Expand Up @@ -76,7 +63,6 @@ function parse(s::String, values::Vector{Vector{String}}; default=0.0)
end
end
else
# println(fields)
error("Unable to parse this string")
end
end
Expand Down

0 comments on commit 21b1c3b

Please sign in to comment.