~ubuntu-branches/ubuntu/breezy/antlr/breezy

« back to all changes in this revision

Viewing changes to lib/csharp/src/antlr/TokenStreamBasicFilter.cs

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-06-29 16:11:22 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050629161122-g81crc3z92p5xhsg
Tags: 2.7.5-6ubuntu4
Build depend on java-gcj-compat-dev, depend on java-gcj-compat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
using BitSet = antlr.collections.impl.BitSet;
3
 
        
4
 
namespace antlr
5
 
{
6
 
        /*ANTLR Translator Generator
7
 
        * Project led by Terence Parr at http://www.jGuru.com
8
 
        * Software rights: http://www.antlr.org/license.html
9
 
        *
10
 
        * $Id: $
11
 
        */
12
 
 
13
 
        //
14
 
        // ANTLR C# Code Generator by Micheal Jordan
15
 
        //                            Kunle Odutola       : kunle UNDERSCORE odutola AT hotmail DOT com
16
 
        //                            Anthony Oguntimehin
17
 
        //
18
 
        // With many thanks to Eric V. Smith from the ANTLR list.
19
 
        //
20
 
 
21
 
        /*This object is a TokenStream that passes through all
22
 
        *  tokens except for those that you tell it to discard.
23
 
        *  There is no buffering of the tokens.
24
 
        */
25
 
        public class TokenStreamBasicFilter : TokenStream
26
 
        {
27
 
                /*The set of token types to discard */
28
 
                protected internal BitSet discardMask;
29
 
                
30
 
                /*The input stream */
31
 
                protected internal TokenStream input;
32
 
                
33
 
                public TokenStreamBasicFilter(TokenStream input)
34
 
                {
35
 
                        this.input = input;
36
 
                        discardMask = new BitSet();
37
 
                }
38
 
                public virtual void  discard(int ttype)
39
 
                {
40
 
                        discardMask.add(ttype);
41
 
                }
42
 
                public virtual void  discard(BitSet mask)
43
 
                {
44
 
                        discardMask = mask;
45
 
                }
46
 
                public virtual Token nextToken()
47
 
                {
48
 
                        Token tok = input.nextToken();
49
 
                        while (tok != null && discardMask.member(tok.Type))
50
 
                        {
51
 
                                tok = input.nextToken();
52
 
                        }
53
 
                        return tok;
54
 
                }
55
 
        }
 
1
using System;
 
2
using BitSet = antlr.collections.impl.BitSet;
 
3
        
 
4
namespace antlr
 
5
{
 
6
        /*ANTLR Translator Generator
 
7
        * Project led by Terence Parr at http://www.jGuru.com
 
8
        * Software rights: http://www.antlr.org/license.html
 
9
        *
 
10
        * $Id:$
 
11
        */
 
12
 
 
13
        //
 
14
        // ANTLR C# Code Generator by Micheal Jordan
 
15
        //                            Kunle Odutola       : kunle UNDERSCORE odutola AT hotmail DOT com
 
16
        //                            Anthony Oguntimehin
 
17
        //
 
18
        // With many thanks to Eric V. Smith from the ANTLR list.
 
19
        //
 
20
 
 
21
        /*This object is a TokenStream that passes through all
 
22
        *  tokens except for those that you tell it to discard.
 
23
        *  There is no buffering of the tokens.
 
24
        */
 
25
        public class TokenStreamBasicFilter : TokenStream
 
26
        {
 
27
                /*The set of token types to discard */
 
28
                protected internal BitSet discardMask;
 
29
                
 
30
                /*The input stream */
 
31
                protected internal TokenStream input;
 
32
                
 
33
                public TokenStreamBasicFilter(TokenStream input)
 
34
                {
 
35
                        this.input = input;
 
36
                        discardMask = new BitSet();
 
37
                }
 
38
                public virtual void  discard(int ttype)
 
39
                {
 
40
                        discardMask.add(ttype);
 
41
                }
 
42
                public virtual void  discard(BitSet mask)
 
43
                {
 
44
                        discardMask = mask;
 
45
                }
 
46
                public virtual IToken nextToken()
 
47
                {
 
48
                        IToken tok = input.nextToken();
 
49
                        while (tok != null && discardMask.member(tok.Type))
 
50
                        {
 
51
                                tok = input.nextToken();
 
52
                        }
 
53
                        return tok;
 
54
                }
 
55
        }
56
56
}
 
 
b'\\ No newline at end of file'