protected function tag(&$tag, $simple = false) {
if ($simple)
$chars = '^@,:;{}\][>\(\) "\'';
else
$chars = '^@,;{}["\'';

$s = $this->seek();

$hasExpression = false;
$parts = array();
while ($this->tagBracket($parts, $hasExpression));

$oldWhite = $this->eatWhiteDefault;
$this->eatWhiteDefault = false;

while (true) {
if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) {
$parts[] = $m[1];
if ($simple) break;

while ($this->tagBracket($parts, $hasExpression));
continue;
}

if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
if ($this->interpolation($interp)) {
$hasExpression = true;
$interp[2] = true; // don't unescape
$parts[] = $interp;
continue;
}

if ($this->literal("@")) {
$parts[] = "@";
continue;
}
}

if ($this->unit($unit)) { // for keyframes
$parts[] = $unit[1];
$parts[] = $unit[2];
continue;
}

break;
}

$this->eatWhiteDefault = $oldWhite;
if (!$parts) {
$this->seek($s);
return false;
}

if ($hasExpression) {
$tag = array("exp", array("string", "", $parts));
} else {
$tag = trim(implode($parts));
}

$this->whitespace();
return true;
}
protected function tag(&$tag, $simple = false) {
if ($simple)
$chars = '^@,:;{}\][>\(\) "\'';
else
$chars = '^@,;{}["\'';

$s = $this->seek();

$hasExpression = false;
$parts = array();
while ($this->tagBracket($parts, $hasExpression));

$oldWhite = $this->eatWhiteDefault;
$this->eatWhiteDefault = false;

while (true) {
if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) {
$parts[] = $m[1];
if ($simple) break;

while ($this->tagBracket($parts, $hasExpression));
continue;
}

if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
if ($this->interpolation($interp)) {
$hasExpression = true;
$interp[2] = true; // don't unescape
$parts[] = $interp;
continue;
}

if ($this->literal("@")) {
$parts[] = "@";
continue;
}
}

if ($this->unit($unit)) { // for keyframes
$parts[] = $unit[1];
$parts[] = $unit[2];
continue;
}

break;
}

$this->eatWhiteDefault = $oldWhite;
if (!$parts) {
$this->seek($s);
return false;
}

if ($hasExpression) {
$tag = array("exp", array("string", "", $parts));
} else {
$tag = trim(implode($parts));
}

$this->whitespace();
return true;
}
protected function tag ( & $ tag , $ simple = false ) { if ( $ simple ) $ chars = '^@,:;{}\][>\(\) "\'' ; else $ chars = '^@,;{}["\'' ; $ s = $ this -> seek ( ) ; $ hasExpression = false ; $ parts = array ( ) ; while ( $ this -> tagBracket ( $ parts , $ hasExpression ) ) ; $ oldWhite = $ this -> eatWhiteDefault ; $ this -> eatWhiteDefault = false ; while ( true ) { if ( $ this -> match ( '([' . $ chars . '0-9][' . $ chars . ']*)' , $ m ) ) { $ parts [ ] = $ m [ 1 ] ; if ( $ simple ) break ; while ( $ this -> tagBracket ( $ parts , $ hasExpression ) ) ; continue ; } if ( isset ( $ this -> buffer [ $ this -> count ] ) && $ this -> buffer [ $ this -> count ] == "@" ) { if ( $ this -> interpolation ( $ interp ) ) { $ hasExpression = true ; $ interp [ 2 ] = true ; // don't unescape
 $ parts [ ] = $ interp ; continue ; } if ( $ this -> literal ( "@" ) ) { $ parts [ ] = "@" ; continue ; } } if ( $ this -> unit ( $ unit ) ) { // for keyframes
 $ parts [ ] = $ unit [ 1 ] ; $ parts [ ] = $ unit [ 2 ] ; continue ; } break ; } $ this -> eatWhiteDefault = $ oldWhite ; if ( ! $ parts ) { $ this -> seek ( $ s ) ; return false ; } if ( $ hasExpression ) { $ tag = array ( "exp" , array ( "string" , "" , $ parts ) ) ; } else { $ tag = trim ( implode ( $ parts ) ) ; } $ this -> whitespace ( ) ; return true ; }
a space separated list of selectors
a space separated list of selectors