antlr
Class TokenStreamHiddenTokenFilter

java.lang.Object
  extended byantlr.TokenStreamBasicFilter
      extended byantlr.TokenStreamHiddenTokenFilter
All Implemented Interfaces:
TokenStream

public class TokenStreamHiddenTokenFilter
extends TokenStreamBasicFilter
implements TokenStream

This object filters a token stream coming from a lexer or another TokenStream so that only certain token channels get transmitted to the parser. Any of the channels can be filtered off as "hidden" channels whose tokens can be accessed from the parser.


Constructor Summary
TokenStreamHiddenTokenFilter(TokenStream input)
           
 
Method Summary
 BitSet getDiscardMask()
           
 CommonHiddenStreamToken getHiddenAfter(CommonHiddenStreamToken t)
          Return a ptr to the hidden token appearing immediately after token t in the input stream.
 CommonHiddenStreamToken getHiddenBefore(CommonHiddenStreamToken t)
          Return a ptr to the hidden token appearing immediately before token t in the input stream.
 BitSet getHideMask()
           
 CommonHiddenStreamToken getInitialHiddenToken()
          Return the first hidden token if one appears before any monitored token.
 void hide(BitSet mask)
           
 void hide(int m)
           
 Token nextToken()
          Return the next monitored token.
 
Methods inherited from class antlr.TokenStreamBasicFilter
discard, discard
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenStreamHiddenTokenFilter

public TokenStreamHiddenTokenFilter(TokenStream input)
Method Detail

getDiscardMask

public BitSet getDiscardMask()

getHiddenAfter

public CommonHiddenStreamToken getHiddenAfter(CommonHiddenStreamToken t)
Return a ptr to the hidden token appearing immediately after token t in the input stream.


getHiddenBefore

public CommonHiddenStreamToken getHiddenBefore(CommonHiddenStreamToken t)
Return a ptr to the hidden token appearing immediately before token t in the input stream.


getHideMask

public BitSet getHideMask()

getInitialHiddenToken

public CommonHiddenStreamToken getInitialHiddenToken()
Return the first hidden token if one appears before any monitored token.


hide

public void hide(int m)

hide

public void hide(BitSet mask)

nextToken

public Token nextToken()
                throws TokenStreamException
Return the next monitored token. Test the token following the monitored token. If following is another monitored token, save it for the next invocation of nextToken (like a single lookahead token) and return it then. If following is unmonitored, nondiscarded (hidden) channel token, add it to the monitored token. Note: EOF must be a monitored Token.

Specified by:
nextToken in interface TokenStream
Overrides:
nextToken in class TokenStreamBasicFilter
Throws:
TokenStreamException