gov.llnl.babel.ast
Class ASTNode

java.lang.Object
  extended by gov.llnl.babel.ast.ASTNode
Direct Known Subclasses:
Argument, Assertion, Attribute, BinaryExpr, Ensures, EnumItem, Extents, FromClause, FuncExpr, Literal, Method, Name, NodeList, Requires, SIDLFile, StructItem, Type, TypeSearchClause, UnaryExpr

public abstract class ASTNode
extends java.lang.Object

Base class for all AST nodes


Field Summary
protected  Token d_firstToken
           
protected  Token d_lastToken
           
protected  ASTNode d_parent
           
protected  ParseTreeNode d_src
           
protected  Symbol d_symbol
           
 
Constructor Summary
ASTNode()
           
ASTNode(ParseTreeNode src, ASTNode parent)
           
 
Method Summary
abstract  java.lang.Object accept(Visitor v, java.lang.Object data)
          implements "Visitor Pattern"
 java.lang.String getFilename()
          If we have information about the sourcecode, traverse parent pointers until we get to a node that knows its filename.
 Token getFirstToken()
           
 Token getLastToken()
           
 ASTNode getParent()
           
 ParseTreeNode getParseTreeNode()
           
 Symbol getSymbolTableEntry()
           
 void setParent(ASTNode node)
           
 void setParserTreeNode(ParseTreeNode src)
           
 void setSymbolTableEntry(Symbol symbol)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

d_firstToken

protected Token d_firstToken

d_lastToken

protected Token d_lastToken

d_parent

protected ASTNode d_parent

d_symbol

protected Symbol d_symbol

d_src

protected ParseTreeNode d_src
Constructor Detail

ASTNode

public ASTNode()

ASTNode

public ASTNode(ParseTreeNode src,
               ASTNode parent)
Parameters:
src - the ParseTreeNode useful for debugging (or null) for generated code
parent - the parent ASTNode.
Method Detail

getFirstToken

public Token getFirstToken()

getLastToken

public Token getLastToken()

getFilename

public java.lang.String getFilename()
If we have information about the sourcecode, traverse parent pointers until we get to a node that knows its filename. Return null if information is not available (or in the case of generated ASTs, not applicable)

Returns:

setParent

public void setParent(ASTNode node)

getParent

public ASTNode getParent()

setParserTreeNode

public void setParserTreeNode(ParseTreeNode src)

getParseTreeNode

public ParseTreeNode getParseTreeNode()

setSymbolTableEntry

public void setSymbolTableEntry(Symbol symbol)

getSymbolTableEntry

public Symbol getSymbolTableEntry()

accept

public abstract java.lang.Object accept(Visitor v,
                                        java.lang.Object data)
implements "Visitor Pattern"

Parameters:
v - The visitor class
data - Optional extra data
Returns:
Optional extra data