public class AntlrModelResolverVisitor extends AntlrAstVisitor
After this visitor is done, all IModelReference elements
within the rule will have been resolved, or the relevant errors raised.
This visitor cannot, in the same iteration, check that all references are also appropriate. For
example, it will not check that in the comparison date = '2005-12-30', the
date reference is an attribute rather than a model element. This is done using type
checking later.
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,IVariableDeclaration> |
globalVariables |
| Constructor and Description |
|---|
AntlrModelResolverVisitor(IClassifier ruleContext,
IModelCollection models,
Map<String,IVariableDeclaration> globalVariables,
List<NRLError> errors)
Initialize a constraint visitor with a rule context classifier, the model, a map of global
variables and an error list to populate.
|
AntlrModelResolverVisitor(IClassifier ruleContext,
IModelCollection models,
Map<String,IVariableDeclaration> globalVariables,
List<Variable> contextVariables,
List<NRLError> errors) |
AntlrModelResolverVisitor(IModelCollection models,
Map<String,IVariableDeclaration> globalVariables,
List<Variable> contextVariables,
List<NRLError> errors) |
| Modifier and Type | Method and Description |
|---|---|
void |
bindVariable(IVariable var,
INRLAstNode declarationNode,
boolean checkDuplicates) |
protected IModelElement |
getCurrentContext() |
protected Stack<IModelElement> |
getCurrentContextStack() |
List<NRLError> |
getErrors() |
protected IModelCollection |
getModels() |
protected IClassifier |
getRuleContext() |
VariableContext |
getVariableContext() |
void |
pushCurrentContext(IModelElement context)
Explicitly push a model element on the current context stack.
|
protected void |
raiseError(INRLAstNode node,
int statusCode,
String message) |
protected void |
raiseError(ModelReferenceImpl ref,
int statusCode,
String message)
Convenience method to add an error to the error list, for a particular model reference
|
protected void |
visitAfter(Antlr3NRLBaseAst node)
Visit the current node and pop the context stack where necessary, for example when a
quantifier goes out of scope.
|
protected boolean |
visitBefore(Antlr3NRLBaseAst node)
Visit the current node and keep the "current context" up to date.
|
visitAfter, visitBeforeprotected Map<String,IVariableDeclaration> globalVariables
public AntlrModelResolverVisitor(IClassifier ruleContext, IModelCollection models, Map<String,IVariableDeclaration> globalVariables, List<NRLError> errors)
ruleContext - models - globalVariables - errors - public AntlrModelResolverVisitor(IClassifier ruleContext, IModelCollection models, Map<String,IVariableDeclaration> globalVariables, List<Variable> contextVariables, List<NRLError> errors)
public AntlrModelResolverVisitor(IModelCollection models, Map<String,IVariableDeclaration> globalVariables, List<Variable> contextVariables, List<NRLError> errors)
public void bindVariable(IVariable var, INRLAstNode declarationNode, boolean checkDuplicates)
protected IModelCollection getModels()
protected IModelElement getCurrentContext()
protected Stack<IModelElement> getCurrentContextStack()
protected IClassifier getRuleContext()
public VariableContext getVariableContext()
public void pushCurrentContext(IModelElement context)
context - the new context elementprotected boolean visitBefore(Antlr3NRLBaseAst node)
The method also keeps the variable context up to date.
visitBefore in class AntlrAstVisitorprotected void visitAfter(Antlr3NRLBaseAst node)
Also pop the variable stack when variables go out of scope.
visitAfter in class AntlrAstVisitorprotected void raiseError(ModelReferenceImpl ref, int statusCode, String message)
ref - the model referencestatusCode - the error status codemessage - the messageprotected void raiseError(INRLAstNode node, int statusCode, String message)
Copyright © 2006-2013. All Rights Reserved.