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 BitSet
discardMask
The set of token types to discardprotected TokenStream
input
The input stream
-
Constructor Summary
Constructors Constructor Description TokenStreamBasicFilter(TokenStream input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
discard(int ttype)
void
discard(BitSet mask)
java.lang.String
getEntireText()
Returns the entire text input to the lexer.TokenOffsetInfo
getOffsetInfo(Token token)
Returns the offset information for the tokenToken
nextToken()
-
-
-
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:
nextToken
in interfaceTokenStream
- Throws:
TokenStreamException
-
getEntireText
public java.lang.String getEntireText()
Description copied from interface:IASDebugStream
Returns the entire text input to the lexer.- Specified by:
getEntireText
in 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:IASDebugStream
Returns the offset information for the token- Specified by:
getOffsetInfo
in interfaceIASDebugStream
- Parameters:
token
- the token whose information need to be retrieved- Returns:
- offset info, or
null
-
-