Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
}
}
}
$this->seek($s);
return false;
}
// consume a less variable
protected function variable(&$name) {
$s = $this->seek();
if ($this->literal($this->lessc->vPrefix, false) &&
($this->variable($sub) || $this->keyword($name)))
{
if (!empty($sub)) {
$name = array('variable', $sub);
} else {
$name = $this->lessc->vPrefix.$name;
}
return true;
}
$name = null;
$this->seek($s);
return false;
}
/**
* Consume an assignment operator
* Can optionally take a name that will be set to the current property name
*/
protected function assign($name = null) {
if ($name) $this->currentProperty = $name;
return $this->literal(':') || $this->literal('=');
}
// consume a keyword
protected function keyword(&$word) {
if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) {
$word = $m[1];
return true;
}
return false;
}
// consume an end of statement delimiter
protected function end() {
if ($this->literal(';')) {
return true;
} elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {
// if there is end of file or a closing block next then we don't need a ;
return true;
}
return false;
}
protected function guards(&$guards) {
$s = $this->seek();
if (!$this->literal("when")) {
$this->seek($s);
return false;
}
$guards = array();
while ($this->guardGroup($g)) {
$guards[] = $g;
if (!$this->literal(",")) break;
}
if (count($guards) == 0) {
$guards = null;
$this->seek($s);
return false;
}
return true;
}
// a bunch of guards that are and'd together
// TODO rename to guardGroup
protected function guardGroup(&$guardGroup) {
$s = $this->seek();
$guardGroup = array();
while ($this->guard($guard)) {
$guardGroup[] = $guard;
if (!$this->literal("and")) break;
}
if (count($guardGroup) == 0) {
$guardGroup = null;
$this->seek($s);
return false;
}
return true;
}
protected function guard(&$guard) {
$s = $this->seek();
$negate = $this->literal("not");
if ($this->literal("(") && $this->expression($exp) && $this->literal(")")) {
$guard = $exp;
if ($negate) $guard = array("negate", $guard);
return true;
}
$this->seek($s);
return false;
}
/* raw parsing functions */
protected function literal($what, $eatWhitespace = null) {
if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
// shortcut on single letter
if (!isset($what[1]) && isset($this->buffer[$this->count])) {
if ($this->buffer[$this->count] == $what) {
if (!$eatWhitespace) {
$this->count++;
return true;
}
// goes below...
} else {
return false;
}
}
if (!isset(self::$literalCache[$what])) {
self::$literalCache[$what] = lessc::preg_quote($what);
}
return $this->match(self::$literalCache[$what], $m, $eatWhitespace);
}
protected function genericList(&$out, $parseItem, $delim="", $flatten=true) {
$s = $this->seek();
$items = array();
while ($this->$parseItem($value)) {
$items[] = $value;
if ($delim) {
if (!$this->literal($delim)) break;
}
}
if (count($items) == 0) {
$this->seek($s);
return false;
}
if ($flatten && count($items) == 1) {
$out = $items[0];
} else {
$out = array("list", $delim, $items);
}
return true;
}
// advance counter to next occurrence of $what
// $until - don't include $what in advance
// $allowNewline, if string, will be used as valid char set
protected function to($what, &$out, $until = false, $allowNewline = false) {
if (is_string($allowNewline)) {
$validChars = $allowNewline;
} else {
$validChars = $allowNewline ? "." : "[^\n]";
}
if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) return false;
if ($until) $this->count -= strlen($what); // give back $what
$out = $m[1];
return true;
}
// try to match something on head of buffer
protected function match($regex, &$out, $eatWhitespace = null) {
if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault;
$r = '/'.$regex.($eatWhitespace && !$this->writeComments ? '\s*' : '').'/Ais';
if (preg_match($r, $this->buffer, $out, null, $this->count)) {
$this->count += strlen($out[0]);
if ($eatWhitespace && $this->writeComments) $this->whitespace();
return true;
}
return false;
}
// match some whitespace
protected function whitespace() {
if ($this->writeComments) {
$gotWhite = false;
while (preg_match(self::$whitePattern, $this->buffer, $m, null, $this->count)) {
if (isset($m[1]) && empty($this->commentsSeen[$this->count])) {
$this->append(array("comment", $m[1]));
$this->commentsSeen[$this->count] = true;
}
$this->count += strlen($m[0]);
$gotWhite = true;
}
return $gotWhite;
} else {
$this->match("", $m);
return strlen($m[0]) > 0;
}
}
// match something without consuming it
protected function peek($regex, &$out = null, $from=null) {
if (is_null($from)) $from = $this->count;
$r = '/'.$regex.'/Ais';
$result = preg_match($r, $this->buffer, $out, null, $from);
return $result;
}
// seek to a spot in the buffer or return where we are on no argument
protected function seek($where = null) {
if ($where === null) return $this->count;
else $this->count = $where;
return true;
}
/* misc functions */
public function throwError($msg = "parse error", $count = null) {
$count = is_null($count) ? $this->count : $count;
$line = $this->line +
substr_count(substr($this->buffer, 0, $count), "\n");
if (!empty($this->sourceName)) {
$loc = "$this->sourceName on line $line";
} else {
$loc = "line: $line";
}
// TODO this depends on $this->count
if ($this->peek("(.*?)(\n|$)", $m, $count)) {
throw new exception("$msg: failed at `$m[1]` $loc");
} else {
throw new exception("$msg: $loc");
}
}
protected function pushBlock($selectors=null, $type=null) {
$b = new stdclass;
$b->parent = $this->env;
$b->type = $type;
$b->id = self::$nextBlockId++;
$b->isVararg = false; // TODO: kill me from here
$b->tags = $selectors;
$b->props = array();
$b->children = array();
$this->env = $b;
return $b;
}
// push a block that doesn't multiply tags
protected function pushSpecialBlock($type) {
return $this->pushBlock(null, $type);
}
// append a property to the current block
protected function append($prop, $pos = null) {
if ($pos !== null) $prop[-1] = $pos;
$this->env->props[] = $prop;
}
// pop something off the stack
protected function pop() {
$old = $this->env;
$this->env = $this->env->parent;
return $old;
}
// remove comments from $text
// todo: make it work for all functions, not just url
protected function removeComments($text) {
$look = array(
'url(', '//', '/*', '"', "'"
);
$out = '';
$min = null;
while (true) {
// find the next item
foreach ($look as $token) {
$pos = strpos($text, $token);
if ($pos !== false) {
if (!isset($min) || $pos < $min[1]) $min = array($token, $pos);
}
}
if (is_null($min)) break;
$count = $min[1];
$skip = 0;
$newlines = 0;
switch ($min[0]) {
case 'url(':
if (preg_match('/url\(.*?\)/', $text, $m, 0, $count))
$count += strlen($m[0]) - strlen($min[0]);
break;
case '"':
case "'":
if (preg_match('/'.$min[0].'.*?(?indentLevel = 0;
}
public function indentStr($n = 0) {
return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
}
public function property($name, $value) {
return $name . $this->assignSeparator . $value . ";";
}
protected function isEmpty($block) {
if (empty($block->lines)) {
foreach ($block->children as $child) {
if (!$this->isEmpty($child)) return false;
}
return true;
}
return false;
}
public function block($block) {
if ($this->isEmpty($block)) return;
$inner = $pre = $this->indentStr();
$isSingle = !$this->disableSingle &&
is_null($block->type) && count($block->lines) == 1;
if (!empty($block->selectors)) {
$this->indentLevel++;
if ($this->breakSelectors) {
$selectorSeparator = $this->selectorSeparator . $this->break . $pre;
} else {
$selectorSeparator = $this->selectorSeparator;
}
echo $pre .
implode($selectorSeparator, $block->selectors);
if ($isSingle) {
echo $this->openSingle;
$inner = "";
} else {
echo $this->open . $this->break;
$inner = $this->indentStr();
}
}
if (!empty($block->lines)) {
$glue = $this->break.$inner;
echo $inner . implode($glue, $block->lines);
if (!$isSingle && !empty($block->children)) {
echo $this->break;
}
}
foreach ($block->children as $child) {
$this->block($child);
}
if (!empty($block->selectors)) {
if (!$isSingle && empty($block->children)) echo $this->break;
if ($isSingle) {
echo $this->closeSingle . $this->break;
} else {
echo $pre . $this->close . $this->break;
}
$this->indentLevel--;
}
}
}
}
if ( ! class_exists( 'lessc_formatter_compressed' ) ) {
class lessc_formatter_compressed extends lessc_formatter_classic {
public $disableSingle = true;
public $open = "{";
public $selectorSeparator = ",";
public $assignSeparator = ":";
public $break = "";
public $compressColors = true;
public function indentStr($n = 0) {
return "";
}
}
}
if ( ! class_exists( 'lessc_formatter_lessjs' ) ) {
class lessc_formatter_lessjs extends lessc_formatter_classic {
public $disableSingle = true;
public $breakSelectors = true;
public $assignSeparator = ": ";
public $selectorSeparator = ",";
}
}