def add_line_numbers(src)
            if src =~ /\A.*, line (\d+)/
                first = $1.to_i - 1
                last  = first + src.count("\n")
                size = last.to_s.length
                real_fmt = "%#{size}d: "
                fmt = " " * (size+2)
                src.gsub!(/^/) do
                    res = sprintf(fmt, first) 
                    first += 1
                    fmt = real_fmt
                    res
                end
            end
        end
def add_line_numbers(src)
            if src =~ /\A.*, line (\d+)/
                first = $1.to_i - 1
                last  = first + src.count("\n")
                size = last.to_s.length
                real_fmt = "%#{size}d: "
                fmt = " " * (size+2)
                src.gsub!(/^/) do
                    res = sprintf(fmt, first) 
                    first += 1
                    fmt = real_fmt
                    res
                end
            end
        end
we rely on the fact that the first line of a source code
 listing has
    # File xxxxx, line dddd