public function nextOfType($tokenName)
    {
        $i = $this->index+1;
        $len = count($this->tokens);
        while ($i < $len) {
            $tok = $this->tokens[$i][0];
            if ($tok === $tokenName) {
                return $i;
            }
            $i++;
        }
        return $len;
    }