You are here

private function HamlParser::toTree in Sassy 7

* Parse Haml source into a document tree. *

Parameters

string Haml source: * @return HamlRootNode the root of this document tree

File

phamlp/haml/HamlParser.php, line 450

Class

HamlParser
HamlParser class. Parses {@link http://haml-lang.com/ Haml} view files. @package PHamlP @subpackage Haml

Code

private function toTree($source) {
  $source = str_replace(array(
    "\r\n",
    "\n\r",
    "\r",
  ), "\n", $source);
  $this->source = explode("\n", $source);
  $this
    ->setIndentChar();
  preg_match_all(self::REGEX_HAML, $source, $this->source, PREG_SET_ORDER);
  unset($source);
  $root = new HamlRootNode(array(
    'format' => $this->format,
    'style' => $this->style,
    'attrWrapper' => $this->attrWrapper,
    'minimizedAttributes' => $this->minimizedAttributes,
  ));
  $this
    ->buildTree($root);
  return $root;
}