Class: Bake::IARCompilerErrorParser

Inherits:
ErrorParser show all
Defined in:
lib/bake/toolchain/errorparser/iar_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

#initializeIARCompilerErrorParser

Returns a new instance of IARCompilerErrorParser.



6
7
8
# File 'lib/bake/toolchain/errorparser/iar_compiler_error_parser.rb', line 6

def initialize()
  @error_expression_start = /\"(.+)\",([0-9]+)\s+(internal |fatal )*([A-Za-z]+)([^:]*):\s*(.*)/
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
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bake/toolchain/errorparser/iar_compiler_error_parser.rb', line 10

def scan_lines(consoleOutput, proj_dir)
  res = []
  error_severity = 255
  consoleOutputFullnames = ""
  lastValidErrorDesc = nil

  consoleOutput[0].each_line do |l|
    d = ErrorDesc.new
    lstripped = l.rstrip
    scan_res = lstripped.scan(@error_expression_start)
    if scan_res.length == 0
      if lastValidErrorDesc
        lastValidErrorDesc.message += l
        d.severity = lastValidErrorDesc.severity
      else
        d.severity = SEVERITY_OK
        d.message = lstripped
      end
      if lstripped == ""
        lastValidErrorDesc = nil
      end
    else
      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][5]
      d.severity = get_severity(scan_res[0][3])
      error_severity = d.severity
      l.gsub!(scan_res[0][0],d.file_name)
      lastValidErrorDesc = d
    end
    res << d
    consoleOutputFullnames << l
  end
  [res, consoleOutputFullnames]
end