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\=.*)/)
|
||||
m = $1
|
||||
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*$/)
|
||||
part = $2.to_i
|
||||
total = $4.to_i
|
||||
linesize = $6.to_i
|
||||
totalsize = $8.to_i
|
||||
filename = $10
|
||||
print "full line: #{line}" if Debuglevel > 0
|
||||
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
|
||||
matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(size\=(?<totalsize>\d+))(\s*line\=(?<linesize>\d+))(\s*name=(?<filename>.*?\S))\s*$/)
|
||||
part = matchdata[:part].to_i
|
||||
total = matchdata[:total].to_i
|
||||
linesize = matchdata[:linesize].to_i
|
||||
totalsize = matchdata[:totalsize].to_i
|
||||
filename = matchdata[:filename]
|
||||
if Debuglevel > 0
|
||||
print "found beginning"
|
||||
if part != nil
|
||||
|
|
@ -161,12 +163,13 @@ def _ydecode_file(file, outfile)
|
|||
closure = false
|
||||
m = $1
|
||||
search_begin = false
|
||||
if m.match(/^\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(.*?\S))\s*$/)
|
||||
part = $2.to_i
|
||||
total = $4.to_i
|
||||
linesize = $6.to_i
|
||||
totalsize = $8.to_i
|
||||
filename = $10
|
||||
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
|
||||
matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(size\=(?<totalsize>\d+))(\s*line\=(?<linesize>\d+))(\s*name=(?<filename>.*?\S))\s*$/)
|
||||
part = matchdata[:part].to_i
|
||||
total = matchdata[:total].to_i
|
||||
linesize = matchdata[:linesize].to_i
|
||||
totalsize = matchdata[:totalsize].to_i
|
||||
filename = matchdata[:filename]
|
||||
puts "found beginning of part #{part}, linesize = #{linesize}, size = #{totalsize}, filename = #{filename}" if Debuglevel > 0
|
||||
end
|
||||
next
|
||||
|
|
@ -230,13 +233,14 @@ def _ydecode_array(data)
|
|||
if data[i].match(/^\=ybegin\s+(.*line\=.*)/)
|
||||
m = $1
|
||||
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*$/)
|
||||
part = $2.to_i
|
||||
total = $4.to_i
|
||||
linesize = $6.to_i
|
||||
size = $8.to_i
|
||||
filename = $10
|
||||
puts " #{Thread.current.inspect} found beginning, linesize = #{linesize}, size = #{size}, filename = #{filename}" if Debuglevel > 0
|
||||
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
|
||||
matchdata = m.match(/^\s*(part\=(?<part>\d+)\s+)?(total\=(?<total>\d+)\s+)?(size\=(?<totalsize>\d+))(\s*line\=(?<linesize>\d+))(\s*name=(?<filename>.*?\S))\s*$/)
|
||||
part = matchdata[:part].to_i
|
||||
total = matchdata[:total].to_i
|
||||
linesize = matchdata[:linesize].to_i
|
||||
totalsize = matchdata[:totalsize].to_i
|
||||
filename = matchdata[:filename]
|
||||
puts " #{Thread.current.inspect} found beginning, linesize = #{linesize}, size = #{totalsize}, filename = #{filename}" if Debuglevel > 0
|
||||
i += 1
|
||||
break
|
||||
else
|
||||
|
|
@ -317,8 +321,9 @@ def get_filename(data)
|
|||
i = 0
|
||||
while i < data.length
|
||||
line = data[i]
|
||||
if line.match(/=ybegin\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(.*?\S))\s*$/m)
|
||||
return $10
|
||||
if matchdata = line.match(/=ybegin\s*(part\=(\d+)\s+)?(total\=(\d+)\s+)?(line\=(\d+))(\s*size\=(\d+))(\s*name=(?<filename>.*?\S))\s*$/m) or
|
||||
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
|
||||
i += 1
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue