|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nrl.parser.ast.impl.AntlrAstVisitor
net.sourceforge.nrl.parser.ast.impl.AntlrModelResolverVisitor
public class AntlrModelResolverVisitor
A visitor for resolving a single rule. Given a model, and an initial rule context, this visitor resolves all model references in the rule.
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.
Field Summary | |
---|---|
protected Map<String,IVariableDeclaration> |
globalVariables
|
Constructor Summary | |
---|---|
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)
|
Method Summary | |
---|---|
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. |
Methods inherited from class net.sourceforge.nrl.parser.ast.impl.AntlrAstVisitor |
---|
visitAfter, visitBefore |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map<String,IVariableDeclaration> globalVariables
Constructor Detail |
---|
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)
Method Detail |
---|
public void bindVariable(IVariable var, INRLAstNode declarationNode, boolean checkDuplicates)
public List<NRLError> getErrors()
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 AntlrAstVisitor
protected void visitAfter(Antlr3NRLBaseAst node)
Also pop the variable stack when variables go out of scope.
visitAfter
in class AntlrAstVisitor
protected 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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |