biz.hammurapi.antlr
Class AST

java.lang.Object
  extended by antlr.BaseAST
      extended by antlr.CommonAST
          extended by biz.hammurapi.antlr.AST
All Implemented Interfaces:
antlr.collections.AST, SourceMarker, Attributable, Visitable, java.io.Serializable

public class AST
extends antlr.CommonAST
implements SourceMarker, Visitable, Attributable

Holds line and column numbers

Version:
$Revision: 1.8 $
Author:
Pavel Vlasov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
AST()
           
 
Method Summary
 boolean accept(Visitor visitor)
           
 void addChild(antlr.collections.AST node)
          Parent calculation
 void enumerate()
           
 boolean equals(java.lang.Object obj)
           
 AST find(int type)
          Finds AST of given type in this AST and siblings.
 AST findChild(int type)
          Finds child of given type.
 java.lang.Object getAttribute(java.lang.Object key)
           
 int getColumn()
           
 Token getFirstToken()
           
 java.lang.String getId()
           
 Token getLastToken()
           
 int getLeftColumn()
          Returns leftmost non-zero column among itself and all children
 int getLine()
           
 AST getParent()
           
 AST getPrevSibling()
           
 int getSize()
           
 java.lang.Integer getSourceId()
          Crude hack, but can't come up with anything better at the time.
 java.lang.String getSourceURL()
           
 Token getToken()
           
 int hashCode()
           
 void initialize(antlr.collections.AST node)
           
 void initialize(antlr.Token tok)
           
 void print(java.lang.String[] tokenNames, boolean withSiblings)
           
 void print(java.lang.String[] tokenNames, java.io.PrintStream out, int level, boolean withSiblings)
           
 void queryChildren()
          Reads column and line from children if its own are 0.
 void remove()
          Removes AST from tree
 java.lang.Object removeAttribute(java.lang.Object key)
           
 void setAttribute(java.lang.Object key, java.lang.Object value)
           
 void setFirstChild(antlr.collections.AST c)
           
 void setNextSibling(antlr.collections.AST n)
           
protected  void setParent(AST parent)
           
protected  void setPrevSibling(AST prevSibling)
           
 void setSourceURL(java.lang.String sourceURL)
           
 void show(java.lang.String[] tokenNames)
           
 void showWithSiblings(java.lang.String title, java.lang.String[] tokenNames)
           
protected  void tabs(java.io.PrintStream out, int level)
           
protected  void visit(java.lang.String[] tokenNames, AST node, int level, java.io.PrintStream out)
           
protected  void visitAll(java.lang.String[] tokenNames, AST node, int level, java.io.PrintStream out)
           
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AST

public AST()
Method Detail

initialize

public void initialize(antlr.Token tok)
Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class antlr.CommonAST

initialize

public void initialize(antlr.collections.AST node)
Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class antlr.CommonAST

getLine

public int getLine()
Specified by:
getLine in interface antlr.collections.AST
Specified by:
getLine in interface SourceMarker
Overrides:
getLine in class antlr.BaseAST

getColumn

public int getColumn()
Specified by:
getColumn in interface antlr.collections.AST
Specified by:
getColumn in interface SourceMarker
Overrides:
getColumn in class antlr.BaseAST

getToken

public Token getToken()

getLeftColumn

public int getLeftColumn()
Returns leftmost non-zero column among itself and all children


getParent

public AST getParent()

setParent

protected void setParent(AST parent)

addChild

public void addChild(antlr.collections.AST node)
Parent calculation

Specified by:
addChild in interface antlr.collections.AST
Overrides:
addChild in class antlr.BaseAST

setFirstChild

public void setFirstChild(antlr.collections.AST c)
Specified by:
setFirstChild in interface antlr.collections.AST
Overrides:
setFirstChild in class antlr.BaseAST

setNextSibling

public void setNextSibling(antlr.collections.AST n)
Specified by:
setNextSibling in interface antlr.collections.AST
Overrides:
setNextSibling in class antlr.BaseAST

getPrevSibling

public AST getPrevSibling()

setPrevSibling

protected void setPrevSibling(AST prevSibling)

remove

public void remove()
Removes AST from tree


queryChildren

public void queryChildren()
Reads column and line from children if its own are 0. Also sets first and last tokens taking children's into account.


getSourceURL

public java.lang.String getSourceURL()
Specified by:
getSourceURL in interface SourceMarker

setSourceURL

public void setSourceURL(java.lang.String sourceURL)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getSize

public int getSize()

getFirstToken

public Token getFirstToken()

getLastToken

public Token getLastToken()

getId

public java.lang.String getId()

enumerate

public void enumerate()

accept

public boolean accept(Visitor visitor)
Specified by:
accept in interface Visitable
Returns:
visitor.vistit()

getSourceId

public java.lang.Integer getSourceId()
Description copied from interface: SourceMarker
Crude hack, but can't come up with anything better at the time.

Specified by:
getSourceId in interface SourceMarker
Returns:
"Primary key" of source file.

print

public void print(java.lang.String[] tokenNames,
                  boolean withSiblings)

print

public void print(java.lang.String[] tokenNames,
                  java.io.PrintStream out,
                  int level,
                  boolean withSiblings)

tabs

protected void tabs(java.io.PrintStream out,
                    int level)

visit

protected void visit(java.lang.String[] tokenNames,
                     AST node,
                     int level,
                     java.io.PrintStream out)

visitAll

protected void visitAll(java.lang.String[] tokenNames,
                        AST node,
                        int level,
                        java.io.PrintStream out)

show

public void show(java.lang.String[] tokenNames)

showWithSiblings

public void showWithSiblings(java.lang.String title,
                             java.lang.String[] tokenNames)

setAttribute

public void setAttribute(java.lang.Object key,
                         java.lang.Object value)
Specified by:
setAttribute in interface Attributable

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Specified by:
getAttribute in interface Attributable

removeAttribute

public java.lang.Object removeAttribute(java.lang.Object key)
Specified by:
removeAttribute in interface Attributable

find

public AST find(int type)
Finds AST of given type in this AST and siblings.

Parameters:
type -
Returns:

findChild

public AST findChild(int type)
Finds child of given type.

Parameters:
type -


Copyright © 2003 Hammurapi Group. All Rights Reserved.