Class: Bake::MSVCCompilerErrorParser

Inherits:
ErrorParser show all
Defined in:
lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb

Constant Summary

Constants inherited from ErrorParser

ErrorParser::SEVERITY_ERROR, ErrorParser::SEVERITY_INFO, ErrorParser::SEVERITY_OK, ErrorParser::SEVERITY_WARNING

Instance Method Summary collapse

Methods inherited from ErrorParser

#get_severity, #get_tasking_severity, #inv_severity, #makeVsError, #scan

Constructor Details

#initializeMSVCCompilerErrorParser

Returns a new instance of MSVCCompilerErrorParser.



6
7
8
9
10
# File 'lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb', line 6

def initialize()
  @error_expression = /(.+)\(([0-9]+)\) : ([A-Za-z\._]+) (C[\d]+: .+)/
  @incEng = "Note: including file: "
  @incGer = "Hinweis: Einlesen der Datei: "
end

Instance Method Details

#scan_lines(consoleOutput, proj_dir) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/bake/toolchain/errorparser/msvc_compiler_error_parser.rb', line 12

def scan_lines(consoleOutput, proj_dir)
  includeList = []
  res = []
  consoleOutputFiltered = ""
  consoleOutputFullnames = ""
  filterLine = 0
  consoleOutput[0].each_line do |l|
    filterLine = filterLine + 1
    next if (filterLine == 1 and l.include?"Assembling: ")
    if (filterLine <= 2 and l.include?"Microsoft (R)")
      filterLine = 1
      next
    end
    next if (filterLine == 2 and l.include?"Copyright (C)")
    next if (filterLine == 3 and l.strip.empty?)
    next if (filterLine == 4 and not l.include?" : " and l.include?".") # the source file
    filterLine = 100

    if l.include?@incEng
      includeList << l[@incEng.length..-1].strip
      next
    end
    if l.include?@incGer
      includeList << l[@incGer.length..-1].strip
      next
    end

    d = ErrorDesc.new
    scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
    lFull = l
    if scan_res.length > 0
      d.file_name = File.expand_path(scan_res[0][0], proj_dir)
      d.line_number = scan_res[0][1].to_i
      d.message = scan_res[0][3]
      if (scan_res[0][2].include?".")
        d.severity = SEVERITY_ERROR
        d.message = scan_res[0][2] + ": " + d.message
      else
        d.severity = get_severity(scan_res[0][2])
      end
      lFull = l.gsub(scan_res[0][0],d.file_name)
    end
    res << d
    consoleOutputFiltered << l
    consoleOutputFullnames << lFull
  end
  consoleOutput[0] = consoleOutputFiltered
  [res, consoleOutputFullnames, includeList.uniq]
end