Sha256: 5ddb3fe9fa0ed7ef4e968f67bb2999e311b1d3898efb52b373b96d0aa38a3047

Contents?: true

Size: 1.32 KB

Versions: 18

Compression:

Stored size: 1.32 KB

Contents

require 'cxxproject/errorparser/error_parser'

module Cxxproject
  class DiabCompilerErrorParser < ErrorParser

    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

    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

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cxxproject-0.5.76 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.75 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.74 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.73 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.72 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.71 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.70 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.69 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.68 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.67 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.66 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.65 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.64 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.63 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.62 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.61 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.60 lib/cxxproject/errorparser/diab_compiler_error_parser.rb
cxxproject-0.5.59 lib/cxxproject/errorparser/diab_compiler_error_parser.rb