'Load all tokens from the token source and put in tokens.
This is done upon first LT request because you might want to
set some token type / channel overrides before filling buffer.'

def fillBuffer(self):

    index = 0
    t = self.tokenSource.nextToken()
    while ((t is not None) and (t.type != EOF)):
        discard = False
        if ((self.discardSet is not None) and (t.type in self.discardSet)):
            discard = True
        elif (self.discardOffChannelTokens and (t.channel != self.channel)):
            discard = True
        try:
            overrideChannel = self.channelOverrideMap[t.type]
        except KeyError:
            pass
        else:
            if (overrideChannel == self.channel):
                t.channel = overrideChannel
            else:
                discard = True
        if (not discard):
            t.index = index
            self.tokens.append(t)
            index += 1
        t = self.tokenSource.nextToken()
    self.p = 0
    self.p = self.skipOffTokenChannels(self.p)
