code: 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:
                  break
              yield t
docs: Yields all tokens up to token but excluding current.