Class DetailAST

  • All Implemented Interfaces:
    antlr.collections.AST, java.io.Serializable

    public final class DetailAST
    extends antlr.CommonASTWithHiddenTokens
    An extension of the CommonAST that records the line and column number.
    See Also:
    ANTLR Website, Serialized Form
    • Field Summary

      • Fields inherited from class antlr.CommonASTWithHiddenTokens

        hiddenAfter, hiddenBefore
      • Fields inherited from class antlr.BaseAST

        down, right
    • Constructor Summary

      Constructors 
      Constructor Description
      DetailAST()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(antlr.collections.AST ast)  
      void addNextSibling​(DetailAST ast)
      Add next sibling.
      void addPreviousSibling​(DetailAST ast)
      Add previous sibling.
      boolean branchContains​(int type)
      Checks if this branch of the parse tree contains a token of the provided type.
      DetailAST findFirstToken​(int type)
      Returns the first child token that makes a specified type.
      int getChildCount()
      Returns the number of child nodes one level below this node.
      int getChildCount​(int type)
      Returns the number of direct child tokens that have the specified type.
      int getColumnNo()
      Gets column number.
      DetailAST getFirstChild()  
      DetailAST getLastChild()
      Gets the last child node.
      int getLineNo()
      Gets line number.
      DetailAST getNextSibling()  
      DetailAST getParent()
      Returns the parent token.
      DetailAST getPreviousSibling()
      Returns the previous sibling or null if no such sibling exists.
      void initialize​(antlr.collections.AST ast)  
      void initialize​(antlr.Token tok)  
      void setColumnNo​(int columnNo)
      Set column number.
      void setFirstChild​(antlr.collections.AST ast)  
      void setLineNo​(int lineNo)
      Set line number.
      void setNextSibling​(antlr.collections.AST ast)  
      java.lang.String toString()  
      • Methods inherited from class antlr.CommonASTWithHiddenTokens

        getHiddenAfter, getHiddenBefore
      • 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, getColumn, getLine, getNumberOfChildren, getTokenNames, removeChildren, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DetailAST

        public DetailAST()
    • Method Detail

      • initialize

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

        public void initialize​(antlr.collections.AST ast)
        Specified by:
        initialize in interface antlr.collections.AST
        Overrides:
        initialize in class antlr.CommonASTWithHiddenTokens
      • setFirstChild

        public void setFirstChild​(antlr.collections.AST ast)
        Specified by:
        setFirstChild in interface antlr.collections.AST
        Overrides:
        setFirstChild in class antlr.BaseAST
      • setNextSibling

        public void setNextSibling​(antlr.collections.AST ast)
        Specified by:
        setNextSibling in interface antlr.collections.AST
        Overrides:
        setNextSibling in class antlr.BaseAST
      • addPreviousSibling

        public void addPreviousSibling​(DetailAST ast)
        Add previous sibling.
        Parameters:
        ast - DetailAST object.
      • addNextSibling

        public void addNextSibling​(DetailAST ast)
        Add next sibling.
        Parameters:
        ast - DetailAST object.
      • addChild

        public void addChild​(antlr.collections.AST ast)
        Specified by:
        addChild in interface antlr.collections.AST
        Overrides:
        addChild in class antlr.BaseAST
      • getChildCount

        public int getChildCount()
        Returns the number of child nodes one level below this node. That is is does not recurse down the tree.
        Returns:
        the number of child nodes
      • getChildCount

        public int getChildCount​(int type)
        Returns the number of direct child tokens that have the specified type.
        Parameters:
        type - the token type to match
        Returns:
        the number of matching token
      • getParent

        public DetailAST getParent()
        Returns the parent token.
        Returns:
        the parent token
      • getLineNo

        public int getLineNo()
        Gets line number.
        Returns:
        the line number
      • setLineNo

        public void setLineNo​(int lineNo)
        Set line number.
        Parameters:
        lineNo - line number.
      • getColumnNo

        public int getColumnNo()
        Gets column number.
        Returns:
        the column number
      • setColumnNo

        public void setColumnNo​(int columnNo)
        Set column number.
        Parameters:
        columnNo - column number.
      • getLastChild

        public DetailAST getLastChild()
        Gets the last child node.
        Returns:
        the last child node
      • branchContains

        public boolean branchContains​(int type)
        Checks if this branch of the parse tree contains a token of the provided type.
        Parameters:
        type - a TokenType
        Returns:
        true if and only if this branch (including this node) contains a token of type type.
      • getPreviousSibling

        public DetailAST getPreviousSibling()
        Returns the previous sibling or null if no such sibling exists.
        Returns:
        the previous sibling or null if no such sibling exists.
      • findFirstToken

        public DetailAST findFirstToken​(int type)
        Returns the first child token that makes a specified type.
        Parameters:
        type - the token type to match
        Returns:
        the matching token, or null if no match
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface antlr.collections.AST
        Overrides:
        toString in class antlr.BaseAST
      • getNextSibling

        public DetailAST getNextSibling()
        Specified by:
        getNextSibling in interface antlr.collections.AST
        Overrides:
        getNextSibling in class antlr.BaseAST
      • getFirstChild

        public DetailAST getFirstChild()
        Specified by:
        getFirstChild in interface antlr.collections.AST
        Overrides:
        getFirstChild in class antlr.BaseAST