private function SassEachNode::parse_in in Sassy 7.3
1 call to SassEachNode::parse_in()
- SassEachNode::parse in phpsass/
tree/ SassEachNode.php - Parse this node.
File
- phpsass/
tree/ SassEachNode.php, line 101
Class
- SassEachNode
- SassEachNode class. Represents a Sass @each loop. @package PHamlP @subpackage Sass.tree
Code
private function parse_in($string) {
$current = '';
$in_brace = FALSE;
$list = array();
if (strpos($string, '(') === FALSE) {
return explode(',', $string);
}
for ($i = 0; $i < strlen($string); $i++) {
$char = $string[$i];
if ($in_brace) {
if ($char == ')') {
$list[] = trim($current);
if (strlen($string) < $i + 1 && $string[$i + 1] == ',') {
$i++;
# skip the comma
}
$current = '';
$in_brace = FALSE;
}
else {
$current .= $char;
}
continue;
}
if ($char == '(') {
$in_brace = TRUE;
continue;
}
if ($char == ',') {
$list[] = trim($current);
$current = '';
continue;
}
$current .= $char;
}
$list[] = trim($current);
$real_list = array();
foreach ($list as $k => $v) {
if (strlen(trim($v))) {
$real_list[] = $v;
}
}
return $real_list;
}