Esempio n. 1
0
 /**
  * Parses a comment line and its child lines.
  * @param string line to parse
  * @param array remaining lines
  * @return mixed SassCommentNode object for CSS comments, null for Sass comments
  * @throws Exception if the comment type is unrecognised
  */
 private function parseComment($line, &$lines)
 {
     switch ($line['source'][1]) {
         case SassCommentNode::Sass_COMMENT:
             $node = null;
             while ($this->hasChild($line, $lines, true)) {
                 array_shift($lines);
                 $this->lineNumber++;
             }
             break;
         case SassCommentNode::CSS_COMMENT:
             $matches = SassCommentNode::match($line);
             $node = new SassCommentNode($matches[SassCommentNode::COMMENT]);
             while ($this->hasChild($line, $lines, true)) {
                 $node->addline(ltrim(array_shift($lines)));
                 $this->lineNumber++;
             }
             break;
         default:
             throw new SassException("Illegal comment type.\nLine {$line['number']}: " . (is_array($line['file']) ? join(DIRECTORY_SEPARATOR, $line['file']) : ''));
             break;
     }
     // switch
     return $node;
 }