|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sonar.c.api.ast.CAstVisitor
public abstract class CAstVisitor
Base class to visit an AST (Abstract Syntactic Tree) generated by a parser. Methods are visited in the following sequential order : init(), visitFile(), visitNode(), leaveNode(), leaveFile() and destroy()
| Field Summary | |
|---|---|
protected CGrammar |
grammar
|
| Constructor Summary | |
|---|---|
CAstVisitor()
|
|
| Method Summary | |
|---|---|
void |
addSourceCode(SourceCode child)
Do not use |
void |
destroy()
Destroy the visitor. |
List<AstNodeType> |
getAstNodeTypesToVisit()
This method can't be overridden. |
protected CGrammar |
getCGrammar()
|
Comments |
getComments()
|
File |
getFile()
|
void |
init()
Initialize the visitor. |
void |
leaveFile(AstNode astNode)
Called once a computation unit tree has been fully visited. |
void |
leaveNode(AstNode astNode)
Called once an AST node has been fully visited. |
void |
onError(Throwable exception)
|
SourceCode |
peekSourceCode()
Do not use |
void |
popSourceCode()
Do not use |
void |
setComments(Comments comments)
Do not use |
void |
setFile(File file)
|
void |
setGrammar(CGrammar grammar)
Do not use |
void |
setSourceCodeStack(Stack<SourceCode> sourceCodeStack)
Do not use |
void |
subscribeTo(AstNodeType... astNodeTypes)
This method must called into the init() method when a Cobol AST visitor wants to subscribe to a set of AST node type. |
void |
visitFile(AstNode astNode)
Called before starting visiting a computation unit tree. |
void |
visitNode(AstNode astNode)
Called to process an AST node whose type has been registered to be visited. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CGrammar grammar
| Constructor Detail |
|---|
public CAstVisitor()
| Method Detail |
|---|
public final List<AstNodeType> getAstNodeTypesToVisit()
getAstNodeTypesToVisit in interface AstVisitorpublic final void subscribeTo(AstNodeType... astNodeTypes)
public final void setSourceCodeStack(Stack<SourceCode> sourceCodeStack)
public final void setGrammar(CGrammar grammar)
public final void setComments(Comments comments)
public final Comments getComments()
public final void addSourceCode(SourceCode child)
public final void popSourceCode()
public final SourceCode peekSourceCode()
public void init()
public void visitFile(AstNode astNode)
visitFile in interface AstVisitorastNode - the root of the treepublic void visitNode(AstNode astNode)
visitNode in interface AstVisitorastNode - the AST node to processpublic void leaveFile(AstNode astNode)
leaveFile in interface AstVisitorastNode - the root of the treepublic void onError(Throwable exception)
public void leaveNode(AstNode astNode)
leaveNode in interface AstVisitorastNode - the AST node which has been visitedpublic void destroy()
public final void setFile(File file)
public final File getFile()
protected final CGrammar getCGrammar()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||