mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-12-23 13:28:16 +00:00
Correct header parsing
This commit is contained in:
parent
e69c6de586
commit
d0e2560ec4
1 changed files with 19 additions and 17 deletions
|
@ -165,6 +165,19 @@ function appendfrom!(dst, dpos, src, spos, n)
|
|||
return dst
|
||||
end
|
||||
|
||||
const action_metainfo = quote
|
||||
|
||||
let markpos = @markpos()
|
||||
|
||||
appendfrom!(metainfo.data, 1, data, markpos, length(markpos:p-1))
|
||||
|
||||
metainfo.filled = @relpos(markpos):@relpos(p-1)
|
||||
|
||||
found_metainfo = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
const sam_actions_metainfo = Dict(
|
||||
:mark => :(@mark),
|
||||
:pos1 => :(pos1 = @relpos(p)),
|
||||
|
@ -173,22 +186,18 @@ const sam_actions_metainfo = Dict(
|
|||
:metainfo_val => :(metainfo.val = pos1:@relpos(p-1)),
|
||||
:metainfo_dict_key => :(push!(metainfo.dictkey, pos2:@relpos(p-1))),
|
||||
:metainfo_dict_val => :(push!(metainfo.dictval, pos2:@relpos(p-1))),
|
||||
:metainfo => quote
|
||||
let markpos = @markpos()
|
||||
|
||||
appendfrom!(metainfo.data, 1, data, markpos, length(markpos:p-1))
|
||||
|
||||
metainfo.filled = @relpos(markpos):@relpos(p-1)
|
||||
|
||||
found_metainfo = true
|
||||
end
|
||||
end
|
||||
:metainfo => action_metainfo
|
||||
)
|
||||
|
||||
const sam_actions_header = merge(
|
||||
sam_actions_metainfo,
|
||||
Dict(
|
||||
:countline => :(linenum += 1),
|
||||
:metainfo => quote
|
||||
$(action_metainfo)
|
||||
push!(header, metainfo)
|
||||
metainfo = MetaInfo()
|
||||
end,
|
||||
:header => quote
|
||||
|
||||
finish_header = true
|
||||
|
@ -309,13 +318,6 @@ const sam_loopcode_header = quote
|
|||
throw(ArgumentError("malformed metainfo at line $(linenum)"))
|
||||
end
|
||||
|
||||
if found_metainfo
|
||||
push!(header, metainfo)
|
||||
found_metainfo = false
|
||||
end
|
||||
|
||||
metainfo = MetaInfo()
|
||||
|
||||
if finish_header
|
||||
@goto __return__
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue