antlr
Class TokenStreamHiddenTokenFilter

java.lang.Object
  |
  +--antlr.TokenStreamBasicFilter
        |
        +--antlr.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.


Field Summary
protected  CommonHiddenStreamToken firstHidden
           
protected  BitSet hideMask
           
protected  CommonHiddenStreamToken lastHiddenToken
          track tail of hidden list emanating from previous monitored token
 
Fields inherited from class antlr.TokenStreamBasicFilter
discardMask, input
 
Constructor Summary
TokenStreamHiddenTokenFilter(TokenStream input)
           
 
Method Summary
protected  void consume()
           
 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)
           
protected  CommonHiddenStreamToken LA(int i)
           
 Token nextToken()
          Return the next monitored token.
 
Methods inherited from class antlr.TokenStreamBasicFilter
discard, discard
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hideMask

protected BitSet hideMask

lastHiddenToken

protected CommonHiddenStreamToken lastHiddenToken
track tail of hidden list emanating from previous monitored token


firstHidden

protected CommonHiddenStreamToken firstHidden
Constructor Detail

TokenStreamHiddenTokenFilter

public TokenStreamHiddenTokenFilter(TokenStream input)
Method Detail

consume

protected void consume()
                throws TokenStreamException
TokenStreamException

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)

LA

protected CommonHiddenStreamToken LA(int i)

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
TokenStreamException


Copyright 1999-2003 Oliver Zeigermann. All Rights Reserved.