Also, it may contain Import and Charset objects stemming from @-rules.
Ejemplo n.º 1
0
 private function parseList(CSSList $oList, $bIsRoot = false)
 {
     while (!$this->isEnd()) {
         if ($this->comes('@')) {
             $oList->append($this->parseAtRule());
         } else {
             if ($this->comes('}')) {
                 $this->consume('}');
                 if ($bIsRoot) {
                     throw new \Exception("Unopened {");
                 } else {
                     return;
                 }
             } else {
                 if ($this->oParserSettings->bLenientParsing) {
                     try {
                         $oList->append($this->parseSelector());
                     } catch (UnexpectedTokenException $e) {
                     }
                 } else {
                     $oList->append($this->parseSelector());
                 }
             }
         }
         $this->consumeWhiteSpace();
     }
     if (!$bIsRoot) {
         throw new \Exception("Unexpected end of document");
     }
 }
Ejemplo n.º 2
0
 public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
 {
     $sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
     $sResult .= parent::render($oOutputFormat);
     $sResult .= '}';
     return $sResult;
 }
Ejemplo n.º 3
0
 public function __toString()
 {
     $sResult = "@{$this->vendorKeyFrame} {$this->animationName} {";
     $sResult .= parent::__toString();
     $sResult .= '}';
     return $sResult;
 }
Ejemplo n.º 4
0
 private function parseListItem(CSSList $oList, $bIsRoot = false)
 {
     if ($this->comes('@')) {
         $oAtRule = $this->parseAtRule();
         if ($oAtRule instanceof Charset) {
             if (!$bIsRoot) {
                 throw new UnexpectedTokenException('@charset may only occur in root document', '', 'custom', $this->iLineNo);
             }
             if (count($oList->getContents()) > 0) {
                 throw new UnexpectedTokenException('@charset must be the first parseable token in a document', '', 'custom', $this->iLineNo);
             }
             $this->setCharset($oAtRule->getCharset()->getString());
         }
         return $oAtRule;
     } else {
         if ($this->comes('}')) {
             $this->consume('}');
             if ($bIsRoot) {
                 throw new SourceException("Unopened {", $this->iLineNo);
             } else {
                 return null;
             }
         } else {
             return $this->parseSelector();
         }
     }
 }
Ejemplo n.º 5
0
 public function __construct($iLineNo = 0)
 {
     parent::__construct($iLineNo);
 }