Sha256: 07738544203d7144fcf0a1b59eea419d9431ecc0d465a53877f159f6c1042896

Contents?: true

Size: 968 Bytes

Versions: 4

Compression:

Stored size: 968 Bytes

Contents

require 'bake/toolchain/errorparser/error_parser'

module Bake
  class GreenHillsCompilerErrorParser < ErrorParser

    def initialize()
      # example:
      # "test.c", line 1: warning #123-D: blah blub
      @error_expression = /"([^"]+)", line ([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z\._]+) (.+)/
    end

    def scan_lines(consoleOutput, proj_dir)
      res = []
      consoleOutputFullnames = ""
      consoleOutput.each_line do |l|
        d = ErrorDesc.new
        scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
        if scan_res.length > 0
          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])
          l.gsub!(scan_res[0][0],d.file_name)
        end
        res << d
        consoleOutputFullnames << l
      end
      [res, consoleOutputFullnames]
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bake-toolkit-2.2.2 lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb
bake-toolkit-2.1.1 lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb
bake-toolkit-2.1.0 lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb
bake-toolkit-2.0.10 lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb