Class ErrorCollector

    • Constructor Detail

      • ErrorCollector

        public ErrorCollector()
    • Method Detail

      • warning

        public void warning​(String message,
                            String sourceName,
                            int line,
                            String lineSource,
                            int lineOffset)
        This is not called during AST generation. warning(String,String,int,int) is used instead.
        Specified by:
        warning in interface ErrorReporter
        Parameters:
        message - a String describing the warning
        sourceName - a String describing the JavaScript source where the warning occured; typically a filename or URL
        line - the line number associated with the warning
        lineSource - the text of the line (may be null)
        lineOffset - the offset into lineSource where problem was detected
        Throws:
        UnsupportedOperationException
      • warning

        public void warning​(String message,
                            String sourceName,
                            int offset,
                            int length)
        Description copied from interface: IdeErrorReporter
        Report a warning.

        The implementing class may choose to ignore the warning if it desires.

        Specified by:
        warning in interface IdeErrorReporter
        Parameters:
        message - a String describing the warning
        sourceName - a String describing the JavaScript source where the warning occured; typically a filename or URL
        offset - the warning's 0-indexed char position in the input stream
        length - the length of the region contributing to the warning
      • error

        public void error​(String message,
                          String sourceName,
                          int line,
                          String lineSource,
                          int lineOffset)
        This is not called during AST generation. warning(String,String,int,int) is used instead.
        Specified by:
        error in interface ErrorReporter
        Parameters:
        message - a String describing the error
        sourceName - a String describing the JavaScript source where the error occured; typically a filename or URL
        line - the line number associated with the error
        lineSource - the text of the line (may be null)
        lineOffset - the offset into lineSource where problem was detected
        Throws:
        UnsupportedOperationException
      • error

        public void error​(String message,
                          String sourceName,
                          int fileOffset,
                          int length)
        Description copied from interface: IdeErrorReporter
        Report an error.

        The implementing class is free to throw an exception if it desires.

        If execution has not yet begun, the JavaScript engine is free to find additional errors rather than terminating the translation. It will not execute a script that had errors, however.

        Specified by:
        error in interface IdeErrorReporter
        Parameters:
        message - a String describing the error
        sourceName - a String describing the JavaScript source where the error occured; typically a filename or URL
        fileOffset - 0-indexed char position of the error in the input stream
        length - the length of the region contributing to the error
      • runtimeError

        public EvaluatorException runtimeError​(String message,
                                               String sourceName,
                                               int line,
                                               String lineSource,
                                               int lineOffset)
        Description copied from interface: ErrorReporter
        Creates an EvaluatorException that may be thrown. runtimeErrors, unlike errors, will always terminate the current script.
        Specified by:
        runtimeError in interface ErrorReporter
        Parameters:
        message - a String describing the error
        sourceName - a String describing the JavaScript source where the error occured; typically a filename or URL
        line - the line number associated with the error
        lineSource - the text of the line (may be null)
        lineOffset - the offset into lineSource where problem was detected
        Returns:
        an EvaluatorException that will be thrown.
      • getErrors

        public List<ParseProblem> getErrors()
        Returns the list of errors and warnings produced during parsing.