|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mozilla.javascript.ast.ErrorCollector
public class ErrorCollector
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).
Constructor Summary | |
---|---|
ErrorCollector()
|
Method Summary | |
---|---|
void |
error(java.lang.String message,
java.lang.String sourceName,
int fileOffset,
int length)
Report an error. |
void |
error(java.lang.String message,
java.lang.String sourceName,
int line,
java.lang.String lineSource,
int lineOffset)
This is not called during AST generation. |
java.util.List<ParseProblem> |
getErrors()
Returns the list of errors and warnings produced during parsing. |
EvaluatorException |
runtimeError(java.lang.String message,
java.lang.String sourceName,
int line,
java.lang.String lineSource,
int lineOffset)
Creates an EvaluatorException that may be thrown. |
java.lang.String |
toString()
|
void |
warning(java.lang.String message,
java.lang.String sourceName,
int offset,
int length)
Report a warning. |
void |
warning(java.lang.String message,
java.lang.String sourceName,
int line,
java.lang.String lineSource,
int lineOffset)
This is not called during AST generation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ErrorCollector()
Method Detail |
---|
public void warning(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)
warning(String,String,int,int)
is used instead.
warning
in interface ErrorReporter
message
- a String describing the warningsourceName
- a String describing the JavaScript source
where the warning occured; 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
java.lang.UnsupportedOperationException
public void warning(java.lang.String message, java.lang.String sourceName, int offset, int length)
IdeErrorReporter
The implementing class may choose to ignore the warning if it desires.
warning
in interface IdeErrorReporter
message
- a String
describing the warningsourceName
- a String
describing the JavaScript source
where the warning occured; typically a filename or URLoffset
- the warning's 0-indexed char position in the input streamlength
- the length of the region contributing to the warningpublic void error(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)
warning(String,String,int,int)
is used instead.
error
in interface ErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occured; 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
java.lang.UnsupportedOperationException
public void error(java.lang.String message, java.lang.String sourceName, int fileOffset, int length)
IdeErrorReporter
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.
error
in interface IdeErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occured; typically a filename or URLfileOffset
- 0-indexed char position of the error in the input streamlength
- the length of the region contributing to the errorpublic EvaluatorException runtimeError(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)
ErrorReporter
runtimeError
in interface ErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occured; 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
public java.util.List<ParseProblem> getErrors()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |