Exakat\Tasks\Load::processWhile PHP Метод

processWhile() приватный Метод

private processWhile ( )
    private function processWhile()
    {
        $whileId = $this->addAtom('While');
        $current = $this->id;
        ++$this->id;
        // Skip while
        while (!in_array($this->tokens[$this->id + 1][0], array(T_CLOSE_PARENTHESIS))) {
            $this->processNext();
        }
        $conditionId = $this->popExpression();
        $this->addLink($whileId, $conditionId, 'CONDITION');
        ++$this->id;
        // Skip )
        $isColon = $this->tokens[$current][0] === T_WHILE && $this->tokens[$this->id + 1][0] === T_COLON;
        $blockId = $this->processFollowingBlock(array(T_ENDWHILE));
        $this->popExpression();
        $this->addLink($whileId, $blockId, 'BLOCK');
        if ($isColon === true) {
            ++$this->id;
            if ($this->tokens[$this->id + 1][0] === T_SEMICOLON) {
                ++$this->id;
                // skip ;
            }
            $fullcode = $this->tokens[$current][1] . ' (' . $this->atoms[$conditionId]['fullcode'] . ') : ' . self::FULLCODE_SEQUENCE . ' ' . $this->tokens[$this->id - 1][1];
        } else {
            $fullcode = $this->tokens[$current][1] . ' (' . $this->atoms[$conditionId]['fullcode'] . ')' . ($this->atoms[$blockId]['bracket'] === true ? self::FULLCODE_BLOCK : self::FULLCODE_SEQUENCE);
        }
        $this->setAtom($whileId, array('code' => $this->tokens[$current][1], 'fullcode' => $fullcode, 'line' => $this->tokens[$current][2], 'token' => $this->getToken($this->tokens[$current][0]), 'alternative' => $isColon));
        $this->pushExpression($whileId);
        $this->processSemicolon();
        return $whileId;
    }
Load