/**
  * @internal
  * @throws SyntaxErrorException
  * @throws \InvalidArgumentException
  * @throws \LogicException
  */
 private function extractInheritance()
 {
     $this->stream->ignoreHorizontalSpace();
     $char = $this->stream->currentAscii();
     if ($char->isVerticalSpace() || $char->is(AsciiChar::OPENING_BRACE())) {
         return;
     }
     if ($char->is(AsciiChar::COLON())) {
         $this->stream->next();
         $this->stream->ignoreHorizontalSpace();
         $this->extractInheritanceName();
     } else {
         throw new SyntaxErrorException($this->stream);
     }
 }
Exemplo n.º 2
0
 protected function endRecord()
 {
     start:
     $ord = $this->stream->ord();
     if ($ord === AsciiChar::NULL) {
         return;
     }
     if ($ord === AsciiChar::SEMICOLON) {
         $this->stream->next();
         $this->commentOpen = true;
         goto start;
     } elseif ($this->commentOpen) {
         if ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) {
             $this->commentOpen = false;
             goto start;
         } else {
             $this->stream->next();
             $this->commentOpen = true;
             goto start;
         }
     } elseif (!$this->commentOpen) {
         if ($this->multiLineOpened) {
             if ($ord === AsciiChar::CLOSE_BRACKET) {
                 $this->multiLineOpened = false;
             }
             $this->stream->next();
             goto start;
         } elseif ($ord === AsciiChar::NULL() || $ord === AsciiChar::LINE_FEED) {
             return;
         }
     }
 }
Exemplo n.º 3
0
 /**
  * @return bool
  */
 private function isRecordClass() : bool
 {
     if ($this->stream->currentAscii()->is(AsciiChar::I_UPPERCASE())) {
         $this->stream->next();
         if ($this->stream->currentAscii()->is(AsciiChar::N_UPPERCASE())) {
             $this->stream->next();
             if ($this->stream->currentAscii()->isHorizontalSpace()) {
                 $this->stream->previous();
                 $this->stream->previous();
                 return true;
             }
         } else {
             $this->stream->previous();
         }
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  * Current char of stream as AsciiChar
  * @return AsciiChar
  * @throws \LogicException
  * @throws \InvalidArgumentException
  */
 public function currentAscii() : AsciiChar
 {
     return AsciiChar::get($this->ord());
 }