protected function handleExpansion(array $token)
{
if (!$this->current) {
$this->throwException("An element expansion needs a preceding element. It can't be used stand-alone.", $token);
}
if ($this->current->type === 'element' && !$token['withSpace']) {
if (!$this->expectNext(['tag'])) {
$this->throwException(sprintf("Expected a tag name or an expanding element after block expansion, " . "a %s-node was given.", $this->getToken()['type']), $token);
}
$token = $this->getToken();
$this->current->tag .= ':' . $token['name'];
return;
}
if ($this->expansion) {
$this->current->expands = $this->expansion;
}
$this->expansion = $this->current;
$this->current = null;
}