## org.eclipse.ocl.lpg
Interface BasicEnvironment

All Superinterfaces:
  Adaptable, Customizable

All Known Subinterfaces:
  Environment.Internal<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>

All Known Implementing Classes:
  AbstractBasicEnvironment, AbstractEnvironment, CompatibilityEnvironment, EcoreEnvironment

    public interface BasicEnvironment

extends Adaptable, Customizable

A `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.

Method Summary
`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, ... errors.
`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`.

Methods inherited from interface org.eclipse.ocl.util.Adaptable
`getAdapter`

Methods inherited from interface org.eclipse.ocl.options.Customizable
`clearOptions, getOptions, getValue, isEnabled, putOptions, removeOption, removeOptions, setOption`

Method Detail

### getASTMapping

    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.

  Parameters:
    `astNode` -
  Returns:
    cstNode

### initASTMapping

    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.

  Parameters:
    `astNode` -
    `cstNode` -

### getFormatter

    FormattingHelper getFormatter()

  Return the message formatter that may be used to format object-related contributions to problem messages.

  Returns:
    non-null message formatter

### setParser

    void setParser(AbstractParser parser)

  Define the syntactic parser from which source tokens and text amy be obtained.

  Parameters:
    `parser` -

### getParser

    AbstractParser getParser()

  Return the syntactic parser from which source tokens and text amy be obtained.

  Returns:
    parser

### setProblemHandler

    ProblemHandler setProblemHandler(ProblemHandler problemHandler)

  Define the handler for any problem reports.

  Parameters:
    `problemHandler` -
  Returns:
    the previous problem handler

### getProblemHandler

    ProblemHandler getProblemHandler()

  Obtains a problem handler to service lexer, parser, analyzer, validator, ... errors.

  Returns:
    the problem handler.

### problem

    void problem(ProblemHandler.Severity severity,
                 ProblemHandler.Phase phase,
                 String problemMessage,
                 String problemContext,
                 Object problemObject)

  Generically reports a problem about some object.

  Parameters:
    `severity` - the severity of the problem
    `phase` - the phase in which the problem was encountered
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `problemObject` - optional object associated with the problem

### analyzerError

    void analyzerError(String problemMessage,
                       String problemContext,
                       Object problemObject)

  Convenience method invoking `getProblemHandler().analyzerProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `problemObject` - optional object associated with the problem

### analyzerError

    void analyzerError(String problemMessage,
                       String problemContext,
                       List<?> problemObjects)

  Convenience method invoking `getProblemHandler().analyzerProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `problemObjects` - optional sequence of objects associated with the problem

### analyzerError

    void analyzerError(String problemMessage,
                       String problemContext,
                       int startOffset,
                       int endOffset)

  Convenience method invoking `getProblemHandler().analyzerProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `startOffset` - character index at the start of the error
    `endOffset` - character index beyond the end of the error

### analyzerWarning

    void analyzerWarning(String problemMessage,
                         String problemContext,
                         Object problemObject)

  Convenience method invoking `getProblemHandler().analyzerProblem` with a `ProblemHandler.warningSeverity`.

  Parameters:
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `problemObject` - optional object associated with the problem

### lexerError

    void lexerError(int errorCode,
                    int startOffset,
                    int endOffset)

  Convenience method invoking `getProblemHandler().lexerProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `errorCode` - the ParserErrorCodes value identifying the error
    `startOffset` - character index at the start of the error
    `endOffset` - character index beyond the end of the error

### parserError

    void parserError(int errorCode,
                     int leftToken,
                     int rightToken,
                     String tokenText)

  Convenience method invoking `getProblemHandler().parserProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `errorCode` - the ParserErrorCodes value identifying the error
    `leftToken` - the lexical token index at the left hand edge of the error
    `rightToken` - the lexical token index at the right hand edge of the error
    `tokenText` - additional text apprropriate to the ParserErrorCodes value.

### utilityError

    void utilityError(String problemMessage,
                      String problemContext,
                      Object problemObject)

  Convenience method invoking `getProblemHandler().utilityProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `problemObject` - optional object associated with the problem

### validatorError

    void validatorError(String problemMessage,
                        String problemContext,
                        Object problemObject)

  Convenience method invoking `getProblemHandler().validatorProblem` with a `ProblemHandler.errorSeverity`.

  Parameters:
    `problemMessage` - message describing the problem
    `problemContext` - optional message describing the reporting context
    `problemObject` - optional object associated with the problem

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.