Package com.javacc.preprocessor
Class Token
java.lang.Object
com.javacc.preprocessor.Token
- All Implemented Interfaces:
PreprocessorConstants
- Direct Known Subclasses:
InvalidToken
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.javacc.preprocessor.PreprocessorConstants
PreprocessorConstants.LexicalState, PreprocessorConstants.TokenType -
Field Summary
Fields inherited from interface com.javacc.preprocessor.PreprocessorConstants
BUF_SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedToken()Token(PreprocessorConstants.TokenType type, PreprocessorLexer tokenSource, int beginOffset, int endOffset) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcopyLocationInfo(Token from) voidcopyLocationInfo(Token start, Token end) intintintintintintgetImage()final TokengetNext()final TokengetType()Return the TokenType of this Token objectbooleanbooleanbooleanstatic TokennewToken(PreprocessorConstants.TokenType type, PreprocessorLexer tokenSource, int beginOffset, int endOffset) voidsetBeginOffset(int beginOffset) It would be extremely rare that an application programmer would use this method.voidsetEndOffset(int endOffset) It would be extremely rare that an application programmer would use this method.voidsetTokenSource(PreprocessorLexer tokenSource) It should be exceedingly rare that an application programmer needs to use this method.protected voidvoidsetUnparsed(boolean unparsed) toString()
-
Constructor Details
-
Token
protected Token() -
Token
public Token(PreprocessorConstants.TokenType type, PreprocessorLexer tokenSource, int beginOffset, int endOffset)
-
-
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
- Returns:
- the PreprocessorLexer object that handles location info for the tokens.
-
setTokenSource
It should be exceedingly rare that an application programmer needs to use this method. -
getType
Return the TokenType of this Token object -
setType
-
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
-
getBeginOffset
public int getBeginOffset() -
getEndOffset
public int getEndOffset() -
getImage
- Returns:
- the string image of the token.
-
getNext
- Returns:
- the next _cached_ regular (i.e. parsed) token or null
-
getPrevious
- Returns:
- the previous regular (i.e. parsed) token or null
-
nextCachedToken
- Returns:
- the next token of any sort (parsed or unparsed or invalid)
-
previousCachedToken
-
replaceType
-
getSource
-
isUnparsed
public boolean isUnparsed() -
setUnparsed
public void setUnparsed(boolean unparsed) -
clearChildren
public void clearChildren() -
getNormalizedText
-
toString
-
precedingTokens
- Returns:
- An iterator of the tokens preceding this one.
-
precedingUnparsedTokens
- Returns:
- a list of the unparsed tokens preceding this one in the order they appear in the input
-
followingTokens
- Returns:
- An iterator of the (cached) tokens that follow this one.
-
copyLocationInfo
-
copyLocationInfo
-
newToken
public static Token newToken(PreprocessorConstants.TokenType type, PreprocessorLexer tokenSource, int beginOffset, int endOffset) -
getLocation
-