org.eclipse.ocl.examples.pivot.context
Interface ParserContext

All Known Implementing Classes:
AbstractParserContext, ClassContext, DiagnosticContext, EClassContext, EInvocationContext, EObjectContext, ModelContext, OperationContext, PropertyContext

public interface ParserContext

A ParserContext captures the context in which source text is parsed. A derived context is constructed with the relevant context, then createBaseResource creates a Concrete Syntax resource for a Concrete Syntax expression string. Then parse creates a corresponding Abstract Syntax ExpressionInOCL. initialize is invoked during the parse to install the derived context into the ExpressionInOCL.


Method Summary
 BaseResource createBaseResource(java.lang.String expression)
          Create a Concrete Syntax resource containing the parsed expression.
 Type getClassContext()
          Return the type of the self variable.
 ExpressionInOCL getExpression(BaseResource resource)
          Extract an Abstract Syntax ExpressionInOCL fronm a Concrete Syntax resource.
 MetaModelManager getMetaModelManager()
          Returbn the MetaModelManager in use.
 void initialize(Base2PivotConversion conversion, ExpressionInOCL expression)
          Callback to initialize the ExpressionInOCL with the derived context such as a contextvariable for the self type, parameter and result variables.
 ExpressionInOCL parse(org.eclipse.emf.ecore.EObject owner, java.lang.String expression)
          Create an Abstract Syntax ExpressionInOCL containing the parsed expression on behalf of a potential owner.
 ExpressionInOCL parse(java.lang.String expression)
          Deprecated. specify owner/owningList for use in diagnostics
 

Method Detail

createBaseResource

@NonNull
BaseResource createBaseResource(@NonNull
                                        java.lang.String expression)
                                throws java.io.IOException,
                                       ParserException
Create a Concrete Syntax resource containing the parsed expression. Semantic errors may be found at the Resource.errors and may be converted to ParseExceptions by invoking PivitUtil.checkResourceErrors.

Throws:
java.io.IOException - if resource loading fails
ParserException

getClassContext

@Nullable
Type getClassContext()
Return the type of the self variable.


getExpression

@Nullable
ExpressionInOCL getExpression(@NonNull
                                       BaseResource resource)
                              throws ParserException
Extract an Abstract Syntax ExpressionInOCL fronm a Concrete Syntax resource.

Throws:
ParserException - if parsing fails

getMetaModelManager

@NonNull
MetaModelManager getMetaModelManager()
Returbn the MetaModelManager in use.


initialize

void initialize(@NonNull
                Base2PivotConversion conversion,
                @NonNull
                ExpressionInOCL expression)
Callback to initialize the ExpressionInOCL with the derived context such as a contextvariable for the self type, parameter and result variables.


parse

@Deprecated
@NonNull
ExpressionInOCL parse(@NonNull
                                         java.lang.String expression)
                      throws ParserException
Deprecated. specify owner/owningList for use in diagnostics

Create an Abstract Syntax ExpressionInOCL containing the parsed expression.

Throws:
ParserException - if parsing fails

parse

@NonNull
ExpressionInOCL parse(@Nullable
                              org.eclipse.emf.ecore.EObject owner,
                              @NonNull
                              java.lang.String expression)
                      throws ParserException
Create an Abstract Syntax ExpressionInOCL containing the parsed expression on behalf of a potential owner.

This an invariant/precondition may specify its constraint as the owner
an operation body may specify the operation as the owner

The owner should be non-null but a null value is tolerated for deprecated compatibility.

Throws:
ParserException - if parsing fails