예제 #1
0
 private function ignoreComment()
 {
     start:
     if (!$this->stream->currentAscii()->isVerticalSpace() && !$this->stream->isEnd()) {
         $this->stream->next();
         goto start;
     }
 }
예제 #2
0
 private function extractClass()
 {
     if ($this->stream->currentAscii()->is(AsciiChar::I_UPPERCASE)) {
         $this->stream->next();
         if ($this->stream->currentAscii()->is(AsciiChar::N_UPPERCASE)) {
             $this->stream->next();
             $this->stream->ignoreHorizontalSpace();
             $this->defaultExtractor('TYPE');
             $this->stream->ignoreHorizontalSpace();
         } else {
             throw new SyntaxErrorException($this->stream);
         }
     } else {
         if ($this->isFirst) {
             throw new SyntaxErrorException($this->stream);
         } else {
             if (RData::isKnownType($this->tokens['NAME']) && !RData::isKnownType($this->tokens['TTL'])) {
                 // no ttl and no origin in record, and in TTL Rdata
                 last_chance:
                 if ($this->previousName && $this->globalTtl) {
                     $this->tokens['TYPE'] = $this->tokens['NAME'];
                     $this->tokens['NAME'] = $this->previousName;
                     $this->tokens['TTL'] = $this->globalTtl;
                 } else {
                     throw new SyntaxErrorException($this->stream);
                 }
             } elseif (!RData::isKnownType($this->tokens['NAME']) && RData::isKnownType($this->tokens['TTL'])) {
                 $this->tokens['TYPE'] = $this->tokens['TTL'];
                 if ($this->previousName && !$this->globalTtl) {
                     $this->tokens['TTL'] = $this->tokens['NAME'];
                     $this->tokens['NAME'] = $this->previousName;
                 } elseif (!$this->previousName && $this->globalTtl) {
                     $this->tokens['TTL'] = $this->globalTtl;
                 } elseif ($this->previousName && $this->globalTtl) {
                     $this->tokens['TTL'] = $this->globalTtl;
                 } else {
                     throw new SyntaxErrorException($this->stream);
                 }
             } elseif (RData::isKnownType($this->tokens['NAME']) && RData::isKnownType($this->tokens['TTL'])) {
                 goto last_chance;
             } else {
                 throw new SyntaxErrorException($this->stream);
             }
             do {
                 $char = $this->stream->currentAscii();
                 $this->stream->previous();
             } while ($char->isWhiteSpace());
             do {
                 $char = $this->stream->currentAscii();
                 $this->stream->previous();
             } while ($char->isPrintableChar() && !$char->isHorizontalSpace());
         }
     }
 }