Sha256: 04179932b4c57495781a4e7d1214996ff3f5fe06aa7deea4c8f70bbcb6657335

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

module Cxxproject

  class ErrorDesc
    def initialize
      @severity = 255
    end
    attr_accessor :severity
    attr_accessor :line_number
    attr_accessor :message
    attr_accessor :file_name
  end

  class ErrorParser

    SEVERITY_INFO = 0
    SEVERITY_WARNING = 1
    SEVERITY_ERROR = 2
    SEVERITY_OK = 255

    def scan(consoleOutput, proj_dir)
      raise "Use specialized classes only"
    end

    def get_severity(str)
      if str == "info" || str == "note"
        SEVERITY_INFO
      elsif str == "warning"
        SEVERITY_WARNING
      elsif str == "error"
        SEVERITY_ERROR
      else
        raise "Unknown severity: #{str}"
      end
    end

    # scan the output from the console line by line and return a list of ErrorDesc objects.
    # for none-error/warning lines the description object will indicate that as severity 255
    # for single line errors/warnings: description will contain severity, line-number, message and file-name
    #
    # for multi-line errors/warnings:
    #   one description object for each line, first one will contain all single line error information,
    #   all following desc.objects will just repeat the severity and include the message
    #
    def scan_lines(consoleOutput, proj_dir)
      raise "Use specialized classes only"
    end


  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cxxproject-0.5.60 lib/cxxproject/errorparser/error_parser.rb
cxxproject-0.5.59 lib/cxxproject/errorparser/error_parser.rb