Skip to content

Commit

Permalink
fix unknown type bug due to serializer tag
Browse files Browse the repository at this point in the history
  • Loading branch information
m-wells committed Feb 14, 2020
1 parent d8b7ba1 commit 6bd42dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AlignedBinaryFormat"
uuid = "94fc9360-1a5e-4d84-93be-ddbadb32b3a7"
authors = ["m-wells <[email protected]>"]
version = "0.5.1"
version = "0.5.2"

[deps]
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
Expand Down
1 change: 0 additions & 1 deletion src/abfkey.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ struct AbfDeserializer
str::String
end


struct AbfKey
pos::Int64
T::Union{DataType, AbfDeserializer}
Expand Down
7 changes: 4 additions & 3 deletions src/read_write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ end
write_type(io::IOStream, data::T) where T<:Union{BitArray,Array} = write_str(io, string(T))
write_type(io::IOStream, x::AbstractString) = write_str(io, string(String))
write_type(io::IOStream, x::DataType) = write_str(io, string(DataType))
write_type(io::IOStream, x::T) where T<:AbfSerializer = write_str(io, string(T))
function write_type(io::IOStream, x::AbfSerializer{T}) where T
write_str(io, "AbfSerializer{"*string(T)*'}')
end

#read_type(io::IOStream, ::Type{BitArray}) = BitArray{read(io, Int64)}
#read_type(io::IOStream, ::Type{Array}) = Array{TYPELOOKUP[read_str(io)], read(io,Int64)}
Expand Down Expand Up @@ -70,8 +72,7 @@ function read_type(io::IOStream)
occursin(r"^BitArray", x) && return parse_type_bitarray(x)
x == "String" && return String
x == "DataType" && return DataType
@show string(AbfSerializer)
startswith(x, string(AbfSerializer)) && return parse_type_serialized(x)
occursin(r"^AbfSerializer", x) && return parse_type_serialized(x)
error("the following type is not recognized: ", x)
end

Expand Down

0 comments on commit 6bd42dd

Please sign in to comment.