public function SassEachNode::parse in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/tree/SassEachNode.php \SassEachNode::parse()
Parse this node.
Parameters
SassContext the context in which this node is parsed:
Return value
array parsed child nodes
File
- phpsass/
tree/ SassEachNode.php, line 79
Class
- SassEachNode
- SassEachNode class. Represents a Sass @each loop. @package PHamlP @subpackage Sass.tree
Code
public function parse($context) {
$children = array();
if ($this->variable && $this->in) {
$context = new SassContext($context);
try {
$eval_in = $this
->evaluate($this->in, $context->parent)->value;
} catch (Exception $e) {
$eval_in = $this->in;
}
$eval_in = $this
->parse_in($eval_in);
foreach ($eval_in as $i => $in) {
$context
->setVariable($this->index_name, new SassNumber($i));
$context
->setVariable($this->variable, new SassString(trim($in)));
$children = array_merge($children, $this
->parseChildren($context));
}
}
return $children;
}