1
0
Fork 0
mirror of https://github.com/MillironX/XAM.jl.git synced 2024-12-23 13:28:16 +00:00

Merge branch 'master' into develop

This commit is contained in:
Ciarán O’Mara 2021-04-01 12:37:54 +11:00
commit 5bd793bc5f
4 changed files with 21 additions and 20 deletions

View file

@ -1,7 +1,7 @@
name = "XAM"
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>"]
version = "0.2.6"
version = "0.2.7"
[deps]
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"

View file

@ -94,17 +94,21 @@ end
Read a `Record` into `rec`; overwriting or adding to existing field values.
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.linenum = ln
rdr.state.filled = f
rdr.state.filled = found
if !f
cs == 0 && throw(EOFError())
throw(ArgumentError("malformed SAM file"))
if found
return record
end
return rec
if cs == 0 || eof(rdr.state.stream)
throw(EOFError())
end
throw(ArgumentError("malformed SAM file"))
end

View file

@ -134,11 +134,10 @@ const sam_machine_metainfo, sam_machine_record, sam_machine_header, sam_machine_
cat(re"\r?", lf)
end
header = rep(cat(metainfo, newline))
header.actions[:exit] = [:header]
header = cat(header, opt(any() \ cat('@'))) # look ahead
header = rep(cat(metainfo, newline))
header.actions[:exit] = [:header]
body = rep(cat(record, newline))
body = record * rep(newline * record) * opt(newline)
body.actions[:exit] = [:body]
sam = cat(header, body)
@ -200,10 +199,6 @@ const sam_actions_header = merge(
finish_header = true
if !eof(stream)
p -= 1 # cancel look-ahead
end
@escape
end
)
@ -308,10 +303,6 @@ Automa.Stream.generate_reader(
const sam_loopcode_header = quote
if cs < 0
throw(ArgumentError("malformed metainfo at line $(linenum)"))
end
if finish_header
@goto __return__
end

View file

@ -194,5 +194,11 @@
close(reader)
# Test blank file.
file_sam = joinpath(samdir, "xx#blank.sam")
records = open(collect, SAM.Reader, file_sam)
@test records == []
end
end