You are here

private function SassParser::toTree in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/SassParser.php \SassParser::toTree()

* Parse Sass source into a document tree. * If the tree is already created return that. *

Parameters

string Sass source: * @return SassRootNode the root of this document tree

1 call to SassParser::toTree()
SassParser::parse in phamlp/sass/SassParser.php
* Parse a sass file or Sass source code and * returns the document tree that can then be rendered. * The file will be searched for in the directories specified by the * load_paths option. * If caching is enabled a cached version will be used…

File

phamlp/sass/SassParser.php, line 493

Class

SassParser
SassParser class. Parses {@link http://sass-lang.com/ .sass and .sccs} files. @package PHamlP @subpackage Sass

Code

private function toTree($source) {
  if ($this->syntax === SassFile::SASS) {
    $source = str_replace(array(
      "\r\n",
      "\n\r",
      "\r",
    ), "\n", $source);
    $this->source = explode("\n", $source);
    $this
      ->setIndentChar();
  }
  else {
    $this->source = $source;
  }
  unset($source);
  $root = new SassRootNode($this);
  $this
    ->buildTree($root);
  return $root;
}