protected function handleAttribute(array $token)
{
if (!$this->current) {
$this->current = $this->createElement();
}
$node = $this->createNode('attribute', $token);
$node->name = $token['name'];
$node->value = $token['value'];
$node->escaped = $token['escaped'];
$node->unchecked = $token['unchecked'];
if (!$node->name && in_array($this->current->type, ['element', 'mixin'])) {
$this->throwException('Attributes in elements and mixins always need a name, it seems you only passed a value.', $token);
}
if ($this->current->type === 'mixinCall' && !$node->value) {
$node->value = $node->name;
$node->name = null;
}
$this->current->attributes[] = $node;
}