public function lookUp(array $types)
    {
        while ($this->hasTokens()) {
            $token = $this->getToken();
            if (!in_array(get_class($token), $types, true)) {
                break;
            }

            yield $token;

            $this->nextToken();
        }
    }
public function lookUp(array $types)
    {
        while ($this->hasTokens()) {
            $token = $this->getToken();
            if (!in_array(get_class($token), $types, true)) {
                break;
            }

            yield $token;

            $this->nextToken();
        }
    }
public function lookUp ( array $ types ) { while ( $ this -> hasTokens ( ) ) { $ token = $ this -> getToken ( ) ; if ( ! in_array ( get_class ( $ token ) , $ types , true ) ) { break ; } yield $ token ; $ this -> nextToken ( ) ; } }
Yields tokens as long as the given types match.

Yields tokens of the given types until
a token is encountered, that is not given
in the types-array

@param array $types the token types that are allowed

@return \Generator
Yields tokens as long as the given types match .