OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
TokenStreamHiddenTokenFilter.hpp
1#ifndef INC_TokenStreamHiddenTokenFilter_hpp__
2#define INC_TokenStreamHiddenTokenFilter_hpp__
3
4/* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
7 *
8 * $Id$
9 */
10
11#include <antlr/config.hpp>
12#include <antlr/TokenStreamBasicFilter.hpp>
13
14#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
15namespace antlr {
16#endif
17
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.
21 *
22 * Any of the channels can be filtered off as "hidden" channels whose
23 * tokens can be accessed from the parser.
24 */
26 // protected BitSet discardMask;
27protected:
28 BitSet hideMask;
29
30private:
31 RefToken nextMonitoredToken;
32
33protected:
34 /** track tail of hidden list emanating from previous
35 * monitored token
36 */
38
39 RefToken firstHidden; // = null;
40
41public:
43
44protected:
45 void consume();
46
47private:
48 void consumeFirst();
49
50public:
51 BitSet getDiscardMask() const;
52
53 /** Return a ptr to the hidden token appearing immediately after
54 * token t in the input stream.
55 */
56 RefToken getHiddenAfter(RefToken t);
57
58 /** Return a ptr to the hidden token appearing immediately before
59 * token t in the input stream.
60 */
61 RefToken getHiddenBefore(RefToken t);
62
63 BitSet getHideMask() const;
64
65 /** Return the first hidden token if one appears
66 * before any monitored token.
67 */
68 RefToken getInitialHiddenToken();
69
70 void hide(int m);
71
72 void hide(const BitSet& mask);
73
74protected:
75 RefToken LA(int i);
76
77public:
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.
85 *
86 * Note: EOF must be a monitored Token.
87 */
88 RefToken nextToken();
89};
90
91#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
92}
93#endif
94
95#endif //INC_TokenStreamHiddenTokenFilter_hpp__
A BitSet to replace java.util.BitSet.
Definition BitSet.hpp:40
This object is a TokenStream that passes through all tokens except for those that you tell it to disc...
This object filters a token stream coming from a lexer or another TokenStream so that only certain to...
RefToken lastHiddenToken
track tail of hidden list emanating from previous monitored token
This interface allows any object to pretend it is a stream of tokens.