antlr

Class TokenStreamHiddenTokenFilter

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
protected CommonHiddenStreamToken
nextMonitoredToken

Fields inherited from class antlr.TokenStreamBasicFilter

discardMask, input

Constructor Summary

TokenStreamHiddenTokenFilter(TokenStream input)

Method Summary

protected CommonHiddenStreamToken
LA(int i)
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)
Token
nextToken()
Return the next monitored token.

Methods inherited from class antlr.TokenStreamBasicFilter

discard, discard, nextToken

Field Details

firstHidden

protected CommonHiddenStreamToken firstHidden


hideMask

protected BitSet hideMask


lastHiddenToken

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


nextMonitoredToken

protected CommonHiddenStreamToken nextMonitoredToken

Constructor Details

TokenStreamHiddenTokenFilter

public TokenStreamHiddenTokenFilter(TokenStream input)

Method Details

LA

protected CommonHiddenStreamToken LA(int i)


consume

protected void consume()
            throws 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(BitSet mask)


hide

public void hide(int m)


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 interface TokenStreamBasicFilter