Class: TexLogParser::FileLineError

Inherits:
Object
  • Object
show all
Includes:
LogParser::RegExpPattern
Defined in:
lib/tex_log_parser/patterns/file_line_error.rb

Overview

Matches messages of this form:

./plain.tex:31: Undefined control sequence.
l.31 ...t contains some \ref{warnings} and \errors
                                                    for testing.

Instance Method Summary collapse

Methods included from LogParser::RegExpPattern

#begins_at?

Methods included from LogParser::Pattern

#begins_at?

Constructor Details

#initializeFileLineError

Creates a new instance.

[View source]

13
14
15
# File 'lib/tex_log_parser/patterns/file_line_error.rb', line 13

def initialize
  super(%r{^(/?(?:.*?/)*[^/]+):(\d+):})
end

Instance Method Details

#read(lines) ⇒ Array<(Message, Int)>

Reads a message from the given lines.

Parameters:

Returns:

  • (Array<(Message, Int)>)

    An array of the message that was read, and the number of lines that it spans.

Raises:

  • If no message end could be found among the given lines.

[View source]

18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tex_log_parser/patterns/file_line_error.rb', line 18

def read(lines)
  # @type [Message] msg
  msg, consumed = super(lines)

  msg.source_file = @start_match[1]
  line = @start_match[2].to_i
  msg.source_lines = { from: line, to: line }
  msg.preformatted = true
  msg.level = :error

  msg.message.gsub!(@start, '')

  [msg, consumed]
end