You are here

private function SassRuleNode::parentReferencePos in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/tree/SassRuleNode.php \SassRuleNode::parentReferencePos()

* Returns the position of the first parent reference in the selector. * If there is no parent reference in the selector this function returns * boolean FALSE. * Note that the return value may be non-Boolean that evaluates to FALSE, * i.e. 0. The return value should be tested using the === operator. *

Parameters

string selector to test: * @return mixed integer: position of the the first parent reference, * boolean: false if there is no parent reference.

1 call to SassRuleNode::parentReferencePos()
SassRuleNode::hasParentReference in phamlp/sass/tree/SassRuleNode.php
* Determines if there is a parent reference in the selector *

File

phamlp/sass/tree/SassRuleNode.php, line 252

Class

SassRuleNode
SassRuleNode class. Represents a CSS rule. @package PHamlP @subpackage Sass.tree

Code

private function parentReferencePos($selector) {
  $inString = '';
  for ($i = 0, $l = strlen($selector); $i < $l; $i++) {
    $c = $selector[$i];
    if ($c === self::PARENT_REFERENCE && empty($inString)) {
      return $i;
    }
    elseif (empty($inString) && ($c === '"' || $c === "'")) {
      $inString = $c;
    }
    elseif ($c === $inString) {
      $inString = '';
    }
  }
  return false;
}