Class BasicErrorReporter

java.lang.Object
autumn.lang.compiler.errors.BasicErrorReporter
All Implemented Interfaces:
IErrorReporter

public final class BasicErrorReporter extends Object implements IErrorReporter
An instance of this class is an error-reporter that reports errors to a PrintStream.
Author:
Mackenzie High
  • Constructor Details

    • BasicErrorReporter

      public BasicErrorReporter()
      Constructor.

      This constructor creates an error-reporter that reports errors using STDOUT.

    • BasicErrorReporter

      public BasicErrorReporter(PrintStream out)
      Constructor.
      Parameters:
      out - is the stream to report errors to.
  • Method Details

    • reportSyntaxError

      public void reportSyntaxError(URL file, int line, int column)
      This method reports that the parsing of a module failed.
      Specified by:
      reportSyntaxError in interface IErrorReporter
      Parameters:
      file - is the path to the module's file, as supplied to the compiler.
      line - is an estimate of where parsing failed within the input.
      column - is an estimate of where parsing failed within the input.
    • reportFailedCheck

      public void reportFailedCheck(ErrorReport report)
      This method reports that a static-check failed.
      Specified by:
      reportFailedCheck in interface IErrorReporter
      Parameters:
      report - is a an error-report that describes what went wrong.
    • errorCount

      public int errorCount()
      This method returns the number of errors that were thus far reported by this reporter.
      Specified by:
      errorCount in interface IErrorReporter
      Returns:
      the number of reported errors.
    • codes

      public List<ErrorCode> codes()
      This method returns a list containing the error-codes that have been reported already.
      Returns:
      an immutable list containing the reported error-codes.
    • reports

      public List<ErrorReport> reports()
      This method returns a list containing the error-reports that have been reported already.
      Returns:
      an immutable list containing the reported errors.