mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-11-23 10:19:56 +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
|
return dst
|
||||||
end
|
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(
|
const sam_actions_metainfo = Dict(
|
||||||
:mark => :(@mark),
|
:mark => :(@mark),
|
||||||
:pos1 => :(pos1 = @relpos(p)),
|
:pos1 => :(pos1 = @relpos(p)),
|
||||||
|
@ -173,22 +186,18 @@ const sam_actions_metainfo = Dict(
|
||||||
:metainfo_val => :(metainfo.val = pos1:@relpos(p-1)),
|
:metainfo_val => :(metainfo.val = pos1:@relpos(p-1)),
|
||||||
:metainfo_dict_key => :(push!(metainfo.dictkey, pos2:@relpos(p-1))),
|
:metainfo_dict_key => :(push!(metainfo.dictkey, pos2:@relpos(p-1))),
|
||||||
:metainfo_dict_val => :(push!(metainfo.dictval, pos2:@relpos(p-1))),
|
:metainfo_dict_val => :(push!(metainfo.dictval, pos2:@relpos(p-1))),
|
||||||
:metainfo => quote
|
:metainfo => action_metainfo
|
||||||
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_header = merge(
|
const sam_actions_header = merge(
|
||||||
sam_actions_metainfo,
|
sam_actions_metainfo,
|
||||||
Dict(
|
Dict(
|
||||||
:countline => :(linenum += 1),
|
:countline => :(linenum += 1),
|
||||||
|
:metainfo => quote
|
||||||
|
$(action_metainfo)
|
||||||
|
push!(header, metainfo)
|
||||||
|
metainfo = MetaInfo()
|
||||||
|
end,
|
||||||
:header => quote
|
:header => quote
|
||||||
|
|
||||||
finish_header = true
|
finish_header = true
|
||||||
|
@ -309,13 +318,6 @@ const sam_loopcode_header = quote
|
||||||
throw(ArgumentError("malformed metainfo at line $(linenum)"))
|
throw(ArgumentError("malformed metainfo at line $(linenum)"))
|
||||||
end
|
end
|
||||||
|
|
||||||
if found_metainfo
|
|
||||||
push!(header, metainfo)
|
|
||||||
found_metainfo = false
|
|
||||||
end
|
|
||||||
|
|
||||||
metainfo = MetaInfo()
|
|
||||||
|
|
||||||
if finish_header
|
if finish_header
|
||||||
@goto __return__
|
@goto __return__
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue