ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/antlr/TokenStreamBasicFilter.cpp
Revision: 2469
Committed: Fri Dec 2 15:38:03 2005 UTC (18 years, 7 months ago) by tim
File size: 965 byte(s)
Log Message:
End of the Link --> List
Return of the Oject-Oriented
replace yacc/lex parser with antlr parser

File Contents

# Content
1 /* ANTLR Translator Generator
2 * Project led by Terence Parr at http://www.jGuru.com
3 * Software rights: http://www.antlr.org/license.html
4 *
5 * $Id: TokenStreamBasicFilter.cpp,v 1.1 2005-12-02 15:38:02 tim Exp $
6 */
7 #include "antlr/TokenStreamBasicFilter.hpp"
8
9 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
10 namespace antlr {
11 #endif
12
13 /** This object is a TokenStream that passes through all
14 * tokens except for those that you tell it to discard.
15 * There is no buffering of the tokens.
16 */
17 TokenStreamBasicFilter::TokenStreamBasicFilter(TokenStream& input_)
18 : input(&input_)
19 {
20 }
21
22 void TokenStreamBasicFilter::discard(int ttype)
23 {
24 discardMask.add(ttype);
25 }
26
27 void TokenStreamBasicFilter::discard(const BitSet& mask)
28 {
29 discardMask = mask;
30 }
31
32 RefToken TokenStreamBasicFilter::nextToken()
33 {
34 RefToken tok = input->nextToken();
35 while ( tok && discardMask.member(tok->getType()) ) {
36 tok = input->nextToken();
37 }
38 return tok;
39 }
40
41 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
42 }
43 #endif
44