antlr
Class TokenStreamBasicFilter

java.lang.Object
  extended by 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
protected  BitSet discardMask
          The set of token types to discard
protected  TokenStream input
          The input stream
 
Constructor Summary
TokenStreamBasicFilter(TokenStream input)
           
 
Method Summary
 void discard(BitSet mask)
           
 void discard(int ttype)
           
 java.lang.String getEntireText()
          Returns the entire text input to the lexer.
 TokenOffsetInfo getOffsetInfo(Token token)
          Returns the offset information for the token
 Token nextToken()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface TokenStream
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 interface IASDebugStream
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 interface IASDebugStream
Parameters:
token - the token whose information need to be retrieved
Returns:
offset info, or null