cppast
Class SimpleNode

java.lang.Object
  extended by cppast.SimpleNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
AstAdditiveExpression, AstAndExpression, AstAssignmentExpression, AstBreakStatement, AstCaseStatement, AstCastExpression, AstCatchBlock, AstClassDeclaration, AstClassDefinition, AstConditionalExpression, AstConstantExpression, AstConstructorDeclaration, AstConstructorDefinition, AstConstructorInitializer, AstContinueStatement, AstDeclaration, AstDeclarationStatement, AstDefaultStatement, AstDeleteExpression, AstDestructorDeclaration, AstDestructorDefinition, AstElseStatement, AstEnumSpecifier, AstEqualityExpression, AstExclusiveOrExpression, AstExpressionStatement, AstFunctionBody, AstFunctionCallExpression, AstFunctionDeclaration, AstFunctionDefinition, AstFunctionName, AstFunctionParameters, AstFunctionPointerPostfix, AstGotoStatement, AstIdExpression, AstIfStatement, AstInclusiveOrExpression, AstIterationStatement, AstLabelStatement, AstLogicalAndExpression, AstLogicalOrExpression, AstMemberDeclaration, AstMultiplicativeExpression, AstNamespaceAliasDefinition, AstNamespaceDefinition, AstNewExpression, AstParameter, AstParameterType, AstParameterTypeQualifier, AstPointerToMemberExpression, AstPostfixExpression, AstPrimaryExpression, AstRelationalExpression, AstReturnStatement, AstShiftExpression, AstSwitchStatement, AstThrowExpression, AstTranslationUnit, AstTryBlock, AstTypeIdExpression, AstUnaryExpression

public abstract class SimpleNode
extends java.lang.Object
implements Node

Provides a custom base node implementation.

Author:
Mathieu Champlon

Constructor Summary
SimpleNode(int id)
          Create a node.
SimpleNode(Parser parser, int id)
          Create a node.
 
Method Summary
 java.lang.Object accept(ParserVisitor visitor, java.lang.Object data)
          Visit the children of the node.
 void closeScope(Token token)
          Close the node scope.
 Token getFirstToken()
          Retrieve the node first token.
 Token getLastToken()
          Retrive the node last token.
 void jjtAddChild(Node node, int index)
          This method tells the node to add its argument to the node's list of children.
 void jjtClose()
          This method is called after all the child nodes have been added.
 Node jjtGetChild(int index)
          This method returns a child node.
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
          
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtSetParent(Node node)
          This pair of methods are used to inform the node of its parent.
 void openScope(Token token, Scope scope)
          Open the node scope.
 java.lang.String resolve(java.lang.String name)
          Resolve a symbol to a fully scoped name.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cppast.Node
jjtAccept
 

Constructor Detail

SimpleNode

public SimpleNode(int id)
Create a node.

Parameters:
id - the node identifier

SimpleNode

public SimpleNode(Parser parser,
                  int id)
Create a node.

Parameters:
parser - the parser
id - the node identifier
Method Detail

jjtOpen

public final void jjtOpen()
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.

Specified by:
jjtOpen in interface Node

jjtClose

public final void jjtClose()
This method is called after all the child nodes have been added.

Specified by:
jjtClose in interface Node

openScope

public final void openScope(Token token,
                            Scope scope)
Open the node scope.

Parameters:
token - the first token of the node
scope - the scope of the node

closeScope

public final void closeScope(Token token)
Close the node scope.

Parameters:
token - the last token of the node

resolve

public final java.lang.String resolve(java.lang.String name)
Resolve a symbol to a fully scoped name.

Parameters:
name - the symbol
Returns:
a fully scoped symbol name

getFirstToken

public final Token getFirstToken()
Retrieve the node first token.

Returns:
a token

getLastToken

public final Token getLastToken()
Retrive the node last token.

Returns:
a token

jjtSetParent

public final void jjtSetParent(Node node)
This pair of methods are used to inform the node of its parent.

Specified by:
jjtSetParent in interface Node

jjtGetParent

public final Node jjtGetParent()

Specified by:
jjtGetParent in interface Node

jjtAddChild

public final void jjtAddChild(Node node,
                              int index)
This method tells the node to add its argument to the node's list of children.

Specified by:
jjtAddChild in interface Node

jjtGetChild

public final Node jjtGetChild(int index)
This method returns a child node. The children are numbered from zero, left to right.

Specified by:
jjtGetChild in interface Node

jjtGetNumChildren

public final int jjtGetNumChildren()
Return the number of children the node has.

Specified by:
jjtGetNumChildren in interface Node

accept

public final java.lang.Object accept(ParserVisitor visitor,
                                     java.lang.Object data)
Visit the children of the node.

Parameters:
visitor - the visitor
data - the custom data
Returns:
a custom result

toString

public final java.lang.String toString()

Overrides:
toString in class java.lang.Object


Copyright © 2006-2007 null. All Rights Reserved.