public function consume($type = NULL)
	{
		if(!$this->valid())
		{
			throw new \OutOfBoundsException('No more tokens available');
		}

		$token = $this->current();
		
		if($type !== NULL && !$token->is($type))
		{
			throw new \UnexpectedValueException(sprintf('Expected token type %s, read "%s" (%d)', $type, $token, $token->getType()));
		}
		
		$this->next();

		return $token;
	}