Package org.mozilla.javascript.ast
Class ErrorCollector
java.lang.Object
org.mozilla.javascript.ast.ErrorCollector
- All Implemented Interfaces:
IdeErrorReporter,ErrorReporter
An error reporter that gathers the errors and warnings for later display. This a useful
ErrorReporter when the CompilerEnvirons is
set to ide-mode (for IDEs).- Author:
- Steve Yegge
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReport an error.voidThis is not called during AST generation.Returns the list of errors and warnings produced during parsing.runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) Creates an EvaluatorException that may be thrown.toString()voidReport a warning.voidThis is not called during AST generation.
-
Constructor Details
-
ErrorCollector
public ErrorCollector()
-
-
Method Details
-
warning
This is not called during AST generation.warning(String,String,int,int)is used instead.- Specified by:
warningin interfaceErrorReporter- Parameters:
message- a String describing the warningsourceName- a String describing the JavaScript source where the warning occurred; typically a filename or URLline- the line number associated with the warninglineSource- the text of the line (may be null)lineOffset- the offset into lineSource where problem was detected- Throws:
UnsupportedOperationException
-
warning
Report a warning.The implementing class may choose to ignore the warning if it desires.
- Specified by:
warningin interfaceIdeErrorReporter- Parameters:
message- aStringdescribing the warningsourceName- aStringdescribing the JavaScript source where the warning occurred; typically a filename or URLoffset- the warning's 0-indexed char position in the input streamlength- the length of the region contributing to the warning
-
error
This is not called during AST generation.warning(String,String,int,int)is used instead.- Specified by:
errorin interfaceErrorReporter- Parameters:
message- a String describing the errorsourceName- a String describing the JavaScript source where the error occurred; typically a filename or URLline- the line number associated with the errorlineSource- the text of the line (may be null)lineOffset- the offset into lineSource where problem was detected- Throws:
UnsupportedOperationException
-
error
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:
errorin interfaceIdeErrorReporter- Parameters:
message- a String describing the errorsourceName- a String describing the JavaScript source where the error occurred; typically a filename or URLfileOffset- 0-indexed char position of the error in the input streamlength- the length of the region contributing to the error
-
runtimeError
public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) Creates an EvaluatorException that may be thrown.runtimeErrors, unlike errors, will always terminate the current script.
- Specified by:
runtimeErrorin interfaceErrorReporter- Parameters:
message- a String describing the errorsourceName- a String describing the JavaScript source where the error occurred; typically a filename or URLline- the line number associated with the errorlineSource- 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
Returns the list of errors and warnings produced during parsing. -
toString
-