1
#ifndef INC_TokenStreamHiddenTokenFilter_hpp__
2
#define INC_TokenStreamHiddenTokenFilter_hpp__
4
/* ANTLR Translator Generator
5
* Project led by Terence Parr at http://www.jGuru.com
6
* Software rights: http://www.antlr.org/license.html
8
* $Id: TokenStreamHiddenTokenFilter.hpp 626096 2007-01-22 06:35:06Z okellogg $
11
#include <antlr/config.hpp>
12
#include <antlr/TokenStreamBasicFilter.hpp>
14
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
18
/**This object filters a token stream coming from a lexer
19
* or another TokenStream so that only certain token channels
20
* get transmitted to the parser.
22
* Any of the channels can be filtered off as "hidden" channels whose
23
* tokens can be accessed from the parser.
25
class ANTLR_API TokenStreamHiddenTokenFilter : public TokenStreamBasicFilter {
26
// protected BitSet discardMask;
31
RefToken nextMonitoredToken;
34
/** track tail of hidden list emanating from previous
37
RefToken lastHiddenToken;
39
RefToken firstHidden; // = null;
42
TokenStreamHiddenTokenFilter(TokenStream& input);
51
BitSet getDiscardMask() const;
53
/** Return a ptr to the hidden token appearing immediately after
54
* token t in the input stream.
56
RefToken getHiddenAfter(RefToken t);
58
/** Return a ptr to the hidden token appearing immediately before
59
* token t in the input stream.
61
RefToken getHiddenBefore(RefToken t);
63
BitSet getHideMask() const;
65
/** Return the first hidden token if one appears
66
* before any monitored token.
68
RefToken getInitialHiddenToken();
72
void hide(const BitSet& mask);
78
/** Return the next monitored token.
79
* Test the token following the monitored token.
80
* If following is another monitored token, save it
81
* for the next invocation of nextToken (like a single
82
* lookahead token) and return it then.
83
* If following is unmonitored, nondiscarded (hidden)
84
* channel token, add it to the monitored token.
86
* Note: EOF must be a monitored Token.
91
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
95
#endif //INC_TokenStreamHiddenTokenFilter_hpp__