You are here

private function SassParser::toTree in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/SassParser.php \SassParser::toTree()

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

Parameters

string Sass source:

Return value

SassRootNode the root of this document tree

1 call to SassParser::toTree()
SassParser::parse in phpsass/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 if possible or…

File

phpsass/SassParser.php, line 555

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;
}