Also, it may contain Import and Charset objects stemming from @-rules.
Exemple #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");
     }
 }
Exemple #2
0
 public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat)
 {
     $sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
     $sResult .= parent::render($oOutputFormat);
     $sResult .= '}';
     return $sResult;
 }
Exemple #3
0
 public function __toString()
 {
     $sResult = "@{$this->vendorKeyFrame} {$this->animationName} {";
     $sResult .= parent::__toString();
     $sResult .= '}';
     return $sResult;
 }
Exemple #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();
         }
     }
 }
 public function __construct($iLineNo = 0)
 {
     parent::__construct($iLineNo);
 }