Class ClangTokenGroup

java.lang.Object
ghidra.app.decompiler.ClangTokenGroup
All Implemented Interfaces:
ClangNode, Iterable<ClangNode>
Direct Known Subclasses:
ClangFuncProto, ClangFunction, ClangReturnType, ClangStatement, ClangVariableDecl

public class ClangTokenGroup extends Object implements ClangNode, Iterable<ClangNode>
A sequence of tokens that form a meaningful group in source code. This group may break up into subgroups and may be part of a larger group.
  • Constructor Details

    • ClangTokenGroup

      public ClangTokenGroup(ClangNode par)
  • Method Details

    • getMinAddress

      public Address getMinAddress()
      Description copied from interface: ClangNode
      Get the smallest Program address associated with the code that this text represents
      Specified by:
      getMinAddress in interface ClangNode
      Returns:
      the smallest Address
    • getMaxAddress

      public Address getMaxAddress()
      Description copied from interface: ClangNode
      Get the biggest Program address associated with the code that this text represents
      Specified by:
      getMaxAddress in interface ClangNode
      Returns:
      the biggest Address
    • AddTokenGroup

      public void AddTokenGroup(ClangNode obj)
      Add additional text to this group
      Parameters:
      obj - is the additional text
    • Parent

      public ClangNode Parent()
      Description copied from interface: ClangNode
      Get the immediate grouping (parent) containing this text element. If this is a complete document, null is returned.
      Specified by:
      Parent in interface ClangNode
      Returns:
      the parent grouping or null
    • numChildren

      public int numChildren()
      Description copied from interface: ClangNode
      Return the number of immediate groupings this text breaks up into
      Specified by:
      numChildren in interface ClangNode
      Returns:
      the number of child groupings
    • Child

      public ClangNode Child(int i)
      Description copied from interface: ClangNode
      Get the i-th child grouping
      Specified by:
      Child in interface ClangNode
      Parameters:
      i - is the index selecting the grouping
      Returns:
      the selected grouping
    • getClangFunction

      public ClangFunction getClangFunction()
      Description copied from interface: ClangNode
      Get the text representing an entire function of which this is part.
      Specified by:
      getClangFunction in interface ClangNode
      Returns:
      text for the whole function
    • setHighlight

      public void setHighlight(Color val)
      Description copied from interface: ClangNode
      Set a highlighting background color for all text elements
      Specified by:
      setHighlight in interface ClangNode
      Parameters:
      val - is the color to set
    • flatten

      public void flatten(List<ClangNode> list)
      Description copied from interface: ClangNode
      Flatten this text into a list of tokens (see ClangToken)
      Specified by:
      flatten in interface ClangNode
      Parameters:
      list - is the container that will contain the tokens
    • decode

      public void decode(Decoder decoder, PcodeFactory pfactory) throws DecoderException
      Decode this text from an encoded stream.
      Parameters:
      decoder - is the decoder for the stream
      pfactory - is used to look up p-code attributes to associate with tokens
      Throws:
      DecoderException - for problems decoding the stream
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<ClangNode> iterator()
      Specified by:
      iterator in interface Iterable<ClangNode>
    • tokenIterator

      public Iterator<ClangToken> tokenIterator(boolean forward)
      Create iterator across all ClangToken objects in this group. The iterator will run over tokens in display order (forward=true) or in reverse of display order (forward=false)
      Parameters:
      forward - is true for a forward iterator, false for a backward iterator
      Returns:
      the iterator
    • stream

      public Stream<ClangNode> stream()
      Gets a stream over this group's children
      Returns:
      a stream of this group's children