Package antlr
Class TokenStreamHiddenTokenFilter
java.lang.Object
antlr.TokenStreamBasicFilter
antlr.TokenStreamHiddenTokenFilter
- All Implemented Interfaces:
IASDebugStream
,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
FieldsModifier and TypeFieldDescriptionprotected CommonHiddenStreamToken
protected BitSet
protected CommonHiddenStreamToken
track tail of hidden list emanating from previous monitored tokenprotected CommonHiddenStreamToken
Fields inherited from class antlr.TokenStreamBasicFilter
discardMask, input
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
consume()
Return a ptr to the hidden token appearing immediately after token t in the input stream.Return a ptr to the hidden token appearing immediately before token t in the input stream.Return the first hidden token if one appears before any monitored token.void
hide
(int m) void
protected CommonHiddenStreamToken
LA
(int i) Return the next monitored token.Methods inherited from class antlr.TokenStreamBasicFilter
discard, discard, getEntireText, getOffsetInfo
-
Field Details
-
hideMask
-
nextMonitoredToken
-
lastHiddenToken
track tail of hidden list emanating from previous monitored token -
firstHidden
-
-
Constructor Details
-
TokenStreamHiddenTokenFilter
-
-
Method Details
-
consume
- Throws:
TokenStreamException
-
getDiscardMask
-
getHiddenAfter
Return a ptr to the hidden token appearing immediately after token t in the input stream. -
getHiddenBefore
Return a ptr to the hidden token appearing immediately before token t in the input stream. -
getHideMask
-
getInitialHiddenToken
Return the first hidden token if one appears before any monitored token. -
hide
public void hide(int m) -
hide
-
LA
-
nextToken
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 interfaceTokenStream
- Overrides:
nextToken
in classTokenStreamBasicFilter
- Throws:
TokenStreamException
-