You are here

function lessc::func in Less CSS Preprocessor 6.3

Same name and namespace in other branches
  1. 6 lessc.inc.php \lessc::func()
1 call to lessc::func()
lessc::value in lessphp/lessc.inc.php

File

lessphp/lessc.inc.php, line 632

Class

lessc

Code

function func(&$func) {
  $s = $this
    ->seek();
  if ($this
    ->match('([\\w\\-_][\\w\\-_:\\.]*)', $m) && $this
    ->literal('(')) {
    $fname = $m[1];
    if ($fname == 'url') {
      $this
        ->to(')', $content, true);
      $args = array(
        'string',
        $content,
      );
    }
    else {
      $args = array();
      while (true) {
        $ss = $this
          ->seek();
        if ($this
          ->keyword($name) && $this
          ->literal('=') && $this
          ->expressionList($value)) {
          $args[] = array(
            'list',
            '=',
            array(
              array(
                'keyword',
                $name,
              ),
              $value,
            ),
          );
        }
        else {
          $this
            ->seek($ss);
          if ($this
            ->expressionList($value)) {
            $args[] = $value;
          }
        }
        if (!$this
          ->literal(',')) {
          break;
        }
      }
      $args = array(
        'list',
        ',',
        $args,
      );
    }
    if ($this
      ->literal(')')) {
      $func = array(
        'function',
        $fname,
        $args,
      );
      return true;
    }
  }
  $this
    ->seek($s);
  return false;
}