Package antlr
Class TokenStreamBasicFilter
- java.lang.Object
-
- antlr.TokenStreamBasicFilter
-
- All Implemented Interfaces:
IASDebugStream,TokenStream
- Direct Known Subclasses:
TokenStreamHiddenTokenFilter
public class TokenStreamBasicFilter extends java.lang.Object implements TokenStream, IASDebugStream
This object is a TokenStream that passes through all tokens except for those that you tell it to discard. There is no buffering of the tokens.
-
-
Field Summary
Fields Modifier and Type Field Description protected BitSetdiscardMaskThe set of token types to discardprotected TokenStreaminputThe input stream
-
Constructor Summary
Constructors Constructor Description TokenStreamBasicFilter(TokenStream input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddiscard(int ttype)voiddiscard(BitSet mask)java.lang.StringgetEntireText()Returns the entire text input to the lexer.TokenOffsetInfogetOffsetInfo(Token token)Returns the offset information for the tokenTokennextToken()
-
-
-
Field Detail
-
discardMask
protected BitSet discardMask
The set of token types to discard
-
input
protected TokenStream input
The input stream
-
-
Constructor Detail
-
TokenStreamBasicFilter
public TokenStreamBasicFilter(TokenStream input)
-
-
Method Detail
-
discard
public void discard(int ttype)
-
discard
public void discard(BitSet mask)
-
nextToken
public Token nextToken() throws TokenStreamException
- Specified by:
nextTokenin interfaceTokenStream- Throws:
TokenStreamException
-
getEntireText
public java.lang.String getEntireText()
Description copied from interface:IASDebugStreamReturns the entire text input to the lexer.- Specified by:
getEntireTextin interfaceIASDebugStream- Returns:
- The entire text or
null, if error occured or System.in was used.
-
getOffsetInfo
public TokenOffsetInfo getOffsetInfo(Token token)
Description copied from interface:IASDebugStreamReturns the offset information for the token- Specified by:
getOffsetInfoin interfaceIASDebugStream- Parameters:
token- the token whose information need to be retrieved- Returns:
- offset info, or
null
-
-