public virtual void FillBuffer()
{
// fast return if the buffer is already full
if ( p != -1 )
return;
int index = 0;
IToken t = _tokenSource.NextToken();
while ( t != null && t.Type != CharStreamConstants.EndOfFile )
{
bool discard = false;
// is there a channel override for token type?
int channelI;
if ( channelOverrideMap != null && channelOverrideMap.TryGetValue( t.Type, out channelI ) )
t.Channel = channelI;
//if ( channelOverrideMap != null && channelOverrideMap.ContainsKey( t.getType() ) )
//{
// object channelI = channelOverrideMap.get( t.getType() );
// if ( channelI != null )
// {
// t.setChannel( (int)channelI );
// }
//}
if ( discardSet != null &&
discardSet.Contains( t.Type ) )
{
discard = true;
}
else if ( discardOffChannelTokens && t.Channel != this.channel )
{
discard = true;
}
if ( !discard )
{
t.TokenIndex = index;
tokens.Add( t );
index++;
}
t = _tokenSource.NextToken();
}
// leave p pointing at first token on channel
p = 0;
p = SkipOffTokenChannels( p );
}