Class Token

java.lang.Object
com.javacc.preprocessor.Token
All Implemented Interfaces:
PreprocessorConstants
Direct Known Subclasses:
InvalidToken

public class Token extends Object implements PreprocessorConstants
  • Constructor Details

  • Method Details

    • setBeginOffset

      public void setBeginOffset(int beginOffset)
      It would be extremely rare that an application programmer would use this method. It needs to be public because it is part of the com.javacc.preprocessor.Node interface.
    • setEndOffset

      public void setEndOffset(int endOffset)
      It would be extremely rare that an application programmer would use this method. It needs to be public because it is part of the com.javacc.preprocessor.Node interface.
    • getTokenSource

      public PreprocessorLexer getTokenSource()
      Returns:
      the PreprocessorLexer object that handles location info for the tokens.
    • setTokenSource

      public void setTokenSource(PreprocessorLexer tokenSource)
      It should be exceedingly rare that an application programmer needs to use this method.
    • getType

      Return the TokenType of this Token object
    • setType

      protected void setType(PreprocessorConstants.TokenType type)
    • isVirtual

      public boolean isVirtual()
      Returns:
      whether this Token represent actual input or was it inserted somehow?
    • isSkipped

      public boolean isSkipped()
      Returns:
      Did we skip this token in parsing?
    • getBeginLine

      public int getBeginLine()
      Returns:
      the (1-based) line location where this Token starts
    • getEndLine

      public int getEndLine()
      Returns:
      the (1-based) line location where this Token ends
    • getBeginColumn

      public int getBeginColumn()
      Returns:
      the (1-based) column where this Token starts
    • getEndColumn

      public int getEndColumn()
      Returns:
      the (1-based) column offset where this Token ends
    • getInputSource

      public String getInputSource()
    • getBeginOffset

      public int getBeginOffset()
    • getEndOffset

      public int getEndOffset()
    • getImage

      public String getImage()
      Returns:
      the string image of the token.
    • getNext

      public final Token getNext()
      Returns:
      the next _cached_ regular (i.e. parsed) token or null
    • getPrevious

      public final Token getPrevious()
      Returns:
      the previous regular (i.e. parsed) token or null
    • nextCachedToken

      public Token nextCachedToken()
      Returns:
      the next token of any sort (parsed or unparsed or invalid)
    • previousCachedToken

      public Token previousCachedToken()
    • replaceType

      public Token replaceType(PreprocessorConstants.TokenType type)
    • getSource

      public String getSource()
    • isUnparsed

      public boolean isUnparsed()
    • setUnparsed

      public void setUnparsed(boolean unparsed)
    • clearChildren

      public void clearChildren()
    • getNormalizedText

      public String getNormalizedText()
    • toString

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

      public Iterator<Token> precedingTokens()
      Returns:
      An iterator of the tokens preceding this one.
    • precedingUnparsedTokens

      public List<Token> precedingUnparsedTokens()
      Returns:
      a list of the unparsed tokens preceding this one in the order they appear in the input
    • followingTokens

      public Iterator<Token> followingTokens()
      Returns:
      An iterator of the (cached) tokens that follow this one.
    • copyLocationInfo

      public void copyLocationInfo(Token from)
    • copyLocationInfo

      public void copyLocationInfo(Token start, Token end)
    • newToken

      public static Token newToken(PreprocessorConstants.TokenType type, PreprocessorLexer tokenSource, int beginOffset, int endOffset)
    • getLocation

      public String getLocation()