Class: TexError

Inherits:
TexWarning show all
Defined in:
lib/trex.rb

Instance Attribute Summary

Attributes inherited from TexWarning

#filestate, #limit

Instance Method Summary collapse

Methods inherited from TexWarning

#add_error, #empty?, #expand_input, #format_error, #format_warning_message, #handle, #has_error?, #render_line, #size, #sort, #to_s

Constructor Details

#initialize(name, pattern, printPattern = /[^!].*/, limit = 10) ⇒ TexError

Returns a new instance of TexError.



960
961
962
# File 'lib/trex.rb', line 960

def initialize(name, pattern, printPattern=/[^!].*/, limit=10)
    super(name, pattern, printPattern, limit)
end

Instance Method Details

#extract_line(string, index, lines) ⇒ Object



964
965
966
967
968
969
970
971
972
973
974
975
976
# File 'lib/trex.rb', line 964

def extract_line(string, index, lines)
    match =  /(?:line(?:s)? |l.)([0-9\-]+( \\.*)?)/
    if string =~ match
        return $1.to_s
    end
    (index+1).upto(lines.size-1) { |i|
        return "-" if lines[i].start_with? "!"
        if lines[i] =~ match
            return $1.to_s
        end
    }
    return "-"
end