You are here

private function lessc::value in Less CSS Preprocessor 6

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

File

./lessc.inc.php, line 550

Class

lessc

Code

private function value(&$val) {
  try {
    return $this
      ->unit($val);
  } catch (exception $ex) {

    /* $this->undo(); */
  }

  // look for accessor
  // must be done before color
  try {
    $save = $this->count;

    // todo: replace with counter stack
    $this
      ->accessor($a);
    $tmp = $this
      ->get($a[0]);

    // get env
    $val = end($tmp[$a[1]]);

    // get latest var
    return $this;
  } catch (exception $ex) {
    $this->count = $save;

    /* $this->undo(); */
  }
  try {
    return $this
      ->color($val);
  } catch (exception $ex) {

    /* $this->undo(); */
  }
  try {
    $save = $this->count;
    $this
      ->func($f);
    $val = array(
      'string',
      $f,
    );
    return $this;
  } catch (exception $ex) {
    $this->count = $save;
  }

  // a string
  try {
    $save = $this->count;
    $this
      ->string($tmp, $d);
    $val = array(
      'string',
      $d . $tmp . $d,
    );
    return $this;
  } catch (exception $ex) {
    $this->count = $save;
  }
  try {
    $this
      ->keyword($k);
    $val = array(
      'keyword',
      $k,
    );
    return $this;
  } catch (exception $ex) {

    /* $this->undo(); */
  }

  // try to get a variable
  try {
    $this
      ->variable($name);
    $val = array(
      'variable',
      '@' . $name,
    );
    return $this;
  } catch (exception $ex) {

    /* $this->undo(); */
  }
  throw new exception('parse error: failed to find value');
}