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

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

private processSign ( )
    private function processSign()
    {
        $sign = $this->tokens[$this->id][1];
        $code = $sign . '1';
        while (in_array($this->tokens[$this->id + 1][0], array(T_PLUS, T_MINUS))) {
            ++$this->id;
            $sign = $this->tokens[$this->id][1] . $sign;
            $code *= $this->tokens[$this->id][1] . '1';
        }
        // -3 ** 3 => -(3 ** 3)
        if (($this->tokens[$this->id + 1][0] === T_LNUMBER || $this->tokens[$this->id + 1][0] === T_DNUMBER) && $this->tokens[$this->id + 2][0] !== T_POW) {
            $operandId = $this->processNext();
            $x = array('code' => $sign . $this->atoms[$operandId]['code'], 'fullcode' => $sign . $this->atoms[$operandId]['fullcode'], 'line' => $this->tokens[$this->id][2], 'token' => $this->getToken($this->tokens[$this->id][0]));
            $this->setAtom($operandId, $x);
            return $operandId;
        } else {
            $finals = $this->precedence->get($this->tokens[$this->id][0]);
            // process the actual load
            $this->nestContext();
            do {
                $this->processNext();
            } while (!in_array($this->tokens[$this->id + 1][0], $finals));
            $this->exitContext();
            $signedId = $this->popExpression();
            for ($i = strlen($sign) - 1; $i >= 0; --$i) {
                $signId = $this->addAtom('Sign');
                $this->addLink($signId, $signedId, 'SIGN');
                $x = array('code' => $sign[$i], 'fullcode' => $sign[$i] . $this->atoms[$signedId]['fullcode'], 'line' => $this->tokens[$this->id][2], 'token' => $this->getToken($this->tokens[$this->id][0]));
                $this->setAtom($signId, $x);
                $signedId = $signId;
            }
            $this->pushExpression($signId);
            if (!$this->isContext(self::CONTEXT_NOSEQUENCE) && $this->tokens[$this->id + 1][0] === T_CLOSE_TAG) {
                $this->processSemicolon();
            }
            return $signId;
        }
    }
Load