def extract_data(output)
results = Hash.new{|h,k| h[k] = []}
exceptions = Hash.new{|h,k| h[k] = []}
bindings = Hash.new{|h,k| h[k] = []}
output.grep(XMP_RE).each do |line|
result_id, op, result = XMP_RE.match(line).captures
case op
when "=>"
klass, value = /(\S+)\s+(.*)/.match(result).captures
results[result_id.to_i] << [klass, value.gsub(/PPPROTECT/, "\n")]
when "~>"
exceptions[result_id.to_i] << result
when "==>"
bindings[result_id.to_i] << result unless result.index(VAR)
end
end
RuntimeData.new(results, exceptions, bindings)
end