'Yields all tokens up to token but excluding current.'

def _flatten_up_to_token(self, token):

    if token.is_group():
        token = next(token.flatten())
    for t in self._curr_stmt.flatten():
        if (t == token):
            raise StopIteration
        (yield t)
