Class: Cxxproject::DiabLinkerErrorParser

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

Instance Method Summary collapse

Constructor Details

#initializeDiabLinkerErrorParser

Returns a new instance of DiabLinkerErrorParser.



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

def initialize()
  @error_expression = /dld: ([A-Za-z]+): (.+)/
  @error_expression_linkerscript = /dld: \"([^\"]+)\", line ([0-9]+): (.+)/
end

Instance Method Details

#scan_lines(consoleOutput, proj_dir) ⇒ Object



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
# File 'lib/errorparser/diab_linker_error_parser.rb', line 11

def scan_lines(consoleOutput, proj_dir)
  res = []
  error_severity = 255
  consoleOutput.each_line do |l|
    l.rstrip!
    d = ErrorDesc.new
    scan_res = l.scan(@error_expression)
    scan_res2 = l.scan(@error_expression_linkerscript)
    if scan_res.length == 0 and scan_res2.length == 0 # msg will end with the beginning of the next message
      d.severity = error_severity
      d.message = l
    elsif scan_res.length > 0
      d.file_name = proj_dir
      d.line_number = 0
      d.message = scan_res[0][1]
      d.severity = get_severity(scan_res[0][0])
      error_severity = d.severity
    else
      d.file_name = proj_dir+"/"+scan_res2[0][0]
      d.line_number = scan_res2[0][1].to_i
      d.message = scan_res2[0][2]
      d.severity = SEVERITY_ERROR
      error_severity = d.severity
    end
    res << d
  end
  [res, consoleOutput]
end