You are here

public static function SassScriptFunction::isa in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/script/SassScriptFunction.php \SassScriptFunction::isa()

* Returns a value indicating if a token of this type can be matched at * the start of the subject string. *

Parameters

string the subject string: * @return mixed match at the start of the string or false if no match

1 call to SassScriptFunction::isa()
SassScriptLexer::lex in phamlp/sass/script/SassScriptLexer.php
* Lex an expression into SassScript tokens. *

File

phamlp/sass/script/SassScriptFunction.php, line 102

Class

SassScriptFunction
SassScriptFunction class. Preforms a SassScript function. @package PHamlP @subpackage Sass.script

Code

public static function isa($subject) {
  if (!preg_match(self::MATCH, $subject, $matches)) {
    return false;
  }
  $match = $matches[0];
  $paren = 1;
  $strpos = strlen($match);
  $strlen = strlen($subject);
  while ($paren && $strpos < $strlen) {
    $c = $subject[$strpos++];
    $match .= $c;
    if ($c === '(') {
      $paren += 1;
    }
    elseif ($c === ')') {
      $paren -= 1;
    }
  }
  return $match;
}