/** * Constructor * * @param string $sourceName * @param boolean $rootParser */ public function __construct($sourceName = null, $rootParser = true) { $this->sourceName = $sourceName; $this->rootParser = $rootParser; $this->charset = null; if (empty(self::$operatorStr)) { self::$operatorStr = $this->makeOperatorStr(self::$operators); $commentSingle = $this->pregQuote(self::$commentSingle); $commentMultiLeft = $this->pregQuote(self::$commentMultiLeft); $commentMultiRight = $this->pregQuote(self::$commentMultiRight); self::$commentMulti = $commentMultiLeft . '.*?' . $commentMultiRight; self::$whitePattern = '/' . $commentSingle . '[^\\n]*\\s*|(' . self::$commentMulti . ')\\s*|\\s+/Ais'; } }
protected function importFile($path, $out) { // see if tree is cached $realPath = realpath($path); if (isset($this->importCache[$realPath])) { $tree = $this->importCache[$realPath]; } else { $code = file_get_contents($path); $parser = new Leafo_ScssPhp_Parser($path, false); $tree = $parser->parse($code); $this->parsedFiles[] = $path; $this->importCache[$realPath] = $tree; } $pi = pathinfo($path); array_unshift($this->importPaths, $pi['dirname']); $this->compileChildren($tree->children, $out); array_shift($this->importPaths); }