antlr
Class TokenStreamHiddenTokenFilter
- TokenStream
public class TokenStreamHiddenTokenFilter
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.
hideMask
protected BitSet hideMask
lastHiddenToken
protected CommonHiddenStreamToken lastHiddenToken
track tail of hidden list emanating from previous
monitored token
TokenStreamHiddenTokenFilter
public TokenStreamHiddenTokenFilter(TokenStream input)
getDiscardMask
public BitSet getDiscardMask()
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.
- nextToken in interface TokenStream
- nextToken in interface TokenStreamBasicFilter