public interface ProblemHandler
ProblemHandler
handles problems detected during the various lexical
syntactic, semantic analysis and validation phases of source text processing.
setParser
should be invoked once the source text is available, then
handleProblem
for each problem and finally flush
to send
any accumulated problems to an appropriate recipient such as an error log or
problem marker view.
See AbstractProblemHandler
for a default implementation of the per
processing phase convenience methods and StringProblemHandler
for
a complete handler that just accumulates all problem reports as a string.Modifier and Type | Interface and Description |
---|---|
static class |
ProblemHandler.Phase
Standard processing phases for problem messages.
|
static class |
ProblemHandler.Severity
Standard problem severities.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
ERROR_MESSAGES |
Modifier and Type | Method and Description |
---|---|
void |
analyzerProblem(ProblemHandler.Severity problemSeverity,
java.lang.String problemMessage,
java.lang.String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a analyzerProblem processing phase. |
void |
beginParse()
Notifies me that parsing is about to begin, from which I may receive
problems.
|
void |
beginValidation()
Notifies me that validation is about to begin, from which I may receive
problems.
|
void |
endParse()
Notifies me that parsing has completed, and I will get no further
problems in this session.
|
void |
endValidation()
Notifies me that validation has completed, and I will get no further
problems in this session.
|
void |
flush(org.eclipse.emf.common.util.Monitor monitor)
Flush all problems to their recipient.
|
int |
getErrorReportLineOffset()
Queries the line offset for reporting errors.
|
AbstractParser |
getParser()
Queries the parser from which I obtain source tokens and text.
|
void |
handleProblem(ProblemHandler.Severity problemSeverity,
ProblemHandler.Phase processingPhase,
java.lang.String problemMessage,
java.lang.String processingContext,
int startOffset,
int endOffset)
Handle a problem of problemSeverity that has arisen during processingPhase and which
is explained by problemMessage optionally clarified, if non-null, by processingContext,
and if non-negative by the startOffset and endOffset character indexes in the parsing stream.
|
void |
lexerProblem(ProblemHandler.Severity problemSeverity,
java.lang.String problemMessage,
java.lang.String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a lexerProblem processing phase. |
void |
parserProblem(ProblemHandler.Severity problemSeverity,
java.lang.String problemMessage,
java.lang.String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a parserProblem processing phase. |
void |
setErrorReportLineOffset(int offset)
Sets the line offset for reporting errors.
|
void |
setParser(AbstractParser parser)
Define the syntactic parser from which source tokens and text may be obtained.
|
void |
utilityProblem(ProblemHandler.Severity problemSeverity,
java.lang.String problemMessage,
java.lang.String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a utilityProblem processing phase. |
void |
validatorProblem(ProblemHandler.Severity problemSeverity,
java.lang.String problemMessage,
java.lang.String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a validatorProblem processing phase. |
void setParser(AbstractParser parser)
parser
- AbstractParser getParser()
void handleProblem(ProblemHandler.Severity problemSeverity, ProblemHandler.Phase processingPhase, java.lang.String problemMessage, java.lang.String processingContext, int startOffset, int endOffset)
problemSeverity
- text describing the problem severity (e.g. errorSeverity
)processingPhase
- optional text describing the processing phase (e.g. analyzerProblem
)problemMessage
- message describing the problemprocessingContext
- optional message describing the reporting context (e.g. "PathNameCS"
)startOffset
- (inclusive) index of first source character influencing the problem, -ve if unknownendOffset
- (exclusive) index of last source character influencing the problem, -ve if unknownvoid analyzerProblem(ProblemHandler.Severity problemSeverity, java.lang.String problemMessage, java.lang.String processingContext, int startOffset, int endOffset)
handleProblem
with a analyzerProblem
processing phase.problemSeverity
- text describing the problem severityproblemMessage
- message describing the problemprocessingContext
- optional message describing the reporting context (e.g. "PathNameCS"
)startOffset
- (inclusive) index of first source character influencing the problem, -ve if unknownendOffset
- (exclusive) index of last source character influencing the problem, -ve if unknownvoid lexerProblem(ProblemHandler.Severity problemSeverity, java.lang.String problemMessage, java.lang.String processingContext, int startOffset, int endOffset)
handleProblem
with a lexerProblem
processing phase.problemSeverity
- text describing the problem severityproblemMessage
- message describing the problemprocessingContext
- optional message describing the reporting context (e.g. "PathNameCS"
)startOffset
- (inclusive) index of first source character influencing the problem, -ve if unknownendOffset
- (exclusive) index of last source character influencing the problem, -ve if unknownvoid parserProblem(ProblemHandler.Severity problemSeverity, java.lang.String problemMessage, java.lang.String processingContext, int startOffset, int endOffset)
handleProblem
with a parserProblem
processing phase.problemSeverity
- text describing the problem severityproblemMessage
- message describing the problemprocessingContext
- optional message describing the reporting context (e.g. "PathNameCS"
)startOffset
- (inclusive) index of first source character influencing the problem, -ve if unknownendOffset
- (exclusive) index of last source character influencing the problem, -ve if unknownvoid utilityProblem(ProblemHandler.Severity problemSeverity, java.lang.String problemMessage, java.lang.String processingContext, int startOffset, int endOffset)
handleProblem
with a utilityProblem
processing phase.problemSeverity
- text describing the problem severityproblemMessage
- message describing the problemprocessingContext
- optional message describing the reporting context (e.g. "PathNameCS"
)startOffset
- (inclusive) index of first source character influencing the problem, -ve if unknownendOffset
- (exclusive) index of last source character influencing the problem, -ve if unknownvoid validatorProblem(ProblemHandler.Severity problemSeverity, java.lang.String problemMessage, java.lang.String processingContext, int startOffset, int endOffset)
handleProblem
with a validatorProblem
processing phase.problemSeverity
- text describing the problem severityproblemMessage
- message describing the problemprocessingContext
- optional message describing the reporting context (e.g. "PathNameCS"
)startOffset
- (inclusive) index of first source character influencing the problem, -ve if unknownendOffset
- (exclusive) index of last source character influencing the problem, -ve if unknownvoid setErrorReportLineOffset(int offset)
offset
- int getErrorReportLineOffset()
void beginParse()
void endParse()
void beginValidation()
void endValidation()
void flush(org.eclipse.emf.common.util.Monitor monitor)
monitor
- an optional EMF monitor for reporting progress. May be
null
if not needed by the caller