Class BaseToken

  • Direct Known Subclasses:
    CompoundBaseToken, LeafBaseToken

    public abstract class BaseToken
    extends Object
    BaseToken is the abstract base class for all tokens processed by the low level BaseTokenScanner. The resulting hierarchy represents very simple syntactic elements.
    Author:
    djl 2009.03.14
    • Constructor Detail

      • BaseToken

        public BaseToken()
    • Method Detail

      • isLeaf

        public abstract boolean isLeaf()
        Answer whether this token is a leaf token.
        Returns:
        the answer to the question "is this token a leaf?"
      • isCompound

        public abstract boolean isCompound()
        Answer whether this token is a compound token.
        Returns:
        the answer to the question "is this token compound?"
      • isLiteral

        public boolean isLiteral()
        Answer whether this token represents a literal.
        Returns:
        the answer to the question "is this token a literal?"
      • isOperator

        public boolean isOperator()
        Answer whether this token represents a know operator.
        Returns:
        the answer to the question "is this token an operator?"
      • isIdentifier

        public boolean isIdentifier()
        Answer whether this token represents an identifier.
        Returns:
        the answer to the question "is this token an identifier?"
      • isNest

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

        public boolean isPunctuation()
        Answer whether this token represents a punctuation character.
        Returns:
        the answer to the question "is this token a punctuation character?"
      • match

        public boolean match​(String s)
        Answer whether this token matches the given string. By default case matters.
        Parameters:
        s - the String to match agains
        Returns:
        the answer to the question "does this token match a given string?
      • match

        public abstract boolean match​(String s,
                                      boolean fIgnoreCaseFlag)
        Answer whether this token matches the given string.
        Parameters:
        s - the String to match agains
        fIgnoreCaseFlag - the flag that controls if case matters
        Returns:
        the answer to the question "does this token match a given string?
      • getSimpleName

        public String getSimpleName()
        Return the simple class name for this instance.
        Returns:
        the class name without the package path