From f5bfd78020d0fa51339040261c83c7f7655a3592 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:57:56 -0500 Subject: [PATCH] refactor: Change Edit parsing to return *Edit types --- src/Edit.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Edit.jl b/src/Edit.jl index 62040a6..1e6e6b6 100644 --- a/src/Edit.jl +++ b/src/Edit.jl @@ -94,15 +94,15 @@ function Base.parse(::Type{<:Edit{Se,Sy}}, s::Union{String,SubString{String}}) w pos = parse(UInt, m[1]) stop = parse(UInt, m[2]) stop ≥ pos || throw(ArgumentError("Non-positive deletion length: \"" * s * "\"")) - Edit{Se,Sy}(Deletion(stop - pos + 1), pos) + return DeletionEdit{Se,Sy}(pos, stop - pos + 1) elseif (m = match(r"^(\d+)([A-Za-z]+)$", s); m) !== nothing pos = parse(UInt, m[1]) seq = Se(m[2]) - Edit{Se,Sy}(Insertion(seq), pos) + return InsertionEdit{Se,Sy}(pos, seq) elseif (m = match(r"^[A-Za-z](\d+)([A-Za-z])$", s); m) !== nothing pos = parse(UInt, m[1]) sym = Sy(first(m[2])) - Edit{Se,Sy}(Substitution(sym), pos) + return SubstitutionEdit{Se,Sy}(pos, sym) else throw(ArgumentError("Failed to parse edit \"" * s * '"')) end