function lessc::parse in Less CSS Preprocessor 6.3
Same name and namespace in other branches
- 6 lessc.inc.php \lessc::parse()
File
- lessphp/
lessc.inc.php, line 1209
Class
Code
function parse($str = null) {
if ($str) {
$this->buffer = $str;
}
$this->env = array();
$this->expandStack = array();
$this->count = 0;
$this->line = 1;
$this->buffer = $this
->removeComments($this->buffer);
$this
->push();
// set up global scope
$this
->set('__tags', array(
'',
));
// equivalent to 1 in tag multiplication
// trim whitespace on head
if (preg_match('/^\\s+/', $this->buffer, $m)) {
$this->line += substr_count($m[0], "\n");
$this->buffer = ltrim($this->buffer);
}
$out = '';
while (false !== ($compiled = $this
->chunk())) {
if (is_string($compiled)) {
$out .= $compiled;
}
}
if ($this->count != strlen($this->buffer)) {
$this
->throwParseError();
}
if (count($this->env) > 1) {
throw new exception('parse error: unclosed block');
}
// print_r($this->env);
return $out;
}