public function scan($regexp)
    {
        if (preg_match($regexp, $this->getRemainder(), $matches)) {
            if (strlen($matches[0]) &&
                mb_strpos($this->getRemainder(), $matches[0]) === 0) {
                return $this->setState($matches,
                    $this->head + mb_strlen($matches[0]), $this->head);
            }
        }
        return $this->setState();
    }