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,15 +165,8 @@ function appendfrom!(dst, dpos, src, spos, n)
|
|||
return dst
|
||||
end
|
||||
|
||||
const sam_actions_metainfo = Dict(
|
||||
:mark => :(@mark),
|
||||
:pos1 => :(pos1 = @relpos(p)),
|
||||
:pos2 => :(pos2 = @relpos(p)),
|
||||
:metainfo_tag => :(metainfo.tag = pos1:@relpos(p-1)),
|
||||
: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
|
||||
const action_metainfo = quote
|
||||
|
||||
let markpos = @markpos()
|
||||
|
||||
appendfrom!(metainfo.data, 1, data, markpos, length(markpos:p-1))
|
||||
|
@ -182,13 +175,29 @@ const sam_actions_metainfo = Dict(
|
|||
|
||||
found_metainfo = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
const sam_actions_metainfo = Dict(
|
||||
:mark => :(@mark),
|
||||
:pos1 => :(pos1 = @relpos(p)),
|
||||
:pos2 => :(pos2 = @relpos(p)),
|
||||
:metainfo_tag => :(metainfo.tag = pos1:@relpos(p-1)),
|
||||
: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 => 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