private function lessc::evaluate in Less CSS Preprocessor 6
Same name and namespace in other branches
- 6.3 lessphp/lessc.inc.php \lessc::evaluate()
2 calls to lessc::evaluate()
File
- ./
lessc.inc.php, line 857
Class
Code
private function evaluate($op, $lft, $rgt) {
$pushed = 0;
// figure out what expressions and variables are equal to
while (in_array($lft[0], $this->dtypes)) {
if ($lft[0] == 'expression') {
$lft = $this
->evaluate($lft[1], $lft[2], $lft[3]);
}
else {
if ($lft[0] == 'variable') {
$lft = $this
->getVal($lft[1], $this
->pushName($lft[1]), array(
'number',
0,
));
$pushed++;
}
}
}
while ($pushed != 0) {
$this
->popName();
$pushed--;
}
while (in_array($rgt[0], $this->dtypes)) {
if ($rgt[0] == 'expression') {
$rgt = $this
->evaluate($rgt[1], $rgt[2], $rgt[3]);
}
else {
if ($rgt[0] == 'variable') {
$rgt = $this
->getVal($rgt[1], $this
->pushName($rgt[1]), array(
'number',
0,
));
$pushed++;
}
}
}
while ($pushed != 0) {
$this
->popName();
$pushed--;
}
if ($lft[0] == 'color' && $rgt[0] == 'color') {
return $this
->op_color_color($op, $lft, $rgt);
}
if ($lft[0] == 'color') {
return $this
->op_color_number($op, $lft, $rgt);
}
if ($rgt[0] == 'color') {
return $this
->op_number_color($op, $lft, $rgt);
}
// default number number
return $this
->op_number_number($op, $lft, $rgt);
}