|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.mofscript.parser.MofScriptModelChecker
public class MofScriptModelChecker
Semantic checker for MOFScript
Field Summary | |
---|---|
protected TransformationRule |
_currentRule
|
protected java.lang.String |
_currentRuleType
|
protected MofScriptErrorManager |
_errorMgr
|
protected ExecutionManager |
_execMgr
|
protected java.util.Hashtable<java.lang.String,Expression> |
_fileDeclarations
|
protected java.util.Hashtable<java.lang.String,MOFScriptTransformation> |
_importedTransformations
|
protected java.util.Hashtable<java.lang.String,MOFScriptParameter> |
_inputParameters
|
protected boolean |
_metamodelsOk
|
protected java.util.Hashtable<java.lang.String,MOFScriptObject> |
_postCheckReferences
|
protected MOFScriptTransformation |
_transformation
|
protected TransformationProxy |
_transformationProxy
|
protected MOFScriptSpecification |
_transformationSpec
|
protected java.util.Stack<java.lang.Object> |
_variableStack
|
protected static boolean |
NON_EXISTING_FUNCTION
|
static int |
SOURCE_METAMODEL
|
static int |
TARGET_METAMODEL
|
Constructor Summary | |
---|---|
MofScriptModelChecker()
Default constructor |
Method Summary | |
---|---|
void |
addImportedTransformation(java.lang.String importName,
java.lang.String importUri,
MOFScriptTransformation importedTr)
Add imported transformations |
boolean |
addSourceMetaModel(MOFScriptParameter param)
|
boolean |
addTargetMetaModel(MOFScriptParameter param)
|
protected MofScriptParseError |
booleanFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if boolean function is OK |
void |
checkExpression(Expression exp)
Checks an expression |
void |
checkMetaModels()
sets the source and target metamodels from transformation objects |
void |
checkParameter(MOFScriptParameter parameter)
Checks a domain (a parameter) to the rule |
protected MofScriptParseError |
checkParameterUsage(java.lang.String fName,
FunctionCall fc,
int requiredParamCount)
Checks the parameters usage Used where for locked number of parameters |
protected MofScriptParseError |
checkParameterUsage(java.lang.String fName,
FunctionCall fc,
int lowerCount,
int upperCount)
Checks the numbers of parameters |
void |
checkReference(Reference ref)
Checks the refrence |
void |
checkReferenceName(java.lang.String refName,
MOFScriptObject checkObj)
Checks the refrence name |
protected MofScriptParseError |
checkRuleContext(MOFScriptParameter parameter)
Checks the context of a rule |
void |
checkStatement(MOFScriptStatement statement,
boolean postCheck)
Checks a statement within a rule |
void |
checkTransformationRule(TransformationRule rule,
boolean postCheck)
Checks a transformation rule for type usages, rule invocations etc |
protected java.lang.String |
checkType(java.lang.String dtype,
MOFScriptObject checkObject)
|
void |
checkVariableDeclaration(VariableDeclaration varDecl)
Checks properties of the transformation |
protected MofScriptParseError |
checkVariableUsage(VariableDeclaration var,
java.lang.String functionCalled,
FunctionCall fc)
Check if the usage of a variable (e.g. a Hashtable var) is legal |
void |
clear()
Clears all stored values |
java.lang.String |
findGlobalParameter(java.lang.String name)
Returns the type name of the parameter if it exists |
VariableDeclaration |
findGlobalVariables(MOFScriptTransformation transformation,
java.lang.String name)
Finds global variables |
java.lang.Object |
findVariable(java.lang.String name)
Find a variable either globally or locally |
int |
getErrorCount()
Gets the error count |
MofScriptErrorManager |
getErrorManager()
Gets the error manager |
java.util.Iterator |
getErrors()
Gets the errors |
protected org.eclipse.emf.ecore.ENamedElement |
getMetaModelReference(java.lang.String refName,
MOFScriptObject checkObj)
Gets a meta model reference |
boolean |
getMetaModelsOK()
|
protected VariableDeclaration |
getTempVar()
|
MOFScriptTransformation |
getTransformationModel()
|
TransformationProxy |
getTransformationProxy()
returns the current transformation model |
MOFScriptSpecification |
getTransformationSpecification()
|
protected MofScriptParseError |
hashtableFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if a Hashtable function is OK |
protected MofScriptParseError |
integerFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if integer function is OK |
boolean |
isSuperTransformation(MOFScriptTransformation transformation,
MOFScriptTransformation possibleSuper)
|
protected MofScriptParseError |
listFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if a list function is OK |
void |
postCheck()
Semantic checks of the complete model |
protected void |
postCheckExpression(Expression exp)
Post checking, when all rules can be resolved... |
protected void |
postCheckFunctionCall(FunctionCall fc)
Perform post check of a function call |
protected void |
postCheckUnresolvedReferences()
Iterators through unresolved references and looks for them again. |
void |
printErrors()
Prints the errors to system.out |
protected MofScriptParseError |
realFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if real function is OK |
protected void |
setExtendsRelation(MOFScriptTransformation transformation,
java.util.Hashtable trHierarchy)
Set the extend relation |
void |
setTransformationModel(MOFScriptTransformation transformation)
|
void |
setTransformationSpecification(MOFScriptSpecification trModel)
|
protected MofScriptParseError |
stringFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if a string function is OK |
protected MofScriptParseError |
systemFunctionOk(java.lang.String functionCalled,
FunctionCall fc)
Checks if a system function is OK |
(package private) MofScriptParseError |
validateType(java.lang.String mm,
java.lang.String type,
int metamodel,
MOFScriptObject checkObj)
Checks that a stringified type is an existing metamodel type |
(package private) MofScriptParseError |
validateTypePrefix(java.lang.String prefix,
int metamodel,
MOFScriptObject checkObj)
Finds a prefix for a type and checks if it comes from the correct meta model |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int SOURCE_METAMODEL
public static int TARGET_METAMODEL
protected TransformationProxy _transformationProxy
protected MOFScriptSpecification _transformationSpec
protected MOFScriptTransformation _transformation
protected ExecutionManager _execMgr
protected MofScriptErrorManager _errorMgr
protected java.util.Stack<java.lang.Object> _variableStack
protected java.util.Hashtable<java.lang.String,MOFScriptParameter> _inputParameters
protected java.util.Hashtable<java.lang.String,Expression> _fileDeclarations
protected java.util.Hashtable<java.lang.String,MOFScriptTransformation> _importedTransformations
protected java.lang.String _currentRuleType
protected TransformationRule _currentRule
protected boolean _metamodelsOk
protected java.util.Hashtable<java.lang.String,MOFScriptObject> _postCheckReferences
protected static boolean NON_EXISTING_FUNCTION
Constructor Detail |
---|
public MofScriptModelChecker()
Method Detail |
---|
public TransformationProxy getTransformationProxy()
public void setTransformationSpecification(MOFScriptSpecification trModel)
trModel
- public MOFScriptSpecification getTransformationSpecification()
public void setTransformationModel(MOFScriptTransformation transformation)
transformation
- public MOFScriptTransformation getTransformationModel()
public void clear()
public boolean getMetaModelsOK()
public void checkMetaModels()
public boolean addSourceMetaModel(MOFScriptParameter param)
param
-
public boolean addTargetMetaModel(MOFScriptParameter param)
public void checkVariableDeclaration(VariableDeclaration varDecl)
public void checkTransformationRule(TransformationRule rule, boolean postCheck)
protected org.eclipse.emf.ecore.ENamedElement getMetaModelReference(java.lang.String refName, MOFScriptObject checkObj)
refName
-
protected MofScriptParseError checkRuleContext(MOFScriptParameter parameter)
parameter
- public void checkParameter(MOFScriptParameter parameter)
domain
- protected java.lang.String checkType(java.lang.String dtype, MOFScriptObject checkObject)
dtype
- Full name of the type
public void checkStatement(MOFScriptStatement statement, boolean postCheck)
statement
- public java.lang.String findGlobalParameter(java.lang.String name)
exp
- public VariableDeclaration findGlobalVariables(MOFScriptTransformation transformation, java.lang.String name)
name
-
public java.lang.Object findVariable(java.lang.String name)
exp
- public void checkExpression(Expression exp)
exp
- public void checkReference(Reference ref)
ref
- public void checkReferenceName(java.lang.String refName, MOFScriptObject checkObj)
refName
- checkObj
- MofScriptParseError validateTypePrefix(java.lang.String prefix, int metamodel, MOFScriptObject checkObj)
type
- metamodel
-
MofScriptParseError validateType(java.lang.String mm, java.lang.String type, int metamodel, MOFScriptObject checkObj)
mm
- type
- metamodel
- checkObj
-
public void postCheck() throws MofScriptModelException
MofScriptModelException
protected void postCheckUnresolvedReferences()
protected void postCheckExpression(Expression exp)
exp
- protected void postCheckFunctionCall(FunctionCall fc)
fc
- public boolean isSuperTransformation(MOFScriptTransformation transformation, MOFScriptTransformation possibleSuper)
transformation
- possibleSuper
-
protected void setExtendsRelation(MOFScriptTransformation transformation, java.util.Hashtable trHierarchy)
transformation
- trHierarchy
- public void addImportedTransformation(java.lang.String importName, java.lang.String importUri, MOFScriptTransformation importedTr)
importName
- importUri
- importedTr
- protected VariableDeclaration getTempVar()
protected MofScriptParseError checkVariableUsage(VariableDeclaration var, java.lang.String functionCalled, FunctionCall fc)
var
- functionCalled
-
protected MofScriptParseError systemFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError stringFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError listFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError hashtableFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError booleanFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError realFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError integerFunctionOk(java.lang.String functionCalled, FunctionCall fc)
functionCalled
- fc
-
protected MofScriptParseError checkParameterUsage(java.lang.String fName, FunctionCall fc, int requiredParamCount)
fName
- fc
- requiredParamCount
-
protected MofScriptParseError checkParameterUsage(java.lang.String fName, FunctionCall fc, int lowerCount, int upperCount)
fName
- fc
- lowerCount
- upperCount
-
public void printErrors()
public MofScriptErrorManager getErrorManager()
public int getErrorCount()
public java.util.Iterator getErrors()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |