Class: Cxxproject::ClangCompilerErrorParser

Inherits:
ErrorParser
  • Object
show all
Defined in:
lib/errorparser/clang_compiler_error_parser.rb

Instance Method Summary collapse

Constructor Details

#initializeClangCompilerErrorParser

Returns a new instance of ClangCompilerErrorParser.



6
7
8
# File 'lib/errorparser/clang_compiler_error_parser.rb', line 6

def initialize()
  @error_expression = /([^:]+):([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z\._]+): (.+)/
end

Instance Method Details

#scan_lines(consoleOutput, proj_dir) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/errorparser/clang_compiler_error_parser.rb', line 10

def scan_lines(consoleOutput, proj_dir)
  res = []
  consoleOutputFullnames = ""
  consoleOutput.each_line do |l|
    d = ErrorDesc.new
    scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
    if scan_res.length > 0
      d.file_name = File.expand_path(scan_res[0][0])
      d.line_number = scan_res[0][1].to_i
      d.message = scan_res[0][4]
      if (scan_res[0][3].include?("."))
        d.severity = SEVERITY_ERROR
        d.message = scan_res[0][3] + ": " + d.message
      else
        d.severity = get_severity(scan_res[0][3])
      end
      l.gsub!(scan_res[0][0],d.file_name)
    end
    res << d
    consoleOutputFullnames << l
  end
  [res, consoleOutputFullnames]
end