Class: Cxxproject::DiabCompilerErrorParser

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

Instance Method Summary collapse

Constructor Details

#initializeDiabCompilerErrorParser

Returns a new instance of DiabCompilerErrorParser.



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

def initialize()
  @error_expression_start = /\"(.+)\", line ([0-9]+): (?!included)(catastrophic |fatal )*([A-Za-z]+)[:]* (.+)/  
  @error_expression_end = /^[ \t]*\^/ # well, it may end without "^"... in this case the error will last the next one starts or console text ends
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
# File 'lib/errorparser/diab_compiler_error_parser.rb', line 11

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