boolangstudio /Dependencies/boo/lib/antlr-2.7.5/lib/csharp/src/antlr/TokenStreamBasicFilter.cs

Language C# Lines 56
MD5 Hash eb2afd9cc062e06865b39076b9f3d44a Estimated Cost $728 (why?)
Repository https://github.com/w4x/boolangstudio.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using BitSet = antlr.collections.impl.BitSet;
	
namespace antlr
{
	/*ANTLR Translator Generator
	* Project led by Terence Parr at http://www.jGuru.com
	* Software rights: http://www.antlr.org/license.html
	*
	* $Id:$
	*/

	//
	// ANTLR C# Code Generator by Micheal Jordan
	//                            Kunle Odutola       : kunle UNDERSCORE odutola AT hotmail DOT com
	//                            Anthony Oguntimehin
	//
	// With many thanks to Eric V. Smith from the ANTLR list.
	//

	/*This object is a TokenStream that passes through all
	*  tokens except for those that you tell it to discard.
	*  There is no buffering of the tokens.
	*/
	public class TokenStreamBasicFilter : TokenStream
	{
		/*The set of token types to discard */
		protected internal BitSet discardMask;
		
		/*The input stream */
		protected internal TokenStream input;
		
		public TokenStreamBasicFilter(TokenStream input)
		{
			this.input = input;
			discardMask = new BitSet();
		}
		public virtual void  discard(int ttype)
		{
			discardMask.add(ttype);
		}
		public virtual void  discard(BitSet mask)
		{
			discardMask = mask;
		}
		public virtual IToken nextToken()
		{
			IToken tok = input.nextToken();
			while (tok != null && discardMask.member(tok.Type))
			{
				tok = input.nextToken();
			}
			return tok;
		}
	}
}
Back to Top