public abstract class AbstractProblemHandler extends Object implements ProblemHandler
ProblemHandler API, useful for
subclasses to selectively override behaviour.ProblemHandler.Phase, ProblemHandler.SeverityERROR_MESSAGES| Modifier | Constructor and Description |
|---|---|
protected |
AbstractProblemHandler(AbstractParser parser)
Initializes me with the parser that can supply line number locations for
problems.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addProblem(String message)
The default implementation just prints the message using
System.out.println. |
void |
analyzerProblem(ProblemHandler.Severity problemSeverity,
String problemMessage,
String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a analyzerProblem processing phase. |
void |
beginParse()
This default implementation does nothing.
|
void |
beginValidation()
This default implementation does nothing.
|
void |
endParse()
This default implementation does nothing.
|
void |
endValidation()
This default implementation does nothing.
|
void |
flush(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,
String problemMessage,
String processingContext,
int startOffset,
int endOffset)
Implements the interface, invoking
addProblem with a line comprising
processingPhase-problemSeverity in processingContext; lineNumber : problemMessage. |
void |
lexerProblem(ProblemHandler.Severity problemSeverity,
String problemMessage,
String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a lexerProblem processing phase. |
void |
parserProblem(ProblemHandler.Severity problemSeverity,
String problemMessage,
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,
String problemMessage,
String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a utilityProblem processing phase. |
void |
validatorProblem(ProblemHandler.Severity problemSeverity,
String problemMessage,
String processingContext,
int startOffset,
int endOffset)
Convenience method typically invoking
handleProblem
with a validatorProblem processing phase. |
protected AbstractProblemHandler(AbstractParser parser)
parser - my parserprotected void addProblem(String message)
System.out.println.message - the problem descriptionpublic void analyzerProblem(ProblemHandler.Severity problemSeverity, String problemMessage, String processingContext, int startOffset, int endOffset)
ProblemHandlerhandleProblem
with a analyzerProblem processing phase.analyzerProblem in interface ProblemHandlerproblemSeverity - 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 unknownpublic void beginParse()
beginParse in interface ProblemHandlerpublic void endParse()
endParse in interface ProblemHandlerpublic void beginValidation()
beginValidation in interface ProblemHandlerpublic void endValidation()
endValidation in interface ProblemHandlerpublic void flush(Monitor monitor)
ProblemHandlerflush in interface ProblemHandlermonitor - an optional EMF monitor for reporting progress. May be
null if not needed by the callerpublic void setParser(AbstractParser parser)
ProblemHandlersetParser in interface ProblemHandlerpublic AbstractParser getParser()
ProblemHandlergetParser in interface ProblemHandlerpublic void handleProblem(ProblemHandler.Severity problemSeverity, ProblemHandler.Phase processingPhase, String problemMessage, String processingContext, int startOffset, int endOffset)
addProblem with a line comprising
processingPhase-problemSeverity in processingContext; lineNumber : problemMessage.handleProblem in interface ProblemHandlerproblemSeverity - 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 unknownpublic void lexerProblem(ProblemHandler.Severity problemSeverity, String problemMessage, String processingContext, int startOffset, int endOffset)
ProblemHandlerhandleProblem
with a lexerProblem processing phase.lexerProblem in interface ProblemHandlerproblemSeverity - 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 unknownpublic void parserProblem(ProblemHandler.Severity problemSeverity, String problemMessage, String processingContext, int startOffset, int endOffset)
ProblemHandlerhandleProblem
with a parserProblem processing phase.parserProblem in interface ProblemHandlerproblemSeverity - 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 unknownpublic void utilityProblem(ProblemHandler.Severity problemSeverity, String problemMessage, String processingContext, int startOffset, int endOffset)
ProblemHandlerhandleProblem
with a utilityProblem processing phase.utilityProblem in interface ProblemHandlerproblemSeverity - 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 unknownpublic void validatorProblem(ProblemHandler.Severity problemSeverity, String problemMessage, String processingContext, int startOffset, int endOffset)
ProblemHandlerhandleProblem
with a validatorProblem processing phase.validatorProblem in interface ProblemHandlerproblemSeverity - 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 unknownpublic void setErrorReportLineOffset(int offset)
ProblemHandlersetErrorReportLineOffset in interface ProblemHandlerpublic int getErrorReportLineOffset()
ProblemHandlergetErrorReportLineOffset in interface ProblemHandlerCopyright © 2015 Open eHealth Foundation. All rights reserved.