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()); } } }
private function extractGlobalVariable() { $variableName = ''; start: if ($this->stream->currentAscii()->isLetter()) { $variableName .= $this->stream->current(); $this->stream->next(); goto start; } elseif ($this->stream->currentAscii()->isHorizontalSpace()) { $variableName = mb_strtolower($variableName); if (!array_key_exists($variableName, $this->allowedGlobalVariables)) { throw new SyntaxErrorException($this->stream); } $this->stream->ignoreHorizontalSpace(); $this->extractGlobalVariableValue($variableName); } else { throw new SyntaxErrorException($this->stream); } }