Class NestedBaseTokens


public class NestedBaseTokens extends CompoundBaseToken
NestedBaseTokens is a token that holds a sequence of tokens as well as the two bracketing characters. This nesting of tokens makes many algorithms easier in the higher levels of a parser.
Author:
djl 2009.03.14
  • Constructor Details

    • NestedBaseTokens

      public NestedBaseTokens(char chStart, char chEnd, BaseToken[] aTokens)
      Construct a new NestedBaseTokens with the given parameters.
      Parameters:
      chStart - the character that starts the nesting
      chEnd - the character that ends the nesting
      aTokens - the right argument for the node
  • Method Details

    • getTokens

      public BaseToken[] getTokens()
      Return an array of BaseTokens making up the receiver.
      Specified by:
      getTokens in class CompoundBaseToken
      Returns:
      the an array of BaseTokens making up the receiver.
    • isNest

      public boolean isNest()
      Answer whether this token represents a nested collection of tokens.
      Overrides:
      isNest in class BaseToken
      Returns:
      the answer to the question "is this token a nesting of tokens?"
    • getNestStart

      public char getNestStart()
      Obtain the character that begins the nesting.
      Returns:
      the character that begings the nesting
    • getNestEnd

      public char getNestEnd()
      Obtain the character that ends the nesting.
      Returns:
      the character that ends the nesting
    • toString

      public String toString()
      Return a human-readable description for this token.
      Overrides:
      toString in class CompoundBaseToken
      Returns:
      a String description of the token