You are here

public function SassWhileNode::parse in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/tree/SassWhileNode.php \SassWhileNode::parse()

Parse this node.

Parameters

SassContext the context in which this node is parsed:

Return value

array the parsed child nodes

File

phpsass/tree/SassWhileNode.php, line 50

Class

SassWhileNode
SassWhileNode class. Represents a Sass @while loop and a Sass @do loop. @package PHamlP @subpackage Sass.tree

Code

public function parse($context) {
  $children = array();
  if ($this->isDo) {
    do {
      $children = array_merge($children, $this
        ->parseChildren($context));
    } while ($this
      ->evaluate($this->expression, $context)
      ->toBoolean());
  }
  else {
    while ($this
      ->evaluate($this->expression, $context)
      ->toBoolean()) {
      $children = array_merge($children, $this
        ->parseChildren($context));
    }
  }
  return $children;
}