mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-12-23 21:28:18 +00:00
Merge branch 'hotfix/issue-34'
This commit is contained in:
commit
22667dc7af
4 changed files with 21 additions and 20 deletions
|
@ -1,7 +1,7 @@
|
||||||
name = "XAM"
|
name = "XAM"
|
||||||
uuid = "d759349c-bcba-11e9-07c2-5b90f8f05f7c"
|
uuid = "d759349c-bcba-11e9-07c2-5b90f8f05f7c"
|
||||||
authors = ["Kenta Sato <bicycle1885@gmail.com>", "Ben J. Ward <ward9250@gmail.com>", "Ciarán O'Mara <Ciaran.OMara@utas.edu.au>"]
|
authors = ["Kenta Sato <bicycle1885@gmail.com>", "Ben J. Ward <ward9250@gmail.com>", "Ciarán O'Mara <Ciaran.OMara@utas.edu.au>"]
|
||||||
version = "0.2.6"
|
version = "0.2.7"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
|
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
|
||||||
|
|
|
@ -94,17 +94,21 @@ end
|
||||||
Read a `Record` into `rec`; overwriting or adding to existing field values.
|
Read a `Record` into `rec`; overwriting or adding to existing field values.
|
||||||
It is assumed that `rec` is already initialized or empty.
|
It is assumed that `rec` is already initialized or empty.
|
||||||
"""
|
"""
|
||||||
function Base.read!(rdr::Reader, rec::Record)
|
function Base.read!(rdr::Reader, record::Record)
|
||||||
|
|
||||||
cs, ln, f = readrecord!(rdr.state.stream, rec, (rdr.state.state, rdr.state.linenum))
|
cs, ln, found = readrecord!(rdr.state.stream, record, (rdr.state.state, rdr.state.linenum))
|
||||||
|
|
||||||
rdr.state.state = cs
|
rdr.state.state = cs
|
||||||
rdr.state.linenum = ln
|
rdr.state.linenum = ln
|
||||||
rdr.state.filled = f
|
rdr.state.filled = found
|
||||||
|
|
||||||
if !f
|
if found
|
||||||
cs == 0 && throw(EOFError())
|
return record
|
||||||
throw(ArgumentError("malformed SAM file"))
|
|
||||||
end
|
end
|
||||||
return rec
|
|
||||||
|
if cs == 0 || eof(rdr.state.stream)
|
||||||
|
throw(EOFError())
|
||||||
|
end
|
||||||
|
|
||||||
|
throw(ArgumentError("malformed SAM file"))
|
||||||
end
|
end
|
||||||
|
|
|
@ -134,11 +134,10 @@ const sam_machine_metainfo, sam_machine_record, sam_machine_header, sam_machine_
|
||||||
cat(re"\r?", lf)
|
cat(re"\r?", lf)
|
||||||
end
|
end
|
||||||
|
|
||||||
header′ = rep(cat(metainfo, newline))
|
header = rep(cat(metainfo, newline))
|
||||||
header′.actions[:exit] = [:header]
|
header.actions[:exit] = [:header]
|
||||||
header = cat(header′, opt(any() \ cat('@'))) # look ahead
|
|
||||||
|
|
||||||
body = rep(cat(record, newline))
|
body = record * rep(newline * record) * opt(newline)
|
||||||
body.actions[:exit] = [:body]
|
body.actions[:exit] = [:body]
|
||||||
|
|
||||||
sam = cat(header, body)
|
sam = cat(header, body)
|
||||||
|
@ -200,10 +199,6 @@ const sam_actions_header = merge(
|
||||||
|
|
||||||
finish_header = true
|
finish_header = true
|
||||||
|
|
||||||
if !eof(stream)
|
|
||||||
p -= 1 # cancel look-ahead
|
|
||||||
end
|
|
||||||
|
|
||||||
@escape
|
@escape
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
@ -308,10 +303,6 @@ Automa.Stream.generate_reader(
|
||||||
|
|
||||||
const sam_loopcode_header = quote
|
const sam_loopcode_header = quote
|
||||||
|
|
||||||
if cs < 0
|
|
||||||
throw(ArgumentError("malformed metainfo at line $(linenum)"))
|
|
||||||
end
|
|
||||||
|
|
||||||
if finish_header
|
if finish_header
|
||||||
@goto __return__
|
@goto __return__
|
||||||
end
|
end
|
||||||
|
|
|
@ -194,5 +194,11 @@
|
||||||
|
|
||||||
close(reader)
|
close(reader)
|
||||||
|
|
||||||
|
# Test blank file.
|
||||||
|
file_sam = joinpath(samdir, "xx#blank.sam")
|
||||||
|
|
||||||
|
records = open(collect, SAM.Reader, file_sam)
|
||||||
|
@test records == []
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue