allow for different ordering of items in ybegin/part lines.
TODO generalise, this is ugly
This commit is contained in:
parent
0cc83ff0cc
commit
35aa9e9e86
1 changed files with 26 additions and 21 deletions
|
|
@ -97,12 +97,14 @@ def _ydecode_file(file, outfile)
|
||||||
if line.match(/^\=ybegin\s+(.*line\=.*)/)
|
if line.match(/^\=ybegin\s+(.*line\=.*)/)
|
||||||
m = $1
|
m = $1
|
||||||
puts " #{Thread.current.inspect} ybegin match; rest: #{m}" if Debuglevel > 0
|
puts " #{Thread.current.inspect} ybegin match; rest: #{m}" if Debuglevel > 0
|
||||||
if m.match(/^\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(.*?\S))\s*$/)
|
print "full line: #{line}" if Debuglevel > 0
|
||||||
part = $2.to_i
|
if matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(line\=(?<linesize>\d+))(\s*size\=(?<totalsize>\d+))(\s*name=(?<filename>.*?\S))\s*$/) or
|
||||||
total = $4.to_i
|
matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(size\=(?<totalsize>\d+))(\s*line\=(?<linesize>\d+))(\s*name=(?<filename>.*?\S))\s*$/)
|
||||||
linesize = $6.to_i
|
part = matchdata[:part].to_i
|
||||||
totalsize = $8.to_i
|
total = matchdata[:total].to_i
|
||||||
filename = $10
|
linesize = matchdata[:linesize].to_i
|
||||||
|
totalsize = matchdata[:totalsize].to_i
|
||||||
|
filename = matchdata[:filename]
|
||||||
if Debuglevel > 0
|
if Debuglevel > 0
|
||||||
print "found beginning"
|
print "found beginning"
|
||||||
if part != nil
|
if part != nil
|
||||||
|
|
@ -161,12 +163,13 @@ def _ydecode_file(file, outfile)
|
||||||
closure = false
|
closure = false
|
||||||
m = $1
|
m = $1
|
||||||
search_begin = false
|
search_begin = false
|
||||||
if m.match(/^\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(.*?\S))\s*$/)
|
if matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(line\=(?<linesize>\d+))(\s*size\=(?<totalsize>\d+))(\s*name=(?<filename>.*?\S))\s*$/) or
|
||||||
part = $2.to_i
|
matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(size\=(?<totalsize>\d+))(\s*line\=(?<linesize>\d+))(\s*name=(?<filename>.*?\S))\s*$/)
|
||||||
total = $4.to_i
|
part = matchdata[:part].to_i
|
||||||
linesize = $6.to_i
|
total = matchdata[:total].to_i
|
||||||
totalsize = $8.to_i
|
linesize = matchdata[:linesize].to_i
|
||||||
filename = $10
|
totalsize = matchdata[:totalsize].to_i
|
||||||
|
filename = matchdata[:filename]
|
||||||
puts "found beginning of part #{part}, linesize = #{linesize}, size = #{totalsize}, filename = #{filename}" if Debuglevel > 0
|
puts "found beginning of part #{part}, linesize = #{linesize}, size = #{totalsize}, filename = #{filename}" if Debuglevel > 0
|
||||||
end
|
end
|
||||||
next
|
next
|
||||||
|
|
@ -230,13 +233,14 @@ def _ydecode_array(data)
|
||||||
if data[i].match(/^\=ybegin\s+(.*line\=.*)/)
|
if data[i].match(/^\=ybegin\s+(.*line\=.*)/)
|
||||||
m = $1
|
m = $1
|
||||||
puts " #{Thread.current.inspect} ybegin match; rest: #{m}" if Debuglevel > 0
|
puts " #{Thread.current.inspect} ybegin match; rest: #{m}" if Debuglevel > 0
|
||||||
if m.match(/^\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(.*?\S))\s*$/)
|
if matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(line\=(?<linesize>\d+))(\s*size\=(?<totalsize>\d+))(\s*name=(?<filename>.*?\S))\s*$/) or
|
||||||
part = $2.to_i
|
matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(size\=(?<totalsize>\d+))(\s*line\=(?<linesize>\d+))(\s*name=(?<filename>.*?\S))\s*$/)
|
||||||
total = $4.to_i
|
part = matchdata[:part].to_i
|
||||||
linesize = $6.to_i
|
total = matchdata[:total].to_i
|
||||||
size = $8.to_i
|
linesize = matchdata[:linesize].to_i
|
||||||
filename = $10
|
totalsize = matchdata[:totalsize].to_i
|
||||||
puts " #{Thread.current.inspect} found beginning, linesize = #{linesize}, size = #{size}, filename = #{filename}" if Debuglevel > 0
|
filename = matchdata[:filename]
|
||||||
|
puts " #{Thread.current.inspect} found beginning, linesize = #{linesize}, size = #{totalsize}, filename = #{filename}" if Debuglevel > 0
|
||||||
i += 1
|
i += 1
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
|
@ -317,8 +321,9 @@ def get_filename(data)
|
||||||
i = 0
|
i = 0
|
||||||
while i < data.length
|
while i < data.length
|
||||||
line = data[i]
|
line = data[i]
|
||||||
if line.match(/=ybegin\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(.*?\S))\s*$/m)
|
if matchdata = line.match(/=ybegin\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(?<filename>.*?\S))\s*$/m) or
|
||||||
return $10
|
matchdata = line.match(/=ybegin\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(size\=(\d+))(\s*line\=(\d+))(\s*name=(?<filename>.*?\S))\s*$/m)
|
||||||
|
return matchdata[:filename]
|
||||||
end
|
end
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue