public class OCLAnalyzer<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> extends AbstractOCLAnalyzer<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>
OCLAnalyzer performs semantic analysis on a CST produced by
an OCLParser to create the OCL AST. It is necessary that
syntactic parsing and semantic analysis are performed in two steps because
LPG is a bottom up parser and cannot provide enough contextual information to
create the AST on the first pass.environmentFactory, IMPLICIT_SET_CONVERSION, OCL_ANNOTATIONS_URI, oclFactory, uml| Constructor and Description |
|---|
OCLAnalyzer(AbstractOCLParser parser)
Construct an OCL semantic analyzer that will use a given parser to
perform syntactic and lexical analysis.
|
OCLAnalyzer(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)
Construct an OCL semantic analyzer with default syntactic and lexical
parsers all operating within a given environment.
|
OCLAnalyzer(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment,
String text)
Construct an OCL semantic analyzer with default syntactic and lexical
parsers all operating within a given environment.
|
OCLAnalyzer(OCLParser parser)
Construct an OCL semantic analyzer that will use a given parser to
perform syntactic and lexical analysis.
|
| Modifier and Type | Method and Description |
|---|---|
protected CT |
createConstraint()
Creates an Constraint instance.
|
protected ExpressionInOCL<C,PM> |
createExpressionInOCL()
Creates an ExpressionInOcl instance.
|
protected OCLFactory |
createOCLFactory(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env)
Creates/obtains the
OCLFactory that I use to create OCL AST
elements. |
void |
ERROR(List<?> problemObjects,
String rule,
String problemMessage) |
void |
ERROR(Object problemObject,
String rule,
String problemMessage) |
void |
ERROR(String problemMessage) |
OCLParser |
getParser()
Deprecated.
Use the
AbstractOCLAnalyzer.getAbstractParser() method, instead |
protected boolean |
isErrorNode(TypedElement<C> expr)
Queries whether the specified expression is a placeholder that was
created for an expression that failed to parse.
|
protected void |
markAsErrorNode(TypedElement<C> expr)
Marks the specified (sub)expression as a placeholder for an expression
that could not be parsed.
|
OCLExpression<C> |
parseAST(OCLExpressionCS cst,
ConstraintKind constraintType)
Parses the specified concrete syntax model to an abstract syntax model.
|
CSTNode |
parseConcreteSyntax()
Performs a concrete-syntax parser and throws
ParserException
if any parse errors are encountered. |
CT |
parseInitOrDerValueCS()
Parses the input as an InitOrDerValueCS.
|
CT |
parseInvOrDefCS()
Parses the input as an InvOrDefCS.
|
List<CT> |
parseOCLDocument(List<CT> constraints)
Parses the input as an OCLDocumentCS.
|
List<CT> |
parsePackageDeclarationCS(List<CT> constraints)
Parses the input as a PackageDeclarationCS.
|
CT |
parsePrePostOrBodyDeclCS()
Parses the input as a PrePostOrBodyDeclCS.
|
Variable<C,PM> |
parseVariableDeclarationCS(boolean addToEnvironment)
Parses the input as a VariableDeclarationCS.
|
argumentsCS, arrowOperationCallExpCS, booleanLiteralExpCS, checkNotReflexive, classifierContextDeclCS, collectionLiteralExpCS, collectionLiteralPartCS, collectionTypeCS, collectionTypeIdentifierCS, contextDeclCS, createClassifierContext, createDummyInvalidLiteralExp, createDummyInvalidLiteralExp, createDummyInvalidType, createDummyPackage, createImplicitCollect, createImplicitSource, createOperationContext, createPackageContext, createPropertyContext, createSequenceOfNames, createVariableExp, defCS, documentCS, equalName, genOperationCallExp, genVariableDeclaration, getAbstractParser, getBagType, getBoolean, getCollectionKind, getCollectionSourceExpression, getCollectionType, getCollectionType, getCommonSuperType, getElementType, getLoopBody, getOCLEnvironment, getOCLType, getOclVoid, getOperationMessageType, getOrderedSetType, getPropertyType, getSequenceType, getSetType, getSignalMessageType, getStandardLibrary, getTupleType, getTypeType, ifExpCS, initASTMapping, initASTMapping, initOrDerValueCS, integerLiteralExpCS, invalidLiteralExpCS, invCS, invOrDefCS, isAtPre, isAtPre, isEscaped, isIdentifierOrKeyword, iterateExpCS, iteratorExpCS, letExp, letExpCS, letExpCSRecursive, literalExpCS, lookupAssociationClassReference, lookupClassifier, lookupImplicitSourceForOperation, lookupOperation, lookupProperty, lookupSignal, lookupState, loopExpCS, messageExpCS, modelPropertyCallExpCS, nullLiteralExpCS, oclExpressionCS, oclIsInStateOperationCallExpCS, operationCallExpCS, operationContextDeclCS, operationCS, operationString, packageDeclarationCS, packageDeclarationCS, parametersCS, prePostOrBodyDeclCS, primitiveLiteralExpCS, primitiveTypeCS, propertyCallExpCS, propertyContextCS, qualifiersCS, realLiteralExpCS, resolveIteratorOperation, setQualifiers, simpleAssociationClassName, simpleNameCS, simpleNavigationName, simplePropertyName, simpleTypeName, simpleUndefinedName, simpleVariableName, stateExpCS, staticOperationCallExpCS, stringLiteralExpCS, tupleLiteralExpCS, tupleLiteralPartCS, tupleLiteralPartListCS, tupleTypeCS, typeCS, typeCS, unescape, unlimitedNaturalLiteralExpCS, variableDeclarationCS, variableDeclarationListCS, variableExpCScomputeInputString, dumpTokens, formatClass, formatEClassName, formatName, formatPath, formatPath, formatQualifiedName, formatString, formatType, getCharOffset, getEnvironment, getFormatter, getLexer, getTraceFlag, initialize, initialize, initPropertyPositions, initStartEndPositions, initTypePositions, makeName, makeString, reset, reset, setCharacterOffset, setFileName, setTab, setTraceFlag, TRACE, TRACEpublic OCLAnalyzer(AbstractOCLParser parser)
parser - the syntactic (and lexical) parserpublic OCLAnalyzer(OCLParser parser)
parser - the syntactic (and lexical) parserpublic OCLAnalyzer(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment)
environment - the symbolic and problem handling environmentpublic OCLAnalyzer(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> environment, String text)
environment - the symbolic and problem handling environmenttext - the source text for analysis@Deprecated public OCLParser getParser()
AbstractOCLAnalyzer.getAbstractParser() method, insteadAbstractAnalyzerprotected OCLFactory createOCLFactory(Environment<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E> env)
AbstractOCLAnalyzerOCLFactory that I use to create OCL AST
elements.public CSTNode parseConcreteSyntax()
ParserException
if any parse errors are encountered.null if it could not be parsedpublic OCLExpression<C> parseAST(OCLExpressionCS cst, ConstraintKind constraintType)
cst - the OCL concrete syntax modelconstraintType - the kind of constraint to parsepublic List<CT> parseOCLDocument(List<CT> constraints)
constraints - the constraints list to populatepublic List<CT> parsePackageDeclarationCS(List<CT> constraints)
constraints - public CT parseInvOrDefCS()
null if it could not
be parsedpublic CT parsePrePostOrBodyDeclCS()
null if it could not
be parsedpublic CT parseInitOrDerValueCS()
null if it could not
be parsedpublic Variable<C,PM> parseVariableDeclarationCS(boolean addToEnvironment)
addToEnvironment - boolean whether or not to add the the parsed variable to the
environmentnull if it could
not be parsedpublic void ERROR(List<?> problemObjects, String rule, String problemMessage)
ERROR in class AbstractAnalyzerpublic void ERROR(Object problemObject, String rule, String problemMessage)
ERROR in class AbstractAnalyzerpublic void ERROR(String problemMessage)
ERROR in class AbstractAnalyzerprotected CT createConstraint()
AbstractOCLAnalyzerprotected ExpressionInOCL<C,PM> createExpressionInOCL()
AbstractOCLAnalyzerprotected boolean isErrorNode(TypedElement<C> expr)
AbstractOCLAnalyzer
Queries whether the specified expression is a placeholder that was
created for an expression that failed to parse. An example is the
expression returned by AbstractOCLAnalyzer.createDummyInvalidLiteralExp().
The default implementation simply returns false; subclasses
should override if necessary, in conjunction with the
AbstractOCLAnalyzer.markAsErrorNode(TypedElement) method.
isErrorNode in class AbstractOCLAnalyzer<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>expr - a (sub)expressionAbstractOCLAnalyzer.markAsErrorNode(TypedElement)protected void markAsErrorNode(TypedElement<C> expr)
AbstractOCLAnalyzer
Marks the specified (sub)expression as a placeholder for an expression
that could not be parsed. A subsequent invocation of the
AbstractOCLAnalyzer.isErrorNode(TypedElement) method should recognize an expression
thus marked. Subsequent attempts to mark an expression that is already
marked have no effect.
The default implementation does nothing; subclasses should override if necessary, in conjunction with the isErrorPlaceholder method.
markAsErrorNode in class AbstractOCLAnalyzer<PK,C,O,P,EL,PM,S,COA,SSA,CT,CLS,E>expr - an expression that takes the place of a (sub)expression that
could not be parsedAbstractOCLAnalyzer.isErrorNode(TypedElement)Copyright © 2015 Open eHealth Foundation. All rights reserved.