You are here

private function lessc::expHelper in Less CSS Preprocessor 6

Same name and namespace in other branches
  1. 6.3 lessphp/lessc.inc.php \lessc::expHelper()
1 call to lessc::expHelper()
lessc::expression in ./lessc.inc.php

File

./lessc.inc.php, line 518

Class

lessc

Code

private function expHelper($lhs, $minP) {

  // while there is an operator and the precedence is greater or equal to min
  while ($this
    ->match($this->matchString, $m) && $this->precedence[$m[1]] >= $minP) {

    // check for subexp
    try {
      $this
        ->literal('(')
        ->expression($exp)
        ->literal(')');
      $rhs = $exp;
    } catch (exception $ex) {
      $this
        ->value($rhs);
    }

    // find out if next up needs rhs
    if ($this
      ->peek($this->matchString, $mi) && $this->precedence[$mi[1]] > $minP) {
      $rhs = $this
        ->expHelper($rhs, $this->precedence[$mi[1]]);
    }

    // todo: find a way to precalculate non-delayed types
    if (in_array($rhs[0], $this->dtypes) || in_array($lhs[0], $this->dtypes)) {
      $lhs = array(
        'expression',
        $m[1],
        $lhs,
        $rhs,
      );
    }
    else {
      $lhs = $this
        ->evaluate($m[1], $lhs, $rhs);
    }
  }
  return $lhs;
}