You are here

function lessc::value in Less CSS Preprocessor 6.3

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

File

lessphp/lessc.inc.php, line 352

Class

lessc

Code

function value(&$value) {

  // try a unit
  if ($this
    ->unit($value)) {
    return true;
  }

  // see if there is a negation
  $s = $this
    ->seek();
  if ($this
    ->literal('-', false) && $this
    ->variable($vname)) {
    $value = array(
      'negative',
      array(
        'variable',
        $this->vPrefix . $vname,
      ),
    );
    return true;
  }
  else {
    $this
      ->seek($s);
  }

  // accessor
  // must be done before color
  // this needs negation too
  if ($this
    ->accessor($a)) {
    $tmp = $this
      ->getEnv($a[0]);
    if ($tmp && isset($tmp[$a[1]])) {
      $value = end($tmp[$a[1]]);
    }
    return true;
  }

  // color
  if ($this
    ->color($value)) {
    return true;
  }

  // css function
  // must be done after color
  if ($this
    ->func($value)) {
    return true;
  }

  // string
  if ($this
    ->string($tmp, $d)) {
    $value = array(
      'string',
      $d . $tmp . $d,
    );
    return true;
  }

  // try a keyword
  if ($this
    ->keyword($word)) {
    $value = array(
      'keyword',
      $word,
    );
    return true;
  }

  // try a variable
  if ($this
    ->variable($vname)) {
    $value = array(
      'variable',
      $this->vPrefix . $vname,
    );
    return true;
  }
  return false;
}