protected function checkExpression(DOMNode $node, $expr, Tag $tag)
	{
		$this->checkContext($node);

		if (preg_match('/^\\$(\\w+)$/', $expr, $m))
		{
			// Either this expression came from a variable that is considered safe, or it's a
			// stylesheet parameters, which are considered safe by default
			$this->checkVariable($node, $tag, $m[1]);
		}
		elseif (preg_match('/^@[-\\w]+(?:\\s*\\|\\s*@[-\\w]+)*$/', $expr))
		{
			$this->checkAttributeExpression($node, $tag, $expr);
		}
		elseif (!$this->isExpressionSafe($expr))
		{
			throw new UnsafeTemplateException("Cannot assess the safety of expression '" . $expr . "'", $node);
		}
	}