public function __construct($token)
{
parent::__construct($token);
preg_match(self::MATCH, $token->source, $matches);
if (empty($matches[self::NAME]) || $matches[self::VALUE] === '') {
throw new SassVariableNodeException('Invalid variable definition; name and expression required', $this);
}
$this->name = $matches[self::NAME];
$this->value = $matches[self::VALUE];
$this->isDefault = !empty($matches[self::SASS_DEFAULT]) || !empty($matches[self::SCSS_DEFAULT]);
// Warn about deprecated features
if ($matches[self::IDENTIFIER] === self::SASS_IDENTIFIER) {
$this->addWarning('Variables prefixed with "!" is deprecated; use "' . $this->name . '"');
}
if (!empty($matches[SassVariableNode::SASS_ASSIGNMENT])) {
$this->addWarning('Setting variables with "' . (!empty($matches[SassVariableNode::SASS_DEFAULT]) ? '||' : '') . '=" is deprecated; use "$' . $this->name . ': ' . $this->value . (!empty($matches[SassVariableNode::SASS_DEFAULT]) ? ' !default' : ''));
}
}