public interface BasicEnvironment extends Adaptable, Customizable
BasicEnvironment
provides input token and output problem support for a text analysis
comprising an AbstractAnalyzer
for semantic analysis,
AbstractParser
for syntactic analysis
(parsing), and an AbstractLexer
for lexical analysis.Modifier and Type | Method and Description |
---|---|
void |
analyzerError(String problemMessage,
String problemContext,
int startOffset,
int endOffset)
Convenience method invoking
getProblemHandler().analyzerProblem
with a ProblemHandler.errorSeverity . |
void |
analyzerError(String problemMessage,
String problemContext,
List<?> problemObjects)
Convenience method invoking
getProblemHandler().analyzerProblem
with a ProblemHandler.errorSeverity . |
void |
analyzerError(String problemMessage,
String problemContext,
Object problemObject)
Convenience method invoking
getProblemHandler().analyzerProblem
with a ProblemHandler.errorSeverity . |
void |
analyzerWarning(String problemMessage,
String problemContext,
Object problemObject)
Convenience method invoking
getProblemHandler().analyzerProblem
with a ProblemHandler.warningSeverity . |
CSTNode |
getASTMapping(Object astNode)
Return the mapping of an astNode to its originating cstNode, so that
AST-based analysis may report error messages exploiting the CST context, or
to support incremental AST/CST update.
|
FormattingHelper |
getFormatter()
Return the message formatter that may be used to format object-related contributions
to problem messages.
|
AbstractParser |
getParser()
Return the syntactic parser from which source tokens and text amy be obtained.
|
ProblemHandler |
getProblemHandler()
Obtains a problem handler to service lexer, parser, analyzer, validator, ...
|
void |
initASTMapping(Object astNode,
CSTNode cstNode)
Initialize the mapping of an object (typically an astNode) to its originating cstNode,
so that AST-based analysis may report error messages exploiting the CST context, or
to support incremental AST/CST update.
|
void |
lexerError(int errorCode,
int startOffset,
int endOffset)
Convenience method invoking
getProblemHandler().lexerProblem
with a ProblemHandler.errorSeverity . |
void |
parserError(int errorCode,
int leftToken,
int rightToken,
String tokenText)
Convenience method invoking
getProblemHandler().parserProblem
with a ProblemHandler.errorSeverity . |
void |
problem(ProblemHandler.Severity severity,
ProblemHandler.Phase phase,
String problemMessage,
String problemContext,
Object problemObject)
Generically reports a problem about some object.
|
void |
setParser(AbstractParser parser)
Define the syntactic parser from which source tokens and text amy be obtained.
|
ProblemHandler |
setProblemHandler(ProblemHandler problemHandler)
Define the handler for any problem reports.
|
void |
utilityError(String problemMessage,
String problemContext,
Object problemObject)
Convenience method invoking
getProblemHandler().utilityProblem
with a ProblemHandler.errorSeverity . |
void |
validatorError(String problemMessage,
String problemContext,
Object problemObject)
Convenience method invoking
getProblemHandler().validatorProblem
with a ProblemHandler.errorSeverity . |
getAdapter
clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption
CSTNode getASTMapping(Object astNode)
astNode
- void initASTMapping(Object astNode, CSTNode cstNode)
astNode
- cstNode
- FormattingHelper getFormatter()
void setParser(AbstractParser parser)
parser
- AbstractParser getParser()
ProblemHandler setProblemHandler(ProblemHandler problemHandler)
problemHandler
- ProblemHandler getProblemHandler()
void problem(ProblemHandler.Severity severity, ProblemHandler.Phase phase, String problemMessage, String problemContext, Object problemObject)
severity
- the severity of the problemphase
- the phase in which the problem was encounteredproblemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextproblemObject
- optional object associated with the problemvoid analyzerError(String problemMessage, String problemContext, Object problemObject)
getProblemHandler().analyzerProblem
with a ProblemHandler.errorSeverity
.problemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextproblemObject
- optional object associated with the problemvoid analyzerError(String problemMessage, String problemContext, List<?> problemObjects)
getProblemHandler().analyzerProblem
with a ProblemHandler.errorSeverity
.problemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextproblemObjects
- optional sequence of objects associated with the problemvoid analyzerError(String problemMessage, String problemContext, int startOffset, int endOffset)
getProblemHandler().analyzerProblem
with a ProblemHandler.errorSeverity
.problemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextstartOffset
- character index at the start of the errorendOffset
- character index beyond the end of the errorvoid analyzerWarning(String problemMessage, String problemContext, Object problemObject)
getProblemHandler().analyzerProblem
with a ProblemHandler.warningSeverity
.problemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextproblemObject
- optional object associated with the problemvoid lexerError(int errorCode, int startOffset, int endOffset)
getProblemHandler().lexerProblem
with a ProblemHandler.errorSeverity
.errorCode
- the ParserErrorCodes value identifying the errorstartOffset
- character index at the start of the errorendOffset
- character index beyond the end of the errorvoid parserError(int errorCode, int leftToken, int rightToken, String tokenText)
getProblemHandler().parserProblem
with a ProblemHandler.errorSeverity
.errorCode
- the ParserErrorCodes value identifying the errorleftToken
- the lexical token index at the left hand edge of the errorrightToken
- the lexical token index at the right hand edge of the errortokenText
- additional text apprropriate to the ParserErrorCodes value.void utilityError(String problemMessage, String problemContext, Object problemObject)
getProblemHandler().utilityProblem
with a ProblemHandler.errorSeverity
.problemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextproblemObject
- optional object associated with the problemvoid validatorError(String problemMessage, String problemContext, Object problemObject)
getProblemHandler().validatorProblem
with a ProblemHandler.errorSeverity
.problemMessage
- message describing the problemproblemContext
- optional message describing the reporting contextproblemObject
- optional object associated with the problemCopyright © 2005, 2018 IBM Corporation and others. All Rights Reserved.